<?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>Using PDM microphone on nrf5340</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/115075/using-pdm-microphone-on-nrf5340</link><description>I am developing a board with the nrf5340, and using a PDM microphone for audio input. 
 I have used the same microphone on the nrf52832 with the nrf PDM driver with success. 
 However, on the nrf5340 under Zephyr, I get the following error as soon as</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 02 Oct 2024 09:54:29 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/115075/using-pdm-microphone-on-nrf5340" /><item><title>RE: Using PDM microphone on nrf5340</title><link>https://devzone.nordicsemi.com/thread/504647?ContentTypeID=1</link><pubDate>Wed, 02 Oct 2024 09:54:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c130b179-e703-4467-9210-0401ea67566a</guid><dc:creator>BrianW</dc:creator><description>&lt;p&gt;Yup, that works thanks and I get audio data...Now to work on the audio processing so it actually sounds like me..&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using PDM microphone on nrf5340</title><link>https://devzone.nordicsemi.com/thread/504623?ContentTypeID=1</link><pubDate>Wed, 02 Oct 2024 08:12:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:36e17613-78d7-4c50-82bf-965cc27ffa46</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Yes. I think that should be pointing to the nrfx_pdm_irq_handler() in nrfx_pdm.c.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using PDM microphone on nrf5340</title><link>https://devzone.nordicsemi.com/thread/504468?ContentTypeID=1</link><pubDate>Tue, 01 Oct 2024 07:06:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:44417a5c-4a65-46d9-9a27-e30b9dc44c4d</guid><dc:creator>BrianW</dc:creator><description>&lt;p&gt;Ok... I thought that as I was using the nrfx_pdm driver, it took care of the low level register poking...&lt;/p&gt;
&lt;p&gt;So this was what nrfx_pdm_init() did, as I pass my callback to that:&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span&gt;errcode&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;nrfx_pdm_init&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&amp;amp;&lt;/span&gt;&lt;span&gt;config1&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span&gt;_drv_pdm_handler&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;rather than me doing it. The irq handler must be in the driver (which then calls my handler when it needs a new buffer etc)&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;I can add&lt;/div&gt;
&lt;div&gt;&lt;span&gt;IRQ_CONNECT(DT_IRQN(PDM_NL),&amp;nbsp; IRQ_PRIO_LOWEST, _nrfx_XXX_handler, 0, 0);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;but what would be the handler function in the pdm driver?&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using PDM microphone on nrf5340</title><link>https://devzone.nordicsemi.com/thread/504447?ContentTypeID=1</link><pubDate>Mon, 30 Sep 2024 22:22:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aac5f529-b03c-418c-a695-bd7698bb86a2</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I am sorry for the late reply!&lt;/p&gt;
&lt;p&gt;It looks like you are not forwarding the interrupt to your driver.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Please open VS Code in your NCS directory, and search for &amp;quot;IRQ_CONNECT(NRFX_IRQ_NUMBER_GET(&amp;quot;, and you will see a lot of examples that are doing this. Unfortunately, not for the PDM, but a lot of other peripherals, such as UART:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#if defined(__ZEPHYR__)
    IRQ_CONNECT(NRFX_IRQ_NUMBER_GET(NRF_UARTE_INST_GET(UARTE_INST_IDX)), IRQ_PRIO_LOWEST,
                NRFX_UARTE_INST_HANDLER_GET(UARTE_INST_IDX), 0, 0);
#endif&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The error that you are seeing is that you are setting up your PDM, and enabling interrupts, and then an interrupt occurs, but the application doesn&amp;#39;t know where to send it.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I am not really sure whether the PDM has these macros t point to it&amp;#39;s base, but if you are building for the nRF5340, the NRF_PDM0_S_BASE is found in nrf5340_application.h file, and is either 0x50026000, or 0x40026000 if you are building for nrf5340dk_nrf5340_cpuapp_ns.&lt;/p&gt;
&lt;p&gt;Then make it point to your&amp;nbsp;&lt;span&gt;_drv_pdm_handler().&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Edvin&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>