cancel
Showing results for 
Search instead for 
Did you mean: 

what is the crystal oscillator frequency of UART of STM32f103CB

Olly Kao
Associate III

Hi,

I just read an article mentioned that micro controller will limit (or do smthing) to lower down the frequency of crystal oscillator to match the multiply number of 9600 for UART, is that right?

So if I'm using PLL to boost CPU frequency from 8M to 72M, then what is the exact frequency of CPU and UART and what is the maximum Baud rate? since i tried Baud rate 921,600 and transmitted by calling HAL_UART_Transmit, it doesn't transmit the data properly. Any help?

Thanks a lot!

1 ACCEPTED SOLUTION

Accepted Solutions

> So the Frequency of UART doesn't need to match the multiply number of 9600?

No timing source is perfect. UART receivers can generally tolerate a frequency difference of a couple percent. As long as you're within that tolerance, all is fine.

For a 36 MHz peripheral clock and a target UART clock of 9600, USART_BRR is going to be 3750 and you hit the nominal frequency exactly.

For a 36 MHz peripheral clock and a target UART clock of 921600, USART_BRR is going to be 39 and you have a nominal error of +0.1%. This is well within the tolerance of most receivers.

The reference manual goes into a good amount of detail on this.

If you feel a post has answered your question, please click "Accept as Solution".

View solution in original post

3 REPLIES 3
TDK
Guru

Link the article.

The MCU calculates UART frequency based on the UART clock and the BRR register. Doesn't do anything more complicated than that.

From the datasheet:

One of the USART interfaces is able to communicate at speeds of up to 4.5 Mbit/s. The other available interfaces communicate at up to 2.25 Mbit/s.

If you feel a post has answered your question, please click "Accept as Solution".

The article : https://magicjackting.pixnet.net/blog/post/135222109

So the Frequency of UART doesn't need to match the multiply number of 9600?

> So the Frequency of UART doesn't need to match the multiply number of 9600?

No timing source is perfect. UART receivers can generally tolerate a frequency difference of a couple percent. As long as you're within that tolerance, all is fine.

For a 36 MHz peripheral clock and a target UART clock of 9600, USART_BRR is going to be 3750 and you hit the nominal frequency exactly.

For a 36 MHz peripheral clock and a target UART clock of 921600, USART_BRR is going to be 39 and you have a nominal error of +0.1%. This is well within the tolerance of most receivers.

The reference manual goes into a good amount of detail on this.

If you feel a post has answered your question, please click "Accept as Solution".