Starting the second channel of a timer causes assert failure
Hello,
I configured a timer in STM32CubeMX2 to use 2 channels (HAL_TIM_CHANNEL_1 and HAL_TIM_CHANNEL_3). After the mx_system_init() I use the following code:
hal_tim_handle_t *htim5 = mx_tim5_gethandle();
if (HAL_TIM_OC_StartChannel(htim5, HAL_TIM_CHANNEL_1) != HAL_OK) {
return (-1);
}
if (HAL_TIM_OC_StartChannel(htim5, HAL_TIM_CHANNEL_3) != HAL_OK) {
return (-1);
}
if (HAL_TIM_Start(htim5) != HAL_OK) {
return (-1);
}
The first channel starts as expected, but when I attempt to start the second channel the code causes an assert in HAL_TIM_OC_StartChannel:
/* Check and update the channel state */
ASSERT_DBG_STATE(htim->channel_states[channel],
HAL_TIM_OC_CHANNEL_STATE_IDLE);
Do I need to do anything different?
Regards,
-Gil

