DMA priorities
Posted: Thu Jun 18, 2015 3:13 pm
Hello,
I'm working on a WS2812 LED project. The LEDs are driven by a STM32F4 which writes to the IO port at 2.4MHz via DMA2, resulting in 2.4MB/s data throughput.
I receive the control data for the LEDs via Ethernet. Everything works fine.
Now I want to switch from Ethernet to SD card as signal source. It is connected on SPI1, which is also tied to DMA2.
In general, this seems to work as well, but the LEDs start to flicker a little bit as soon as I start reading from the SD card. The WS2812 protocol needs very stable timing, otherwise the LEDs receive wrong data.
SPI clock for SD card is 10.5Mhz, so a maximum of ~1.3MB/s.
I tried to set all DMA priorities in mcuconf.h to 0 and set my own WS2812 priority to 3, but this makes no difference.
Is it possible that the F4's DMA is overloaded with this amount of data? I expected that the F4 @168MHz should be able to handle a lot of traffic.
Does a SPI DMA transfer block the DMA for such a long time? The LEDs accept a jitter of ~0.1 microseconds.
I wonder because as far as I know the Ethernet uses DMA (its own DMA?) as well but there are no problems when I generate high Ethernet traffic in parallel with WS2812 protocol. So whats the problem here, is it the memory bus, the DMA itself, ...?
Would it have been better to choose SPI2 or SPI3 for the SD card, because those are on DMA1?
Thanks, RuWe
I'm working on a WS2812 LED project. The LEDs are driven by a STM32F4 which writes to the IO port at 2.4MHz via DMA2, resulting in 2.4MB/s data throughput.
I receive the control data for the LEDs via Ethernet. Everything works fine.
Now I want to switch from Ethernet to SD card as signal source. It is connected on SPI1, which is also tied to DMA2.
In general, this seems to work as well, but the LEDs start to flicker a little bit as soon as I start reading from the SD card. The WS2812 protocol needs very stable timing, otherwise the LEDs receive wrong data.
SPI clock for SD card is 10.5Mhz, so a maximum of ~1.3MB/s.
I tried to set all DMA priorities in mcuconf.h to 0 and set my own WS2812 priority to 3, but this makes no difference.
Is it possible that the F4's DMA is overloaded with this amount of data? I expected that the F4 @168MHz should be able to handle a lot of traffic.
Does a SPI DMA transfer block the DMA for such a long time? The LEDs accept a jitter of ~0.1 microseconds.
I wonder because as far as I know the Ethernet uses DMA (its own DMA?) as well but there are no problems when I generate high Ethernet traffic in parallel with WS2812 protocol. So whats the problem here, is it the memory bus, the DMA itself, ...?
Would it have been better to choose SPI2 or SPI3 for the SD card, because those are on DMA1?
Thanks, RuWe