<?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>I&amp;#39;d like to know how to control the Neopixel LED.</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/69834/i-d-like-to-know-how-to-control-the-neopixel-led</link><description>Hello 
 I&amp;#39;m trying to control the neopixeled WS2812. I referred to the following site. 
 https://electronut.in/nrf52-i2s-ws2812/ 
 I&amp;#39;m going to use this example of neopixel LED to control LED 3chain. I want to remove the Bluetooth function from this code</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 11 Jan 2021 13:46:24 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/69834/i-d-like-to-know-how-to-control-the-neopixel-led" /><item><title>RE: I'd like to know how to control the Neopixel LED.</title><link>https://devzone.nordicsemi.com/thread/288404?ContentTypeID=1</link><pubDate>Mon, 11 Jan 2021 13:46:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dd2196d4-4e39-4619-b166-e699a45d805f</guid><dc:creator>Stian R&amp;#248;ed Hafskjold</dc:creator><description>&lt;p&gt;Hi, you will have to check the output of the I2S pins with a logic analyzer, and see if there are any differences between the outputs.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I'd like to know how to control the Neopixel LED.</title><link>https://devzone.nordicsemi.com/thread/288293?ContentTypeID=1</link><pubDate>Mon, 11 Jan 2021 02:21:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5fc9c4b1-5804-4879-8e66-751569bebf5e</guid><dc:creator>schosdas</dc:creator><description>&lt;p&gt;&lt;span style="font-size:inherit;"&gt;Hello&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size:inherit;"&gt;I succeeded in output one LED using I2S. However, when more LEDs are used, LEDs except the first one have a strange output. I suspect there might be a problem transferring the buffer.&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:inherit;"&gt;Can you tell me what the problem is with this code and how to solve it?&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;// https://rs29.tistory.com/14

#include &amp;lt;stdio.h&amp;gt;
#include &amp;quot;nrf.h&amp;quot;
#include &amp;quot;nrf_drv_i2s.h&amp;quot;
#include &amp;quot;nrf_delay.h&amp;quot;
#include &amp;quot;app_util_platform.h&amp;quot;
#include &amp;quot;app_error.h&amp;quot;
#include &amp;quot;boards.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;


#define sk6812_led_num 3 //number of LEDs
#define sk6812_rst_buffer 8 //reset, 32bit*8= 256bit = 0.3125us*256 = 80us
#define sk6812_buf_len sk6812_led_num * 4 + 8 //buffer size, 32bit

//[0][0]=Green, [0][1]=Red, [0][2]=Blue, [0][3]=White
static uint32_t sk6812_buffer[2][sk6812_buf_len] = {0}; //sk6812_buffer[2][sk6812_buf_len]

volatile bool i2s_running = false;

//LED color data, apply in buffer
typedef struct sk6812_rgbw{
  uint8_t red;
  uint8_t green;
  uint8_t blue;
  uint8_t white;
}sk6812_rgbw_struct;



// This is the I2S data handler - all data exchange related to the I2S transfers is done here.
//The data handler set with I2S initialization is called immediately after transmission and after transmission completion.
static void i2s_data_handler(nrf_drv_i2s_buffers_t const * p_released, uint32_t status)
{
    static uint8_t transfer_chk = 0;

    if(p_released-&amp;gt;p_tx_buffer != 0) //If p_tx_buffer was previously delivered to the buffer
    {
      transfer_chk++;	//when send data count++
    }

    if(transfer_chk != 0) //after data send, stop i2s
    {
      nrf_drv_i2s_stop();
      i2s_running = false;
      transfer_chk = 0;	
    }
}

//data send to buffer though DMA
void sk6812_send_buffer()
{
  uint32_t err_code = NRF_SUCCESS;
  
  nrf_drv_i2s_buffers_t const i2s_buffers = {.p_tx_buffer = sk6812_buffer[0],}; 

  if(i2s_running == false) //if no runnning i2s
  {
    err_code = nrf_drv_i2s_start(&amp;amp;i2s_buffers, sk6812_buf_len, 0); //buffer, size, flag
    
    APP_ERROR_CHECK(err_code);

    i2s_running == true;
  }
}


