Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
84
Добавлен:
01.03.2016
Размер:
3.56 Mб
Скачать

RM0016

Universal asynchronous receiver transmitter (UART)

 

 

The output enable signal for the Smartcard I/O enables driving into a bidirectional line which is also driven by the Smartcard. This signal is active while transmitting the start and data bits and transmitting NACK. While transmitting the stop bits this signal is disabled, so that the UART weakly drives a ‘1’ on the bidirectional line.

Note: 1 A break character is not significant in Smartcard mode. A 00h data with a framing error will be treated as data and not as a break.

2No IDLE frame is transmitted when toggling the TEN bit. The IDLE frame (as defined for the other configurations) is not defined by the ISO protocol.

Figure 127 details how the NACK signal is sampled by the UART. In this example the UART is transmitting a data and is configured with 1.5 stop bits. The receiver part of the UART is enabled in order to check the integrity of the data and the NACK signal.

Figure 127. Parity error detection using 1.5 stop bits

 

Bit 7

 

Parity Bit

 

 

 

1.5 Stop Bit

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

1 bit time

 

 

 

 

 

 

1.5 bit time

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

sampling at

 

 

 

 

sampling at

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

8th, 9th, 10th

 

 

 

 

 

 

 

16th, 17th, 18th

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

0.5 bit time

 

 

 

1 bit time

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

sampling at

 

 

 

 

 

 

 

sampling at

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

8th, 9th, 10th

 

 

 

 

 

 

 

8th, 9th, 10th

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

The UART can provide a clock to the smartcard through the UART_CK output. In smartcard mode, UART_CK is not associated to the communication but is simply derived from the internal peripheral input clock through a 5-bit prescaler. The division ratio is configured in the prescaler register UART_PSCR. UART_CK frequency can be programmed from fMASTER/2 to fMASTER/62, where fMASTER is the peripheral input clock.

22.3.12IrDA SIR ENDEC block

 

IrDA mode is selected by setting the IREN bit in the UART_CR5 register. The STOP bits in

 

the UART_CR3 register must be configured to “1 stop bit”. In IrDA mode, the following bits

 

must be kept cleared:

 

LINEN, STOP and CKEN bits in the UART_CR3 register,

 

SCEN and HDSEL bits in the UART_CR5 register.

Note:

This feature is only available in UART1, UART2 and UART4.

 

The IrDA SIR physical layer specifies use of a Return to Zero, Inverted (RZI) modulation

 

scheme that represents logic 0 as an infrared light pulse (see Figure 128).

 

The SIR Transmit encoder modulates the Non Return to Zero (NRZ) transmit bit stream

 

output from the UART. The output pulse stream is transmitted to an external output driver

 

and infrared LED. The UART supports only bit rates up to 115.2 kbps for the SIR ENDEC. In

 

normal mode the transmitted pulse width is specified as 3/16 of a bit period.

Doc ID 14587 Rev 9

331/454

Universal asynchronous receiver transmitter (UART)

RM0016

 

 

The SIR receive decoder demodulates the return-to-zero bit stream from the infrared detector and outputs the received NRZ serial bit stream to UART. The decoder input is normally HIGH (marking state) in the idle state. The transmit encoder output has the opposite polarity to the decoder input. A start bit is detected when the decoder input is low.

IrDA is a half duplex communication protocol. If the Transmitter is busy (i.e. the UART is sending data to the IrDA encoder), any data on the IrDA receive line will be ignored by the IrDA decoder and if the Receiver is busy (UART is receiving decoded data from the UART), data on the TX from the UART to IrDA will not be encoded by IrDA. While receiving data, transmission should be avoided as the data to be transmitted could be corrupted.

A ’0’ is transmitted as a high pulse and a ’1’ is transmitted as a ’0’. The width of the pulse is specified as 3/16th of the selected bit period in normal mode (see Figure 129).

The SIR decoder converts the IrDA compliant receive signal into a bit stream for the UART.

The SIR receive logic interprets a high state as a logic one and low pulses as logic zeros.

The transmit encoder output has the opposite polarity to the decoder input. The SIR output is in low state when idle.

The IrDA specification requires the acceptance of pulses greater than 1.41 us. The acceptable pulse width is programmable. Glitch detection logic on the receiver end filters out pulses of width less than 2 PSC periods (PSC is the prescaler value programmed in UART_PSCR). Pulses of width less than 1 PSC period are always rejected, but those of width greater than one and less than two periods may be accepted or rejected, those greater than 2 periods will be accepted as a pulse. The IrDA encoder/decoder doesn’t work when PSC=0.

The receiver can communicate with a low-power transmitter.

In IrDA mode, the STOP bits in the UART_CR2 register must be configured to “1 stop bit”.

IrDA low-power mode

The IrDA can be used either in normal mode or in Low Power mode. The Low Power mode is selected by setting the IRLP bit in UART_CR5 register.

Transmitter:

In low-power mode the pulse width is not maintained at 3/16 of the bit period. Instead, the width of the pulse is 3 times the low-power baud rate which can be a minimum of 1.42 MHz. Generally this value is 1.8432 MHz (1.42 MHz < PSC< 2.12 MHz). A low-power mode programmable divisor divides the system clock to achieve this value.

Receiver:

Receiving in low-power mode is similar to receiving in normal mode. For glitch detection the UART should discard pulses of duration shorter than 1/PSC. A valid low is accepted only if its duration is greater than 2 periods of the IrDA low-power Baud clock (PSC value in UART_PSCR).

Note: 1 A pulse of width less than two and greater than one PSC period(s) may or may not be rejected.

2The receiver set up time should be managed by software. The IrDA physical layer specification specifies a minimum of 10 ms delay between transmission and reception (IrDA is a half duplex protocol).

332/454

Doc ID 14587 Rev 9

RM0016

Universal asynchronous receiver transmitter (UART)

 

 

 

Figure 128. IrDA SIR ENDECblock diagram

 

 

 

IREN bit

 

 

 

IrDA

IrDA_TX

UART_TX pin

 

TX

 

 

Transmit

 

 

 

 

 

 

 

 

 

 

Encoder

 

 

UART

 

IREN bit

 

 

 

 

IrDA

IrDA_RX

UART_RX pin

 

 

Receive

 

RX

 

 

Decoder

 

 

 

 

 

 

Figure 129. IrDA data modulation (3/16) - normal mode

 

Start

 

 

 

 

 

 

 

 

stop bit

TX

bit

 

0

1

0

0

1

1

0

1

 

0

1

 

bit period

 

 

 

 

 

 

 

 

 

IrDA_TDO

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

3/16

 

IrDA_RDI

 

 

 

 

 

 

 

 

 

 

RX

0

1

0

1

0

0

1

1

0

1

 

Doc ID 14587 Rev 9

333/454

Соседние файлы в папке Минимум документации STM8