cancel
Showing results for 
Search instead for 
Did you mean: 

SPI Communications with DMA

stuart239955
Associate II
Posted on April 17, 2012 at 16:16

Hi,

I've a complicated application with 3 STM32F1xx microcontrollers.

Each of the microcontrollers communicate to each other via SPI. DMA is used for SPI communications.

The micros (STM32F103) have 2 SPI ports each.

One micro is SPI slave on SPI1 (to another micro) and also master on SPI2 (to another micro). Thus, it is using both SPI ports with DMA.

I have noticed that, independently, SPI communications (using DMA) on SPI1 and SPI2 works OK (no corruption). However, when SPI1 and SPI2 are in use at the same time (which happens occasionally in my application), I have noticed that some of the messages get corrupted (looks like DMA problems). It appears as if the DMA cannot cope with both SPI ports in use at the same time. Maybe the DMA arbiter is overloaded? Is it a question of DMA priorities?

Does anyone know whether there is an issue with DMA, using both channels at the same time with DMA?

Any answers would be most appreciated.

Stuart

#stm32-spi-dma
2 REPLIES 2
Posted on April 17, 2012 at 19:32

Perhaps you've exceed your bus bandwidth? At what rate are you clocking the data, does the problem persist if you half that rate? Using 16-bit instead of 8-bit will half the bus loading.

Also check the errata.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
stuart239955
Associate II
Posted on April 18, 2012 at 13:25

Thanks Clive,

I tried lowering the data rate (from 9MHz SPI to 4.5MHz) & it appeared to stop the problem. Do you know what happens when the DMA bus bandwidth is exceeded? I though that I'd get some sort of exception.

Unfortunately, I can't use  16 bit data format.

I checked the errata sheet & found no mention of this sort of problem.

Thanks,

Stuart