void sk6812_set_color(sk6812_rgbw_struct* set_color, uint8_t index)
{
  uint32_t temp_g, temp_r, temp_b, temp_w = 0;

  for(uint8_t i=0;i&amp;lt;8;i++)	//Green
  {
    if((set_color-&amp;gt;green&amp;gt;&amp;gt;(7-i))&amp;amp;0x1==1)
    {
      temp_g|=0xC&amp;lt;&amp;lt;(7-i)*4;
    }
    else
    {
      temp_g|=0x8&amp;lt;&amp;lt;(7-i)*4;
    }

    if((set_color-&amp;gt;red&amp;gt;&amp;gt;(7-i))&amp;amp;0x1==1)	//Red
    {
      temp_r|=0xC&amp;lt;&amp;lt;(7-i)*4;
    }
    else
    {
      temp_r|=0x8&amp;lt;&amp;lt;(7-i)*4;
    }

    if((set_color-&amp;gt;blue&amp;gt;&amp;gt;(7-i))&amp;amp;0x1==1)	//Blue
    {
      temp_b|=0xC&amp;lt;&amp;lt;(7-i)*4;
    }
    else
    {
      temp_b|=0x8&amp;lt;&amp;lt;(7-i)*4;
    }

    if((set_color-&amp;gt;white&amp;gt;&amp;gt;(7-i))&amp;amp;0x1==1)	//White
    {
      temp_w|=0xC&amp;lt;&amp;lt;(7-i)*4;
    }
    else
    {
      temp_w|=0x8&amp;lt;&amp;lt;(7-i)*4;
    }
  }
  
  sk6812_buffer[0][index*4]=((temp_g&amp;amp;0x0000FFFF)&amp;lt;&amp;lt;16)|((temp_g&amp;amp;0xFFFF0000)&amp;gt;&amp;gt;16);
  sk6812_buffer[0][index*4+1]=((temp_r&amp;amp;0x0000FFFF)&amp;lt;&amp;lt;16)|((temp_r&amp;amp;0xFFFF0000)&amp;gt;&amp;gt;16);
  sk6812_buffer[0][index*4+2]=((temp_b&amp;amp;0x0000FFFF)&amp;lt;&amp;lt;16)|((temp_b&amp;amp;0xFFFF0000)&amp;gt;&amp;gt;16);
  sk6812_buffer[0][index*4+3]=((temp_w&amp;amp;0x0000FFFF)&amp;lt;&amp;lt;16)|((temp_w&amp;amp;0xFFFF0000)&amp;gt;&amp;gt;16);

  sk6812_send_buffer();	
  nrf_delay_ms(1);
}



int main(void)
{
    uint32_t err_code = NRF_SUCCESS;

    err_code = NRF_LOG_INIT(NULL);
    APP_ERROR_CHECK(err_code);

    //NRF_LOG_DEFAULT_BACKENDS_INIT();

    //NRF_LOG_INFO(&amp;quot;I2S loopback example started.&amp;quot;);

    //I2S setting
    nrf_drv_i2s_config_t config = NRF_DRV_I2S_DEFAULT_CONFIG;	
    config.sdout_pin = I2S_SDOUT_PIN;	//SDOUT PIN 27
    config.mck_setup = NRF_I2S_MCK_32MDIV10;
    config.ratio     = NRF_I2S_RATIO_32X;
    config.sample_width=NRF_I2S_SWIDTH_16BIT;	
    config.channels  = NRF_I2S_CHANNELS_STEREO;
    
    err_code = nrf_drv_i2s_init(&amp;amp;config, i2s_data_handler);	
    APP_ERROR_CHECK(err_code);

    sk6812_rgbw_struct temp_rgbw;

    //color setting
    temp_rgbw.red = 0;
    temp_rgbw.green = 0;
    temp_rgbw.blue = 0;
    temp_rgbw.white = 0;

    for(uint8_t i=0;i&amp;lt;sk6812_led_num;i++) //first time led off
    {
      sk6812_set_color(&amp;amp;temp_rgbw,i);
    }


    for (;;)
    {
        //firt led
        temp_rgbw.red = 128;
        temp_rgbw.green = 0;
        temp_rgbw.blue = 0;
        temp_rgbw.white = 0; 

        sk6812_set_color(&amp;amp;temp_rgbw,0);

        //second led
        temp_rgbw.red = 0;
        temp_rgbw.green = 128;
        temp_rgbw.blue = 0;
        temp_rgbw.white = 0; 

        sk6812_set_color(&amp;amp;temp_rgbw,1); 
        
        //third led
        temp_rgbw.red = 0;
        temp_rgbw.green = 0;
        temp_rgbw.blue = 128;
        temp_rgbw.white = 0; 

        sk6812_set_color(&amp;amp;temp_rgbw,2);         
    }
}

