Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This works for WS2812B but not WS2812 #3

Closed
MartyMacGyver opened this issue Feb 18, 2017 · 0 comments
Closed

This works for WS2812B but not WS2812 #3

MartyMacGyver opened this issue Feb 18, 2017 · 0 comments

Comments

@MartyMacGyver
Copy link
Owner

MartyMacGyver commented Feb 18, 2017

This doesn't work well on old 6-pin WS2812 devices, Strictly speaking, you can get it mostly working by using a WS2812_CYCLE time of about 240ns, but it's still glitchy.

Even then, a look with the logic analyzer reveals the problem: a bit-banged test using the Particle Photon and the Adafruit_NeoPixel library gives the following timings:

Low:   tH = 0.31µs ±0.01µs / tL = 0.94µs ±0.01µs
High:  tH = 0.82µs ±0.01µs / tL = 0.44µs ±0.01µs
Cycle: 1.25µs ±0.02µs

The ESP32 RMT timings (with WS2812_CYCLE = 240ns):

Low:   tH = 0.48µs ±0.01µs / tL = 0.47µs ±0.01µs
High:  tH = 0.95µs ±0.01µs / tL = 0.95µs ±0.01µs
Cycle: 1.43µs ±0.48µs

The spec timings are as follows:

WS2812:

Low:   tH = 0.35µs ±0.15µs / tL = 0.80µs ±0.15µs
High:  tH = 0.70µs ±0.15µs / tL = 0.60µs ±0.15µs
Cycle: 1.25µs ±0.60µs
Reset: >50µs

WS2812B:

Low:   tH = 0.35µs ±0.15µs / tL = 0.90µs ±0.15µs
High:  tH = 0.90µs ±0.15µs / tL = 0.35µs ±0.15µs
Cycle: 1.25µs ±0.15µs
Reset: >50µs

As a rule of thumb we see that a low bit needs a longer time in the low state than the high state, and vice versa for high. A 2:1 duty cycle should suffice for both, but a 50:50 duty cycle will not do (it's a wonder it works at all for the WS2812B let alone the WS2812 - presumably the tH is what's mediating this and so lengthening that timing serves to be decoded as low versus high.

If possible, the RMT should be driving a more appropriate signal. Otherwise it's not a very reliable solution versus bit-banging (which works remarkably poorly on the ESP32).

(Note: there's a lot of leeway when signalling, but not enough to allow 50:50 timing to work glitch-free.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant