cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F413VGT uart9 baud rate problem

TKim.11
Associate

There is a bug to set baud-rate of uart9.

If I set it to 9600, it works as 19200.

I think it is a problem of driver code.

The UART9 and UART10 should use PCLK2 but the code uses PLCK1.

Please check below.

My environment:

Win 10. 1809

STM32CubxMX version 5.2.1

Atollic TrueSTUDIO® for STM32, Built on Eclipse Neon.1a.

Version: 9.3.0 

Build id: 20190212-0734

stm32f4xx_hal_uart.c : line 3094

#if defined(USART6)
    if ((huart->Instance == USART1) || (huart->Instance == USART6))
    {
      huart->Instance->BRR = UART_BRR_SAMPLING16(HAL_RCC_GetPCLK2Freq(), huart->Init.BaudRate);
    }
#else
    if (huart->Instance == USART1)
    {
      huart->Instance->BRR = UART_BRR_SAMPLING16(HAL_RCC_GetPCLK2Freq(), huart->Init.BaudRate);
    }
#endif /* USART6 */
    else
    {
      huart->Instance->BRR = UART_BRR_SAMPLING16(HAL_RCC_GetPCLK1Freq(), huart->Init.BaudRate);
    }
  }

datasheet : stm32f413vg.pdf page 37

0 REPLIES 0