2020-05-14 08:01 AM
When I generate for TIM9 input capture to measure a pulse width, CubeMX inserts correctly these two lines into the function MX_TIM9_Init:
if (HAL_TIM_IC_Init(&htim9) != HAL_OK)
{
Error_Handler();
}
Then in the stm32fxx_hal_msp.c file it inserts a HAL_TIM_IC_MspInit with the TIM9 stuff in it.
But for TIM10:
If I also generate for TIM10 also for input capture to measure pulse width it now inserts these lines in the MX_TIM10_Init function:
if (HAL_TIM_Base_Init(&htim10) != HAL_OK)
{
Error_Handler();
}
if (HAL_TIM_IC_Init(&htim10) != HAL_OK)
{
Error_Handler();
}
and in the stm32fxx_hal_msp.c file it inserts a HAL_TIM_Base_MspInit function instead of a HAL_TIM_IC_MspInit.
Why the 2 different behaviors for TIM9 and TIM10? I did manual code (without using CubeMX) could I get away using TIM9 annd TIM10 the same way (without the TIM_Base stuff) just sticking with HAL_TIM_IC_Mspinit for both timers?
Thanks
Solved! Go to Solution.
2020-05-15 06:02 AM
Hello,
Please Refer to datasheet ( Link)
According to this reference : "TIM10, TIM11, TIM13, and TIM14 feature one independent channel, whereas TIM9 and TIM12 have two independent channels for input capture/output compare, PWM or one-pulse mode output. They can be synchronized with the TIM2, TIM3, TIM4, TIM5 full-featured general-purpose timers. They can also be used as simple time bases".
Regards
2020-05-15 01:56 AM
Hello,
Could you please share your file .ioc to check ?
Regards
2020-05-15 03:03 AM
2020-05-15 06:02 AM
Hello,
Please Refer to datasheet ( Link)
According to this reference : "TIM10, TIM11, TIM13, and TIM14 feature one independent channel, whereas TIM9 and TIM12 have two independent channels for input capture/output compare, PWM or one-pulse mode output. They can be synchronized with the TIM2, TIM3, TIM4, TIM5 full-featured general-purpose timers. They can also be used as simple time bases".
Regards