Skip to main content
Associate II
December 20, 2023
Solved

UART cannot set high baud rate

  • December 20, 2023
  • 6 replies
  • 8863 views

I have a uart peripheral whose baud rate can only be set to 3.125M. However, the baud rate of another uart peripheral with the same clock configuration in the project can be set to 12.5M. I want to know what the baud rate limit is based on? How to increase the baud rate from 3.125M to 12.5M?

 

fkst_0-1703066288603.png

fkst_2-1703066511624.png

 

fkst_1-1703066310126.png

 

This topic has been closed for replies.
Best answer by TDK

CubeMX is using the UART5 clock selection to determine the acceptable UART7 speeds. Clearly a bug. In MCUA it's set to SYSCLK=200MHz but in MCUB it's set to PCLK1=50MHz, hence the difference in behavior.

Easy workaround: enable UART5, set the clock selection to SYSCLK to match that of UART7, then disable UART5.

TDK_0-1703134308790.png

6 replies

AScha.3
Super User
December 20, 2023

You selected probably different oversampling modes or clock prescaler settings (in adv. parameters).

-> read in  rm....

"If you feel a post has answered your question, please click ""Accept as Solution""."
fkstAuthor
Associate II
December 20, 2023

hi, AScha.3 

 Thanks for your answer, I checked the parameters are the same.

AScha.3
Super User
December 20, 2023

But in pics you show : different speed limits, but for same peripheral - how this can be at same parameters and clk ?

AScha3_0-1703073194893.png

but 

 

AScha3_1-1703073230602.png

I  can do same :

AScha3_0-1703074115338.png

and :

AScha3_1-1703074162521.png

 

:)

"If you feel a post has answered your question, please click ""Accept as Solution""."
gbm
Principal
December 20, 2023

With the default 16x oversampling, the max baud rate is uart_input_clock / 16. Set the oversampling to 8 if you need more - then it's limited to uart_input_clock / 8. Or increase the UART input clock frequency if it is possible.

My STM32 stuff on github - compact USB device stack and more: https://github.com/gbm-ii/gbmUSBdevice
TDK
Super User
December 20, 2023

The baud rate limit is based on the internal UART clock and the settings you use for the UART.

Attach your IOC if you're having issues. You show limits for the same peripheral twice, which isn't consistent with your question.

"If you feel a post has answered your question, please click ""Accept as Solution""."
fkstAuthor
Associate II
December 21, 2023

In my project, two identical MCUs need to cross-communicate, but the upper limit of the baud rate of MCUB is limited, which troubles me.

Since i am not allowed to send ioc files, I took screenshots of the clock and uart configuration of the two chips. In addition, I am using the linux version(1.12.0) of CubeIDE. 

MCUA

fkst_6-1703125787306.png

 

fkst_7-1703125787359.png

 

 

MCUB

fkst_8-1703125786670.png

 

 

fkst_9-1703125787638.png

 

 

Thanks.

TDK
Super User
December 21, 2023

I understand the issue you're describing now.

You can rename your IOC files to *.TXT and attach them.

It appears there is a bug with how CubeMX is calculating the max rate here, as it isn't adjusted for the selected clock source. There's probably a workaround, but I can't duplicate the issue. Seeing your IOC files would be insightful.

"If you feel a post has answered your question, please click ""Accept as Solution""."
TDK
TDKBest answer
Super User
December 21, 2023

CubeMX is using the UART5 clock selection to determine the acceptable UART7 speeds. Clearly a bug. In MCUA it's set to SYSCLK=200MHz but in MCUB it's set to PCLK1=50MHz, hence the difference in behavior.

Easy workaround: enable UART5, set the clock selection to SYSCLK to match that of UART7, then disable UART5.

TDK_0-1703134308790.png

"If you feel a post has answered your question, please click ""Accept as Solution""."
Amel NASRI
Technical Moderator
December 26, 2023

Hello @fkst & @TDK ,

Even though the solution is already found, I let our STM32CubeMX expert @Semer CHERNI investigate the issue deeply.

Question will be moved to STM32CubeMX forum board.

-Amel

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.
Semer CHERNI
ST Employee
January 2, 2024

Hello @fkst 

I confirm the issue related to STM32CubeMX. It's now tracked internally for analysis and future fix (169726: this is an internal ticket number)

KR,
Semer.