cancel
Showing results for 
Search instead for 
Did you mean: 

Bug in generated code for MX_LPUART1_UART_Init

STawn.1
Associate

In a project for a STM32L4S7ZITx with LPUART1 enabled the following code is generated:

/**
  * @brief LPUART1 Initialization Function
  * @param None
  * @retval None
  */
static void MX_LPUART1_UART_Init(void)
{
 
  /* USER CODE BEGIN LPUART1_Init 0 */
 
  /* USER CODE END LPUART1_Init 0 */
 
  /* USER CODE BEGIN LPUART1_Init 1 */
 
  /* USER CODE END LPUART1_Init 1 */
  hlpuart1.Instance = LPUART1;
  hlpuart1.Init.BaudRate = 115200;
  hlpuart1.Init.WordLength = UART_WORDLENGTH_8B;
  hlpuart1.Init.StopBits = UART_STOPBITS_1;
  hlpuart1.Init.Parity = UART_PARITY_NONE;
  hlpuart1.Init.Mode = UART_MODE_TX_RX;
  hlpuart1.Init.HwFlowCtl = UART_HWCONTROL_NONE;
  hlpuart1.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE;
  hlpuart1.Init.ClockPrescaler = UART_PRESCALER_DIV1;
  hlpuart1.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT;
  hlpuart1.FifoMode = UART_FIFOMODE_DISABLE;
  if (HAL_UART_Init(&hlpuart1) != HAL_OK)
  {
    Error_Handler();
  }
  if (HAL_UARTEx_SetTxFifoThreshold(&hlpuart1, UART_TXFIFO_THRESHOLD_1_8) != HAL_OK)
  {
    Error_Handler();
  }
  if (HAL_UARTEx_SetRxFifoThreshold(&hlpuart1, UART_RXFIFO_THRESHOLD_1_8) != HAL_OK)
  {
    Error_Handler();
  }
  if (HAL_UARTEx_DisableFifoMode(&huart1) != HAL_OK)
  {
    Error_Handler();
  }
  /* USER CODE BEGIN LPUART1_Init 2 */
 
  /* USER CODE END LPUART1_Init 2 */
 
}

Line 39 is the only place that huart1 is referenced in any of the generated code. I assume this is meant to be hlpuart1.

1 ACCEPTED SOLUTION

Accepted Solutions
Khouloud ZEMMELI
ST Employee

@STawn.1​  Issue confirmed and it will be fixed,

Thanks for your feedback.

Khouloud

View solution in original post

12 REPLIES 12
Khouloud ZEMMELI
ST Employee

Hello @STawn.1​ 

It will be internally checked

Regards,

Khouloud

Khouloud ZEMMELI
ST Employee

@STawn.1​  Issue confirmed and it will be fixed,

Thanks for your feedback.

Khouloud

CBald
Associate III

Chiming in that this issue also just affected me today, so it is still not fixed.

Hello @CBald​ 

The fix will be available for the next CubeMX release (6.1.0).

Regards,

Khouloud

Mhd
Associate

I'd like to add to this bug: it also happens in the LPUART1_IRQHandler:

void LPUART1_IRQHandler(void)
{
  /* USER CODE BEGIN LPUART1_IRQn 0 */
 
  /* USER CODE END LPUART1_IRQn 0 */
  HAL_UART_IRQHandler(&huart1);            //<--- Here, huart1 should be hlpuart1
  /* USER CODE BEGIN LPUART1_IRQn 1 */
 
  /* USER CODE END LPUART1_IRQn 1 */
}

Hi @Mhd​ 

Could you please share your ioc file ?

Thanks

Khouloud

Mine exhibits the same behavior, huart instead of hlpuart in the IRQHandler

See attached file

@Mhd​  & @CBald​  fix is done, it will be available in the next release.

Thanks for your feedbacks

Khouloud