Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

WS2812B how is it with timing ?

Status
Not open for further replies.

carpenter

Full Member level 6
Joined
Jul 25, 2012
Messages
353
Helped
22
Reputation
44
Reaction score
24
Trophy points
1,298
Activity points
4,467
I am considering using the RGB LED WS2812B as a signal LED with an MCU, 1 up to 5 pcs.
I found several different datasheets unfortunately, the timing of the communication protocol differs quite fundamentally in them.

Does anyone have real experience with these LEDs?
I don't want to bypass PWM or SPI or other HW, but connect to general GPIO
and on STM32F then let's look at T0H max 380ns and min 5 instructions are based on a minimum clock of 14MHz

WS2812B.jpg

View attachment WS2812Ba.pdfView attachment WS2812B.pdf
 

Hi,

if I understood the datasheet correct, 24 bits are reqired to set the color of the LED. 8 bit for the red value, 8 bit for the blue value and 8 bit for green.
According to the sequence chart on page 4 a time of 800 ns ~ 1.38 µs is required to set a single bit (T0H + T1H or T0L + T1L). The smallest time instance is 220 ns which corresponds to a frequency of ~4.55 MHz. Which should not be a problem with a STM32F if not operated at a low frequency.

As the 5 LEDs are wired in series, they are daisy chained. Consequently it takes more time until the last LED receives the intended color information, as its information is shifted through the registers of the previous LEDs. So you have to send the color information of the 5th LED first followed by the color of the 4th and so on.

So basically the only information you are interested in is the minimum microcontroller wait time of 220 ns ~ 380 ns (as it seems you are aiming to communicate by bit banging). The overall time untill all 5 LEDs are correctly set shoud last (800 ns ~ 1.38 µs) • Numbers of LEDs • Data length = (800 ns ~ 1.38 µs) • 5 • 24 = 96 µs ~ 165.6 µs.

greets
 

In essence, YES.
the most critical seems to be the shortest time period it is T0H
which is according to one datasheet

220ns - 380ns

according to the second

250ns - 550ns

because my assembler code needs at least 5 clock cycles for this part of the program
380/5= approximately 13,2MHz
550/5= approximately 9,1MHz

and one more approach is possible
in one dataseeet is Th+Tl= 125us +- 600ns e.i. max 1850ns with with a ratio of 1/3 to 2/3
600/5= approximately 8,4MHz

I am struck by the ambiguity with which the manufacturer states the timing of the data protocol.
 

Ok, if I understand you correct you need least 5 clock cycles to perform a value change at the data pin.

At witch frequency will your MCU be operated? Are you using an external oscillator/crystal, or are you using the internal RC oscillator?

I am struck by the ambiguity with which the manufacturer states the timing of the data protocol.

Where do you source your LEDs? Large distributers like digikey, farnell or mouser usually provide the datasheet where you should find valid timings.
Is it not possible to adjust your code afterwards? What are your limitations by means of MCU operation frequency? Or is it a power consumption issue?

greets
 

hello,


i deeply study this device and did many measurements with a logic analyser
to build the correct protocole in ASM ( mixed into C langage)
i use a PIC18F26K22 at 64MHz .. effective cycle is 4/64 µS => 62.5nS

see HERE

even in French .. but maybe usefull

main datas are

WS2812
[FONT=&quot]Operation frequency Fosc2 —— —— 800 —— KHz[/FONT]
[FONT=&quot]transmission data rate mini 400Kbps[/FONT]
[FONT=&quot]Data transfer time( TH+TL=1.25µs±600ns)[/FONT]
[FONT=&quot]T0H 0 code ,high voltage time 0.35us ±150ns[/FONT]
[FONT=&quot]T1H 1 code ,high voltage time 0.7us ±150ns[/FONT]
[FONT=&quot]T0L 0 code , low voltage time 0.8us ±150ns[/FONT]
[FONT=&quot]T1L 1 code ,low voltage time 0.6us ±150ns[/FONT]
[FONT=&quot]RES low voltage time Above 50µs[/FONT]
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top