<?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>NRF52840DK driving Neopixel is flickering</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/84365/nrf52840dk-driving-neopixel-is-flickering</link><description>Goodday all 
 
 Im trying to drive some Neopixel LEDs with 52840DK SDK_17.1.0. and have been following this example. https://devzone.nordicsemi.com/f/nordic-q-a/70560/nrfx_i2s-library-never-recognized 
 The code works but there is a severe flicker on</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sat, 05 Feb 2022 06:17:27 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/84365/nrf52840dk-driving-neopixel-is-flickering" /><item><title>RE: NRF52840DK driving Neopixel is flickering</title><link>https://devzone.nordicsemi.com/thread/351414?ContentTypeID=1</link><pubDate>Sat, 05 Feb 2022 06:17:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:40993605-2693-48f4-8eac-6714f87b9514</guid><dc:creator>melt</dc:creator><description>&lt;p&gt;Thank you&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52840DK driving Neopixel is flickering</title><link>https://devzone.nordicsemi.com/thread/351279?ContentTypeID=1</link><pubDate>Fri, 04 Feb 2022 10:30:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:55509a63-3365-472b-b3b3-586de7623d44</guid><dc:creator>Sigurd</dc:creator><description>[quote user="melt777"]No more flickering or flashing. I can address each LED individually and I can adjust the brightness.[/quote]
&lt;p&gt;Great!&lt;/p&gt;
[quote user="melt777"]How do I set the color?[/quote]
&lt;p&gt;Here is the doc for &lt;span&gt;drv_ws2812_set_pixel&lt;/span&gt;:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;/**@brief Function for setting the specified pixel in the LED state buffer to the specified color.
 *
 * @param[in] pixel_no  Number of the pixel in the LED chain.
 *                      Specify a value in the range from 0 to @ref WS2812_LED_CHAIN_PIXELS_COUNT_MAX-1.
 *                      Values out of the range are ignored.
 * @param[in] color     Color to be set. Use the RGB format. Bits 23 to 16 are for the red component,
 *                      bits 15 to 8 are for the green component, and bits 7 to 0 are for the blue component.
 *
 * @note Call @ref drv_ws2812_display to update the LED chain from the frame buffer.
 */
void drv_ws2812_set_pixel(uint32_t pixel_no, uint32_t color);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;So for red, try setting color to&amp;nbsp;&lt;span&gt;&amp;nbsp;e.g.&amp;nbsp;&lt;/span&gt;16711680 (bit 23 to 16 set to 1).&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1643970540065v1.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52840DK driving Neopixel is flickering</title><link>https://devzone.nordicsemi.com/thread/351261?ContentTypeID=1</link><pubDate>Fri, 04 Feb 2022 09:57:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:920dfef9-f459-458e-a307-b1ef99e0b4f7</guid><dc:creator>melt</dc:creator><description>&lt;p&gt;The Bulb example has proven most useful. I have removed all the Zigbee code and files and was left with a barebone framework to experiment with the neopixel driver. No more flickering or flashing. I can address each LED individually and I can adjust the brightness. But for some reason im only get shades of blue.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;my code below&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;
#include &amp;quot;sdk_config.h&amp;quot;
#include &amp;quot;bsp.h&amp;quot;
#include &amp;quot;boards.h&amp;quot;
#include &amp;quot;app_pwm.h&amp;quot;
#include &amp;quot;app_timer.h&amp;quot;
#include &amp;quot;nrf_log.h&amp;quot;
#include &amp;quot;nrf_log_ctrl.h&amp;quot;
#include &amp;quot;nrf_log_default_backends.h&amp;quot;
#include &amp;quot;drv_ws2812.h&amp;quot;
#define LED_CHAIN_DOUT_PIN                NRF_GPIO_PIN_MAP(1,7)                 /**&amp;lt; GPIO pin used as DOUT (to be connected to DIN pin of the first ws2812 led in chain) */
#define DRV_WS2812_LED_CHAIN_PIXELS_COUNT_MAX 20


#if (APP_BULB_USE_WS2812_LED_CHAIN)
/**@brief Timer responsible for triggering periodic led chain refresh */
APP_TIMER_DEF(m_ws2812_refresh_timer);

/** @brief Requests a led chain refresh */
static volatile bool m_ws2812_refresh_request;
#endif

/**@brief Function for initializing the application timer.
 */
static void timer_init(void)
{
    uint32_t error_code = app_timer_init();
    APP_ERROR_CHECK(error_code);
}

/**@brief Function for initializing the nrf log module.
 */
static void log_init(void)
{
    ret_code_t err_code = NRF_LOG_INIT(NULL);
    APP_ERROR_CHECK(err_code);

    NRF_LOG_DEFAULT_BACKENDS_INIT();
}


/**@brief Callback for button events.
 *
 * @param[in]   evt      Incoming event from the BSP subsystem.
 */
static void buttons_handler(bsp_event_t evt)
{

}


/**@brief Function for initializing LEDs and a single PWM channel.
 */
static void leds_buttons_init(void)
{


}

/**@brief Function for application main entry.
 */
int main(void)
{
       /* Initialize timer, logging system and GPIOs. */
    timer_init();
    log_init();
    leds_buttons_init();
    drv_ws2812_init(LED_CHAIN_DOUT_PIN);
    drv_ws2812_set_pixel_all(60);

     //   drv_ws2812_set_pixel_all(25);
   drv_ws2812_display(NULL, NULL);
}


/**
 * @}
 */
&lt;/pre&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;How do I set the color? according to the driver the 2nd variable should set the RGB color.&lt;/p&gt;
&lt;p&gt;drv_ws2812_set_pixel(uint32_t pixel_no, uint32_t color);&lt;/p&gt;
&lt;p&gt;but my 2nd variable set brightness (of blue only)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52840DK driving Neopixel is flickering</title><link>https://devzone.nordicsemi.com/thread/351099?ContentTypeID=1</link><pubDate>Thu, 03 Feb 2022 12:45:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f5d51d89-d3af-4f92-b1c5-95e275b6f936</guid><dc:creator>melt</dc:creator><description>&lt;p&gt;Thanks Sigurd. I suspect that I2S is the problem here. I can successfully drive these LEDs with a Particle Photon board,&amp;nbsp;so I know the hardware is working. With only 1 LED it works find but as soon as I add more Neopixels the&amp;nbsp;flickering becomes more&amp;nbsp;noticeable. With 20 LEDs they are definitely switching on and off as if the FOR(;;) loop is to slow. Hence me playing with the&amp;nbsp;&amp;nbsp;&lt;span&gt;i2s_init()&amp;nbsp; function to increase the frequency. I have also noted that setting channels Left or Right only lights up every 2nd LED.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Will play around with the light_bulb example today -&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52840DK driving Neopixel is flickering</title><link>https://devzone.nordicsemi.com/thread/351086?ContentTypeID=1</link><pubDate>Thu, 03 Feb 2022 12:11:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:95ae8dc6-ecd6-4477-8c8f-9b5e74bd6c29</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;This post might be helpful:&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/72958/ws2812-driver"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/72958/ws2812-driver&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;PS: The mentioned ws2812 driver in the&amp;nbsp;&lt;span&gt;light_bulb example uses PWM and not i2s.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>