cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F2/4 SPI Slave rx DMA and unknown transferlength

mail2
Associate II
Posted on August 23, 2013 at 12:48

Hello again,

I have connected two STM32F2 via SPI1. The data will be transfered via a variable sized datablock. The first two bytes are a command (5 bit) and a length (11bit) information of the following block. Is it possible to read the first two bytes via polling and transfer the remaining - variable sized block - block via dma?

Thanks

Martin

#spi-slave-polling-dma
3 REPLIES 3
Posted on August 23, 2013 at 15:51

I would imagine so, and probably read the first two byte via DMA as well. Basically setting up a 2 byte transfer, and DMA TC to catch the arrival and light off a longer transfer.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
mail2
Associate II
Posted on August 23, 2013 at 16:14

Hello Clive,

Do you have any experience how fast the DMA can be reconfigured and restarted? It should be fast enough to run in the DMA interrupt Handler, so i don't miss any data of the running SPI Stream. I will try it, thank you for the hint.

Martin

Posted on August 23, 2013 at 20:02

In magnitude it's about the same whether you polled or used DMA interrupts.

How fast are you proposing to send the data? You'd have an 8 or 16 bit clock window depending on how you set up the SPI. There might be more efficient ways to change address/length in the DMA controller than reconfiguring it completely with the FW library.

If it's super critical I'd probably look at a large circular DMA buffer, that wouldn't need reconfiguring and processing at HT / TC intervals.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..