You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The RtcGetCalendarValue function checks the RTC subsecond register for consistency but does not check the date or time registers. Because the code doesn't use the RTC shadow registers (see here), the code needs to check the subsecond, time, and date registers to make sure none of them have changed. Our internal fix looks like this:
uint64_t calendarValue = 0;
volatile uint32_t firstSSR;
volatile uint32_t firstTR;
volatile uint32_t firstDR;
uint32_t correction;
uint32_t seconds;
// The LoRaWAN stack bypasses the RTC's shadow registers, so we need to make
// sure the RTC isn't in the process of updating any of its registers while
// we get the date & time.
do
{
firstSSR = RTC->SSR;
firstTR = RTC->TR;
firstDR = RTC->DR;
HAL_RTC_GetTime( &RtcHandle, time, RTC_FORMAT_BIN );
HAL_RTC_GetDate( &RtcHandle, date, RTC_FORMAT_BIN );
} while ((firstSSR != RTC->SSR) || (firstTR != RTC->TR) || (firstDR != RTC->DR));
I haven't checked to see if the board files for the other STM32 processors have the same issue, but it's probably something to look at.
The text was updated successfully, but these errors were encountered:
The RtcGetCalendarValue function checks the RTC subsecond register for consistency but does not check the date or time registers. Because the code doesn't use the RTC shadow registers (see here), the code needs to check the subsecond, time, and date registers to make sure none of them have changed. Our internal fix looks like this:
I haven't checked to see if the board files for the other STM32 processors have the same issue, but it's probably something to look at.
The text was updated successfully, but these errors were encountered: