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

DMA handlers not called on STM32F446RE #7

Closed jungnitz closed 3 years ago

jungnitz commented 4 years ago

I have a fairly simple setup with 6 parallel outputs. However I have ran into problems with LEDs either not showing up or flickering or similar things. First thing I tried was hooking up an logic analyzer to one of the data pins, which shows data sent with correct timing, but seemingly the same 16 bits repeatedly and no reset signal. Further investigation showed that ws2812b.transferComplete is never reset after beginning transmission. Since that is done in the DMA callbacks, I decided to set breakpoints in the IRQ and the HAL handlers and noticed that while the IRQ is called, the HAL handlers are never called. I didn't really go into detail about how this library really works and therefore do not know whether its relevant or not, but the Timer callbacks and the Timer IRQ are never called aswell. I would appreciate help getting this to work.

jungnitz commented 4 years ago

I have found the issue. HAL_DMA_DeInit resets all values in the DMA_HandleTypeDef passed to it. Therefore no values and callbacks are stored (and the interrupt flags are not set in HAL_DMA_Init). Commenting these lines fixed it. I'd suggest doing so in the code provided here aswell if there is no real purpose for these.

jcrademacher commented 3 years ago

@nklz I noticed the transferComplete flag wasn't being reset as well. Thanks for noticing this, I've been struggling with this for a while now. I'm commenting here so hopefully martin sees this and gets rid of those lines for others who want to use the library.

hubmartin commented 3 years ago

Hi, thanks for info. Can you test this PR #8 ? More details in the PR. Can someone with hardware and correct compiler/IDE test it? Thanks

hubmartin commented 3 years ago

So it motivated me enough to build some hardware with Discovery kit and LED strip. I've updated the HAL from Github and the #8 fixed it.

jcrademacher commented 3 years ago

I've tested PR #8 and it works correctly.

hubmartin commented 3 years ago

Thanks for confirmation.