2020-12-01 06:42 AM
Hi,
I have generated and built code by STM32CubeIDE but the SysTick and Timer not work. I set breakpoint but the interrupt function just not run. GPIO feature work normal. But when I create the project by STM32CubeMX with the same configuration and built code by KeilC then everything work good. So is that a bug of SMT32CubeIDE? I'm using STM32F103C8T6 on board Bluepill. I don't want to use KeilC anymore because it not free. What should i do now?
Thank for your advice.
Solved! Go to Solution.
2020-12-02 07:39 PM
> So I think there is a bug on STM32CubeIDE Compiler when built HAL code.
Probably more likely there was a bug in your code. Having the timer set up in slave trigger mode will require you to actually trigger it, which your code doesn't do.
> sSlaveConfig.SlaveMode = TIM_SLAVEMODE_TRIGGER;
> sSlaveConfig.InputTrigger = TIM_TS_ITR0;
2020-12-01 07:53 AM
How do you know it's not working? If you debug and hit pause, where is the CPU executing instructions?
2020-12-01 08:21 AM
Hi Ihoan.1,
Can you please share your .ioc file ?
Regards,
Ons.
2020-12-01 05:12 PM
Hi, I have upgraded to STM32CubeIDE 1.5.0, and the systick works now. But the timer still not work. Everything in the main while (1) still works normally except the timer interrupt. I tried to set breakpoint in Timer interrupt function, but nothing hit this breakpoint
Please see the attached file for detail
2020-12-01 05:13 PM
Hi, I have upgraded to STM32CubeIDE 1.5.0, and the systick works now. But the timer still not work. Everything in the main while (1) still works normally except the timer interrupt. I tried to set breakpoint in Timer interrupt function, but nothing hit this breakpoint
Please see the attached file for detail
2020-12-01 06:32 PM
Please check if your code have user code as below.
In MX_TIM2_Init(void) add the following.
/* USER CODE BEGIN TIM2_Init 2 */
LL_TIM_EnableIT_UPDATE(TIM2);
/* USER CODE END TIM2_Init 2 */
After MX_TIM2_Init() add the following
/* USER CODE BEGIN 2 */
LL_TIM_EnableCounter(TIM2);
2020-12-01 07:08 PM
Hi, Thank for your advice.
But it is low layer library. I'm using HAL library and have no way to implement those function from low layer library
2020-12-01 07:12 PM
2020-12-01 08:26 PM
Add a line as below in MX_TIM1_Init(void)
/* USER CODE BEGIN TIM1_Init 2 */
HAL_TIM_Base_Start_IT(&htim1);
HAL_TIM_Base_Start(&htim1);
/* USER CODE END TIM1_Init 2 */
2020-12-02 12:46 AM
Hi. I did as you said. but the timer still doesn't work!