663
Chapter 32 USART (LIN / FIFO)
8.Notes on using USART
8. Notes on using USART
Notes on using USART are given below.
■ Enabling Operations
In USART, the control register (SCR04) has TXE (transmission) and RXE (reception) operation enable bits.
Both, transmission and reception operations, must be enabled before the transfer starts because they have
been disabled as the default value (initial value).
In single wire bus systems like ISO 9141 (LIN bus system) because of the mono directional communication it
is highly recommended to enable only one of these two bits at the same time. Because of the automatic
reception the sent data by USART would be received by USART too.
■ Cancelling Transfers
Transfers can be cancelled by clearing their operation enable bits TXE / RXE. If RXE is cleared during an
ongoing reception, then the USART state machines must be reset (set UPCL=1). If a transmission is ongoing
at the same time, it will be cancelled too! In this case, wait until TDRE=1 and TBI=1 before setting UPCL.
■ Communication Mode Setting
Set the communication mode while the system is not operating. If the mode is changed during transmission or
reception, the transmission or reception is stopped and possible data will be get lost.
■ Transmission Interrupt Enabling Timing
The default (initial value) of the transmission data empty flag bit (SSR04: TDRE) is “1” (no transmission data
and transmission data write enable state). A transmission interrupt request is generated as soon as the
transmission interrupt request is enabled (SSR04: TIE=1). Be sure to set the TIE flag to “1” after setting the
transmission data to avoid an immediate interrupt.
■ Using LIN operation mode 3
The LIN features are also available in mode 0 (transmitting, receiving break), but using mode 3 sets the
USART data format automatically to LIN format (8N1, LSB first). So, break features are appliable for bus
protocols other than LIN in mode 0. Note, that the transmission time of the break is variable, but the detection
is specified to a minimum of 11 serial bit times.
■ Changing Operation Settings
It is strongly recommended to reset USART after changing operation settings.
Particularly in synchronous mode 2 if (for example) start-/stop-bits are added to or removed from the data
format.
<Caution>
If settings in the Serial Mode Register (SMR04) are desired, it is not useful to set the UPCL bit at the same
time to reset USART. The correct operation settings are not guaranteed in this case. Thus it is recommended
to set the bits of the SMR04 and then to set them again plus the UPCL bit.
■ LIN slave settings
To initiate USART for LIN slave make sure to set the baudrate before receiving the first LIN synchronization
break. This is needed to detect safely the minimum of 11 bit times of a LIN synch break.
■ Software compatibility
Although USART is similar to older Fujitsu-UARTs it is not software compatible to them. The programming
models may be the same, but the structure of the registers differ. Furthermore the setting of the baud rate is
now determined by a reload value instead of selecting a preset value.
■ Bus Idle Function
The Bus Idle Function cannot be used in synchronous mode 2.