This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

error running example led_ws2812 for nrf52833 !

I have custom board with nrf52833 Soc. I was trying to implement  WS2812 LED driver in zephyr  which connected to (P1.09). according to WS2812 Sample Application I copy the .overlay and .conf of nrf52dk_nrf52832 and past it to my nrf52833. and change in overlay the pin that I use in the led_ws2812  which is D32 (P1.09). However when I build and run the example it did not work. I dont know what my error or i need to add somthing in DT?
any one can help?

Im working with nrf sdk 1.7.0 with segger IDE.

 .conf: 

CONFIG_SPI=y

# This driver only uses spi_write() with the SPIM instance it allocates,
# so PAN 58 doesn't matter, because the RX length is always 0.
CONFIG_SOC_NRF52832_ALLOW_SPIM_DESPITE_PAN_58=y

 .overlay 

/*
 * Copyright (c) 2019, Nordic Semiconductor ASA
 *
 * SPDX-License-Identifier: Apache-2.0
 */

#include <dt-bindings/led/led.h>

#include "../nrf52-bindings.h"

&spi1 { /* */
	compatible = "nordic,nrf-spim";
  mosi-pin = <32>;//MOSI on D32 : P1.09 
	led_strip: ws2812@0 {
		compatible = "worldsemi,ws2812-spi";
		label = "WS2812";

		/* SPI */
		reg = <0>; /* ignored, but necessary for SPI bindings */
		spi-max-frequency = <SPI_FREQ>;

		/* WS2812 */
		chain-length = <1>; /* arbitrary; change at will */
		color-mapping = <LED_COLOR_ID_GREEN
				 LED_COLOR_ID_RED
				 LED_COLOR_ID_BLUE>;
		spi-one-frame = <ONE_FRAME>;
		spi-zero-frame = <ZERO_FRAME>;
	};
};

/ {
	aliases {
		led-strip = &led_strip;
	};
};

Parents
  • Hello,

    mosi-pin = <32>;//MOSI on D32 : P1.09

    I believe the line above from your overlay is the main issue here. 'mosi-pin = <32>;' will enable P1.00,  not "D32". If you would like to enable P1.09 you should write:

    mosi-pin = <41>;//32+9

    Remember to rerun CMake after updating the .overlay file before you build and run.

    If are still having problems after changing the mentioned pin, then here a few other ideas:

    when I build and run the example it did not work

    What did not work? How did it fail? Are you able to successfully build the project and flash it to the device? Is there any output to the serial terminal?

    First thing to try is adding the below config to your .conf file, as mentioned in the sample's README.rst file:

    CONFIG_WS2812_STRIP_SPI=y

    If the mentioned config does not work, here are a few other things to check:

    • At what voltage are you powering the LEDs?
    • What is the voltage level of the communication?
    • Have you tried the sample with an nRF DK, like nRF 52DK or nRF53833 DK?
    • Do your .overlay and .conf files have correct file names corresponding to the name of your custom board?
    • Have you probed the SPI interface to see if there is any activity on the pins?

    Please note:

    Im working with nrf sdk 1.7.0

    You mention that you are working with nRF Connect SDK v1.7.0, however, the documentation you are linking to is the latest version of the sample, in  zephyr. If you check the nRF Connect SDK v1.7.0 release notes you will find that this version of the SDK is based on zephyr v2.6.0-rc1-ncs1. I assume you wanted to refer to led_ws2812 in nRF Connect SDK v1.7.0. The link to the code is broken. I think this should be the correct link: led_ws2812 in nRF connect SDK v1.7.0 on github.

    Best regards,

    Håkon

Reply
  • Hello,

    mosi-pin = <32>;//MOSI on D32 : P1.09

    I believe the line above from your overlay is the main issue here. 'mosi-pin = <32>;' will enable P1.00,  not "D32". If you would like to enable P1.09 you should write:

    mosi-pin = <41>;//32+9

    Remember to rerun CMake after updating the .overlay file before you build and run.

    If are still having problems after changing the mentioned pin, then here a few other ideas:

    when I build and run the example it did not work

    What did not work? How did it fail? Are you able to successfully build the project and flash it to the device? Is there any output to the serial terminal?

    First thing to try is adding the below config to your .conf file, as mentioned in the sample's README.rst file:

    CONFIG_WS2812_STRIP_SPI=y

    If the mentioned config does not work, here are a few other things to check:

    • At what voltage are you powering the LEDs?
    • What is the voltage level of the communication?
    • Have you tried the sample with an nRF DK, like nRF 52DK or nRF53833 DK?
    • Do your .overlay and .conf files have correct file names corresponding to the name of your custom board?
    • Have you probed the SPI interface to see if there is any activity on the pins?

    Please note:

    Im working with nrf sdk 1.7.0

    You mention that you are working with nRF Connect SDK v1.7.0, however, the documentation you are linking to is the latest version of the sample, in  zephyr. If you check the nRF Connect SDK v1.7.0 release notes you will find that this version of the SDK is based on zephyr v2.6.0-rc1-ncs1. I assume you wanted to refer to led_ws2812 in nRF Connect SDK v1.7.0. The link to the code is broken. I think this should be the correct link: led_ws2812 in nRF connect SDK v1.7.0 on github.

    Best regards,

    Håkon

Children
No Data
Related