joewa / WS2812-LED-Driver_ChibiOS

LED Driver for WS2812B for ChibiOS
MIT License
9 stars 5 forks source link

Need Help to make it work on STM32L4 series #3

Open JeremySavonet opened 5 years ago

JeremySavonet commented 5 years ago

Hi Joewa,

Could you please give me some help in order to make the library works on STM32L4 series.

The reference manual of STM32L4xx series says that if using PA1 (AF1 is TIM2_CH2), the associate DMA streams should be DMA1_STREAM1 on channel 2 using PWM2.

Using that I'm not to make a led strip of ws2812 work.

Thanks in advance for your time and hope to read from you,

Regards, Jeremy Savonet

vitormhenrique commented 4 years ago

I was also having issues to make this work, but I think I figure it out, the TIM channel on the datasheet is from 1 to 4, but on Chibios is from 0 to 3.....

So you need to use channel on the datasheet channel - 1

#define WS2812_TIM_N    4  // timer, 1-11
#define WS2812_TIM_CH   1  // timer channel, 0-3

Also, for the DMA stream you need to use the TIMX_UP not the exact TIMX_CH stream, don't ask me why, but that works, so for example TIM4 would be STREAM6, CHANNEL2

Screen Shot 2020-03-07 at 9 59 56 AM