cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L053/51: Can't set DBG_STOP at the start of main

14545714
Associate II
Posted on May 28, 2015 at 01:41

Hi, I want the debug ability during stop mode. According to the reference menu, DBG_STOP in register DBG_CR bit should be set to do this. But after I set it, it is still 0. I have tried several ways:

  1. Use a macro ''execUserSetup'' in IAR.
  2. When the debug session is launched, use ''Register view'' window and modify it directly.
  3. Call ''HAL_EnableDBGStopMode'' or ''HAL_DBG_LowPowerConfig'' at the begining of ''main''.
But none of the above works. It always remain 0.

Does anybody have any idea? Thanks

#dbg_stop #dbg_cr #dbg_mcu
2 REPLIES 2
fenugrec
Associate II
Posted on May 28, 2015 at 23:24

Don't forget you probably need to enable the DBGMCU peripheral clock !

14545714
Associate II
Posted on May 29, 2015 at 06:53

Yes, I think you are right. After setting bit ''DBGEN'' in RCC_APB2ENR, DBGMCU could be modified. Maybe ''DBGSMEN'' in RCC_APB2SMENR should also be set, which is the enable bit for DBG clock in sleep mode. However, I didn't find much description about these two bits in the reference manual.

Thanks