SN32F280 Series
32-Bit Cortex-M0 Micro-Controller
SONiX TECHNOLOGY CO., LTD
Page 174
Version 1.1
register value does not comply with these two requests, then the fractional divider output is undefined.
If DIVADDVAL is zero then the fractional divider is disabled, and the clock will not be divided.
UART can operate with or without using the Fractional Divider. The desired baud rate can be achieved using several
different Fractional Divider settings. The following algorithm illustrates one way of finding a set of DLM, DLL, MULVAL,
and DIVADDVAL values. Such set of parameters yields a baud rate with a relative error of less than 1.1% from the
desired one.
The following example illustrates selecting the DIVADDVAL, MULVAL, DLM, and DLL to generate BR = 115200 when
UARTn_PCLK = 12 MHz, and Oversampling = 16.
UARTn_PCLK
UART
BAUDRATE
=
Oversampling x (256 x DLM + DLL) x (1 + DIVADDVAL / MULVAL)
12000000
115200 =
16 x (256 x DLM + DLL) x (1 + DIVADDVAL / MULVAL)
(256 x DLM + DLL) x (1 + DIVADDVAL / MULVAL) = 6.51
Since the value of MULVAL and DIVADDVAL should comply with the following conditions:
1. 1
≤ MULVAL ≤ 15
2. 0
≤ DIVADDVAL ≤ 14
3. DIVADDVAL< MULVAL
Thus, the suggested UART settings would be: DLM = 0, DLL = 4, DIVADDVAL = 5, and MULVAL = 8 (fill in 7 in the
MULVAL bits). The baud rate generated is 115384, and has a relative error of 0.16% from the originally specified
115200.
15.6 AUTO-BAUD FLOW
15.6.1 AUTO-BAUD
The UART auto-
baud function can be used to measure the incoming baud rate based on the “AT” protocol (Hayes
command). If enabled the auto-baud feature will measure the bit time of the receive data stream and set the divisor latch
registers
Auto-baud function is started by setting the START bit in
register, and can be stopped by clearing the
START bit. The START bit will clear once auto-baud has finished and reading the bit will return the status of auto-baud
(pending/finished). When auto-baud function is started, FIFO will be cleared, not available to write the TX FIFO, and the
transmitter will stop transmitting until auto-baud function finishes or be stopped.
Two auto-baud measuring modes are available which can be selected by the MODE bit in
Mode 0 the baud rate is measured on two subsequent falling edges of the UART RX pin (the falling edge of the start bit
and the falling edge of the least significant bit). In Mode 1 the baud rate is measured between the falling edge and the
subsequent rising edge of the UART RX pin (the length of the start bit).
The AUTORESTART bit in
register can be used to automatically restart baud rate measurement if a
timeout occurs (the rate measurement counter overflows). If this bit is set, the rate measurement will restart at the next
falling edge of the URXD pin.
The auto-baud function can generate two interrupts.
The ABTOINT interrupt in
register will get set if the interrupt is enabled (ABTOIE bit in
register is set and the auto-baud rate measurement counter overflows).
register will get set if the interrupt is enabled (ABTOIE bit in
register is set and the auto-baud has completed successfully).