
ST10R272L - ASYNCHRONOUS/SYNCHRONOUS SERIAL INTERFACE
234/320
the error interrupt request is due to an overrun error (Asynchronous and synchronous
mode).
12.4
ASC0 baud rate generation
The serial channel ASC0 has its own dedicated 13-bit baud rate generator with 13-bit reload
capability, allowing baud rate generation independent from the timers.
The baud rate generator is clocked with the CPU clock divided by 2. The timer is counting
downwards and can be started or stopped through the Baud Rate Generator Run Bit S0R in
register S0CON. Each underflow of the timer provides one clock pulse to the serial channel.
The timer is reloaded with the value stored in its 13-bit reload register each time it
underflows. The resulting clock is again divided according to the operating mode and
controlled by the Baudrate Selection Bit S0BRS. If S0BRS=’1’, the clock signal is
additionally divided to 2/3rd of its frequency (see formulas and table). So the baud rate of
ASC0 is determined by the CPU clock, the reload value, the value of S0BRS and the
operating mode (asynchronous or synchronous).
Register S0BG is the dual-function Baud Rate Generator/Reload register. Reading S0BG
returns the content of the timer (bits 15...13 return zero), while writing to S0BG always
updates the reload register (bits 15...13 are insignificant).
An auto-reload of the timer with the content of the reload register is performed each time
S0BG is written to. However, if S0R=’0’ at the time the write operation to S0BG is performed,
the timer will not be reloaded until the first instruction cycle after S0R=’1’.
12.4.1 Asynchronous mode baud rates
For asynchronous operation, the baud rate generator provides a clock with 16 times the rate
of the established baud rate. Every received bit is sampled at the 7th, 8th and 9th cycle of
this clock. The baud rate for asynchronous operation of serial channel ASC0 and the
required reload value for a given baudrate can be determined by the following formulas:
<S0BRL> is the content of the reload register, taken as unsigned 13-bit integer,
<S0BRS> is the value of bit S0BRS (i.e. ‘0’ or ‘1’), taken as integer.
Using the above equation, the maximum baud rate can be calculated for any given clock
speed. The device datasheet gives a table of values for baud rate vs reload register value for
SOBRS=0 and SOBRS=1.
B
Async
=
f
CPU
(32 + 16*<S0BRS>) * (<S0BRL> + 1)
S0BRL = (
f
CPU
(32 + 16*<S0BRS>) * B
Async
) - 1