Associate III
July 27, 2023
Question
PWM generation for RGB LED Strip using WS2812 protocol
- July 27, 2023
- 2 replies
- 3898 views
So i am using STM32F401RE board where i have written the code to for a strip of RGB led working on the WS2812 protocol which is nothing but using 24 bit PWM waveform for 1 led in GRB format. Every time i enable the PWM channel using CCR1 register for Timer2, always i am getting 1 extra pulse always at the beginning, due to which instead of 24 pulses, 25 pulses are sent and the entire data gets corrupted, how can i control the timer channel in more efficient way. I have attached the code and the datasheet below.
Note the naming conventions might change as the header file is also made by us.