LED_strip sample and nrf52840dk board in version 2.8

I'm a software guy with a bit of embedded dev experience and trying to get the LED_strip sample to work in v2.8. I got the code working in 2.61, and discovered that a 2.8 sample was available. I tried to put it together, but was getting an error on compile, and realized that I had no overlay selected for the LED strip usage. I tried to find the correct overlay for the nrf52840dk, but it doesn't show up in search:

Is there another overlay that I can adapt to this board?

I tried bringing the overlay I used in the 2.61 sample, but that doesn't seem to match naming conventions, and I also tried to adapt an overlay but it still didn't compile, so I'm missing something.

I have the LED strip connected to p0.29, and would like to indicate that in the overlay configuration.

Here is the overlay I'm using in 2.61:

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

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

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

&spi1 { /* MOSI on D11 / P0.23 */
	compatible = "nordic,nrf-spim";
	led_strip: ws2812@0 {
		compatible = "worldsemi,ws2812-spi";

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

		/* WS2812 */
		chain-length = <6>; /* 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>;
	};
};

&spi1_default {
	group1 {
		psels = <NRF_PSEL(SPIM_MOSI, 0, 29)>, // pin p0.29 gets the data signal
				<NRF_PSEL(SPIM_SCK, 0, 30)>; // clock is not used for WS2812
				//<NRF_PSEL(SPIM_MISO, 0, 31)>;
	};
};
&spi1_sleep {
	group1 {
		psels = <NRF_PSEL(SPIM_MOSI, 0, 29)>,
				<NRF_PSEL(SPIM_SCK, 0, 30)>;
				//<NRF_PSEL(SPIM_MISO, 0, 31)>;
		low-power-enable;
	};
};
/ {
	aliases {
		led-strip = &led_strip;
	};
};

Here is the config file:

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

Thanks for any input!

Parents Reply
  • We recommend starting development with the latest SDK release, which is v2.8.0 at the time of writing. v2.9.0 is expected to be released soon. In addition to the testing performed by the Zephyr project upstream, we do extensive testing for our SoCs and integrations.

    I did not get any build errors when I tried to build the led_strip sample in v2.8.0 for 'nrf52840dk/nrf52840' board. Only change I did was to add the missing overlay to the led_strip/boards directory (is the same as the one you posted):

    2350.nrf52840dk_nrf52840.overlay

    Note: the overlay will be applied automatically if you perform pristine after adding the devictree overlay to the boards folder.

    Please try to add the file above to your boards folder and see if you still get build errors.

    Best regards,

    Vidar

Children
Related