How to get Segger RTT to work with sleep modes on stm32
I'm trying to use RTT on an stm32L433 and it looks like it doesn't work when the device is in sleep mode (no output on the RTTViewer).
my test code is a loop with a printf and a 2seconds sleep.
- when a debugger is attached, stepping through the code makes it works fine
- when a debugger is attached running the code yields no output on the RTTViewer
- stopping the code after it runs for a little bit prints all the previously missed outputs
- replacing the sleep with a busy wait loop makes it work correctly
- mixing busy loop and sleep seems to works most time depending on the proportion of active/sleep times
it seems like I'm experiencing the same issue as this thread form the SEGGER Forum,
to summarize the issue from that thread
"The target device goes to sleep again before RTT data can be read by J-Link.
With other target devices this is usually not an issue as the AHB-AP is still active during sleep so J-Link can access RTT data.
This is however not the case for most ST target devices."
I tried setting DBG_SLEEP, DBG_STOP, and DBG_STANDBY to 1 in the DBGMCU_CR register but that didn't change the result.
is there anything else that needs to be done so that a debugger can read the memory while the processor is in sleep mode?
another thread with the same issue
Thanks
