cancel
Showing results for 
Search instead for 
Did you mean: 

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

MSilv
Associate

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.

 

1 ACCEPTED SOLUTION

Accepted Solutions
STTwo-32
ST Employee

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

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

View solution in original post

1 REPLY 1
STTwo-32
ST Employee

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

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.