<?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>12s with DMA to play Audio in two ram buffers</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/83444/12s-with-dma-to-play-audio-in-two-ram-buffers</link><description>Hi Nordic, 
 can you provide sample code on EasyDMA with I2S peripheral to play 120k audio with two ram buffers.</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 26 Jan 2022 16:20:06 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/83444/12s-with-dma-to-play-audio-in-two-ram-buffers" /><item><title>RE: 12s with DMA to play Audio in two ram buffers</title><link>https://devzone.nordicsemi.com/thread/349822?ContentTypeID=1</link><pubDate>Wed, 26 Jan 2022 16:20:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d1660085-c8ef-4bc2-b9fd-59f682590c7b</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;Hello, got any progress?&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/i2s_5F00_loopback.zip"&gt;devzone.nordicsemi.com/.../i2s_5F00_loopback.zip&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I&amp;#39;m trying to set up an I2S loopback sample (using two ram buffers) based on the test&amp;nbsp;zephyr\tests\drivers\i2s\i2s_api\src\main.c, but I haven&amp;#39;t been able to make it work quite yet. I&amp;#39;m not able to read out the data that is sent. However, I figured it was better to share something than nothing.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 12s with DMA to play Audio in two ram buffers</title><link>https://devzone.nordicsemi.com/thread/348020?ContentTypeID=1</link><pubDate>Mon, 17 Jan 2022 12:15:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:84274651-17ba-4a9f-88df-895699b7e0a6</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;Hello, I&amp;#39;ll just let you know that I&amp;#39;m working with setting together a simple sample.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 12s with DMA to play Audio in two ram buffers</title><link>https://devzone.nordicsemi.com/thread/347046?ContentTypeID=1</link><pubDate>Tue, 11 Jan 2022 04:09:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7bc63154-64cb-43ee-8717-1a62cbc0b2eb</guid><dc:creator>saiteja143</dc:creator><description>&lt;p&gt;&amp;nbsp;audio data i taken in ram.&lt;/p&gt;
