ws2812 #risc-v


Ivo
 

Dear all,
I am trying to run Zephyr sample ./zephyr/samples/drivers/led_ws2812/README.rst on chipset ESP32c3.
After some tuning of this example, I am able to run it, diodes starts to flash one by one, but they never turn off all. Anytime I start the microcontroller, 3 diodes keep shining, they do change color but there is always certaing brightness offset I cannot get rid of, moreover I tried to turn all the diodes off, but no luck.
In contrast, the same example runs pretty fine on nrf52840_dongle, could anyone help me tweak this example for RISCV?
I guess it has something to do with these 3 items in dts overlay which need to be fine tuned for specific hardware platform,according to this page:
https://docs.zephyrproject.org/latest/build/dts/api/bindings/led_strip/worldsemi,ws2812-spi.html
- spi-max-frequency
  - spi-zero-frame
  - spi-one-frame.
But how can I get to know these parameters? For nrf52840 they are already included, but for esp32c3 I guess they must be calculated.
Could anyone give me a hint how to proceed further?

Thanks


Bolivar, Marti
 

Hi:

The following blog post is an excellent resource about pulse timing:

https://wp.josh.com/2014/05/13/ws2812-neopixels-are-not-so-finicky-once-you-get-to-know-them/

You'll need to hook up a logic analyzer or scope to the data pin and
check the pulses to debug once you understand the protocol.

On Sun, Feb 05 2023, Ivo via lists zephyrproject org wrote:

Dear all,
I am trying to run Zephyr sample ./zephyr/samples/drivers/led_ws2812/README.rst on chipset ESP32c3.
After some tuning of this example, I am able to run it, diodes starts to flash one by one, but they never turn off all. Anytime I start the microcontroller, 3 diodes keep shining, they do change color but there is always certaing brightness offset I cannot get rid of, moreover I tried to turn all the diodes off, but no luck.
In contrast, the same example runs pretty fine on nrf52840_dongle, could anyone help me tweak this example for RISCV?
I guess it has something to do with these 3 items in dts overlay which need to be fine tuned for specific hardware platform,according to this page:
https://docs.zephyrproject.org/latest/build/dts/api/bindings/led_strip/worldsemi,ws2812-spi.html

- spi-max-frequency
- spi-zero-frame
- spi-one-frame.

But how can I get to know these parameters? For nrf52840 they are already included, but for esp32c3 I guess they must be calculated.
Could anyone give me a hint how to proceed further?

Thanks


Scott Shawcroft
 

The best way I've thought of neopixel (aka ws2812) timing is that its a 800 khz signal with 1/3 and 2/3 duty cycle.

On ESP chips, the RMT peripheral is generally the best way to produce it. Here is non-Zephyr code from CircuitPython: https://github.com/adafruit/circuitpython/blob/main/ports/espressif/common-hal/neopixel_write/__init__.c

~Scott

On Wed, Feb 8, 2023 at 7:56 AM Bolivar, Marti via lists.zephyrproject.org <marti.bolivar=nordicsemi.no@...> wrote:

Hi:

The following blog post is an excellent resource about pulse timing:

https://wp.josh.com/2014/05/13/ws2812-neopixels-are-not-so-finicky-once-you-get-to-know-them/

You'll need to hook up a logic analyzer or scope to the data pin and
check the pulses to debug once you understand the protocol.

On Sun, Feb 05 2023, Ivo via lists zephyrproject org wrote:
>
> Dear all,
> I am trying to run Zephyr sample ./zephyr/samples/drivers/led_ws2812/README.rst on chipset ESP32c3.
> After some tuning of this example, I am able to run it, diodes starts to flash one by one, but they never turn off all. Anytime I start the microcontroller, 3 diodes keep shining, they do change color but there is always certaing brightness offset I cannot get rid of, moreover I tried to turn all the diodes off, but no luck.
> In contrast, the same example runs pretty fine on nrf52840_dongle, could anyone help me tweak this example for RISCV?
> I guess it has something to do with these 3 items in dts overlay which need to be fine tuned for specific hardware platform,according to this page:
> https://docs.zephyrproject.org/latest/build/dts/api/bindings/led_strip/worldsemi,ws2812-spi.html
>
> - spi-max-frequency
>   - spi-zero-frame
>   - spi-one-frame.
>
> But how can I get to know these parameters? For nrf52840 they are already included, but for esp32c3 I guess they must be calculated.
> Could anyone give me a hint how to proceed further?
>
> Thanks
>