Skip to main content
HEhat.1
Associate II
Sep 16, 2020 9:35 AM UTC
Solved

Setting of MDK-ARM while STOP mode

Hello, I'm using STML052T8.

I'd like to debug while STOP mode on MDK-ARM.

How can I set up the MDK-ARM for STOP mode?

I'd like to know if there is a caution as this the first time to use MDK-ARM.

Thank you in advance.

This topic has been closed for replies.
Tesla DeLorean
Tesla DeLoreanBest answer
Guru
Sep 18, 2020 2:52 AM UTC

DBGMCU->CR |= DBGMCU_CR_DBG_STOP; /* To be able to debug in stop mode */

https://www.st.com/resource/en/reference_manual/dm00108281-ultralowpower-stm32l0x2-advanced-armbased-32bit-mcus-stmicroelectronics.pdf

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..

4 replies

HEhat.1
HEhat.1Author
Associate II
Sep 18, 2020 1:28 AM UTC

adding screenshot.

Click "Edit" then "configuration"?

But I still don't know how to do.

There is no configuration for STOP mode in MDK-ARM or μVision?

Tesla DeLorean
Guru
Sep 18, 2020 2:32 AM UTC

There is a DBG_CR register at 0x40015804, you could configure in your own code, or in a debug initialization script

Bit 0 DBG_SLEEP: Debug Sleep mode

0: In Sleep mode, FCLK is clocked by the system clock previously configured by the software while HCLK is disabled. The clock controller configuration is not reset and remains in its previously programmed state. As a consequence, when exiting from Sleep mode, the software does not need to reconfigure the clock controller.

1: In this case, when entering in Sleep mode, HCLK is fed by the same clock that is provided to FCLK (system clock previously configured by the software). 

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
Tesla DeLorean
Tesla DeLoreanBest answer
Guru
Sep 18, 2020 2:52 AM UTC
Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
HEhat.1
HEhat.1Author
Associate II
Sep 28, 2020 9:07 AM UTC

Thank you for your reply.

I have already tried to add "DBGMCU->CR |= DBGMCU_CR_DBG_STOP;r" but still it does not connect.

​

I confirmed following points:

・ The setting of MDK-ARM and μVsion are okay to debug during STOP mode.

・​After writing program to flash, MCU can execute user code and enter STOP mode.

・After entering STOP mode with "DBGMCU->CR |= DBGMCU_CR_DBG_STOP;", it can never come back from STOP mode and cannot connect debugger to MCU.

​

I doubt that:

・There is no supplying clock to MCU when returning from STOP mode.

・RDP is set.

​

The order to enter STOP mode in program is below. (These code is in the same function.)

  1. Disable systick (to prevent EXTI)
  2. Set "DBGMCU->CR |= DBGMCU_CR_DBG_STOP;"
  3. Enter STOP mode
  4. Enable systick

If you have any review, please add comment.

I also try to figure it out, thank you.

​