&lt;p&gt;like this way i am try to use ram buffers and play Audio .&lt;span&gt;My audio configuration is 8kHz, stereo with 16 bits per sample.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;can you provide better solution for this Dma handling with two Ram buffers.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Any and all advice would be highly helpful.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;int PlaybackPosition = I2S_DATA_BLOCK_WORDS;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;uint8_t Audio_data[]={0x52, 0x49, 0x46, 0x46, 0xC6, 0x07, 0x01, 0x00, 0x57, 0x41, 0x56, 0x45, 0x66, 0x6D, 0x74, 0x20, &lt;br /&gt;0x12, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x40, 0x1F, 0x00, 0x00, 0x00, 0x7D, 0x00, 0x00, &lt;br /&gt;0x04, 0x00, 0x10, 0x00, 0x00, 0x00, 0x64, 0x61, 0x74, 0x61, 0xA0, 0x07, 0x01, 0x00, 0x00, 0x00, &lt;br /&gt;0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,....}&lt;/p&gt;
&lt;p&gt;config.sdout_pin = I2S_SDOUT_PIN;&lt;br /&gt; config.sck_pin = I2S_CONFIG_SCK_PIN;&lt;br /&gt; config.lrck_pin = I2S_CONFIG_LRCK_PIN;&lt;br /&gt; config.mck_pin = I2S_CONFIG_MCK_PIN;&lt;br /&gt; config.mode = I2S_CONFIG_MODE_MODE_Master;&lt;br /&gt; config.alignment = I2S_CONFIG_ALIGN_ALIGN_Left; //it always should be in left_justified&lt;br /&gt; config.format = NRF_I2S_FORMAT_ALIGNED;&lt;br /&gt; config.sample_width = NRF_I2S_SWIDTH_16BIT;&lt;br /&gt; config.channels = I2S_CONFIG_CHANNELS_CHANNELS_Stereo;&lt;br /&gt; config.mck_setup = NRF_I2S_MCK_32MDIV8;&lt;br /&gt; config.ratio = NRF_I2S_RATIO_256X;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // it depends upon audio sample 8K,16K..&lt;br /&gt; config.channels = NRF_I2S_CHANNELS_STEREO;&lt;br /&gt; err_code = nrf_drv_i2s_init(&amp;amp;config, data_handler);&lt;br /&gt; APP_ERROR_CHECK(err_code);&lt;/p&gt;
&lt;p&gt;&lt;br /&gt; for (;;)&lt;br /&gt; {&lt;br /&gt; m_blocks_transferred = 0;&lt;br /&gt; mp_block_to_fill = NULL;&lt;br /&gt; &lt;br /&gt; /* Initialize the data buffer */&lt;br /&gt; for(uint16_t i=0; i &amp;lt; I2S_DATA_BLOCK_WORDS; i++)&lt;br /&gt; {&lt;/p&gt;
&lt;p&gt;m_buffer_tx[0][i]= *(Audio_data +i);&amp;nbsp;&lt;br /&gt; &lt;br /&gt; }&lt;br /&gt; nrf_drv_i2s_buffers_t const initial_buffers = {&lt;br /&gt; .p_tx_buffer = m_buffer_tx[0],&lt;br /&gt; .p_rx_buffer = NULL,&lt;br /&gt; };&lt;/p&gt;
&lt;p&gt;err_code = nrf_drv_i2s_start(&amp;amp;initial_buffers,512,0); //here starting the i2s&lt;br /&gt; APP_ERROR_CHECK(err_code);&lt;/p&gt;
&lt;p&gt;do {&lt;br /&gt; // Wait for an event.&lt;br /&gt; __WFE();&lt;br /&gt; // Clear the event register.&lt;br /&gt; __SEV();&lt;br /&gt; __WFE();&lt;/p&gt;
&lt;p&gt;/***********************************/&lt;br /&gt; if (mp_block_to_fill) &lt;br /&gt; {&lt;br /&gt; for(int i = 0; i &amp;lt; I2S_DATA_BLOCK_WORDS; i++)&lt;br /&gt; {&lt;br /&gt; m_buffer_tx[1][i] = *(Audio_data +PlaybackPosition);&lt;br /&gt; PlaybackPosition++;&lt;br /&gt; NRF_LOG_INFO(&amp;quot;Loop buffer %04x&amp;quot;, m_buffer_tx[1][i]);&lt;br /&gt; mp_block_to_fill = NULL;&lt;br /&gt; }&lt;br /&gt; ++m_blocks_transferred;&lt;/p&gt;
&lt;p&gt;}&lt;br /&gt; /*******************************/&lt;br /&gt; } while (m_blocks_transferred &amp;lt; BLOCKS_TO_TRANSFER);&lt;br /&gt; nrf_drv_i2s_stop();&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;static void data_handler(nrf_drv_i2s_buffers_t const * p_released,&lt;br /&gt; uint32_t status)&lt;br /&gt;{&lt;br /&gt; // &amp;#39;nrf_drv_i2s_next_buffers_set&amp;#39; is called directly from the handler&lt;br /&gt; // each time next buffers are requested, so data corruption is not&lt;br /&gt; // expected.&lt;br /&gt; ASSERT(p_released);&lt;/p&gt;
&lt;p&gt;// When the handler is called after the transfer has been stopped&lt;br /&gt; // (no next buffers are needed, only the used buffers are to be&lt;br /&gt; // released), there is nothing to do.&lt;br /&gt; if (!(status &amp;amp; NRFX_I2S_STATUS_NEXT_BUFFERS_NEEDED))&lt;br /&gt; {&lt;br /&gt; return;&lt;br /&gt; }&lt;/p&gt;
&lt;p&gt;// First call of this handler occurs right after the transfer is started.&lt;br /&gt; // No data has been transferred yet at this point, so there is nothing to&lt;br /&gt; // check. Only the buffers for the next part of the transfer should be&lt;br /&gt; // provided.&lt;br /&gt; if (!p_released-&amp;gt;p_rx_buffer)&lt;br /&gt; {&lt;br /&gt; NRF_LOG_INFO(&amp;quot;Next TX buffer.&amp;quot;);&lt;/p&gt;
&lt;p&gt;nrf_drv_i2s_buffers_t const next_buffers = {&lt;br /&gt; .p_rx_buffer = NULL,&lt;br /&gt; .p_tx_buffer =m_buffer_tx[1],&lt;br /&gt; };&lt;br /&gt; APP_ERROR_CHECK(nrf_drv_i2s_next_buffers_set(&amp;amp;next_buffers));&lt;/p&gt;
&lt;p&gt;mp_block_to_fill =m_buffer_tx[1];&lt;br /&gt; }&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 12s with DMA to play Audio in two ram buffers</title><link>https://devzone.nordicsemi.com/thread/346681?ContentTypeID=1</link><pubDate>Fri, 07 Jan 2022 11:45:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2ab9c24f-5712-44be-9686-e44943634d47</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;Check out this reply&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/support-private/support/282038#permalink=720949"&gt;https://devzone.nordicsemi.com/support-private/support/282038#permalink=720949&lt;/a&gt;, where I point to some i2s samples. Find the sample that suits you the best and modify it according to your needs.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>