Skip to main content
Explorer
July 26, 2024
Question

Hard fault error happened when executed PDM_filter function

  • July 26, 2024
  • 2 replies
  • 1556 views

I am trying to convert microphone PDM signal into PCM signal and i used external PDM2PCM library files (which is used for STM32L4 cortex-M4) for that, i am able to bulid it for STM32H5 controller. When i execute the blelow PDM_filter_init function i am getting the hard fault error. Could you please help me to solve this issue.

 

void MX_PDM2PCM_Init(void)
{
/* USER CODE BEGIN 2 */
/* USER CODE END 2 */

/**
*/
PDM1_filter_handler.bit_order = PDM_FILTER_BIT_ORDER_MSB;
PDM1_filter_handler.endianness = PDM_FILTER_ENDIANNESS_BE;
PDM1_filter_handler.high_pass_tap = 2104533974;
PDM1_filter_handler.in_ptr_channels = 1;
PDM1_filter_handler.out_ptr_channels = 1;
PDM_Filter_Init(&PDM1_filter_handler); - Hard fault error occurred on this line

PDM1_filter_config.decimation_factor = PDM_FILTER_DEC_FACTOR_64;
PDM1_filter_config.output_samples_number = 125;
PDM1_filter_config.mic_gain = 0;
PDM_Filter_setConfig(&PDM1_filter_handler, &PDM1_filter_config);

/* USER CODE BEGIN 3 */
/* USER CODE END 3 */

}

    This topic has been closed for replies.

    2 replies

    Technical Moderator
    July 26, 2024

    Dear @Nagarajan ,

    can you please have a screenshot on the Hardfault location and trace/log of the stack when at Hardfault while(1) . This is to check which instruction caused that .

    hypothesis:

    1) using a library not for Cortex-M33 / M4 should work also , but to check secure / non secure parts 

    2) Initialization is missing some hardware configuration 

    3) used library for PDM not ready for H5 series 

     

    Let us know ,

    STOne-32

    NagarajanAuthor
    Explorer
    August 1, 2024

    I am not able to proceed further, would it be possible to port STM32L PCM library to STM32H5 controller or not? or can i try some other STM32 PCM library to make it work?

    Graduate II
    July 26, 2024

    Would be helpful to see the disassembly or a proper dump of the failure..

    If it's the call, then perhaps vpush on the function side, and the FPU not enabled?

    Have your system output actionable information

    https://github.com/cturvey/RandomNinjaChef/blob/main/KeilHardFault.c

    NagarajanAuthor
    Explorer
    July 29, 2024

    I enabled the CRC feature as i was told it is a part of the procedure for PDM to PCM conversion. After executing the CRC_Lock() function it is going to hard fault error. I didn't enable the FPU.

     

    Nagarajan_0-1722240518277.png