Skip to main content
MSilv
Visitor II
February 13, 2024
Solved

STM32H563 using CUBEMX and LL - UART9 does not have its Baud Rate Register initialized correctly

  • February 13, 2024
  • 1 reply
  • 999 views

I'm using a STM32H563 Nucleo and the latest version of CubeMX along with the Keil (V6.19 C Compiler - uVision IDE V5.38)

I have discovered a weird issue where even though CubeMX seems to be generating the initialization code for the baud rate for UART9 correctly, it does not actually get loaded into the UART9 Baud Rate Register (BRR) using the Lower Level (LL) libraries:

UART_InitStruct.BaudRate = 19200;
UART_InitStruct.DataWidth = LL_USART_DATAWIDTH_9B;
UART_InitStruct.StopBits = LL_USART_STOPBITS_1;
UART_InitStruct.Parity = LL_USART_PARITY_ODD;
UART_InitStruct.TransferDirection = LL_USART_DIRECTION_TX_RX;
UART_InitStruct.HardwareFlowControl = LL_USART_HWCONTROL_NONE;
UART_InitStruct.OverSampling = LL_USART_OVERSAMPLING_16;
LL_USART_Init(UART9, &UART_InitStruct);
LL_USART_ConfigAsyncMode(UART9);
LL_USART_Enable(UART9);

When I compile and execute the code, the USART_BRR value stays unchanged at 0 hex.  I have tried the same thing on UART7 and it works just fine.  I am trying to trace through the LL code and see where it's failing to load the UART9 BRR, but in the meantime I thought it best to report the issue.  The behavior is completely repeatable.

 

This topic has been closed for replies.
Best answer by STTwo-32

Hello @MSilv 

Thank you for having reported this. I've reproduced the issue, and I can confirm it. 

I've escalated this issue for fix in the internal ticket number 173387.

(PS: Internal ticket number 173387 is not accessible or usable by customers).

Until that, you can still use the HAL driver for the UART9 or the LL driver with other UARTs.

Also, as a temporary workaround, you can use integrate this function to the MX_UART9_Init(void):

LL_USART_SetBaudRate(USART_TypeDef *USARTx, uint32_t PeriphClk, uint32_t PrescalerValue, uint32_t OverSampling,uint32_t BaudRate)

Best Regards.

STTwo-32

1 reply

STTwo-32
STTwo-32Best answer
Technical Moderator
February 14, 2024

Hello @MSilv 

Thank you for having reported this. I've reproduced the issue, and I can confirm it. 

I've escalated this issue for fix in the internal ticket number 173387.

(PS: Internal ticket number 173387 is not accessible or usable by customers).

Until that, you can still use the HAL driver for the UART9 or the LL driver with other UARTs.

Also, as a temporary workaround, you can use integrate this function to the MX_UART9_Init(void):

LL_USART_SetBaudRate(USART_TypeDef *USARTx, uint32_t PeriphClk, uint32_t PrescalerValue, uint32_t OverSampling,uint32_t BaudRate)

Best Regards.

STTwo-32