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
  • Hi

    Can you share how the SPI is set up in the devicetree now? Please follow how our SPI samples have the SPI set up in the devicetree.

    Best regards,

    Simon

  • 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

Reply
  • 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

Children
No Data
Related