2024-11-20 03:20 PM
I am working on a project where the end goal is that TIM8 is used to capture an incoming PWM signal on PC6. I want TIM2 to trigger from TIM8 and generate a single pulse on PB11. I have TIM8 working, capturing both rising and falling edges properly. However, after many attempts, I am not getting anything on TIM2.
I decided to check the output itself, and PB11 can be set high or low just fine, set as open drain. This rules out any hardware/PCB issues with the pin. Next I tried running a continuous PWM on TIM2 and the pin stays high.
So I stepped through the debugger, and I noticed that TIM2 registers aren't getting set. I tried manually setting them in the debugger and they immediately revert back to 0.
//This code works
TIM_HandleTypeDef HeaterTimer;
Solved! Go to Solution.
2024-11-20 03:39 PM
I was missing this line:
__HAL_RCC_TIM2_CLK_ENABLE();
That fixed everything!
2024-11-20 03:39 PM
I was missing this line:
__HAL_RCC_TIM2_CLK_ENABLE();
That fixed everything!