-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Description
I noticed this issue while using the ws2812_spi LED strip driver on a nucleo_g0b1re board.
The led_ws2812 sample can be used to reproduce the issue. This patch is needed to add support for the nucleo_g0b1re board to the led_ws2812 sample.
When running this sample, then the MOSI signal goes high for 80 microseconds before and after transmitting data:
The issue is that this high "preamble" state is interpreted as a high bit by the first WS2812 LED of the strip. And then the signal of all the LEDs is shifted by one bit, which results in visual glitches.
Note that from a SPI protocol standpoint, the MOSI signal is correct because the clock signal is off during this extra "high" states. Thus, this won't affect a real SPI device. But the WS2812 strip LED controller is not a SPI device. It doesn't use the clock signal. SPI is used here as a hack on a single wire (MOSI) to generate a control signal for the LEDs.
In addition, the issue is not systematic. It depends on the last data sent over MOSI. If the last 4 bytes are zero, then there are no high "preamble" state when sending the next buffer of data.
I also tried disabling DMA and interrupts but this doesn't affect the issue.

