cancel
Showing results for 
Search instead for 
Did you mean: 

PDM Filter problem

baiyongchen
Associate II
Posted on January 22, 2014 at 10:08

Hi, can someone help me solve a problem on PDM Filter Init function:

PDM_Filter_Init() cannot return from it in second invoke.

How can we reset the function and call it again?

Thanks!

  ..........

  RCC->AHB1ENR |= RCC_AHB1ENR_CRCEN;

  Filter.LP_HZ = 8000;

  Filter.HP_HZ = 10;

  Filter.Fs = 16000;

  Filter.Out_MicChannels = 1;

  Filter.In_MicChannels = 1;

  PDM_Filter_Init((PDMFilter_InitStruct *)&Filter);

  ...........

  RCC->AHB1ENR |= RCC_AHB1ENR_CRCEN;

  Filter.LP_HZ = 8000;

  Filter.HP_HZ = 10;

  Filter.Fs = 32000;

  Filter.Out_MicChannels = 1;

  Filter.In_MicChannels = 1;

  PDM_Filter_Init((PDMFilter_InitStruct *)&Filter);//will dead loop here

 .................

2 REPLIES 2
Posted on January 22, 2014 at 16:09

I don't see the value of enabling the CRC unit the second time around.

I'm not familiar with the code in question. So does the second invocation crash into a Hard Fault or something, or is it getting stuck in a loop internally.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
baiyongchen
Associate II
Posted on January 23, 2014 at 10:08

It is getting stuck in a loop internally.

I found the solution: 

Add reset CRC DR ,it work well.

  ..........

  

  CRC->CR = CRC_CR_RESET;//Reset CRC DR

  RCC->AHB1ENR |= RCC_AHB1ENR_CRCEN;

  Filter.LP_HZ = 8000;

  Filter.HP_HZ = 10;

  Filter.Fs = 16000;

  Filter.Out_MicChannels = 1;

  Filter.In_MicChannels = 1;

  PDM_Filter_Init((PDMFilter_InitStruct *)&Filter);

  ...........

  CRC->CR = CRC_CR_RESET;//Reset CRC DR

  RCC->AHB1ENR |= RCC_AHB1ENR_CRCEN;

  Filter.LP_HZ = 8000;

  Filter.HP_HZ = 10;

  Filter.Fs = 32000;

  Filter.Out_MicChannels = 1;

  Filter.In_MicChannels = 1;

  PDM_Filter_Init((PDMFilter_InitStruct *)&Filter);//will dead loop here

 .................