How to control WS2812B LEDs on nrf54 via SPI?

Hi, 

I'm using nrf Connect SDK 3.1.0 and want to control three WS2812B LEDs with the LED strip driver. Therefore, I created the devicetree entry similar to the sample:

&spi00 {
	status = "okay";
	compatible = "nordic,nrf-spim";
	pinctrl-0 = <&spi00_default>;
	pinctrl-1 = <&spi00_sleep>;
	pinctrl-names = "default", "sleep";
	led_strip: ws2812@0 {
		compatible = "worldsemi,ws2812-spi";
		/* SPI */
		reg = <0>;
		spi-max-frequency = <4000000>;

		/* WS2812 */
		chain-length = <3>;
		color-mapping = <LED_COLOR_ID_GREEN
						LED_COLOR_ID_RED
						LED_COLOR_ID_BLUE>;
		// jedes Bit entspricht bei 4Mhz Übertragungsgeschwindigkeit einer Zeitspanne von 250ns 
		// Laut Datenblatt wird eine "0" durch min. 400ns an und 850ns aus dargestellt
		// Eine "1" wird durch min. 800ns an und 450ns aus dargestellt
		spi-zero-frame = <0x40>;
		spi-one-frame = <0x70>;
	};
};

The MOSI pin is defined here:

spi00_default: spi00_default {
        group1 {
                psels = <NRF_PSEL_DISCONNECTED(SPIM_MISO)>,
					<NRF_PSEL(SPIM_MOSI, 2, 4)>,
					<NRF_PSEL_DISCONNECTED(SPIM_SCK)>;
        };
	};

    spi00_sleep: spi00_sleep {
        group1 {
                psels = <NRF_PSEL_DISCONNECTED(SPIM_SCK)>,
					<NRF_PSEL(SPIM_MOSI, 2, 4)>,
					<NRF_PSEL_DISCONNECTED(SPIM_MISO)>;
                        low-power-enable;
        };
	};

When using led_strip_update_rgb(led_strip, pixels, STRIP_NUM_PIXELS); the LEDs doesn't light up. I already checked the output pin with an oscilloscope and there's no output data on that pin. 

Can anyone help me with this issue? 

Best regards,

Christian

Parents Reply Children
  • Hi, 

    it's configured as you can see in the initial post, except that the clock pin is configured to an unused pin at the moment.

    spi00_default: spi00_default {
            group1 {
                    psels = <NRF_PSEL_DISCONNECTED(SPIM_MISO)>,
    					<NRF_PSEL(SPIM_MOSI, 2, 4)>,
    					<NRF_PSEL(SPIM_SCK, 2, 1)>;
            };
    	};
    
        spi00_sleep: spi00_sleep {
            group1 {
                    psels = <NRF_PSEL(SPIM_SCK, 2, 1)>,
    					<NRF_PSEL(SPIM_MOSI, 2, 4)>,
    					<NRF_PSEL_DISCONNECTED(SPIM_MISO)>;
                            low-power-enable;
            };
    	};

    The method device_is_ready(led_strip) returns true. 

    I just testet the spi without the led_strip driver and the result was the same. The output pin doesn't shows any data. 

    I also checked the zephyr.dts file and I couldn't see a duplicate mapping of the pin. 

    Do you have any suggestions what to check next? 

    Best regards,

    Christian

  • Hi, 

    I just checked the pinplanner for the NRF54L15 QFN-48 and saw, that I can just assign P2.02 and P2.08 to the SDO line of SPI00. If that is true, then it should be clear, why there is no SPI output on P2.04, right?

    Best regards

    Christian

Related