Skip to main content
Associate III
January 7, 2025
Question

Continuous DMA from memory to SPI

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.

16 replies

TDK
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.

"If you feel a post has answered your question, please click ""Accept as Solution""."
SoCalJimAuthor
Associate III
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.

TDK
January 7, 2025

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

"If you feel a post has answered your question, please click ""Accept as Solution""."
waclawek.jan
Super User
January 8, 2025

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

JW