
CHAPTER 15 SERIAL INTERFACE UART2
282
User
’
s Manual U14260EJ3V1UD
15.4.2 Asynchronous serial interface (UART) mode
This mode enables full-duplex operation wherein one byte of data after the start bit is transmitted or received.
The on-chip baud rate generator dedicated to UART enables communications using a wide range of selectable
baud rates.
The UART baud rate generator can also be used to generate a MIDI-standard baud rate (31.25 kbps).
(1) Registers to be used
Asynchronous serial interface mode register 2 (ASIM2)
Asynchronous serial interface status register 2 (ASIS2)
Baud rate generator control register 2 (BRGC2)
Asynchronous serial interface transmit status register 2 (ASIF2)
Clock select register 2 (CKSEL2)
Transfer mode specification register 2 (TRMC2)
Port mode register 3 (PM3)
Port register 3 (P3)
The basic procedure of setting an operation in the UART mode is as follows.
<1> Set the CKSEL2 register (see
Figure 15-7
).
<2> Set the BRGC2 register (see
Figure 15-6
).
<3> Clear bits 7 and 6 (TRM12 and TRM02) of the TRMC2 register to 0 and set bit 3 (ISMD2) (see
Figure 15-8
).
<4> Set bits 4 to 0 (PS21, PS20, CL2, SL2, and ISEM2) of the ASIM2 register (see
Figure 15-3
).
<5> Set bit 7 (POWER2) of the ASIM2 register to 1.
<6> Set bit 6 (TXE2) of the ASIM2 register to 1.
→
Transmission is enabled.
<7> Set bit 5 (RXE2) of the ASIM2 register to 1.
→
Reception is enabled.
<8> Write data to TXB2.
→
Data transmission is started.
Caution Take relationship with the other party of communication when setting the port mode register
and port register.
The relationship between the register settings and pins is shown below.
Table 15-2. Relationship Between Register Settings and Pins (UART Mode)
ASIM2
TRMC2
PM34
P34
PM35
P35
Operation Pin Function
POW TXE2 RXE2 PS21 PS20
ER2
CL2
SL2
I
SEM2 TRM12 TRM02 ISMD2
MPIEN2
MPS2
Mode
P34/
SI3/
TxD2
P35/
SO3/
RxD2
1
0
1
0/1
0/1
0/1
×
0/1
0
0
×
×
×
×
Note
×
Note
1
×
Reception P34
RxD2
1
1
0
0/1
0/1
0/1
0/1
×
0
0
0/1
×
×
0
0
×
Note
×
Note
Transmission
TxD2
P35
1
1
1
0/1
0/1
0/1
0/1
0/1
0
0
0/1
×
×
0
0
1
×
Transmission/
TxD2
reception
RxD2
Note
Can be set as port function.
Caution When using UART2, stop the operation of SIO3 (bit 7 (CSIE3) of serial operation mode register 3
(CSIM3) = 0).
Remark
×
: don
’
t care, ASIM2: Asynchronous serial interface mode register 2,
TRMC2: Transfer mode specification register 2, PM
××
: Port mode register,
P
××
: Port output latch