<?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>I2S on NRF9160</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/60256/i2s-on-nrf9160</link><description>I have understood that zephyr I2S APIs do not support NRF9160 ATM. Is that true? 
 Also, I could not find any samples about using NRFX I2S drivers on NRF9160. Are there any such samples anywhere? 
 Now I took the approach that I try to use I2S from /modules</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 28 Jul 2025 14:08:04 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/60256/i2s-on-nrf9160" /><item><title>RE: I2S on NRF9160</title><link>https://devzone.nordicsemi.com/thread/543772?ContentTypeID=1</link><pubDate>Mon, 28 Jul 2025 14:08:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:020e9fcc-b113-4d1a-bfa6-9ebd542171d4</guid><dc:creator>MLU</dc:creator><description>&lt;p&gt;Hi&lt;br /&gt;was your problem finally solved?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I2S on NRF9160</title><link>https://devzone.nordicsemi.com/thread/299147?ContentTypeID=1</link><pubDate>Thu, 11 Mar 2021 05:48:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:38c08f5e-0af8-426c-88ab-448cd6d955f9</guid><dc:creator>duxinglang</dc:creator><description>&lt;p&gt;&lt;span&gt;Hi fastfox,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span class="transSent"&gt;Is your i2s working now?&amp;nbsp;&lt;/span&gt;&lt;span class="transSent"&gt;I am developing the i2s&amp;nbsp;function, but I also encountered the problem of the program crashing. I&amp;nbsp;debug it and find that it crashed when calling the function &amp;quot;nrf_i2s_task_trigger&amp;quot;. I see that this is just an assignment operation, I don&amp;#39;t understand why it would crash, can you give me some advice?&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span class="transSent"&gt;&lt;pre class="ui-code" data-mode="text"&gt;NRF_STATIC_INLINE void nrf_i2s_task_trigger(NRF_I2S_Type * p_reg,
                                            nrf_i2s_task_t task)
{
    *((volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)task)) = 0x1UL;
}&lt;/pre&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I2S on NRF9160</title><link>https://devzone.nordicsemi.com/thread/251724?ContentTypeID=1</link><pubDate>Tue, 26 May 2020 13:06:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:38d6358f-999d-4475-97a8-fcd263e2b0da</guid><dc:creator>fastfox</dc:creator><description>&lt;p&gt;I am far from expert in this matter, but IIRC default config uses 16bit width and I believe your mic uses 24bits. I had the definitions like this:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;  nrfx_i2s_config_t config = NRFX_I2S_DEFAULT_CONFIG(I2S_SCK_PIN, I2S_WS_PIN, NRFX_I2S_PIN_NOT_USED, NRFX_I2S_PIN_NOT_USED, I2S_SD_PIN);
  config.mode = NRF_I2S_MODE_MASTER;
  config.mck_setup = NRF_I2S_MCK_32MDIV21;     // MCK running at 32MHz/21 = 1.5238095MHz
  config.channels = NRF_I2S_CHANNELS_LEFT;     // We only have one channel(mono)
  config.sample_width = NRF_I2S_SWIDTH_24BIT;  // Mic uses 24 bit words
  config.ratio = NRF_I2S_RATIO_96X;            // This becomes LRCK frequency aka sample rate?. MCK/96 = 15.873ksamples/s = Under low power limit
  config.format = NRF_I2S_FORMAT_I2S;&lt;/pre&gt;with this mic:&amp;nbsp;&lt;a href="https://invensense.tdk.com/products/ics-43434/"&gt;https://invensense.tdk.com/products/ics-43434/&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I2S on NRF9160</title><link>https://devzone.nordicsemi.com/thread/250819?ContentTypeID=1</link><pubDate>Tue, 19 May 2020 20:33:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:67f10e57-648c-4095-baf5-bbc8b1ca28ef</guid><dc:creator>Nahom Abraha</dc:creator><description>&lt;p&gt;Hi fastfox,&lt;/p&gt;
&lt;p&gt;I am trying to do the same thing, but I have a don&amp;#39;t receive any dat. I am using this microphone (&lt;a href="https://www.adafruit.com/product/3421"&gt;https://www.adafruit.com/product/3421&lt;/a&gt;).&lt;span&gt;The microphone&amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;works with a raspberry pi so the microphone works.&lt;/span&gt;&lt;span&gt;I don&amp;#39;t know how to fix this.&lt;/span&gt;&lt;span&gt;&amp;nbsp; I think the problem is the datahandler.I connected&lt;/span&gt;&lt;br /&gt;&lt;span&gt;LRCL with pin 8&lt;/span&gt;&lt;br /&gt;&lt;span&gt;DOUT with 9&lt;/span&gt;&lt;br /&gt;&lt;span&gt;BCLK with pin 10&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Here is my code can you help me?&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#include &amp;lt;nrf.h&amp;gt;
#include &amp;lt;zephyr.h&amp;gt;
#include &amp;lt;device.h&amp;gt;
#include &amp;lt;sys/printk.h&amp;gt;
#include &amp;lt;stdbool.h&amp;gt;
#include &amp;lt;nrfx_i2s.h&amp;gt;
#include &amp;lt;string.h&amp;gt;

