This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

HOW TO ANALYSIS PDM DATA CONTINUOUSLY IN NRF52832

For my audio application, I need to convert pcm out from pdm module(nrf52832) to an audio format (mp3,wav) continuously. Is there any method or procedure for this??...or any sample example?? please help... Actually, MIC is outing pdm data, PDM_IRQHandler runs in code but i don't know whether data is correct or not...?? how can i process that data in buffers without storing data to internal flash.

void PDM_IRQHandler(void)
{
    if (nrf_pdm_event_check(NRF_PDM_EVENT_END))
    {
        nrf_pdm_event_clear(NRF_PDM_EVENT_END);      
        //Buffer is ready to process.
        if (nrf_pdm_buffer_get() == m_cb1.buffers[0])
        {
				//	printf("%d",*(m_cb1.buffers[1]));
			  //	printf("%d",*(m_cb1.buffers[1]));
           m_cb1.event_handler(m_cb1.buffers[1], m_cb1.buffer_length);
				//	drv_audio_pdm_event_handler(m_cb1.buffers[1], m_cb1.buffer_length);
        }
        else
        {
            m_cb1.event_handler(m_cb1.buffers[0], m_cb1.buffer_length);
        }
    }
    else if (nrf_pdm_event_check(NRF_PDM_EVENT_STARTED))
    {
        nrf_pdm_event_clear(NRF_PDM_EVENT_STARTED);
        m_cb1.status = NRF_PDM_STATE_RUNNING;
        
        //Swap buffer.
        if (nrf_pdm_buffer_get() == m_cb1.buffers[0])
        {
            nrf_pdm_buffer_set(m_cb1.buffers[1],m_cb1.buffer_length);
        }
        else
        {
            nrf_pdm_buffer_set(m_cb1.buffers[0],m_cb1.buffer_length);
        }
    }
    else if (nrf_pdm_event_check(NRF_PDM_EVENT_STOPPED))
    {
        nrf_pdm_event_clear(NRF_PDM_EVENT_STOPPED);
        nrf_pdm_disable();
        m_cb1.status = NRF_PDM_STATE_IDLE;
    }
}
Related