zephyr icon indicating copy to clipboard operation
zephyr copied to clipboard

ws2812-spi not sending correct data on sam0 platform

Open PeeJay opened this issue 1 year ago • 3 comments

Describe the bug The ws2812-spi driver appears to have issues on the sam0 platform. I am using a custom board that is compatible with the Adafruit itsybitsy M4 express, and have connected a WS2812b strip to PA21, running the led_strip sample. The issue is that the first LED doesn't do anything, but the remaining 5 do.

I've checked the timings with a logic analyser and they are correct, however I notice that the spi bus will return to high when idle. When using the FastLed library with an Arduino sketch the data line was low at idle. In the overlay for the ESP32 there is this...

* Workaround to support WS2812 driver */
	line-idle-low;

...in the SPI dts section, but no such option exists for sam0.

Here is the relevant part from my DTS

&sercom3 {
	status = "okay";
	compatible = "atmel,sam0-spi";
	dipo = <2>;
	dopo = <3>;

	#address-cells = <1>;
	#size-cells = <0>;

	pinctrl-0 = <&sercom3_spi_default>;
	pinctrl-names = "default";

	status_rgb_led: ws2812@0 {
		compatible = "worldsemi,ws2812-spi";
		reg = <0>;
		spi-max-frequency = <WS2812C_SPI_FREQ>;

		chain-length = <6>;
		color-mapping =	<LED_COLOR_ID_GREEN>,
						<LED_COLOR_ID_RED>,
						<LED_COLOR_ID_BLUE>;
		spi-one-frame = <WS2812C_ONE_FRAME>;
		spi-zero-frame = <WS2812C_ZERO_FRAME>;
		
	};
};

PeeJay avatar Apr 28 '24 05:04 PeeJay

Hi @PeeJay! We appreciate you submitting your first issue for our open-source project. 🌟

Even though I'm a bot, I can assure you that the whole community is genuinely grateful for your time and effort. 🤖💙

github-actions[bot] avatar Apr 28 '24 05:04 github-actions[bot]

Update: After experimenting with the SPI port there doesn't seem to be any way to get it to return to LOW when the transmission is finished. Switching the pin to GPIO has around a 200ns delay both ways so that's not an option either. I think it's simply not possible to use the sam0 SPI port. sam0-i2s does not exist and ws2812-gpio is NRF only.

PeeJay avatar Apr 29 '24 07:04 PeeJay

This issue has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this issue will automatically be closed in 14 days. Note, that you can always re-open a closed issue at any time.

github-actions[bot] avatar Jun 30 '24 00:06 github-actions[bot]