Skip to content

Commit fd800ca

Browse files
jeromecoutantadbridge
authored andcommitted
STM32 : issue to exit deepsleep when RTC has not been initialized
1 parent f42db05 commit fd800ca

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

targets/TARGET_STM/rtc_api.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,7 @@ int rtc_isenabled(void)
288288

289289
void rtc_synchronize(void)
290290
{
291+
RtcHandle.Instance = RTC;
291292
if (HAL_RTC_WaitForSynchro(&RtcHandle) != HAL_OK) {
292293
error("rtc_synchronize error\n");
293294
}
@@ -298,6 +299,7 @@ void rtc_synchronize(void)
298299
static void RTC_IRQHandler(void)
299300
{
300301
/* Update HAL state */
302+
RtcHandle.Instance = RTC;
301303
HAL_RTCEx_WakeUpTimerIRQHandler(&RtcHandle);
302304
/* In case of registered handler, call it. */
303305
if (irq_handler) {
@@ -339,13 +341,15 @@ void rtc_set_wake_up_timer(uint32_t delta)
339341
NVIC_SetVector(RTC_WKUP_IRQn, (uint32_t)RTC_IRQHandler);
340342
NVIC_EnableIRQ(RTC_WKUP_IRQn);
341343

344+
RtcHandle.Instance = RTC;
342345
if (HAL_RTCEx_SetWakeUpTimer_IT(&RtcHandle, 0xFFFF & WakeUpCounter, WakeUpClock[DivIndex-1]) != HAL_OK) {
343346
error("rtc_set_wake_up_timer init error (%d)\n", DivIndex);
344347
}
345348
}
346349

347350
void rtc_deactivate_wake_up_timer(void)
348351
{
352+
RtcHandle.Instance = RTC;
349353
HAL_RTCEx_DeactivateWakeUpTimer(&RtcHandle);
350354
}
351355

0 commit comments

Comments
 (0)