2021-11-24 10:15 AM
Developing with STM32CubeIDE V1.6.1 for MCU STM32L452VCTX.
Set up as STM32 Project in order to use debugger.
Using STM32Cube_FW_L4_V1.17.0 for SDK.
Compiling using gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.
Using FreeRTOS.
Using LPTIM1 to track sleep mode duration in order to adjust OS timer upon wake up.
If breakpoint is set before the LPTIM1 CNT register is read a value is obtained. If breakpoint is set after the LPTIM1 CNT register is read or if free running the value read is always zero (0).
In addition the LPUART is not communicating.
(This project is also set up as a C Project and the LPUART works fine but there is not the debug capability.)
Attached is a document showing the anomaly.
Has anyone had this problem? How did you resolve it?
2021-11-24 11:41 AM
Timers continue to run while the core is halted. No doubt this is part of the explanation. The debugger is not reading CNT values at the exact moment it hits the breakpoint, but rather at some later point in time.
If it works when free running, start it without breakpoints, let it run, then hit pause and examine registers to determine why LPTIM is not running. It could also be the nature of the way you're reading it out. You can also attach a debugger to a core without resetting it to examine its state.
Hard to know without seeing any code.
2021-11-24 12:05 PM
Thanks for responding. In free running it only reads 0. When it hits the breakpoint after the read, the LPTIM is enabled and there is a value in the CNT register even though it read a zero (0). (see attached document) Can manually press the RD (read) button and the CNT register changes value so that indicates the timer is running.
I am using the drivers supplied by STM to do the reading of the LPTIM CNT register.
The attached document shows the code where the breakpoints happen. Would you like to see the raw C code?