Skip to main content
Visitor II
May 26, 2025
Solved

stm32U073 tamper 4 push button will hardfault

  • May 26, 2025
  • 2 replies
  • 470 views

hi ,

i enable tamper4 and RTC in stm32mx and only enable bit RTC_CR_TAMPTS, TSE=0
no other code add into rtc.c or tamper.c 

russell_hsiao_1-1748237400474.png

Using  debug mode to clear TSF and CTAMP4F.
when push button will happen hard fault.  
Only two code  in main while loop "led" and "hal_delay", if i remove HAL_Delay , will not happen . 
someone can help me?

russell_hsiao_0-1748236937233.png

HAL_Delay(1000);

HAL_GPIO_TogglePin(GPIOA,GPIO_PIN_11);

    This topic has been closed for replies.
    Best answer by russell_hsiao

    hi Saket_Om,
    Try disable WWDG, but still happened.
    I follow how to debug to trace hard fault cause by "HAL_Delay".
    Now use TIM to replace HAL_Delay. It seems work good.
     

    2 replies

    Technical Moderator
    May 26, 2025

    Hello @russell_hsiao 

    Please check the article below to debug hardfault:

    How to debug a HardFault on an Arm® Cortex®-M STM3... - STMicroelectronics Community

    Could you share your .ioc file please then we can assiste you more effectively. 

    Visitor II
    May 26, 2025

    hi , i upload my .ioc
    and here i disable  those bit. 

    /* USER CODE BEGIN RTC_Init 2 */

    __HAL_RTC_TIMESTAMP_DISABLE(&hrtc);

    CLEAR_BIT(RTC->CR, RTC_CR_ITSE);

    CLEAR_BIT(RTC->CR, RTC_CR_TAMPALRM_TYPE);

    /* USER CODE END RTC_Init 2 */

    russell_hsiao_2-1748274120299.png

     

    Technical Moderator
    May 27, 2025

    Hello @russell_hsiao 

    Could you check without WWDG init please? 

    russell_hsiaoAuthorAnswer
    Visitor II
    June 2, 2025

    hi Saket_Om,
    Try disable WWDG, but still happened.
    I follow how to debug to trace hard fault cause by "HAL_Delay".
    Now use TIM to replace HAL_Delay. It seems work good.