AnsweredAssumed Answered

CubeMX STM32L433CC ETR2 Input bug?

Question asked by Br_ggemann.Dieter on Mar 6, 2017
Latest reply on Feb 12, 2018 by Jeanne Joly

Hi

 

When TIM2 of this device is configured according to the screenshot, the following code will be generated:

void HAL_TIM_Base_MspInit(TIM_HandleTypeDef* tim_baseHandle)
{

  GPIO_InitTypeDef GPIO_InitStruct;
  if(tim_baseHandle->Instance==TIM1)
  {
  /* USER CODE BEGIN TIM1_MspInit 0 */

  /* USER CODE END TIM1_MspInit 0 */
    /* Peripheral clock enable */
    __HAL_RCC_TIM1_CLK_ENABLE();
  /* USER CODE BEGIN TIM1_MspInit 1 */

  /* USER CODE END TIM1_MspInit 1 */
  }
  else if(tim_baseHandle->Instance==TIM2)
  {
  /* USER CODE BEGIN TIM2_MspInit 0 */

  /* USER CODE END TIM2_MspInit 0 */
    /* Peripheral clock enable */
    __HAL_RCC_TIM2_CLK_ENABLE();
 
    /**TIM2 GPIO Configuration   
    PA0     ------> TIM2_ETR
    */

    GPIO_InitStruct.Pin = GPIO_PIN_0;
    GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
    GPIO_InitStruct.Pull = GPIO_NOPULL;
    GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;

    // This line is missing:
    GPIO_InitStruct.Alternate = GPIO_AF14_TIM2;

    HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);

  /* USER CODE BEGIN TIM2_MspInit 1 */

  /* USER CODE END TIM2_MspInit 1 */
  }
}

The line marked as missing becomes not generated leaving the pin as output.

 

Besides this error the wording within the Configuration of TIM2 -> GPIO is also missleading, telling the user

that this is an output pin. "Maximum Output Speed: ..."

 

CubeMX 4.19

STM32Cube_FW_L4_V1.6.0.

 

Dieter

Outcomes