Skip to main content
WKowo
Associate II
July 26, 2019
Solved

Sending data to SPI via DMA

  • July 26, 2019
  • 3 replies
  • 1075 views

I'm using STM32F429 and trying to use HAL library to communicate to SPI slave via DMA channel.

I'd like to ask how is resolved problem with for example sending data to SPI via DMA? Is there any kind of synchronization between SPI and DMA to disallow overwritting SPI DATA register by DMA when SPI is sending previous SPI DATA register? In other words - how DMA knows how fast it should move data from source buffer to SPI DATA register to not overwrite its contents?

Is there any synchronization protocol which tells DMA to stop transmitting to SPI DATA register because SPI is currently busy with transmitting previous SPI DATA register?

This topic has been closed for replies.
Best answer by Tesla DeLorean

The DMA is triggered byte the SPI TXE flag, the DR holding register​ is separate from the internal shift register that puts the data on the wire.

3 replies

Gabriel Melo
Associate II
July 26, 2019

The DMAs on STM32 microcontrollers can generate two interruptions: HalfTransfer and TransferComplete.

You can use the latter to know when the data is sent and start sending new data.

Tesla DeLorean
Tesla DeLoreanBest answer
Guru
July 26, 2019

The DMA is triggered byte the SPI TXE flag, the DR holding register​ is separate from the internal shift register that puts the data on the wire.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
WKowo
WKowoAuthor
Associate II
July 26, 2019

Thank you for rapid answer.