Zephyr WS2812 Driver undefined reference to `__device_dts_ord_68'

I am trying to implement the Ws2812 driver on the NRF5340 based on the driver example.  

The specific error I am getting is:

c:/sysgcc/arm-eabi/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: zephyr/drivers/spi/libdrivers__spi.a(spi_nrfx_spim.c.obj):(.rodata.__compound_literal.1+0x0): undefined reference to `__device_dts_ord_68'

This is similar to this post:

 Implementing WS2812 Driver NCS (undefined reference to `__device_dts_ord_61') 

 It seems like there is something missing in the configuration.  

prj.conf:

#	BT
CONFIG_BT=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_DEVICE_NAME="QuantaFlo 2.0""
CONFIG_BT_DEVICE_APPEARANCE=833
CONFIG_BT_MAX_PAIRED=1
CONFIG_BT_DEBUG_LOG=y
CONFIG_BT_MAX_CONN=1
#CONFIG_BT_L2CAP_TX_BUF_COUNT=5


# This example requires more workqueue stack
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048
CONFIG_HEAP_MEM_POOL_SIZE=2048

#	SPI
CONFIG_SPI=y
#CONFIG_NRFX_SPIM=y
#CONFIG_NRFX_SPIM4=y
CONFIG_GPIO=n

CONFIG_CPLUSPLUS=y
CONFIG_LIB_CPLUSPLUS=y
CONFIG_NEWLIB_LIBC=y


# CONFIG_CONSOLE is not set

CONFIG_GPIO_NRFX=n
#CONFIG_NRFX_GPIOTE=y

#	USB
CONFIG_USB_DEVICE_STACK=y
CONFIG_USB_DEVICE_PRODUCT="SS QF2.0"
CONFIG_LOG=y
CONFIG_USB_DRIVER_LOG_LEVEL_ERR=y
CONFIG_USB_DEVICE_LOG_LEVEL_ERR=y

CONFIG_USB_DEVICE_PID=0x0501
CONFIG_USB_DEVICE_VID=0x2047

#	Logging
CONFIG_USE_SEGGER_RTT=y
#CONFIG_LOG_BACKEND_RTT=y

#	Neopixels
CONFIG_LED_STRIP=y
CONFIG_WS2812_STRIP=y
CONFIG_LED_STRIP_LOG_LEVEL_DBG=y

The overlay file:

&spi4 {
	compatible="nordic,nrf-spim";
	status = "ok";
	sck-pin = <36>;
	mosi-pin = <41>;
	miso-pin = <25>;

}; 

&zephyr_udc0 {
	cdc_acm_uart0 {
		compatible = "zephyr,cdc-acm-uart";
		label = "CDC_ACM_0";
	};
};


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



#define SPI_FREQ    4000000
#define ZERO_FRAME  0x40
#define ONE_FRAME   0x70

&spi2 {
	compatible = "nordic,nrf-spim";
	status = "okay";
	sck-pin = <0>;
	miso-pin = <0>;
	mosi-pin = <16>;

	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;
	};
};

Nothing in the other linked post seemed to help.

Parents
  • The code file:

    #include <zephyr.h>
    #include <device.h>
    #include <hal/nrf_gpio.h>
    #include "leds.h"
    #include "qf_settings.h"
    
    #include <logging/log.h>
    LOG_MODULE_REGISTER(Leds, LOG_LEVEL_DBG);
    
    #define RESET_BITS                      6                                                  /**< Reset bits. */
    #define I2S_BUFFER_SIZE                 ((3 * QfSettings::Leds::LED_COUNT) + RESET_BITS)   /**< i2s buffer size for driving the neopixel. */
    
    #define IRQ_PRI                         1
    
    Leds leds;
    
    
    #define STRIP_NODE		    DT_ALIAS(led_strip)
    #define STRIP_NUM_PIXELS	DT_PROP(DT_ALIAS(led_strip), chain_length)
    
    static const struct device *strip = DEVICE_DT_GET(STRIP_NODE);
    
    void Leds::init()
    {
    
        //	Configure 5V enable as output
    	nrf_gpio_pin_dir_set(QfSettings::Pins::Digital::LED_EN, NRF_GPIO_PIN_DIR_OUTPUT);
      enable_leds();
      
      
      if (device_is_ready(strip)) 
      {
        LOG_INF("Found LED strip device %s", strip->name);
      }
      else {
        LOG_ERR("LED strip device %s is not ready", strip->name);
        return;
      }
      
      
      while (1) k_sleep(K_MSEC(1000));
      
    }
    
    void Leds::enable_leds()
    {
      nrf_gpio_pin_set(QfSettings::Pins::Digital::LED_EN);
    }
    
    void Leds::disable_leds()
    {
      nrf_gpio_pin_clear(QfSettings::Pins::Digital::LED_EN);
    }

  • zephyr.dts

    spi2: spi@b000 {
    				compatible = "nordic,nrf-spim";
    				#address-cells = < 0x1 >;
    				#size-cells = < 0x0 >;
    				reg = < 0xb000 0x1000 >;
    				interrupts = < 0xb 0x1 >;
    				status = "okay";
    				label = "SPI_2";
    				sck-pin = < 0x0 >;
    				miso-pin = < 0x0 >;
    				mosi-pin = < 0x10 >;
    				led_strip: ws2812@0 {
    					compatible = "worldsemi,ws2812-spi";
    					label = "WS2812";
    					reg = < 0x0 >;
    					spi-max-frequency = < 0x3d0900 >;
    					chain-length = < 0x1 >;
    					color-mapping = < 0x2 0x1 0x3 >;
    					spi-one-frame = < 0x70 >;
    					spi-zero-frame = < 0x40 >;
    				};
    			};

Reply
  • zephyr.dts

    spi2: spi@b000 {
    				compatible = "nordic,nrf-spim";
    				#address-cells = < 0x1 >;
    				#size-cells = < 0x0 >;
    				reg = < 0xb000 0x1000 >;
    				interrupts = < 0xb 0x1 >;
    				status = "okay";
    				label = "SPI_2";
    				sck-pin = < 0x0 >;
    				miso-pin = < 0x0 >;
    				mosi-pin = < 0x10 >;
    				led_strip: ws2812@0 {
    					compatible = "worldsemi,ws2812-spi";
    					label = "WS2812";
    					reg = < 0x0 >;
    					spi-max-frequency = < 0x3d0900 >;
    					chain-length = < 0x1 >;
    					color-mapping = < 0x2 0x1 0x3 >;
    					spi-one-frame = < 0x70 >;
    					spi-zero-frame = < 0x40 >;
    				};
    			};

Children
No Data
Related