2019-09-12 03:06 AM
void HAL_TIM_PWM_PulseFinishedCallback(TIM_HandleTypeDef *htim)
{
if(htim->Instance == htim2.Instance && htim->Channel == HAL_TIM_ACTIVE_CHANNEL_1) {
HAL_TIM_PWM_Stop_DMA(&htim2, TIM_CHANNEL_1);
__HAL_TIM_SET_COUNTER(&htim2, 0);
__HAL_TIM_SET_COMPARE(&htim2, TIM_CHANNEL_2, 100);
HAL_TIM_OC_Start_IT(&htim2, TIM_CHANNEL_2);
}
}
The OC settings are all normal elsewhere. However, it is not set by the change of time set here. Very quickly it comes to HAL_TIM_OC_DelayElapsedCallback.
Even if the words are awkward, please understand. Google Translate.
Solved! Go to Solution.
2019-09-12 03:25 AM
> Very quickly it comes to HAL_TIM_OC_DelayElapsedCallback.
Maybe the related flag (CC2IF) is already set in TIMx_SR. You might want to clear the TIMx_SR.CC2IF before you call HAL_TIM_OC_Start_IT().
JW
2019-09-12 03:25 AM
> Very quickly it comes to HAL_TIM_OC_DelayElapsedCallback.
Maybe the related flag (CC2IF) is already set in TIMx_SR. You might want to clear the TIMx_SR.CC2IF before you call HAL_TIM_OC_Start_IT().
JW
2019-09-12 05:48 AM
__HAL_TIM_CLEAR_FLAG (& htim2, TIM_SR_CC2IF);
By inserting the above.
Thank you.