1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

cpu/sam0_common: RTC: wait for syncbusy in rtc_get_time()

`rtt_get_counter()` already waits for syncbusy before reading the time,
but we also have to do this in RTC mode (`rtc_get_time()`) to avoid
reading old values.

Thus, always wait for syncbusy to clear when accessing the COUNT register.
This commit is contained in:
Benjamin Valentin 2022-05-31 15:26:22 +02:00
parent ac524e69b8
commit d77724bf04

View File

@ -90,8 +90,8 @@ static void _read_req(void)
{
#ifdef RTC_READREQ_RREQ
RTC->MODE0.READREQ.reg = RTC_READREQ_RREQ;
_wait_syncbusy();
#endif
_wait_syncbusy();
}
#endif
@ -644,7 +644,6 @@ void rtt_clear_overflow_cb(void)
uint32_t rtt_get_counter(void)
{
_wait_syncbusy();
_read_req();
return RTC->MODE0.COUNT.reg;
}