Skip to content

Commit 6ffa763

Browse files
committed
fixup! boards/nucleo-wl55jc: enable RTC peripheral
1 parent 141748d commit 6ffa763

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

cpu/stm32/periph/rtc_all.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,21 @@ int rtc_set_time(struct tm *time)
326326

327327
int rtc_get_time(struct tm *time)
328328
{
329+
#if defined(CPU_FAM_STM32WL)
330+
stmclk_dbp_unlock();
331+
/* unlock RTC */
332+
RTC->WPR = WPK1;
333+
RTC->WPR = WPK2;
334+
335+
RTC->ICSR &= ~RTC_ICSR_RSF;
336+
337+
RTC->WPR = 0xff;
338+
stmclk_dbp_lock();
339+
340+
/* waiting for the RSF bit to be set again */
341+
while (!(RTC_REG_ISR & RTC_ICSR_RSF)) {};
342+
#endif
343+
329344
/* save current time */
330345
uint32_t tr = RTC->TR;
331346
uint32_t dr = RTC->DR;

0 commit comments

Comments
 (0)