Skip to main content
Visitor II
January 7, 2025
Question

Continuous DMA from memory to SPI

  • January 7, 2025
  • 2 replies
  • 2468 views

We need to continuously DMA a single 16-bit word to the SPI transmitter. (Neither the memory address nor the peripheral address would increment.) Can this be done without intervention? I.e. do we have to use a DMA Complete interrupt to set a flag and call HAL_SPI_Transmit_DMA whenever the flag gets set, or can we configure HAL_SPI_Transmit_DMA to set and forget it?

    This topic has been closed for replies.

    2 replies

    Super User
    January 7, 2025

    Should be doable. Set up a circular transfer where neither address increments. Length of the transfer is not relevant-any nonzero value will do. Disable interrupts after it starts if you don't want to service them.

    SoCalJimAuthor
    Visitor II
    January 7, 2025

    I set up no-address-increment, Half Word (16-bit), circular DMA, from memory to SPI, transmitting 0xE002 = binary 1110000000000010 to visualize the bit spacing:

    You can see there’s no space between the words.

    Super User
    January 7, 2025

    That's what a continuous SPI stream looks like. Do you want something else?

    Super User
    January 8, 2025

    Read out and check/post content of SPI and relevant GPIO registers.

    JW