cancel
Showing results for 
Search instead for 
Did you mean: 

Why an STM32L476's RTC counts more than 24h and don't icnreases the day

albert2
Associate II

I've designed a board that has a STM32L476.

This part is supplied using a triple system of dual battery + power ( when it is available)

We've manufactured more than 20k units of them and they are working ok

A few days ago 2 boards came back to our design lab that exhibit the following symptoms :

-> The RTC keeps counting past 23:59:59 until 39:59:59

-> Neither on 23h nor 39h rollover the day gets increased

-> When trying to set the time we get the following data:

If the time is less than 20h, 20h get added to it

Else the hour is correctly set

-> Rollover behavior don't changes

If we force a reset of the CPU, the problem dissapears.

More data:

-> The RTC access is done using HAL libs.

-> The RTC isn't reset when setting the date/time

We still have one untouched board for testing, but any try to use a debugger would trigger a CPU reset, making the probblem dissapear. (This is why we lost ont of the boards )

Does anybody have a hint about what the problem could be ?

32 REPLIES 32
PaulinoJr3
Associate

Hi, I have solved this, replacing the following files by old version of the hal API from other project:

Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_rtc.h
Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_rtc_ex.h
Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rtc.c
Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rtc_ex.c

I only replacing, but we can see in git diff the differences

BugFix-RTC-MoreThan24hs.PNG

 

If you look at the definitions of the symbols you've replacing, you'd see the same values. Thus, this is not the reason of the "fix" which is quite likely concidental.

I believe most of the problems in this thread are caused by uninitialized local structs used to set up the RTC or the time there.

JW

It wasn't just what's in the diff that changed, but all .c code, and for me it resolved.