cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F030 Disable Debug in StopMode from firmware (Registers edit) is not working!

Pelekis
Associate

Hello,

I have a custom made board, currently running with just an STM32F030K6T and a simple regulator on it.

Trying to implement power saving modes I face some weird behavior on the DBG module of the MCU.

The problem is that even after writing the DBG_MCU->CR Register via the HAL_DBGMCU_DisableDBGStopMode();

I am not able to see the module stops during the Stop Mode.

 

Initially that was really interesting.

So I tried to Disable the DBG in Stop mode from Debugger configuration window ("Debug in low power modes:Disabled").

The debugger then during connection is initializing on itself the DBG_MCU Registers and everything seems to work fine after the Debugger is been killed after __WFE(); execution.

Although if I debug the system with the "Debug in low power modes:Disabled" and I stop the debug session before the system goes into stop mode the MCU is not able to change and keep the DBG Module unclocked in order to prevent further power consumption.

So I tried again to stop firmwarely the DBG Module form in-code side but this time did 2 things:

1) CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_STOP);

2)__HAL_RCC_DBGMCU_CLK_DISABLE();

Again nothing happened.

 

So By Now the only way to achieve disabling the DBG Module is not form in-code side.

Have anyone face such problem before an may came with a solution?

Best Regards

Pelekis

 

 

 

2 REPLIES 2
Jocelyn RICARD
ST Employee

Hello @Pelekis ,

First, is your device going to stop mode without debugger connection, that is starting from power on ?

In case STOP mode is working fine in that case, when using debug in stop mode you need to disable the systick using HAL_SuspendTick();

This would make a sequence like this:

	  HAL_SuspendTick();
	  HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFE);
	  SystemClock_Config();
	  HAL_ResumeTick();

I hope this will help

Best regards

Jocelyn

Andrew Neil
Evangelist III