09.12.2012 Views

RM0090: Reference manual - STMicroelectronics

RM0090: Reference manual - STMicroelectronics

RM0090: Reference manual - STMicroelectronics

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Universal synchronous asynchronous receiver transmitter (USART) <strong>RM0090</strong><br />

26.3.4 Fractional baud rate generation<br />

The baud rate for the receiver and transmitter (Rx and Tx) are both set to the same value as<br />

programmed in the Mantissa and Fraction values of USARTDIV.<br />

Equation 1: Baud rate for standard USART (SPI mode included)<br />

Equation 2: Baud rate in Smartcard, LIN and IrDA modes<br />

USARTDIV is an unsigned fixed point number that is coded on the USART_BRR register.<br />

● When OVER8=0, the fractional part is coded on 4 bits and programmed by the<br />

DIV_fraction[3:0] bits in the USART_BRR register<br />

● When OVER8=1, the fractional part is coded on 3 bits and programmed by the<br />

DIV_fraction[2:0] bits in the USART_BRR register, and bit DIV_fraction[3] must be kept<br />

cleared.<br />

Note: The baud counters are updated to the new value in the baud registers after a write operation<br />

to USART_BRR. Hence the baud rate register value should not be changed during<br />

communication.<br />

How to derive USARTDIV from USART_BRR register values when OVER8=0<br />

Example 1:<br />

If DIV_Mantissa = 0d27 and DIV_Fraction = 0d12 (USART_BRR = 0x1BC), then<br />

Mantissa (USARTDIV) = 0d27<br />

Fraction (USARTDIV) = 12/16 = 0d0.75<br />

Therefore USARTDIV = 0d27.75<br />

Example 2:<br />

To program USARTDIV = 0d25.62<br />

This leads to:<br />

DIV_Fraction = 16*0d0.62 = 0d9.92<br />

The nearest real number is 0d10 = 0xA<br />

DIV_Mantissa = mantissa (0d25.620) = 0d25 = 0x19<br />

Then, USART_BRR = 0x19A hence USARTDIV = 0d25.625<br />

Example 3:<br />

To program USARTDIV = 0d50.99<br />

This leads to:<br />

DIV_Fraction = 16*0d0.99 = 0d15.84<br />

751/1416 Doc ID 018909 Rev 3<br />

f CK<br />

Tx/Rx baud = ----------------------------------------------------------------------------------<br />

8 × ( 2 – OVER8)<br />

× USARTDIV<br />

f CK<br />

Tx/Rx baud =<br />

---------------------------------------------<br />

16 × USARTDIV

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!