#include &amp;quot;microphone.h&amp;quot;
#include &amp;quot;button.h&amp;quot;
#include &amp;quot;udp.h&amp;quot;

#define  I2S_BUFFER_SIZE 1024
#define  SCK_PIN    10 
#define  SDIN_PIN   9
#define  LRCK_PIN   8
#define  MCK_PIN    7
#define  SDOUT_PIN  6 

int counter;
static uint32_t rx_buffer[I2S_BUFFER_SIZE]={0};
static uint32_t tx_buffer[I2S_BUFFER_SIZE]={0};
static nrfx_i2s_buffers_t buffer;   
 
ISR_DIRECT_DECLARE(i2s_isr_handler) 
{
  nrfx_i2s_irq_handler();
  ISR_DIRECT_PM();

  return 1; 
}

static void data_handler(nrfx_i2s_buffers_t const * p_released, uint32_t status)
{ 
  if (NRFX_I2S_STATUS_NEXT_BUFFERS_NEEDED == status)
  {
    printk(&amp;quot;%u\n&amp;quot;,status);
    nrfx_err_t err = nrfx_i2s_next_buffers_set(&amp;amp;buffer);
    if (err != NRFX_SUCCESS ) {
        printk(&amp;quot;next buffer failed with error code:%d\n&amp;quot;,err);
      } 
  }

  if(p_released != NULL){
    if (p_released-&amp;gt;p_rx_buffer != NULL)
    {
        //uint8_t* data=p_released-&amp;gt;p_rx_buffer;
        //data[0] == p_released-&amp;gt;p_rx_buffer[0]
        uint8_t data[I2S_BUFFER_SIZE]={0};
        memcpy(data,p_released-&amp;gt;p_rx_buffer, sizeof(p_released-&amp;gt;p_rx_buffer));
        for(int i=0; i &amp;lt;1024; i++)
        {
            printk(&amp;quot;data: 0x%hhX\n&amp;quot;,data[i]);
            printk(&amp;quot;data2:0x%hhX\n&amp;quot;,p_released-&amp;gt;p_rx_buffer[i]);
        }
      }
    }
  }
}

void recordaudio(void)
{
  printk(&amp;quot;Start i2s configuration\n&amp;quot;);
  nrfx_err_t err;
  uint16_t buffer_size=2048;
  nrfx_i2s_config_t config = NRFX_I2S_DEFAULT_CONFIG(SCK_PIN,LRCK_PIN,MCK_PIN,SDOUT_PIN,SDIN_PIN);
  
  buffer.p_rx_buffer=rx_buffer;
  buffer.p_tx_buffer=tx_buffer;

 //config.irq_priority = NRFX_I2S_DEFAULT_CONFIG_IRQ_PRIORITY;
// config.mode = NRF_I2S_MODE_MASTER;
// config.mck_setup = NRF_I2S_MCK_32MDIV8;
// config.channels = NRF_I2S_CHANNELS_LEFT;
// config.sample_width = NRF_I2S_SWIDTH_16BIT;
// config.ratio = NRF_I2S_RATIO_32X;
// config.format = NRF_I2S_FORMAT_I2S;
// config.alignment=NRF_I2S_ALIGN_LEFT;
//  
 IRQ_DIRECT_CONNECT(I2S_IRQn, 0,i2s_isr_handler, 0);

  err = nrfx_i2s_init(&amp;amp;config, data_handler);
  if (err != NRFX_SUCCESS)
  {
      printk(&amp;quot;i2s init failed:%d\n&amp;quot;,err);
  }
  printk(&amp;quot;i2s_start\n&amp;quot;);
  err=nrfx_i2s_start(&amp;amp;buffer,buffer_size, 0);
  if(err!=NRFX_SUCCESS )
    {
     printk(&amp;quot;i2s start failed with error:%d\n&amp;quot;,err);
    }
  while(1)
     {
      printk(&amp;quot;recording\n&amp;quot;);
      k_sleep(2000);
     }
    printk(&amp;quot;\n stop recording \n&amp;quot;);
    nrfx_i2s_stop();
    nrfx_i2s_uninit();
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Thank you in advance&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I2S on NRF9160</title><link>https://devzone.nordicsemi.com/thread/246385?ContentTypeID=1</link><pubDate>Fri, 24 Apr 2020 05:36:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:154769d9-525b-46fc-97b9-1da91674914d</guid><dc:creator>fastfox</dc:creator><description>&lt;p&gt;It looks like the key for not to crash was a combination of&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;IRQ_DIRECT_CONNECT(I2S_IRQn, 0,
                     i2s_isr_handler, 0);
                     
