13 Secondary UART (UART2)
The MPC82G516A is equipped with a secondary UART (hereafter, called UART2), which also has four operation
modes the same as the first UART except the following differences:
(1) The UART2 has no enhanced functions: Framing Error Detection and Auto Address Recognition.
(2) The UART2 use the dedicated Baud Rate Timer as its Baud Rate Generator.
(3) The UART2 uses port pin P1.3 (S2TXD) and P1.2 (S2RXD) for transmit and receive, respectively.
These two UARTs can be operated simultaneously in identical or different modes and communication speeds.
13.1 UART2 Related Registers
The following special function registers are related to the operation of the UART2:
S2CON (Address=AAH, UART2 Control Register, Reset Value=0000,0000B)
7
6
5
4
3
2
1
0
S2SM0 S2SM1 S2SM2 S2REN S2TB8
S2RB8
S2TI
S2RI
S2SM0: UART2 Mode Select Bit 0.
S2SM1: UART2 Mode Select Bit 1.
S2SM0 S2SM1
Mode
Description
Baud Rate
0
0
1
1
0
1
0
1
0
1
2
3
Shift Register Fosc/12
8-bit UART
9-bit UART
9-bit UART
Variable
Fosc/64 or Fosc/32
Variable
Where, Fosc is the system clock frequency.
S2SM2: Enables the multiprocessor communication feature in Modes 2 or 3. If SM2=1 then Rl will not be set
unless the received 9th data bit (RB8) is ‘1’, indicating an address, and the received byte is a Given or Broadcast
Address. In Mode 1, if SM2=1 then Rl will not be activated unless a valid stop bit was received, and the received
byte is a Given or Broadcast Address. In Mode 0, SM2 should be ‘0’.
S2REN: Enables serial reception. Set by software to enable reception. Cleared by software to disable reception.
S2TB8: The 9th data bit that will be transmitted in Modes 2 and 3. Set or cleared by software as desired.
S2RB8: In modes 2 and 3, the 9th data bit that was received. In Mode 1, if SM2=0, RB8 is the stop bit that was
received. In Mode 0, RB8 is not used.
S2Tl: Transmit interrupt flag. Set by hardware at the end of the 8th bit time in Mode 0, or at the beginning of the
stop bit in the other modes, in any serial transmission. Must be cleared by software.
S2Rl: Receive interrupt flag. Set by hardware at the end of the 8th bit time in Mode 0, or halfway through the stop
bit time in the other modes, in any serial reception (except see SM2). Must be cleared by software.
S2BUF (Address=9AH, UART2 Serial Data Buffer, Reset Value=xxH)
7
6
5
4
3
2
1
0
(D7)
(D6)
(D5)
(D4)
(D3)
(D2)
(D1)
(D0)
S2BRT (Address=BAH, UART2 Baud Rate Timer Reload Register, Reset Value=00H)
7
6
5
4
3
2
1
0
(Baud Rate Timer Reload Value)
AUXR2 (Address=A6H, Auxiliary Register 2, Reset Value=0000,0000B)
7
6
5
4
3
2
1
0
T0X12
T1X12 URM0X6 S2TR S2SMOD S2TX12 S2CKOE T0CKOE
S2TR: UART2 Baud Rate Timer control bit. Set/clear to turn on/off, respectively.
S2SMOD: UART2 double baud rate enable bit. When set, the baud rate is doubled.
S2TX12: UART2 Baud Rate Timer clock source select. Set to select Fosc, and clear to select Fosc/12.
S2CKOE: Set to enable the clock output of UART2 Baud Rate Timer on P3.5.
63
MPC82G516A Data Sheet
MEGAWIN