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.

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

Figure 255. Break detection in LIN mode vs. Framing error detection<br />

In these examples, we suppose that LBDL=1 (11-bit break length), M=0 (8-bit data)<br />

Case 1: break occurring after an Idle<br />

RX line<br />

RXNE / FE<br />

LBD<br />

26.3.9 USART synchronous mode<br />

data 1 IDLE BREAK<br />

data2 (0x55) data 3 (header)<br />

Case 1: break occurring while a data is being received<br />

RX line<br />

RXNE / FE<br />

LBD<br />

The synchronous mode is selected by writing the CLKEN bit in the USART_CR2 register to<br />

1. In synchronous mode, the following bits must be kept cleared:<br />

● LINEN bit in the USART_CR2 register,<br />

1 data time 1 data time<br />

data 1 data 2 BREAK<br />

data2 (0x55) data 3 (header)<br />

1 data time 1 data time<br />

● SCEN, HDSEL and IREN bits in the USART_CR3 register.<br />

The USART allows the user to control a bidirectional synchronous serial communications in<br />

master mode. The SCLK pin is the output of the USART transmitter clock. No clock pulses<br />

are sent to the SCLK pin during start bit and stop bit. Depending on the state of the LBCL bit<br />

in the USART_CR2 register clock pulses will or will not be generated during the last valid<br />

data bit (address mark). The CPOL bit in the USART_CR2 register allows the user to select<br />

the clock polarity, and the CPHA bit in the USART_CR2 register allows the user to select the<br />

phase of the external clock (see Figure 256, Figure 257 & Figure 258).<br />

During the Idle state, preamble and send break, the external SCLK clock is not activated.<br />

In synchronous mode the USART transmitter works exactly like in asynchronous mode. But<br />

as SCLK is synchronized with TX (according to CPOL and CPHA), the data on TX is<br />

synchronous.<br />

In this mode the USART receiver works in a different manner compared to the<br />

asynchronous mode. If RE=1, the data is sampled on SCLK (rising or falling edge,<br />

depending on CPOL and CPHA), without any oversampling. A setup and a hold time must<br />

be respected (which depends on the baud rate: 1/16 bit time).<br />

Note: The SCLK pin works in conjunction with the TX pin. Thus, the clock is provided only if the<br />

transmitter is enabled (TE=1) and a data is being transmitted (the data register USART_DR<br />

Doc ID 018909 Rev 3 766/1416

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

Saved successfully!

Ooh no, something went wrong!