2024-09-24 04:28 AM - last edited on 2024-09-25 09:25 AM by Amel NASRI
In the file "stm32g4xx_hal_rtc_ex.c" in the function "HAL_RTCEx_SetTamper_IT(...)" there is an if-statement:
if (sTamper->Trigger != RTC_TAMPERTRIGGER_RISINGEDGE)
{
tmpreg |= (sTamper->Tamper << TAMP_CR2_TAMP1TRG_Pos);
}
And the corresponding .h file has:
#define RTC_TAMPERTRIGGER_RISINGEDGE 0x00U /*!< Warning : Filter must be RTC_TAMPERFILTER_DISABLE */
#define RTC_TAMPERTRIGGER_FALLINGEDGE 0x01U /*!< Warning : Filter must be RTC_TAMPERFILTER_DISABLE */
#define RTC_TAMPERTRIGGER_LOWLEVEL 0x02U /*!< Warning : Filter must not be RTC_TAMPERFILTER_DISABLE */
#define RTC_TAMPERTRIGGER_HIGHLEVEL 0x03U /*!< Warning : Filter must not be RTC_TAMPERFILTER_DISABLE */
This becomes an issue if configuring for RTC_TAMPERTRIGGER_LOWLEVEL.
The issue seems to be that the code inside the if-statement sets the TAMP1TRG bit to 1 if true. Since the defines for the different triggers are numbered from 0 to 3, TAMP1TRG will always be 1 so long as we are not using RISINGEDGE. However, to use LOWLEVEL, we want TAMP1TRG to be set to 0.
2024-09-26 12:22 PM
Hi All,
This post has been escalated to the ST Online Support Team for additional assistance. We'll contact you directly.
Regards,
Jake
ST Support