cancel
Showing results for 
Search instead for 
Did you mean: 

I am using inbuilt RTC of STM32G941re , I am facing problem in interupt,when I set one min the alarm interupt comes after 30sec only not 1 minutes

PUnde.2
Associate

The alarm time set properly but interupt ​in half time &sometimes I not came,please share if any one have idea

2 REPLIES 2
RBENF.1
ST Employee

Hello @PUnde.2​ ,

Please share the code related to your RTC and alarm configuration using the code snippet tool.

Regards,

Ryan

PUnde.2
Associate

{

RTC_AlarmTypeDef sAlarm = {0};

sAlarm.AlarmTime.Hours = Hours;

sAlarm.AlarmTime.Minutes = Minutes;

sAlarm.AlarmTime.Seconds = 30;

sAlarm.AlarmTime.SubSeconds = 0;

sAlarm.AlarmMask = RTC_ALARMMASK_DATEWEEKDAY;

sAlarm.AlarmSubSecondMask = RTC_ALARMSUBSECONDMASK_ALL;

sAlarm.AlarmDateWeekDaySel = RTC_ALARMDATEWEEKDAYSEL_DATE;

sAlarm.AlarmDateWeekDay = 1;

sAlarm.Alarm = RTC_ALARM_A;

if (HAL_RTC_SetAlarm_IT(&hrtc, &sAlarm, RTC_FORMAT_BIN) != HAL_OK)

{

Error_Handler();

}

}

This my​ code related to rtc alarm and i just take flag from interrupt. If I put the 30 sec as const value to rtc alarm it is working fine.