Jump to content
43oh

[Energia Library] WS2811Driver LED Controller Class


Recommended Posts

Thanks! I bought them in assumption they we're WS2811's but as I'm comparing them with the 2812's they look more like these. I'm feeling kind of ashamed, I'm very sorry. Are there any Energia libraries available for the WS2812( b )? Could I possibly change the assembly of the WS2811 to fit the WS2812 timing? In fact I'd love to learn programming my MSP430 the non-energia way. As far as I looked that way of programming, you need to know the MSP430s architecture quite well. I have CCS on my laptop, so during one of my "exam-breaks" I can just load some of the code on my MSP430. Once again, realy sorry to make this error  :blush: .

EDIT

On this forum they're talking about timing differences of the different types of chips ...

https://forum.pjrc.com/threads/23877-WS2812B-compatible-with-OctoWS2811-library

Link to post
Share on other sites
  • Replies 36
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

I ported over oPossum's ws2811 asm routines to msp430-gcc and wrapped it in simple Energia library. This class provides Energia users with a simple class with methods that allow you to configure the

Hey guys, I haven't been around much lately, but a recent project brought me back here and using this WS2811 library.   I'm trying to enable more people to use the LaunchPad in some of my volunteer

Got my strip and played with this a bit. It works great! Here's all 60 LEDs in my one meter strip with flowing colors. Max duty cycle is limited to 40, partly because these things are quite bright an

Posted Images

I calculated timings for the ws2812b and tried already to change the assembly to fit the ws2812b needs. The timings compared to the ws2811 are the following.

; --- High Speed Mode 800KHz
; WS2811
;        High / Low us   High / Low cycles @ 16 MHz
; Zero:  0.25 / 1.00        4 / 16
; One:   0.60 / 0.65        9 / 11
; Reset:    0 / 50+         0 / 800+
;
; WS2812b
;        High / Low us   High / Low cycles @ 16 MHz
; Zero:  0.4 /  0.85        6.4 / 13.6
; One:   0.8 /  0.45        12.8/ 7.2
; Reset:   0 / 50+          0   / 800+

I tried to change the assembly as I said before, I have little or no knowledge about assembly and just tried to reduce cycles at the low values and add some no-ops into the high value part. But I thing I'm not doing it right, mostly because of my limited asm knowledge. Is anybody willing to help me and take a look at the asm code. Maybe if somebody loves to help it's better to open a new thread with the code which's already there.

Link to post
Share on other sites

Hello sorry for my late reply, I had some exams to finish  ^_^ , but today I allowed myself a small break. @@RobG I've runned the code you provided, and it wasn't doing what it should. Then I tried to rewrite the assembly function of @@Rickta59 to fit the timing, but  I kinda  failed, and since I'm not familiar with debugging such functions (I don't have an oscilloscope so I can't find what I've coded wrongly). So I started to insert some NOP's in the  existing  code (well thought off course ) and to my surprise, it started displaying my coded colors more frequently, but for one  or another reason it's still going wrong every 6 to 8 times. I made a small recording of it. I also uploaded code to bitbucket.

 

Link to post
Share on other sites
  • 9 months later...
  • 4 years later...
On 9/9/2014 at 7:01 AM, ILAMtitan said:

Hey guys, I haven't been around much lately, but a recent project brought me back here and using this WS2811 library.

 

I'm trying to enable more people to use the LaunchPad in some of my volunteer work (FIRST robotics) and flashing LEDs is a good eye catching way to do it.  To help facilitate people who are already using Arduino and the venerable AdaFruit NeoPixels, I ported over almost all of her functionality to work in Energia.

 

https://github.com/ILAMtitan/WS2811Driver

 

With this, any project using the NeoPixel library will be near 100% compatible.  I also took some time and worked out support for 25MHz on the 5529 LP (although it's a bit crude).  My assembly knowledge is also only enough to get me so far.  I haven't been able to work out the best way to enable PORT2 to be used since it's a #def in the assembly.  If any of you guys can help work that out, it would be awesome.  I know y'all are also really good at finding problems with code, so feel free to do some QA for me :)

 

I've tested the timings up to 120 LEDs at 25MHz, but it might fail beyond that (I only had two strips to play with).

@ILAMtitanI am trying your code on some LaunchPads, it works perfectly on MSP430G2 LaunchPad, but on MSP439F5529LP it seems that the result is a bit off. I tried on two F5529 LaunchPads that I got, both showed the same results, the LEDs had the right color but the brightness was very dark in spite of any parameters. And eventually I found out that the reason seems to be the timing in the assemly code for 25MHz(ws2811_hs_25.S), the measured time are as below:

        High / Low us    High / Low us @  MHz
         (expected)       (actual)
 Zero:  0.25 / 1.00        0.24 / 0.89
 One:   0.60 / 0.65        0.52 / 0.61

I tried to fix it with adding more nops in the code(please forgive my poor assemly coding...), and it seems to be fixed, at least on my LaunchPads.

I  am posing  this  just in case someone has the similar problem, and also to give my thanks to ILAMtitan and the great guys to create this library in the first place.

Please find  the  code for adjusted timing as below:

https://github.com/Shuyang-z/WS2811Driver

 

Link to post
Share on other sites

Join the conversation

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

Guest
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...