2016-08-01 05:02 AM
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 #stm32f0302016-08-01 06:00 AM
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))
2016-08-01 06:36 AM
It works! Thank you very much!
2016-10-12 12:58 AM
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,Edwin2016-10-12 02:18 AM
> 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? JW2016-10-12 08:42 AM
There are no changes in the configuration or period (completely configured by Cube). Just the compare registers.
Best regards, Edwin