2020-04-16 01:39 AM
When I enable TIM16 and TIM17 for a project on the STM32H753ZI in CubeMX (version 5.6.1) and I select Input Capture direct mode from Remap, I can select TI1 remap capabilities (see picture below).
The generated code below is not correct. Line 17 calls HAL_TIMEx_RemapConfig() which is not suitable for this timer. The code should call HAL_TIMEx_TISelection(&htim17, TIM_TIM17_TI1_RCC_HSE1MHZ, TIM_CHANNEL_1) instead.
/**
* @brief TIM17 Initialization Function
* @param None
* @retval None
*/
static void MX_TIM17_Init(void)
{
/* USER CODE BEGIN TIM17_Init 0 */
/* USER CODE END TIM17_Init 0 */
TIM_IC_InitTypeDef sConfigIC = {0};
/* USER CODE BEGIN TIM17_Init 1 */
/* USER CODE END TIM17_Init 1 */
htim17.Instance = TIM17;
htim17.Init.Prescaler = 0;
htim17.Init.CounterMode = TIM_COUNTERMODE_UP;
htim17.Init.Period = 0xffff;
htim17.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
htim17.Init.RepetitionCounter = 0;
htim17.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_ENABLE;
if (HAL_TIM_Base_Init(&htim17) != HAL_OK)
{
Error_Handler();
}
if (HAL_TIM_IC_Init(&htim17) != HAL_OK)
{
Error_Handler();
}
sConfigIC.ICPolarity = TIM_INPUTCHANNELPOLARITY_RISING;
sConfigIC.ICSelection = TIM_ICSELECTION_DIRECTTI;
sConfigIC.ICPrescaler = TIM_ICPSC_DIV8;
sConfigIC.ICFilter = 3;
if (HAL_TIM_IC_ConfigChannel(&htim17, &sConfigIC, TIM_CHANNEL_1) != HAL_OK)
{
Error_Handler();
}
if (HAL_TIMEx_RemapConfig(&htim17, TIM_TIM17_TI1_RCC_HSE1MHZ) != HAL_OK)
{
Error_Handler();
}
/* USER CODE BEGIN TIM17_Init 2 */
/* USER CODE END TIM17_Init 2 */
}
I've tested this for TIM16 and TIM17 which show the same behaviour.
2020-04-16 01:46 AM
Hi @rb1
Could you please share your .ioc file to check the issue.
Best regards,
Nesrine
2020-04-16 01:52 AM
2020-04-16 05:53 AM
Hello @rb1
Thanks for your feedback, issue confirmed, it will be internally fixed.
Best Regards,
Nesrine