2018-03-09 05:33 AM
I have several STM32 CubeMX / HAL projects and I use EmBitz as IDE. All porjects working fine, including compilation and debugging. There are projects with STM32F103, STM32F205, STM32F207,STM32F405, STM32F429, STM32L476, etc. There is one exception: Execution single stepping is not working withSTM32F091 target. Always steps into timer interrupt and never get out. Is there a solution? Thanks.
Note: this post was migrated and contained many threaded conversations, some content may be missing.2018-03-09 10:16 PM
Its only a suggestion, that you try turning off the Data and Instruction caches.
hopefully you would gain clues as to what is happening there..
Consider shortening the debug cable length..
Check the schematic circuitry on that particular board's 'F091 SWD interface..
There maybe some odd hardware configuration that needs attention.
Check the physical connector male and female parts, looking for connection issues.
Check the ground connection between the host PC and the board and the board's power supply.
You may have unwanted ground currents, it all depends on the Board's power supply.
Grounding to the PC would alleviate that issue.
2018-03-10 12:20 AM
This is an official STM32F091RC Nucleo board.
2018-03-10 03:49 PM
I use this board extensively, and my personal boards use this chip, there are no issues in any platform.
I haven't tried EmBitz, there may be your problem. or else try another board...
2018-03-11 02:51 PM
DBG_TIMx_STOP set for the timer in question in DBGMCU_APBy_FZ?
JW
2018-03-11 10:35 PM
This is a CubeMX generated HAL project. There is FreeRTOS and TIM2 is the time base.
There is a stm32f091xc.h header file, and there are these lines:
/****************** Bit definition for DBGMCU_APB1_FZ register **************/
&sharpdefine DBGMCU_APB1_FZ_DBG_TIM2_STOP_Pos (0U)&sharpdefine DBGMCU_APB1_FZ_DBG_TIM2_STOP_Msk (0x1U << DBGMCU_APB1_FZ_DBG_TIM2_STOP_Pos) /*!< 0x00000001 */&sharpdefine DBGMCU_APB1_FZ_DBG_TIM2_STOP DBGMCU_APB1_FZ_DBG_TIM2_STOP_Msk /*!< TIM2 counter stopped when core is halted */2018-03-12 01:37 AM
Then set it in your program. It will stop the timer during debugging thus suppress further timer interrupts.
JW
2018-03-12 04:06 AM
I tried to put DBGMCU->APB1FZ |= DBGMCU_APB1_FZ_DBG_TIM2_STOP; at several places: the beginning and the end of init in main(), and into the start of the default task. No luck. Single stepping is iterating over and over here in stm32f0xx_it.c:
/**
* @brief This function handles TIM2 global interrupt.*/void TIM2_IRQHandler(void){ /* USER CODE BEGIN TIM2_IRQn 0 *//* USER CODE END TIM2_IRQn 0 */ HAL_TIM_IRQHandler(&htim2); /* USER CODE BEGIN TIM2_IRQn 1 *//* USER CODE END TIM2_IRQn 1 */}2018-03-12 05:02 AM
Do you step inside HAL_TIM_IRQHandler() or are you trying to step over it? Does the handler clear the flag(s) causing the interrupt?
JW
2018-03-12 05:20 AM
No, I do not want to step into it.
If I manually stop execution, or it hits a breakpoint anywhere, it stops. OK. Then I click single step (go to next line) and the debugger jumps intoTIM2_IRQHandler instead of next line. I tried to click on step out, but it stopped again inTIM2_IRQHandler.