Nations Technologies Inc.
Tel
:
+86-755-86309900
:
Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North.
Nanshan District, Shenzhen, 518057, P.R.China
463
/
631
PCLK2 is used for USART1, UART4, UART5, up to 54MHz.
USARTDIV is an unsigned fixed-point number.
USARTDIV and USART_BRCF register configuration
Example 1:
If USARTDIV = 27.75, then
:
DIV_Decimal = 16*0.75 = 12 = 0x0C
DIV_Integer = 27=0x1B
So USART_BRCF = 0x1BC
Example 2:
If USARTDIV = 20.98, then
:
DIV_Decimal = 16*0.98 = 15.68
Nearest integer: DIV_Decimal = 16 = 0x10, out of configurable range, so a carry to integer is required
So DIV_Integer = 20+1 = 21 = 0x15
DIV_Decimal = 0x0
So USART_BRCF = 0x150
Example 3:
If USART_BRCF = 0x19B
:
DIV_Integer = 0x19 = 25
DIV_Decimal = 0x0B = 11
So USARTDIV = 25+11/16 = 25.6875
Table 22-3 Error calculation when setting baud rate
Baud rate
f
PCLK
=27MHz
f
PCLK
=54MHz
serial
number
Kbps
reality
Set value in register
Error(%)
reality
Set value in register
Error(%)
1
2.4
2.4
703.125
0%
2.4
1406.25
0%
2
9.6
9.6
175.8125
0.02%
9.6
351.5625
0%
3
19.2
19.2
87. 8755
0.02%
19.2
175.8125
0.02%
4
57.6
57.6
29.3125
0.05%%
57.6
78.125
0.05%
5
115.2
115.384
14.625
0.16%
115.2
29.3125
0.05%
6
230.4
230.769
7.3125
0.16%
230.769
14.625
0%
7
460.8
461.538
3.6875
0.69%
461.538
7.3125
0%
8
921.6
923.076
1.8125
1%
923.076
4.875
0.8%
9
1687.5
1687.7
1
0%
2250
1.5
0%