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

    You're absolutely right Christian. The pins on P2 have some dedicated uses, where only P2.02 and P2.08 can be assigned as SDO lines for SPI00, while P2.04 is an SDI only for the SPI peripheral. I apologize for missing that in my initial replies, but on P2 you are indeed somewhat restricted to what peripherals can use the pins for.

    Best regards,

    Simon

Reply
  • Hi

    You're absolutely right Christian. The pins on P2 have some dedicated uses, where only P2.02 and P2.08 can be assigned as SDO lines for SPI00, while P2.04 is an SDI only for the SPI peripheral. I apologize for missing that in my initial replies, but on P2 you are indeed somewhat restricted to what peripherals can use the pins for.

    Best regards,

    Simon

Children
Related