Using RTC_WAKEUPCLOCK_CK_SPRE_16BITS as wakeuptimer
Good Day.
I want to put my stm32wb device to sleep standby mode. and wakeup using RTC after specific time.
I am following the PWR_STANDBY_RTC example which works.
I would like to sleep for up to 12 hours and would like to use RTC_WAKEUPCLOCK_CK_SPRE_16BITS and not RTC_WAKEUPCLOCK_RTCCLK_DIV16 since the latter only allows up to 33 seconds.
I am sucessfuly using RTC_WAKEUPCLOCK_RTCCLK_DIV16 but I am puzzled by value.
for example if I set up counter to:
HAL_RTCEx_SetWakeUpTimer_IT(&hrtc, 60, RTC_WAKEUPCLOCK_CK_SPRE_16BITS);
it wakes up roughly 16 minutes later.
I have tried various values but it seems a rough value is i must divide my second by 16 to get more or less correct time.
For example
HAL_RTCEx_SetWakeUpTimer_IT(&hrtc, 60/16, RTC_WAKEUPCLOCK_CK_SPRE_16BITS);
Gives me roughtly 60 second wakeup time.
Help would be greatly appreciated.
I m using external 32khz clock and bluetooth functionality works great.