/** @} */
&lt;/pre&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:inherit;"&gt;Thank you.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I'd like to know how to control the Neopixel LED.</title><link>https://devzone.nordicsemi.com/thread/286984?ContentTypeID=1</link><pubDate>Wed, 30 Dec 2020 10:57:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:19a8ed93-0a20-4b1d-a183-1af8e0b9e02c</guid><dc:creator>Stian R&amp;#248;ed Hafskjold</dc:creator><description>&lt;p&gt;Description of the error code:&lt;/p&gt;
&lt;table&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td colspan="1" rowspan="1"&gt;NRFX_ERROR_INVALID_ADDR&lt;/td&gt;
&lt;td colspan="1" rowspan="1"&gt;If the provided buffers are not placed in the Data RAM region.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v15.2.0/group__nrfx__i2s.html?cp=7_5_2_6_9_0_7_1_9#ga2c12cf4e0542b5f62303526c0ab410e5"&gt;https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v15.2.0/group__nrfx__i2s.html?cp=7_5_2_6_9_0_7_1_9#ga2c12cf4e0542b5f62303526c0ab410e5&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;How are you declaring the buffers? Try to declare the buffers as &lt;strong&gt;static&lt;/strong&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I'd like to know how to control the Neopixel LED.</title><link>https://devzone.nordicsemi.com/thread/286538?ContentTypeID=1</link><pubDate>Thu, 24 Dec 2020 06:48:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9037f2b8-d1a9-4faf-ab0d-c42861d8d9cd</guid><dc:creator>schosdas</dc:creator><description>&lt;p&gt;Hello, Stian.&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;I started with the I2S example of SDK v17.0. &lt;br /&gt;&amp;#39;nrf_drv_i2s_start()&amp;#39; was missing from the code I uploaded, so I added it to main() and ran it again.&lt;/p&gt;
&lt;p&gt;However, an error is output from nrf_drv_i2s_start.&amp;nbsp; This example seems to have been made from the old version of SDK. Is there a problem with transplanting the old version of the SDK?&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;int main(void)
{
    uint32_t err_code = NRF_SUCCESS;

    err_code = NRF_LOG_INIT(NULL);
    APP_ERROR_CHECK(err_code);

    NRF_LOG_DEFAULT_BACKENDS_INIT();

    NRF_LOG_INFO(&amp;quot;I2S loopback example started.&amp;quot;);

    set_led_data(); //first time
    //I2S setting
    nrf_drv_i2s_config_t config = NRF_DRV_I2S_DEFAULT_CONFIG;
    // In Master mode the MCK frequency and the MCK/LRCK ratio should be
    // set properly in order to achieve desired audio sample rate (which
    // is equivalent to the LRCK frequency).
    // For the following settings we&amp;#39;ll get the LRCK frequency equal to
    // 15873 Hz (the closest one to 16 kHz that is possible to achieve).
    config.sdin_pin  = I2S_SDIN_PIN; //26
    config.sdout_pin = I2S_SDOUT_PIN; //27
    config.mck_setup = NRF_I2S_MCK_32MDIV10; //&amp;lt; 32 MHz / 10 = 3.2 MHz.
    config.ratio     = NRF_I2S_RATIO_32X; //96X, //&amp;lt; LRCK = MCK / 32.
    config.channels  = NRF_I2S_CHANNELS_STEREO;

    err_code = nrf_drv_i2s_init(&amp;amp;config, data_handler);
    APP_ERROR_CHECK(err_code);

    // start I2S
    g_i2s_running = true;
    g_i2s_start = true;

    g_demo_mode = 2; //0~2

    err_code = nrf_drv_i2s_start(m_buffer_tx, I2S_BUFFER_SIZE, 0);
    APP_ERROR_CHECK(err_code);

    for (;;)
    {
        // stop I2S
        //nrf_drv_i2s_stop();

        nrf_delay_ms(250);

        // update 
        if (g_i2s_running) 
        {
            nled = (nled + 1) % NLEDS;                
            set_led_data();
        }
    }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;lt;error&amp;gt; app: ERROR 16 [NRF_ERROR_INVALID_ADDR] at Y:\YSC\Project\CODE\Nordic\SDK17.0\nRF5_SDK_17.0.0_9d13099\examples\peripheral\i2s\main.c:162

PC at: 0x00002441

&amp;lt;error&amp;gt; app: End of error report&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thank you for your help.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I'd like to know how to control the Neopixel LED.</title><link>https://devzone.nordicsemi.com/thread/286449?ContentTypeID=1</link><pubDate>Wed, 23 Dec 2020 12:04:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cc866cac-0b42-4f70-8f0f-829056cc6957</guid><dc:creator>Stian R&amp;#248;ed Hafskjold</dc:creator><description>&lt;p&gt;Hi, do you know if the code is running or not? Can you try to check with a simple application that just blinks an LED? You said that you want to &amp;quot;remove the bluetooth function&amp;quot;; does that mean that you are starting out with an example that uses the Softdevice? If so, did you remember to flash the Softdevice as well?&lt;/p&gt;
&lt;p&gt;It is usually very helpful to use a logic analyzer to debug the digital interface between the nRF52 and the LED sensors. At least you can check to see if there is actually any data being transferred.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>