Actions

Difference between revisions of "Driving the WS2811 at 800 kHz with an 8 MHz AVR"

From Just in Time

(Work in Progress)
 
m (adding video)
Line 8: Line 8:
  
 
You can see the result below. For the impatient: example source code can be found [https://github.com/DannyHavenith/ws2811/blame/master/src/ws2811_8.h here]. The assembly is absolutely unreadable, but I explain everything as best as I can after the video, I promise...
 
You can see the result below. For the impatient: example source code can be found [https://github.com/DannyHavenith/ws2811/blame/master/src/ws2811_8.h here]. The assembly is absolutely unreadable, but I explain everything as best as I can after the video, I promise...
 
+
{{#ev:youtube|mP7vBw4UeME|400|left}}
 
{{ShowComments|show=True}}
 
{{ShowComments|show=True}}

Revision as of 00:47, 11 February 2013

WS2811 LED controllers are hot. HackaDay has mentioned them three times in the last two months. Reason enough to order a WS2811 led string on ebay and start researching.

Normally I'd go straight to the datasheet and start working from there, but in this particular case the datasheets are [www.nooelec.com/files/WS2811.pdf not so very informative]. Luckily, the HackaDay links provide some excellent discussions. This one by Alan Burlison is especially helpful. That article not only explains in great detail why a library like FastSPI isn't guaranteed to work, but it comes with working code for a 16Mhz AVR that appears rock solid in its timing. Another good source was a post by "Cunning_Fellow".

Small problem: I didn't have any 16Mhz crystals on stock, so I ordered a few, on ebay again and sat back for the 25 day shipping time to pass. 25 Days is a long time. The led strip had arrived and was sitting on my desk. 25 Days is a really long time. Maybe it could work off an AVR on its internal 8Mhz oscillator? It would be a lot of work. But 25 days is a very, very, long time.

So, that is how I got to sit down and write my 8Mhz version of a WS2811@800Khz bit banger. The challenge is of course that I have 10 clock cycles for every bit, no more no less, and 80 cycles for every byte, no more no less. I wanted the timing to be as rock-steady as Alans, give-or-take the imprecise nature of the AVR internal oscillator.

You can see the result below. For the impatient: example source code can be found here. The assembly is absolutely unreadable, but I explain everything as best as I can after the video, I promise...

nopreview

{{#set: |Article has average rating={{#averagerating:}} }} {{#showcommentform:}}

{{#ask: Belongs to article::Driving the WS2811 at 800 kHz with an 8 MHz AVRModification date::+

 | ?Has comment person
 | ?Has comment date
 | ?Has comment text
 | ?Has comment rating
 | ?Belongs to comment
 | ?Comment was deleted#true,false
 | ?Has comment editor
 | ?Modification date
 | ?Has attached article
 | format=template
 | template=CommentResult
 | sort=Has comment date
 | order=asc
 | link=none
 | limit=100

}}