<?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>nrfx_i2s library never recognized</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/70560/nrfx_i2s-library-never-recognized</link><description>I am trying to use the nrfx_i2s library to run neopixels on a nRF52 DK. I am using SES to compile and flash the code. I am having trouble correctly using the library though. For the init, start, stop, and uniniti i2s functions I get errors &amp;quot;undefined</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sat, 23 Jan 2021 11:06:42 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/70560/nrfx_i2s-library-never-recognized" /><item><title>RE: nrfx_i2s library never recognized</title><link>https://devzone.nordicsemi.com/thread/290850?ContentTypeID=1</link><pubDate>Sat, 23 Jan 2021 11:06:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:525ab105-85ef-44f1-97c5-a9a5fdc5b154</guid><dc:creator>Egor</dc:creator><description>&lt;p&gt;Hi Zack. Thanks for sharing your code.&lt;/p&gt;
&lt;p&gt;I finally found the issue. It was in SDK location. The full path to SDK was: D:\Projects\BLE\Nordic\nRF5_SDK_17.0.2&lt;/p&gt;
&lt;p&gt;When I moved SDK to the root folder like:&amp;nbsp;&lt;span&gt;D:\nRF5_SDK_17.0.2 the issue has gone.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrfx_i2s library never recognized</title><link>https://devzone.nordicsemi.com/thread/289598?ContentTypeID=1</link><pubDate>Mon, 18 Jan 2021 01:01:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1bed3baf-b06f-4be8-96c2-8a03952f7671</guid><dc:creator>ZackBoi</dc:creator><description>&lt;p&gt;Here is the code without all of the ble stuff:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#include &amp;quot;nrf_delay.h&amp;quot;
#include &amp;quot;nrf_drv_i2s.h&amp;quot;

#define neopixels_number                8                                       /**&amp;lt; Neopixels number. */
#define neopixel_pin                    16                                      /**&amp;lt; Neopixel pin number. */

#define reset_bits                      6                                       /**&amp;lt; Reset bits. */
#define i2s_buffer_size                 ((3 * neopixels_number) + reset_bits)   /**&amp;lt; i2d buffer size for driving the neopixel. */
static uint32_t m_buffer_tx[i2s_buffer_size];
static uint32_t       * volatile mp_block_to_fill  = NULL;

static void set_neopixel_data(uint8_t led_index, uint8_t r, uint8_t g, uint8_t b);

/**@brief Function for handeling the i2s data.
 *
 */
static void i2s_data_handler(nrf_drv_i2s_buffers_t const * p_released,
                             uint32_t                      status)
{
    ret_code_t err_code;
    ASSERT(p_released);

    if (!(status &amp;amp; NRFX_I2S_STATUS_NEXT_BUFFERS_NEEDED))
    {
        return;
    }

    if (!p_released-&amp;gt;p_rx_buffer)
    {
        nrf_drv_i2s_buffers_t const next_buffers = {
            .p_tx_buffer = m_buffer_tx,
        };
        err_code = nrf_drv_i2s_next_buffers_set(&amp;amp;next_buffers);
        APP_ERROR_CHECK(err_code);

        mp_block_to_fill = m_buffer_tx;
    }
    else
    {      
        err_code = nrf_drv_i2s_next_buffers_set(p_released);
        APP_ERROR_CHECK(err_code);
        mp_block_to_fill = (uint32_t *)p_released-&amp;gt;p_tx_buffer;
    }
}

/**@brief Function for calculating the rgb channels data value.
 *
 */
static uint32_t rgb_channels_value(uint8_t channel_level)
{
    uint32_t value = 0;

    // 0 
    if(channel_level == 0) {
        value = 0x88888888;
    }
    // 255
    else if (channel_level == 255) {
        value = 0xeeeeeeee;
    }
    else 
    {
        // apply 4-bit 0xe HIGH pattern wherever level bits are 1.
        value = 0x88888888;
        for (uint8_t i = 0; i &amp;lt; 8; i++) 
        {
            if((1 &amp;lt;&amp;lt; i) &amp;amp; channel_level) 
            {
                uint32_t mask = ~(0x0f &amp;lt;&amp;lt; 4*i);
                uint32_t patt = (0x0e &amp;lt;&amp;lt; 4*i);
                value = (value &amp;amp; mask) | patt;
            }
        }

        // swap 16 bits
        value = (value &amp;gt;&amp;gt; 16) | (value &amp;lt;&amp;lt; 16);
    }

    return value;
}

/**@brief Function for setting the leds (rgb) data in the i2s buffer.
 *
 *@param led_n   neopixel number in the array starting with 0.
 *@param r       red led level.
 *@param g       green led level.
 *@param b       blue led level.
 */
