cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F030 - Timer freeze when debugging

ib
Associate II
Posted on August 01, 2016 at 14:02

Hello,

I use an STM32F030 in the current project and I need timer 1 to stop during debugging (breakpoints, execution stop). It does not matter whether the pwm outputs stop in hi or lo, they just need to stop.

After searching in the reference manual and the HAL documentation I found: __HAL_DBGMCU_FREEZE_TIM1()

But it does not work. When debugging (IAR) the bit in the DBGMCU->APB2FZ registor does not change! Even if I try to change the value in the registers window nothing happens. What's wrong?

Best regards,

Edwin Krasser

#tim1 #stm32f030
This discussion has been locked for participation. If you have a question, please start a new topic in order to ask your question
5 REPLIES 5
qwer.asdf
Senior
Posted on August 01, 2016 at 15:00

Make sure you have enabled the debug clock before using the debug module, here's a quick grep for you in the HAL directory:

$ grep -R DBGMCU_CLK .
./Inc/stm32f0xx_hal_rcc.h:#define __HAL_RCC_DBGMCU_CLK_ENABLE() do { \
./Inc/stm32f0xx_hal_rcc.h:#define __HAL_RCC_DBGMCU_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_DBGMCUEN))

ib
Associate II
Posted on August 01, 2016 at 15:36

It works! Thank you very much!

ib
Associate II
Posted on October 12, 2016 at 09:58

Freezing the timer worked, but I got an interesting, very bad effect:

During debugging when the uP is halted (breakpoint, debugger stop), sometimes it happens that the pwm output signals become tristate! Not everytime, but sometimes. This is a very bad effect when driving a power bridge because safety circuitry like monoflops will not work, because there is no low and no high, just something undefined.

Hence I added some pull downs (should not be necessary). That helped.

I used IAR with Segger J-Link Base connected to an STM32F030C6T.

Did anybody face a similar problem?

Thanks,

Edwin

Posted on October 12, 2016 at 11:18

> During debugging when the uP is halted (breakpoint, debugger stop), sometimes it happens that the pwm output signals become tristate!

Do you change the related timer channel *mode* in the program, or do you simply set it up into one of the PWM modes at the beginning and let it run autonomously?

JW

ib
Associate II
Posted on October 12, 2016 at 17:42

There are no changes in the configuration or period (completely configured by Cube). Just the compare registers.

Best regards, Edwin