ISR_DIRECT_DECLARE(i2s_isr_handler) {
  nrfx_i2s_irq_handler();
  ISR_DIRECT_PM(); /* PM done after servicing interrupt for best latency
			  */

  return 1; /* We should check if scheduling decision should be made */
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;and&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;config.mck_setup = NRF_I2S_MCK_32MDIV21;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;to the application. And&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#ifdef NRF_I2S
		PERIPH(&amp;quot;NRF_I2S&amp;quot;, NRF_I2S, 1),
#endif&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;to the SDK&lt;/p&gt;
&lt;p&gt;I thought that I don&amp;#39;t need MCK as I don&amp;#39;t have the wire connected either, but apparently I do need it. And now that I know that, documentation also states that &amp;quot;&lt;span&gt;This generator always needs to be enabled when in Master mode&lt;/span&gt;&amp;quot;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I2S on NRF9160</title><link>https://devzone.nordicsemi.com/thread/245439?ContentTypeID=1</link><pubDate>Mon, 20 Apr 2020 07:59:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cbdfe3f4-57b1-463b-b931-85dace8e84b6</guid><dc:creator>fastfox</dc:creator><description>&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/i2s_2D00_prj.zip"&gt;devzone.nordicsemi.com/.../i2s_2D00_prj.zip&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I tried to make a project with nothing but crashing I2S in it. I am running the SW in custom board, didn&amp;#39;t check what the pins are in dev board.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I2S on NRF9160</title><link>https://devzone.nordicsemi.com/thread/245420?ContentTypeID=1</link><pubDate>Mon, 20 Apr 2020 06:09:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a150bd9d-7d7e-4c65-a83f-2c019ffa6fc5</guid><dc:creator>fastfox</dc:creator><description>&lt;p&gt;I am not sure if I understand you perfectly. I believe steps 1,2,3 an 4 are more or less obsolete as I2S is already included, compiled and i think I actually have the I2S_NS in use(0x40028000UL)&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I tried to use the IRQ define macros, but it still crashes at start.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I try to strip my program to I2S only so that I can send it here&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I2S on NRF9160</title><link>https://devzone.nordicsemi.com/thread/245235?ContentTypeID=1</link><pubDate>Fri, 17 Apr 2020 12:37:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7d255a7d-72d1-4be6-9616-c3642b80ba71</guid><dc:creator>Sigurd</dc:creator><description>[quote user=""]I have understood that zephyr I2S APIs do not support NRF9160 ATM. Is that true?[/quote]
&lt;p&gt;Correct.&amp;nbsp;The work to add&amp;nbsp;support for nRFx devices in the Zephyr I2S API is on-going, as part of &lt;a href="https://github.com/zephyrproject-rtos/zephyr/pull/19436"&gt;this PR&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;For now, you will need to use the approach shown in&amp;nbsp;&lt;/span&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/50656/using-pdm-mic-on-nrf9160dk/204715#204715"&gt;this post&lt;/a&gt;&lt;span&gt;&amp;nbsp;(replace PDM with I2S).&lt;br /&gt;&lt;br /&gt;If that approach does not work,&amp;nbsp;upload your project here, and I can take closer look.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I2S on NRF9160</title><link>https://devzone.nordicsemi.com/thread/245191?ContentTypeID=1</link><pubDate>Fri, 17 Apr 2020 10:13:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1741b59b-dc54-47ec-bb28-9679386e2acc</guid><dc:creator>fastfox</dc:creator><description>&lt;p&gt;Adding&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#ifdef NRF_I2S
		PERIPH(&amp;quot;NRF_I2S&amp;quot;, NRF_I2S, 1),
#endif&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;to spm.c, like here&amp;nbsp;&lt;a href="https://github.com/loopshore/fw-nrfconnect-nrf/commit/8d73f53763cace4a9e52aacaac35289d3495c895"&gt;https://github.com/loopshore/fw-nrfconnect-nrf/commit/8d73f53763cace4a9e52aacaac35289d3495c895&lt;/a&gt;&amp;nbsp;gets me a bit forward. Now you can actually call init. Program crashes when I2S is started though. To this line&amp;nbsp;&lt;a href="https://github.com/zephyrproject-rtos/hal_nordic/blob/master/nrfx/drivers/src/nrfx_i2s.c#L277"&gt;https://github.com/zephyrproject-rtos/hal_nordic/blob/master/nrfx/drivers/src/nrfx_i2s.c#L277&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Any help and answers still appreciated.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>