cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L4P5 PWM with DMA no GPIO output

CLigh.2
Associate

Hey all,

I'm trying to generate DMA PWM for a row of 3 Neopixels. I succeeded on a Nucleo-based L496, but translating to a L4P5 target (custom board) results in no output on the GPIO at all. I've compared the generated HAL code for both and cannot find a meaningful difference, but maybe there's a spot to check that I'm forgetting?

APB2 clock is 120MHz, so I've set the timer period to 149 to achieve the 800kHz the LEDs expect. This is the main settings change I made since the Nucleo defaults to 80MHz.


_legacyfs_online_stmicro_images_0693W00000biRXrQAM.png
_legacyfs_online_stmicro_images_0693W00000biRY1QAM.png
_legacyfs_online_stmicro_images_0693W00000biRXwQAM.png

4 REPLIES 4
gbm
Lead III

And why don't you use UART or SPI for controlling the WS2812? It's much easier, with much smaller memory footprint for WS2812 data.

There is a huge difference in DMA setup between L496 and L4Px; the DMA is quite different in these two MCUs - see the DMAMUX module. So, double check the DMA settings.

My STM32 stuff on github - compact USB device stack and more: https://github.com/gbm-ii/gbmUSBdevice
CLigh.2
Associate

@Community member​ : I confirmed the MOE bit is being set and also added a line to manually set it just to be sure, but no success - thanks for the link, that's a handy site.

@gbm​ : Virtually all tutorials I've come across for these types of LEDs suggest DMA to achieve the tight timing so I didn't consider a different peripheral type. My other peripherals are all either in use or unavailable due to pin conflicts, so I'll have to do a deep-dive on the DMAMUX first but I'll keep this option in mind.

Thanks for the answers!

Read out and check/post content of relevant DMA, DMAMUX, TIM and GPIO registers.

As gbm suggested, SPI or UART Tx handled by DMA is tight, too, and the timing calculation is simpler. There may be examples out there, but I am not interested so don't have particular links.

JW

PS. Can't this be just another case of "CubeMX generates DMA initialization later than of those peripherals' which depend on it" bug?