hubmartin / WS2812B_STM32F4

WS2812 DMA library with low RAM needs. Up to 16 paralel outputs and thousands of LEDs on each of them
MIT License
112 stars 32 forks source link

Beware of STM32F410/411 - errata with DMA2 & GPIO can cause glitches #14

Open GIPdA opened 2 years ago

GIPdA commented 2 years ago

Hello,

Just a notice about a silicon errata from ST for STM32F410 and 411 (and maybe others): using DMA2 and GPIO as done in this project can cause glitches in the generated pulses. Errata says "DMA2 data corruption occurs when managing AHB and APB2 peripherals in a concurrent way", specifically with GPIO when doing memory-to-peripheral transfers (exactly what we need...).

The workaround given in the errata is not suitable: memory-to-memory transfers doesn't support requests, so it can't be used. And DMA1 cannot write to the GPIO peripheral, so can't avoid it.

It's tricky to know when you're "managing AHB and APB2 peripherals in a concurrent way", but I managed to avoid glitch issues (for now) by compiling in "-Ofast". Not very robust, I'm afraid this "workaround" can break easily. We'll see, I'll report if I find something else.