2014-01-07 08:37 AM
I develop a lot of low power applications using STM32 and I'd like the ability to use the debugger while in low power STOP mode. My code works as expected in release mode (i.e. no debugger) but when debugging as soon as the processor enters STOP mode it exits STOP mode. Even if I disable all interrupt sources that could wake it up (RTC alarm and EXTI pin interrupts) it still exits STOP mode immediately. I have added the following at the beginning of main to setup the debug register:
#ifdef DEBUG
DBGMCU->CR = DBGMCU_STOP;
#endif
Processor: STM32F103 (same issue on STM32F101)
Tool chain: Rowley Crossworks for ARM 1.7 build 22
JTAG: ARM-USB-TINY (Olimex)
I would appreciate any ideas.
Regards
Trevor
#dbg_standby #dbg_stop #dbg_sleep
2014-01-07 09:00 AM
Hi
I am not that famailiar with the STM32F103 series, I work with the F4 series. You want to debug the ARM core while it is in STOP mode?!? How can you debug the processor when it is stopped/suspended/halted/not running? '' I'd like the ability to use the debugger while in low power STOP mode.'' Surely this is not possible! ''but when debugging as soon as the processor enters STOP mode it exits STOP mode.'' Well, yes as soon as the processor enter stop mode, the debugger will be sending debug commands which will probably wake the processor/core. As I understand it, one way to achieve low power while running is to change (lower) the clock to a very low speed (try KHz) I beleive the F0 series are the ultra low power series but again - I have no experience with them (yet)2014-01-07 03:03 PM
Thanks for your response.
''How can you debug the processor when it is stopped/suspended/halted/not running?''By setting the DBG_STOP bit in the DBGMCU_CR register (as per code above), see section 31.16.3 of the reference manual here: ''Surely this is not possible!''I think it is. See section 1.2.6 of this low power app note for further evidence of this feature: Has anyone had this working?
2014-01-08 01:08 AM
Hi Trevor
OK, it is possible to debug in the low power modes - I stand corrected. However, from reading the description - it is faking it - the clocks are not being stopped in the normal way. The power consumption will not be lowered in when debugging. From the description - it is also highly dependant on how the tool chain has implemented (if at all) the debug in low power mode. ''but when debugging as soon as the processor enters STOP mode it exits STOP mode.'' Like I said - it sounds like the debugger is sending debug messages which take the core out of STOP mode. It sounds like Rowley Crossworks for ARM 1.7 build 22 JTAG: ARM-USB-TINY (Olimex) does not support it properly.2014-01-08 01:19 AM
First, I have not trying to debug in STOP mode, too.
By setting the DBG_STOP bit in the DBGMCU_CR register (as per code above), see section 31.16.3 of the reference manual here: ......
I think it is. See section 1.2.6 of this low power app note ...
The cited app note is rather vague in this regard:''However, by setting some configuration bits in the DBGMCU_CR register, the software can be debugged even when using the low-power modes extensively.''
This implies to me that setting the DBG_STOP bit might not suffice. Have you tried the CrossWorks support or forum ? IMHO, the version 1.7 is rather old, current version is, AFAIK, 2.3. Not sure if, and how, it supports low power states during debugging.
2014-01-08 02:00 AM
Hi
You got me thinking. Most tool chains use a GDB interface to achieve inter-changeability with different debuggers. GDB comes from Unix. I do not think that GDB under Unix would support low power/suspend. So I think it is unlikely that any tool chain will support 'debugging a processor' while in a low power/suspend mode2014-01-21 07:45 AM
Hello Trevor,
Are you using WFE to enter stop mode?
If it is the case, try to call it twice and put breakpoint after the call of second WFE. In fact, in debug mode, there is an internal signal in the core which wakes-up the MCU as soon as WFE is executed.-Mayla-
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2015-09-21 03:55 AM
Hi Trevor
I have the same problem as you... Did you solved it?2015-09-30 05:41 PM
2015-10-19 07:11 AM
systick clock is not disabled when debug stop mode is set. disable systick before entering stop mode.