static void set_neopixel_data(uint8_t led_index, uint8_t r, uint8_t g, uint8_t b)
{
    for(int i = 0; i &amp;lt; (3 * neopixels_number); i += 3) 
    {
        if (i == (3 * led_index)) 
        {          
           m_buffer_tx[i]   = rgb_channels_value(g);
           m_buffer_tx[i+1] = rgb_channels_value(r);
           m_buffer_tx[i+2] = rgb_channels_value(b);
          
        }
        else 
        {
            m_buffer_tx[i]   = 0x88888888;
            m_buffer_tx[i+1] = 0x88888888;
            m_buffer_tx[i+2] = 0x88888888;
        }
    }

    // reset 
    for(int i = (3 * neopixels_number); i &amp;lt; i2s_buffer_size; i++) 
    {
        m_buffer_tx[i] = 0;
    }

     nrf_drv_i2s_buffers_t const initial_buffers = {
            .p_tx_buffer = m_buffer_tx,
        };
}

/**@brief Function for initialising the i2s.
 *
 */
static void i2s_init()
{
    uint32_t err_code = NRF_SUCCESS;

    nrf_drv_i2s_config_t config = NRF_DRV_I2S_DEFAULT_CONFIG;
    config.sdin_pin  = NRFX_I2S_PIN_NOT_USED;
    config.sdout_pin = neopixel_pin;

    config.mck_setup = NRF_I2S_MCK_32MDIV10;
    config.ratio     = NRF_I2S_RATIO_32X;
    config.channels  = NRF_I2S_CHANNELS_STEREO;
    err_code = nrf_drv_i2s_init(&amp;amp;config, i2s_data_handler);
    APP_ERROR_CHECK(err_code);
}

/**@brief Function for application main entry.
 */
int main(void)
{
    ret_code_t err_code;
    bool erase_bonds;

    nrf_drv_i2s_buffers_t const initial_buffers = 
    {
        .p_tx_buffer = m_buffer_tx 
    };

    i2s_init();

    err_code = nrf_drv_i2s_start(&amp;amp;initial_buffers, i2s_buffer_size, 0);            
    APP_ERROR_CHECK(err_code);
    set_neopixel_data(0,100,100,100); // Turn Off the Pixel

    // Enter main loop.
    for (;;)
    {
        set_neopixel_data(0,20,0,0); // Turn Off the Pixel
        nrf_delay_ms(250);
        set_neopixel_data(1,0,20,0); // Turn Off the Pixel
        nrf_delay_ms(1000);
        set_neopixel_data(2,0,0,20); // Turn Off the Pixel
        nrf_delay_ms(1000);
        set_neopixel_data(0,0,0,20); // Turn Off the Pixel
        nrf_delay_ms(1000);
    }
}


/**
 * @}
 */
/**/
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrfx_i2s library never recognized</title><link>https://devzone.nordicsemi.com/thread/289597?ContentTypeID=1</link><pubDate>Mon, 18 Jan 2021 00:59:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e841b8a7-2fe1-4ed0-a414-28b012bf9796</guid><dc:creator>ZackBoi</dc:creator><description>&lt;p&gt;Hi Egor,&lt;/p&gt;
&lt;p&gt;I figured it out. It was the I2S_ENABLED property in the sdk_config file like you mentioned. After switching it to 1 it started working.&lt;/p&gt;
&lt;p&gt;The reference&amp;nbsp;code I am working with is here:&amp;nbsp;&lt;a href="https://github.com/rmptxf/NeoController" rel="noopener noreferrer" target="_blank"&gt;https://github.com/rmptxf/NeoController&lt;/a&gt;, in the ble_app_neocontroller folder. In this code there is a custom ble service and characteristic that controls the colors of the neopixels. If you just want to quickly test if the neopixel-code is working, start messing around with the for(;;) loop in main() and utilize the set_neopixel_data() function.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrfx_i2s library never recognized</title><link>https://devzone.nordicsemi.com/thread/289584?ContentTypeID=1</link><pubDate>Sun, 17 Jan 2021 18:49:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:391be58e-d588-4dd5-b41a-297b758f1c38</guid><dc:creator>Egor</dc:creator><description>&lt;p&gt;Hey Zack&lt;/p&gt;
&lt;p&gt;I&amp;#39;m also working on neopixel solution with i2s for nRF52840 chip and SDK 17 on Win.&lt;/p&gt;
&lt;p&gt;Having the same issue: &amp;quot;...integration/nrfx/legacy/nrf_drv_i2s.h:103: undefined reference to `nrfx_i2s_init&amp;#39;&amp;quot;.&lt;/p&gt;
&lt;p&gt;Please leave the comment when you find the solution of this.&lt;/p&gt;
&lt;p&gt;BTW: Have you&amp;nbsp;set the I2S_ENABLED to 1 in sdk_config.h ?&lt;/p&gt;
&lt;p&gt;PS: probably we could try an example from Didrik (last post from him):&amp;nbsp;&lt;a title="i2s example" href="https://devzone.nordicsemi.com/f/nordic-q-a/63708/i2s-loopback-example-missing-in-installation-folder/260841"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/63708/i2s-loopback-example-missing-in-installation-folder/260841&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>