Electrical – RTC (real-time clock) in STM32L4 series – date and time is not updating on the debugger variable

debuggingmicrocontrollerrtcstm32stm32f4-discovery

While using the RTC (real-time clock) in the STM32L4 series, but date and time is not updating on the variable in debugger mode. But when I stop the debugging, the variable gets updated instantly and with the correct value.

What is the explanation?

Best Answer

Debuggers are notorious for not updating registers, a few workarounds include:

Copy the registers to variables and try viewing the temporary variables in the debugger. (make sure you protect them somehow to make sure the compiler doesn't optimize them out, if they aren't being used and you have optimizations turned on the temporary variables will be optimized out).

Or use the debugger 'console' or equivalent comm channel with printf statements to print the registers contents.