<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Using ws2812 with nrf52840</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/120717/using-ws2812-with-nrf52840</link><description>I am trying to control ws2812 LED (1 LED) with NRF52840 using nrf connect SDK, I was able to control it with no problem when I set building optimization to debug optimization, but when I set optimization to size or speed optimization I get a hard fault</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 22 Apr 2025 10:10:34 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/120717/using-ws2812-with-nrf52840" /><item><title>RE: Using ws2812 with nrf52840</title><link>https://devzone.nordicsemi.com/thread/532307?ContentTypeID=1</link><pubDate>Tue, 22 Apr 2025 10:10:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e70cbc7e-c10f-4c83-b0c1-cd1590a9df6e</guid><dc:creator>MOHAMED AHMED ALI MAHMOUD ELSABAGH</dc:creator><description>&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/members/kazi-afroza-sultana"&gt;Kazi Afroza Sultana&lt;/a&gt;&amp;nbsp;Adding&amp;nbsp;SPIM_SCK pin on the overlay file actually solved the problem, it was missing before coz it wasn&amp;#39;t used or needed, I am not sure why it&amp;#39;s working on debug optimization and not on size/speed optimization though&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using ws2812 with nrf52840</title><link>https://devzone.nordicsemi.com/thread/531877?ContentTypeID=1</link><pubDate>Tue, 15 Apr 2025 15:28:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:035d4318-9046-47c8-a5a9-7adbf09742f7</guid><dc:creator>MOHAMED AHMED ALI MAHMOUD ELSABAGH</dc:creator><description>&lt;p&gt;I actually have those on top of my file&amp;nbsp;&lt;pre class="ui-code" data-mode="text"&gt;#include &amp;lt;nordic/nrf52840_qiaa.dtsi&amp;gt;
#include &amp;lt;zephyr/dt-bindings/led/led.h&amp;gt;

#include &amp;quot;../../../nrf52-bindings.h&amp;quot;&lt;/pre&gt;&amp;nbsp;also as I mentioned everything is working fine when the build is set to debug optimization but I get those errors only with size or speed optimization build&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using ws2812 with nrf52840</title><link>https://devzone.nordicsemi.com/thread/531876?ContentTypeID=1</link><pubDate>Tue, 15 Apr 2025 15:25:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:128a0ae5-5ca6-4650-8b82-95f6686e41b7</guid><dc:creator>Kazi Afroza Sultana</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I have checked your overlay file. It is missing include header file.&amp;nbsp;&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;spi3_default_alt and&amp;nbsp;spi3_sleep_alt should be inside pinctrl node.&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Can you try this following overlay instead?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#include &amp;lt;zephyr/dt-bindings/led/led.h&amp;gt;
#include &amp;quot;../nrf52-bindings.h&amp;quot;

&amp;amp;pinctrl {
    spi3_default_alt: spi3_default_alt {
        group1 {
            psels = &amp;lt;NRF_PSEL(SPIM_SCK, 0, 10)&amp;gt;,
                   &amp;lt;NRF_PSEL(SPIM_MOSI, 0, 9)&amp;gt;;
        };
    };

    spi3_sleep_alt: spi3_sleep_alt {
        group1 {
            psels = &amp;lt;NRF_PSEL(SPIM_SCK, 0, 10)&amp;gt;,
                   &amp;lt;NRF_PSEL(SPIM_MOSI, 0, 9)&amp;gt;;
            low-power-enable;
        };
    };
};

&amp;amp;spi3 {
    compatible = &amp;quot;nordic,nrf-spim&amp;quot;;
    status = &amp;quot;okay&amp;quot;;
    pinctrl-0 = &amp;lt;&amp;amp;spi3_default_alt&amp;gt;;
    pinctrl-1 = &amp;lt;&amp;amp;spi3_sleep_alt&amp;gt;;
    pinctrl-names = &amp;quot;default&amp;quot;, &amp;quot;sleep&amp;quot;;

    led_strip: ws2812@0 {
        compatible = &amp;quot;worldsemi,ws2812-spi&amp;quot;;

        /* SPI */
        reg = &amp;lt;0&amp;gt;; /* ignored, but necessary for SPI bindings */
        spi-max-frequency = &amp;lt;SPI_FREQ&amp;gt;;

        /* WS2812 */
        chain-length = &amp;lt;1&amp;gt;; /* arbitrary; change at will */
        color-mapping = &amp;lt;LED_COLOR_ID_GREEN
                 LED_COLOR_ID_RED
                 LED_COLOR_ID_BLUE&amp;gt;;
        spi-one-frame = &amp;lt;ONE_FRAME&amp;gt;;
        spi-zero-frame = &amp;lt;ZERO_FRAME&amp;gt;;
    };
};

/ {
    aliases {
        led-strip = &amp;amp;led_strip;
    };
};&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using ws2812 with nrf52840</title><link>https://devzone.nordicsemi.com/thread/531818?ContentTypeID=1</link><pubDate>Tue, 15 Apr 2025 10:35:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c002192d-d1d4-4852-b747-1968d862a5ea</guid><dc:creator>MOHAMED AHMED ALI MAHMOUD ELSABAGH</dc:creator><description>&lt;p&gt;Here is how my overlay looks like&amp;nbsp;&lt;pre class="ui-code" data-mode="text"&gt;&amp;amp;spi3 {
	compatible = &amp;quot;nordic,nrf-spim&amp;quot;;
	status = &amp;quot;okay&amp;quot;;
	pinctrl-0 = &amp;lt;&amp;amp;spi3_default_alt&amp;gt;;
	pinctrl-1 = &amp;lt;&amp;amp;spi3_sleep_alt&amp;gt;;
	// cs-gpios = &amp;lt;&amp;amp;gpio1 8 GPIO_ACTIVE_LOW&amp;gt;; /* D4 */ 
    pinctrl-names = &amp;quot;default&amp;quot;, &amp;quot;sleep&amp;quot;;

	led_strip: ws2812@0 {
		compatible = &amp;quot;worldsemi,ws2812-spi&amp;quot;;

		/* SPI */
		reg = &amp;lt;0&amp;gt;; /* ignored, but necessary for SPI bindings */
		spi-max-frequency = &amp;lt;SPI_FREQ&amp;gt;;

		/* WS2812 */
		chain-length = &amp;lt;1&amp;gt;; /* arbitrary; change at will */
		color-mapping = &amp;lt;LED_COLOR_ID_GREEN
				 LED_COLOR_ID_RED
				 LED_COLOR_ID_BLUE&amp;gt;;
		spi-one-frame = &amp;lt;ONE_FRAME&amp;gt;;
		spi-zero-frame = &amp;lt;ZERO_FRAME&amp;gt;;
	};
};



spi3_default_alt: spi3_default_alt {
		group1 {
			psels = &amp;lt;NRF_PSEL(SPIM_MOSI, 0, 9)&amp;gt;;
			low-power-enable;
		};
	};

	spi3_sleep_alt: spi3_sleep_alt {
		group1 {
			psels = &amp;lt;NRF_PSEL(SPIM_MOSI, 0, 9)&amp;gt;;
			low-power-enable;
		};
	};&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>