Jump to content

WS2811 LED controller driver

Recommended Posts

To use the high speed protocol just change write_ws2811() to write_ws2811_hs(). That will give you the most precise timing possible and allow use of any pin on port 1. SPI/IIC remains free for other uses.


Here is some code for RTC: http://forum.43oh.com/topic/1957-software-real-time-clock-rtc-two-methods/


The 32 kHz crystal is used just for the RTC - the MSP430 can still run at 16 MHz.

Link to post
Share on other sites
  • 7 months later...

This library is awesome. 


I'm trying to integrate it into my existing firmware. My MSP430G2553 is running at DCO 1MHz.. 


How can I adjust the timings, or any other trick to make this code calculated for 16MHz cycle run on my existing firmware (@1MHz) ?


Link to post
Share on other sites

Thank you for responding RobG. 


I'm still trying to avoid bit banging assembly and use timer interrupts to generate PWM with 20% & 50% duty cycle for 0 & 1 respectively. If you have tried already, can you suggest if it's possible with WS2811 ? I read your very first question in this forum and OPossum thinks it's duty cycle that chip looks for. I wonder if you did any further discovery into it ?


Yes, I changed my MCLK to run at 8MHz now (& may further update it to 16 MHz). With that, I can have width of 0 bit pulse to like 25 uS. Roughly running at 20 kHz frequency. Datasheet mentioned only about 400 & 800kHz, but can it run at 10 ~ 20 kHz as well ? Eagerly looking forward for your answer.



Link to post
Share on other sites

In my code, I don't use assembly, C only. I use bit banging or hardware SPI module.

WS2811 requires very precise timing and using interrupts is not an option (11 clock cycles just to get in and out of the interrupt.)

Your MCU has to run @16MHz to meet WS2811's timing requirements, especially WS2812's, which is hardwired for 800kHz clock.

Link to post
Share on other sites

Also, your shared code would greatly help. I see you have used pin 1.2 on msp430g2553, set as SPI master. Can I use any other pin on the board ? like 1.7 ? I already have another board communicating over UART using pin 1.2. I wonder, how well can I sync both UART & SPI on same controller, especially with tight timing  for WS2811. I imagine, I will have to go really low on FPS, about 20 fps with limited number of LEDs, like a strip of 30 and manage my UART activities only during reset pulse time on LED chip. Correct me if I'm wrong. 

Link to post
Share on other sites
  • 2 months later...
  • 1 year later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...