Hello All
Just a quick one with some info that hopefully help some one else.
I got myself some ws2811 strings and set about getting them to work.
After some headaches, I got it going last night.
The timing according to the data sheet is correct.
As the 2811 is a three wire system, it implements a NRZ protocol, much like the TM1804.
The timing is:
0: 500ns high / 2us low
1: 2ns High / 500ns low.
After the frame of data is sent for all pixels a reset code is required to display the data and is simply holding the data line low for more than 24us (50us is recommended).
If you are developing with a hardware SPI like the TP3244 then you only use the data line and will need to do some data conversion and lookups.
I will try to explain clearly how I have done it. There maybe a cleaner way.
Some terms I will use.
SPI bit, byte or data I am referring to the actual data coming out the controller
WS2811 bit, byte or data I am referring to bit or byte that make up the ws2811 data.
DMX bit, byte or data is the dmx data coming into the controller
Firstly I needed to use 5 SPI bits to make up one WS2811 bit.
SPI bits 1 2 3 4 5
_ _ _ _
For 1: output | | _ |
_
For 0: output | | _ _ _ _ |
Set the SPI port to have a 500ns clock.
I have 5 lookup tables each table have 4 elements.
So from the dmx byte, I have masked off the 8th and 7th bits then perform a lookup on first table.
output it to SPI.
then lookup on second table the 7th and 6th bit and output
third table, 5th and 4th bit and output
forth table, 3rd and 2nd bit, out
put
finally fifth table, 2nd and 1st bit and output.
The entire 40 bits or one WS2811 byte looks like this:
Top Line are the DMX bits from a single byte
second line is how I make up the WS2811 bit, 1's and 0's are fixed, X's are the bits that change
8th 7th 7th 6th 5th 4th 3rd 2nd 2nd 1st
1 X X X 0 1 X X X 0 1 X X X 0 1 X X X 0 1 X X X 0 1 X X X 0 1 X X X 0 1 X X X 0
| | | | | |
First Lookup Second Third Forth Fifth
Repeat this for all dmx bytes and your done.
Rereading through this it is a bit confusing, but hopefully you can work it out.
Again this is just how I got the protocol to work. I am sure there is a more eliquent way.
Just a quick one with some info that hopefully help some one else.
I got myself some ws2811 strings and set about getting them to work.
After some headaches, I got it going last night.
The timing according to the data sheet is correct.
As the 2811 is a three wire system, it implements a NRZ protocol, much like the TM1804.
The timing is:
0: 500ns high / 2us low
1: 2ns High / 500ns low.
After the frame of data is sent for all pixels a reset code is required to display the data and is simply holding the data line low for more than 24us (50us is recommended).
If you are developing with a hardware SPI like the TP3244 then you only use the data line and will need to do some data conversion and lookups.
I will try to explain clearly how I have done it. There maybe a cleaner way.
Some terms I will use.
SPI bit, byte or data I am referring to the actual data coming out the controller
WS2811 bit, byte or data I am referring to bit or byte that make up the ws2811 data.
DMX bit, byte or data is the dmx data coming into the controller
Firstly I needed to use 5 SPI bits to make up one WS2811 bit.
SPI bits 1 2 3 4 5
_ _ _ _
For 1: output | | _ |
_
For 0: output | | _ _ _ _ |
Set the SPI port to have a 500ns clock.
I have 5 lookup tables each table have 4 elements.
So from the dmx byte, I have masked off the 8th and 7th bits then perform a lookup on first table.
output it to SPI.
then lookup on second table the 7th and 6th bit and output
third table, 5th and 4th bit and output
forth table, 3rd and 2nd bit, out
put
finally fifth table, 2nd and 1st bit and output.
The entire 40 bits or one WS2811 byte looks like this:
Top Line are the DMX bits from a single byte
second line is how I make up the WS2811 bit, 1's and 0's are fixed, X's are the bits that change
8th 7th 7th 6th 5th 4th 3rd 2nd 2nd 1st
1 X X X 0 1 X X X 0 1 X X X 0 1 X X X 0 1 X X X 0 1 X X X 0 1 X X X 0 1 X X X 0
| | | | | |
First Lookup Second Third Forth Fifth
Repeat this for all dmx bytes and your done.
Rereading through this it is a bit confusing, but hopefully you can work it out.
Again this is just how I got the protocol to work. I am sure there is a more eliquent way.