Page 1 of 1

NeoPixel - WS2812 limited to 21 pixels.

Posted: 13 Sep 2017 11:12
by petergebruers
Up to 21 pixels the color wheel works. But at 22 pixel stuff gets weird. I guess you need 3 bytes per pixel (one for each color) and 4 bytes per colour, if I understand the implementation of NeoPixel::show() correctly. So 21 * 3 * 4 = 252 bytes. And for 22 pixels you need 264 bytes and that is > 256. Coincidence? Does that number exceed the capabilities of the chip or the implementation?

Re: NeoPixel - WS2812 limited to 21 pixels.

Posted: 16 Sep 2017 11:55
by PoltoS
Exactly. Z-Uno is doing radio, hence it can not do full-time control of a too big neopixel strip. To still be able to do that we use SPI MOSI pin in DMA mode.

The DMA buffer is indeed 256 bytes. Each color bit requires four in the buffer. Hence we need 4*3*N bytes for N LEDs. This gives 21 LEDs.

Re: NeoPixel - WS2812 limited to 21 pixels.

Posted: 16 Sep 2017 11:57
by petergebruers
-

Re: NeoPixel - WS2812 limited to 21 pixels.

Posted: 16 Sep 2017 11:58
by PoltoS
Excuse, edited my answer

Re: NeoPixel - WS2812 limited to 21 pixels.

Posted: 16 Sep 2017 11:59
by PoltoS
The buffer is 300 bytes (we use same for IR features too), but SPI can address only 256 of them. The address is 1 byte

Re: NeoPixel - WS2812 limited to 21 pixels.

Posted: 16 Sep 2017 12:04
by petergebruers
Oh, OK. So I'll have to try an alternative approach. Or just use APA102 instead of WS2812 (and bitbang the data and clock).