<?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>PDM start  fail</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/50392/pdm-start-fail</link><description>Hi, I&amp;#39;m using the nRF52840 SDK15.2.0 I&amp;#39;d like to get data from a digital microphone via a PDM interface. The teansfer data to speaker via a I2S interface. 
 Here is my problem: 
 In the ret_code_t nrf_drv_pdm_start(void) { ... nrf_pdm_task_trigger(NRF_PDM_TASK_START</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 12 Aug 2019 08:40:04 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/50392/pdm-start-fail" /><item><title>RE: PDM start  fail</title><link>https://devzone.nordicsemi.com/thread/203503?ContentTypeID=1</link><pubDate>Mon, 12 Aug 2019 08:40:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bce8d0f0-ee22-4a08-a607-afda08c6a8b3</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;Ok. But have you figured out which line is causing the error?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PDM start  fail</title><link>https://devzone.nordicsemi.com/thread/203501?ContentTypeID=1</link><pubDate>Mon, 12 Aug 2019 08:28:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d275d37f-a89c-42c0-96b7-e7d4bcc5a4ce</guid><dc:creator>Louis Wnag</dc:creator><description>&lt;p&gt;I use Debug session to see what&amp;#39;s going on.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PDM start  fail</title><link>https://devzone.nordicsemi.com/thread/203499?ContentTypeID=1</link><pubDate>Mon, 12 Aug 2019 08:23:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fac325af-152f-4125-9b57-132ad75a7c74</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;Ok. Just to make it clear, did you put a breakpoint on&amp;nbsp;&lt;em&gt;nrf_pdm_task_trigger(), &lt;/em&gt;and the program didn&amp;#39;t reach the breakpoint?&lt;/p&gt;
&lt;p&gt;If that is the case, then something before that function is causing the error. You should set a breakpoint incrementally upwards to see what line is causing the error.&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: PDM start  fail</title><link>https://devzone.nordicsemi.com/thread/203000?ContentTypeID=1</link><pubDate>Thu, 08 Aug 2019 09:14:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dd26f243-d0d9-4b9b-8b63-a634a39c0324</guid><dc:creator>Louis Wnag</dc:creator><description>&lt;p&gt;Simon, Thanks your response. The program does not hang at&amp;nbsp;&lt;em&gt;nrf_pdm_task_trigger().&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;/em&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PDM start  fail</title><link>https://devzone.nordicsemi.com/thread/202009?ContentTypeID=1</link><pubDate>Fri, 02 Aug 2019 00:02:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:99f7021b-d9e9-4354-b717-ccbc6c02bfd2</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;How do you know the program hangs at &lt;em&gt;nrf_pdm_task_trigger(), &lt;/em&gt;and not any of the functions before? Try setting a breakpoint at&amp;nbsp;&lt;em&gt;nrf_pdm_task_trigger()&amp;nbsp;&lt;/em&gt;and see if your program reaches it. &lt;a href="https://www.youtube.com/watch?v=uP8RYgYGRvI&amp;amp;t=1s"&gt;Here&lt;/a&gt; is a guide on how to debug in SES. Usually the program&amp;nbsp;stops due to asserts (like &lt;em&gt;APP_ERROR_CHECK()&lt;/em&gt;) or hardfaults, and I guess it is one of them in your case.&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: PDM start  fail</title><link>https://devzone.nordicsemi.com/thread/201796?ContentTypeID=1</link><pubDate>Thu, 01 Aug 2019 09:55:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:eb4fc3fd-6d68-469a-aedf-dab0debb487a</guid><dc:creator>Louis Wnag</dc:creator><description>&lt;p&gt;I try to port PDM part from thingy SDK to SDK_15.2 with nRF52840.&lt;br /&gt;The process hangs (no further message) after nrf_pdm_task_trigger(NRF_PDM_TASK_START).&lt;/p&gt;
&lt;p&gt;Is there any idea what&amp;#39;s wrong in this code?&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;ret_code_t nrf_drv_pdm_start(void)
{
	  ASSERT(m_cb.drv_state != NRF_DRV_STATE_UNINITIALIZED);
    ret_code_t err_code;
		
	  if (m_cb.status != NRF_PDM_STATE_IDLE)
    {
        if (m_cb.status == NRF_PDM_STATE_RUNNING)
        {
            err_code = NRF_SUCCESS;
            printf(&amp;quot;Function: %s, error code: %s.\r\n&amp;quot;, (uint32_t)__func__, (uint32_t)NRF_LOG_ERROR_STRING_GET(err_code));
            return err_code;
        }
        err_code = NRF_ERROR_BUSY;
        printf(&amp;quot;Function: %s, error code: %s.\r\n&amp;quot;, (uint32_t)__func__, (uint32_t)NRF_LOG_ERROR_STRING_GET(err_code));
        return err_code;
    }
    m_cb.status = NRF_PDM_STATE_TRANSITION;
    m_cb.drv_state = NRF_DRV_STATE_POWERED_ON;
    nrf_pdm_enable();
    nrf_pdm_event_clear(NRF_PDM_EVENT_STARTED);

		nrf_pdm_task_trigger(NRF_PDM_TASK_START);
		printf(&amp;quot;PDM-START----\r\n&amp;quot;);	

    err_code = NRF_SUCCESS;
		printf(&amp;quot;Function: %s, error code: %s.\r\n&amp;quot;, (uint32_t)__func__, (uint32_t)NRF_LOG_ERROR_STRING_GET(err_code));
		return err_code;
}

ret_code_t drv_audio_enable(void)
{
	
#if CONFIG_PDM_MIC_PWR_CTRL_ENABLED
#if CONFIG_PDM_MIC_PWR_CTRL_ACT_LOW
    nrf_gpio_pin_clear(CONFIG_IO_PDM_MIC_PWR_CTRL);
#else // !CONFIG_PDM_MIC_PWR_CTRL_ACT_LOW
    nrf_gpio_pin_set(CONFIG_IO_PDM_MIC_PWR_CTRL);
#endif // CONFIG_PDM_MIC_PWR_CTRL_ACT_LOW
#endif // CONFIG_PDM_MIC_PWR_CTRL_ENABLED

    // Skip buffers with invalid data.
    m_skip_buffers = MAX(1, ROUNDED_DIV((CONFIG_PDM_TRANSIENT_STATE_LEN * SAMPLING_RATE),
                                        (1000 * CONFIG_AUDIO_FRAME_SIZE_SAMPLES)));

	  return nrf_drv_pdm_start();
}

uint32_t drv_mic_start(void)
{
    ret_code_t status;

    if(m_audio_enabled == true)
    {
        return NRF_SUCCESS;
    }
    status = drv_audio_enable();
    if (status == NRF_SUCCESS)
    {
        m_audio_enabled = true;
    }
    return status;
}

int main()
{
	drv_audio_init(m_audio_buffer_handler);
	drv_mic_start();
}

&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>