Professional Documents
Culture Documents
r!
o
Application Notes
o
d
AML 8726-MX
m
UART Interface User Guide
E
to
te
u
ib
AMLOGIC, Inc.
3930 Freedom Circle
tr
www.amlogic.com
D
AMLOGIC reserves the right to change any information described herein at any time without notice.
AMLOGIC assumes no responsibility or liability from use of such information.
Table of Content
1. GENERAL DESCRIPTION ............................................................................................................................................. 4
2. OVERVIEW ....................................................................................................................................................................... 4
3. FEATURES ........................................................................................................................................................................ 4
4. UART SIGNAL AND PIN MAPPING ............................................................................................................................ 5
4.1. SIGNAL ......................................................................................................................................................................... 5
4.2. PIN MAPPING ................................................................................................................................................................ 5
r!
5. INTERRUPT ...................................................................................................................................................................... 6
6. POWER MANAGEMENT ............................................................................................................................................... 7
o
7. RESET ................................................................................................................................................................................ 7
o
8. BAUD RATE ...................................................................................................................................................................... 8
8.1. INPUT CLOCK................................................................................................................................................................ 8
d
8.2. BAUD RATE GENERATION ............................................................................................................................................ 8
m
9. REGISTER DESCRIPTIONS .......................................................................................................................................... 9
9.1. UART_A...................................................................................................................................................................... 9
9.2. UART_B .................................................................................................................................................................... 14
E
9.3. UART_C .................................................................................................................................................................... 19
9.4. UART_AO ................................................................................................................................................................. 24
10. ADDRESS MAPPING ................................................................................................................................................. 29
to
11. ANDROID™/LINUX KERNEL ................................................................................................................................. 30
11.1. OPERATION MACRO DEFINITION ............................................................................................................................ 30
11.2. REGISTER MACRO DEFINITION ............................................................................................................................... 30
te
u
ib
tr
is
D
Revision History
Revision Revised Date By Changes
Number
0.1 Feb. 15, 2012 Kevin Zhu Initial release draft
0.2 May. 22,2012 Kevin Zhu UART0~2 renamed to UART_A, UART_B and UART_C
r!
o
o
d
m
E
to
te
u
ib
tr
is
D
1. General Description
Amlogic AML8726-MX is a highly integrated multimedia application processor SoC for Multimedia Internet Device
(MID), tablet and Set Top Box (STB). It integrates a powerful CPU, a 2D/3D graphics subsystem and a
state-of-the-art video decoding engine together with all major peripherals.
This document is a user guide of universal asynchronous receiver/transmitter (UART) serial ports integrated in
AML8726-MX.
r!
The guide provides:
An overview of UART interface
o
The feature of UART
The UART interface pin selection
o
The baud rate generation
The register definition that control and operate UART interface
AML8726-MX UART in Android/Linux Amlogic porting
d
m
2. Overview
Each AML8726-MX has four fully functional UARTs which use the same programming model. They are named as
E
UART_A, UART_B, UART_C and UART_AO. The one with ‘AO’ in the naming are located at the Always-On (AO)
power domain, which cannot be powered off unless AML8726-MX is disconnected from power supply.
The four UARTs are controlled separately. Each UART has a build-in standalone register set for controlling and
to
data exchange.
The UARTs in AML8726-MX can only operate in FIFO mode. UART_A has a 128-byte RX/TX FIFO and
UART_B/UART_C/UART_AO has a 64-byte FIFO. If non-FIFO mode is required, the registers of UART should be
fine tuned and a polling mechanism should be used to fulfill.
te
Each UART has programmable interrupt generation circuit which will reduce the loading of processor and to
improve communication performance.
u
16
A baud-rate generator is also contained in each UART to provide flexible division of input clock by 1 to (2 -1) or 1
23
to (2 -1) according to the setting in the internal register.
ib
3. Features
tr
r!
Table 1. UART Signal Descriptions
Name Type Description
o
RX Input Serial data input to the receive shift register and Receive FIFO.
TX Output Serial data output to external data set.
CTS Input Clear to Send.
o
When asserted, it indicates that the receiver is ready to exchange data.
RTS Output Request to Send.
d
When asserted, it notifies the receiver that the sender is ready to exchange data.
m
4.2. Pin Mapping
In AML8726-MX, only UART RX and TX signal are available. If CTS and RTS signal are required, please contact
with Amlogic Sales.
E
AML8726-MX has 11 GPIO banks. UART_A, UART_B and UART_C are located in Bank X and UART_AO is in the
to
dedicated Bank AO. RX and TX signals of the UART function blocks can be multiplexed to the corresponding bank
in pair.
The relationship between pins and registers of each UART signal and GPIO bank is shown in the table below:
te
UART_TX_A GPIOX_13
UART_A
UART_CTS_A GPIOX_15
ib
UART_RTS_A GPIOX_16
UART_RX_B GPIOX_18
UART_TX_B GPIOX_17
UART_B
tr
UART_CTS_B GPIOX_19
UART_RTS_B GPIOX_20
UART_RX_C GPIOX_22
is
UART_TX_C GPIOX_21
UART_C
UART_CTS_C GPIOX_23
UART_RTS_C GPIOX_24
D
UART_RX_AO GPIOAO_1
UART_TX_AO GPIOAO_0
UART_AO
UART_CTS_AO GPIOAO_2
UART_RTS_AO GPIOAO_3
About GPIO function settings, please refer to AML8726-MX GPIO User Guide for detailed description.
5. Interrupt
The UART interrupts are controlled in two levels: CPU and Function.
In CPU level, the UART interrupts can be controlled and programmed by using the registers below:
r!
set to 1.
0x2691 bit 26 R/W Write 1 to this register bit to clean UART_A interrupt flag.
o
UART_A 0x2692 bit 26 R/W Interrupt mask. Set to 1 to mask UART_A interrupt (disable
UART_A interrupt).
0x2693 bit 26 R/W Fast interrupt enable. Set to 1 to enable UART_A interrupt
o
multiplexing to CPU FAST interrupt
0x2698 bit 11 R UART_B interrupt flag. When interrupt happens, it will be
d
set to 1.
0x2699 bit 11 R/W Write 1 to this register bit to clean UART_B interrupt flag.
m
UART_B 0x269A bit 11 R/W Interrupt mask. Set to 1 to mask UART_B interrupt (disable
UART_A interrupt).
0x269B bit 11 R/W Fast interrupt enable. Set to 1 to enable UART_B interrupt
E
multiplexing to CPU FAST interrupt
0x2698 bit 29 R UART_C interrupt flag. When interrupt happens, it will be
set to 1.
0x2699 bit 29 R/W Write 1 to this register bit to clean UART_C interrupt flag.
to
UART_C 0x269A bit 29 R/W Interrupt mask. Set to 1 to mask UART_C interrupt (disable
UART_AO interrupt).
0x269B bit 29 R/W Fast interrupt enable. Set to 1 to enable UART_C interrupt
multiplexing to CPU FAST interrupt
0x2698 bit 26 R UART_AO interrupt flag. When interrupt happens, it will be
te
set to 1.
0x2699 bit 26 R/W Write 1 to this register bit to clean UART_AO interrupt flag.
UART_AO 0x269A bit 26 R/W Interrupt mask. Set to 1 to mask UART_AO interrupt
u
In Function Level, the block registers need to be set to enable UART interrupt.
UART_A: UART_A_CONTROL[27] and [28] must be set to 1.
tr
For more details and other register setup, please refer to the Register Descriptions section.
D
6. Power Management
The UARTs in AML8726-MX can be shut down to save power consumption by using the register bits described
below:
Need verify
UART_A: in EE domain;
UART_B: in EE domain;
UART_C: in EE domain;
UART_AO: in AO domain;
r!
Setting these bits to 0 will disable the UARTs function blocks and 1 will enable them. After system power-on or
reset, UART modules are enabled on default.
o
o
7. Reset
d
For the UART module in the AO power domain, it is possible to reset it by programming the register bit 0x0010[17]
which is also in AO domain. Setting this bit to 1 will reset the I2C AO function blocks.
m
Note: The receivers and transmitters of UARTs are disabled after system power-on or reset. Therefore software
must program the registers to enable them, e.g., bit 12 and 13 in the corresponding control register should be set
E
to 1.
to
te
u
ib
tr
is
D
8. Baud Rate
A build-in baud rate generator is implemented in AML8726-MX for each UART interface. The generator contains
an input clock, a divider circuits and control registers.
r!
on AML8726-MX system software implementation.
In Amlogic Android/Linux porting for AML8726-MX, the value of UART_Clock can be obtained by using the
o
following process in software.
o
2. Include clock.h at [linux_kernel_root]/arch/arm/mach-meson/include/mach/.
3. Define a variable type struct clk.
d
4. Define an unsigned int type variable uart_clock_rate.
5. Use API clk_get_sys(“clk81”, NULL) to get clock structure.
m
6. Use API clk_get_rate() to get the value of UART_Clock.
#include <linux/clk.h>
#include <asm/clkdev.h>
#include <mach/clock.h> E
to
unsigned int uart_clock_rate;
struct clk *uart_clock
After obtaining the uart_clock_rate, software can use the equation as shown below to generate correct baud rate.
ib
UART_A: or or
UART_B: or or
tr
UART_C: or or
UART_AO: or or
is
D
9. Register Descriptions
These are 6 registers are defined and implemented in AML8726-MX for each UART. They are all 32-bit.
9.1. UART_A
Write Buffer Register (UART_A_WFIFO)
r!
UART_A_WFIFO is the data entry of UART_A transmit FIFO. Writing to the register puts a byte data into the top of
transmit FIFO. The data at the front of the FIFO transmits automatically until transmit FIFO empty.
o
Table 4. UART_A_WFIFO register definition
Name UART_A_WFIFO Offset 0x2130 Width 32-bit
o
Bit R/W Name Default Description
31:8 R - 0 Reserved
d
7:0 W FIFO_WDATA - Write UART Transmit FIFO. The Write FIFO holds 64 bytes
m
Read Buffer Register (UART_A_RFIFO)
UART_A_RFIFO is the data entry of UART Read FIFO. It latches the value of data byte at the front of UART Read
FIFO.
Name UART_A_RFIFO
Bit R/W Name
Offset 0x2131
Default Description
E
Table 5. UART_A_RFIFO register definition
Width 32-bit
to
31:8 R - 0 Reserved
7:0 R FIFO_RDATA 0x00 Read a byte from UART FIFO.
te
u
ib
tr
is
D
r!
28 R/W UART_TX_INT_EN 0 Transmit byte interrupt enable. When enabled, an interrupt will be
generated whenever a byte is read from Transmit FIFO.
0: disable transmit byte interrupt
o
1: enable transmit byte interrupt
27 R/W UART_RX_INT_EN 0 Receive byte interrupt enable. When enabled, an interrupt will be
o
generated whenever a byte is written to Read FIFO.
0: disable receive byte interrupt
1: enable receive byte interrupt
d
26 R/W UART_TX_INV 0 Invert TX signal. 0: TX active HIGH. 1: TX active LOW
25 R/W UART_RX_INV 0 Invert RX signal. 0: RX active HIGH. 1: RX active LOW
m
24 R/W UART_CLR_ERR 0 Clear error. Writing 1 to this register bit clears error.
Note: This bit does not clear to 0 automatically. Please set the bit
to 0 after clearing error manually.
E
23 R/W UART_RX_RST 0 Reset receive state machine. Writing 1 to this register bit resets
receive state machine.
22 R/W UART_TX_RST 0 Reset transmit state machine. Write 1 to this register bit reset
transmit state machine.
to
21:20 R/W UART_DATA_LEN 00 Character length of data.
00: 8-bit
01: 7-bit
10: 6-bit
11: 5-bit
te
19 R/W PARITY_EN 1 Parity enable bit. 0: disable parity bit. 1: enable parity bit
18 R/W PARITY_TYPE 0 Parity type bit. 0: even parity. 1: odd parity
17:16 R/W STOP_BIT_LEN 0 Stop bit length.
u
10-11: reserved.
15 R/W TWO_WIRE_EN 0 Two-wire mode enables. 0: four-wire mode. 1: Two-wire mode
14 - - 0 Reserved
tr
transmit function
11:0 R/W BAUD_RATE 0x120 Baud rate setup. Please refer to Baud Rate Generation Section
for detail.
D
r!
25 R UART_XMIT_BUSY 0 Transmit state machine busy indicator. Being set to 1
indicates transmit state machine is busy
24 R RECV_FIFO_OVERFLOW 0 Receive FIFO overflow indicator. Being set to 1 indicates
o
receive FIFO overflows
23 R CTS_LEVEL 0 CTS signal level.
o
22 R TX_FIFO_EMPTY 0 Transmit FIFO Empty indicator. Being set to 1 indicates
Transmit FIFO is empty
d
21 R TX_FIFO_FULL 0 Transmit FIFO Full indicator. Being set to1 indicates
Transmit FIFO is full.
20 R RX_FIFO_EMPTY 0 Receive FIFO Empty indicator. Being set to 1 indicates
m
Receive FIFO is empty
19 R RX_FIFO_FULL 0 Receive FIFO Full indicator. Being set to 1 indicates
Receive FIFO is full.
E
18 R TX_FIFO_WERR 0 Transmit FIFO writing error indicator. The bit is set to 1 if
writing data to Transmit FIFO when Transmit FIFO is full.
Note: Please use register UART_A_CONTROL bit 24 to
clear this bit. Refer to UART_A_CONTROL register
to
definition.
17 R FRAME_ERR 0 Frame Error indicator. The bit is set to 1 if frame error
detected.
Note: Please use register UART_A_CONTROL bit 24 to
clear this bit. Refer to UART_A_CONTROL register
te
definition.
16 R PARITY_ERR 0 Parity Error indicator. The bit is set to 1 if parity error
detected.
u
15 - - 0 Reserved
14:8 R TX_FIFO_DCNT 0 Transmit FIFO data count. The value is the number of
bytes in the Transmit FIFO.
7 R - 0 Reserved
tr
6:0 R RX_FIFO_DCNT 0 Receive FIFO data count. The value is the number of
bytes in the Receive FIFO.
is
D
r!
you can set this bit to 1.
29 R/W ASYNC_FIFO_PURGE 0 Set to 1 after all UART bytes have been received in order to
purge the data into the async FIFO
o
28 R/W ASYNC_FIFO_EN 0 Automatically send to async FIFO module enable
1: enable automatic sending
o
0:disable automatic sending
27 R/W CTS_FIL_TB_SEL 0 CTS input filter time base selection.
A digital signal filter can be used to filter the UART CTS signal
d
input.
The filter has two parameters, the time base and the number
m
of time base.
0: The time base is 111nS.
1: The time base is 1uS.
E
26-24 R/W CTS_FIL_SEL 0 CTS input filter times
000: No filter.
…
111: Maximum filter time. The time is 7x 111= 777nS
to
(CTS_FIL_TB_SEL = 0) or 7x 1=7uS (CTS_FIL_TB_SEL = 1)
23-20 R/W BAUD_RATE_EXT 0 Extend the baud rate divider to 16-bits together with
UART_A_STATUS[11:0]
Baud_Rate = {Reg4[23:20],Reg2[11:0]}
19 R/W RX_FIL_TB_SEL 0 RX input filter time base selection.
te
time base.
0: The time base is 111nS.
1: The time base is 1uS.
ib
UART_A_REG5
Table 9. UART_A_REG5 register definition
Name UART_A_REG5 Offset 0x2135 Width 32-bit
Bit R/W Name Default Description
31-24 R/W - 0 unused
23 R/W USE New Baud rate. 0 Over the years, the baud rate has been extended by
concatenating bits from different registers. To take
advantage of the full 23-bit baud rate generate (extended to
23 bits to accommodate very low baud rates), you must set
r!
this bit. If this bit is set, then the baud rate is configured
using bits [22:0] below
22:0 R/W NEW_BAUD_RATE: 0 If bit[23] = 1 above, then the baud rate for the UART is
o
computed using these bits. This was added in MX to
accommodate lower baud rates.
o
d
m
E
to
te
u
ib
tr
is
D
9.2. UART_B
Write Buffer Register (UART_B_WFIFO)
UART_B_WFIFO is the data entry of UART_B transmit FIFO. Writing to the register puts a byte data into the top of
transmit FIFO. The data at the front of the FIFO transmits automatically until transmit FIFO empty.
r!
31:8 R - 0 Reserved
7:0 W FIFO_WDATA - Write UART Transmit FIFO.
o
Read Buffer Register (UART_B_RFIFO)
UART_B_RFIFO is the data entry of UART Read FIFO. It latches the value of data byte at the front of UART Read
o
FIFO.
d
Table 9. UART_B_RFIFO register definition
Name UART_B_RFIFO Offset 0x2138 Width 32-bit
m
Bit R/W Name Default Description
31:8 R - 0 Reserved
7:0 R FIFO_RDATA 0x00 Read a byte from UART FIFO.
E
to
te
u
ib
tr
is
D
r!
28 R/W UART_TX_INT_EN 0 Transmit byte interrupt enable. When enabled, an interrupt will be
generated whenever a byte is read from Transmit FIFO.
0: disable transmit byte interrupt
o
1: enable transmit byte interrupt
27 R/W UART_RX_INT_EN 0 Receive byte interrupt enable. When enabled, an interrupt will be
o
generated whenever a byte is written to Read FIFO.
0: disable receive byte interrupt
1: enable receive byte interrupt
d
26 R/W UART_TX_INV 0 Invert TX signal. 0: TX active HIGH. 1: TX active LOW
25 R/W UART_RX_INV 0 Invert RX signal. 0: RX active HIGH. 1: RX active LOW
m
24 R/W UART_CLR_ERR 0 Clear error. Writing 1 to this register bit clears error.
Note: This bit does not clear to 0 automatically. Please set the bit
to 0 after clearing error manually.
E
23 R/W UART_RX_RST 0 Reset receive state machine. Writing 1 to this register bit resets
receive state machine.
22 R/W UART_TX_RST 0 Reset transmit state machine. Write 1 to this register bit reset
transmit state machine.
to
21:20 R/W UART_DATA_LEN 00 Character length of data.
00: 8-bit
01: 7-bit
10: 6-bit
11: 5-bit
te
19 R/W PARITY_EN 1 Parity enable bit. 0: disable parity bit. 1: enable parity bit
18 R/W PARITY_TYPE 0 Parity type bit. 0: even parity. 1: odd parity
17:16 R/W STOP_BIT_LEN 0 Stop bit length.
u
10-11: reserved.
15 R/W TWO_WIRE_EN 0 Two-wire mode enables. 0: four-wire mode. 1: Two-wire mode
14 - - 0 Reserved
tr
transmit function
11:0 R/W BAUD_RATE 0x120 Baud rate setup. Please refer to Baud Rate Generation Section
for detail.
D
r!
25 R UART_XMIT_BUSY 0 Transmit state machine busy indicator. Being set to 1
indicates transmit state machine is busy
24 R RECV_FIFO_OVERFLOW 0 Receive FIFO overflow indicator. Being set to 1 indicates
o
receive FIFO overflows
23 R CTS_LEVEL 0 CTS signal level.
o
22 R TX_FIFO_EMPTY 0 Transmit FIFO Empty indicator. Being set to 1 indicates
Transmit FIFO is empty
d
21 R TX_FIFO_FULL 0 Transmit FIFO Full indicator. Being set to1 indicates
Transmit FIFO is full.
20 R RX_FIFO_EMPTY 0 Receive FIFO Empty indicator. Being set to 1 indicates
m
Receive FIFO is empty
19 R RX_FIFO_FULL 0 Receive FIFO Full indicator. Being set to 1 indicates
Receive FIFO is full.
E
18 R TX_FIFO_WERR 0 Transmit FIFO writing error indicator. The bit is set to 1 if
writing data to Transmit FIFO when Transmit FIFO is full.
Note: Please use register UART_B_CONTROL bit 24 to
clear this bit. Refer to UART_B_CONTROL register
to
definition.
17 R FRAME_ERR 0 Frame Error indicator. The bit is set to 1if frame error
detected.
Note: Please use register UART_B_CONTROL bit 24 to
clear this bit. Refer to UART_B_CONTROL register
te
definition.
16 R PARITY_ERR 0 Parity Error indicator. The bit is set to 1 if parity error
detected.
u
15 - - 0 Reserved
14:8 R TX_FIFO_DCNT 0 Transmit FIFO data count. The value is the number of
bytes in the Transmit FIFO.
7 R - 0 Reserved
tr
6:0 R RX_FIFO_DCNT 0 Receive FIFO data count. The value is the number of
bytes in the Receive FIFO.
is
D
r!
you can set this bit to 1.
29 R/W ASYNC_FIFO_PURGE 0 Set to 1 after all UART bytes have been received in order to
purge the data into the async FIFO
o
28 R/W ASYNC_FIFO_EN 0 Automatically send to async FIFO module enable
1: enable automatic sending
o
0:disable automatic sending
27 R/W CTS_FIL_TB_SEL 0 CTS input filter time base selection.
A digital signal filter can be used to filter the UART CTS signal
d
input.
The filter has two parameters, the time base and the number
m
of time base.
0: The time base is 111nS.
1: The time base is 1uS.
E
26-24 R/W CTS_FIL_SEL 0 CTS input filter times
000: No filter.
…
111: Maximum filter time. The time is 7x 111= 777nS
to
(CTS_FIL_TB_SEL = 0) or 7x 1=7uS (CTS_FIL_TB_SEL = 1)
23-20 R/W BAUD_RATE_EXT 0 Extend the baud rate divider to 16-bits together with
UART_B_STATUS[11:0]
Baud_Rate = [BAUD_RATE_EXT: BAUD_RATE]
19 R/W RX_FIL_TB_SEL 0 RX input filter time base selection.
te
time base.
0: The time base is 111nS.
1: The time base is 1uS.
ib
UART_B_REG5
Table 15. UART_B_REG5 register definition
Name UART_B_REG5 Offset 0x213c Width 32-bit
Bit R/W Name Default Description
31-24 R/W - 0 unused
23 R/W USE New Baud rate. 0 Over the years, the baud rate has been extended by
concatenating bits from different registers. To take
advantage of the full 23-bit baud rate generate (extended to
23 bits to accommodate very low baud rates), you must set
r!
this bit. If this bit is set, then the baud rate is configured
using bits [22:0] below
22:0 R/W NEW_BAUD_RATE: 0 If bit[23] = 1 above, then the baud rate for the UART is
o
computed using these bits. This was added in MX to
accommodate lower baud rates.
o
d
m
E
to
te
u
ib
tr
is
D
9.3. UART_C
Write Buffer Register (UART_C_WFIFO)
UART_C_WFIFO is the data entry of UART transmit FIFO. Writing to the register puts a byte data into the top of
transmit FIFO. The data at the front of the FIFO transmits automatically until transmit FIFO empty.
r!
31:8 R - 0 Reserved
7:0 W FIFO_WDATA - Write UART Transmit FIFO.
o
Read Buffer Register (UART_C_RFIFO)
UART_C_RFIFO is the data entry of UART Read FIFO. It latches the value of data byte at the front of UART Read
o
FIFO.
d
Table 13. UART_C_RFIFO register definition
Name UART_C_RFIFO Offset 0x21C1 Width 32-bit
m
Bit R/W Name Default Description
31:8 R - 0 Reserved
7:0 R FIFO_RDATA 0x00 Read a byte from UART FIFO.
E
to
te
u
ib
tr
is
D
r!
28 R/W UART_TX_INT_EN 0 Transmit byte interrupt enable. When enabled, an interrupt will be
generated whenever a byte is read from Transmit FIFO.
0: disable transmit byte interrupt
o
1: enable transmit byte interrupt
27 R/W UART_RX_INT_EN 0 Receive byte interrupt enable. When enabled, an interrupt will be
o
generated whenever a byte is written to Read FIFO.
0: disable receive byte interrupt
1: enable receive byte interrupt
d
26 R/W UART_TX_INV 0 Invert TX signal. 0: TX active HIGH. 1: TX active LOW
25 R/W UART_RX_INV 0 Invert RX signal. 0: RX active HIGH. 1: RX active LOW
m
24 R/W UART_CLR_ERR 0 Clear error. Writing 1 to this register bit clears error.
Note: This bit does not clear to 0 automatically. Please set the bit
to 0 after clearing error manually.
E
23 R/W UART_RX_RST 0 Reset receive state machine. Writing 1 to this register bit resets
receive state machine.
22 R/W UART_TX_RST 0 Reset transmit state machine. Write 1 to this register bit reset
transmit state machine.
to
21:20 R/W UART_DATA_LEN 00 Character length of data.
00: 8-bit
01: 7-bit
10: 6-bit
11: 5-bit
te
19 R/W PARITY_EN 1 Parity enable bit. 0: disable parity bit. 1: enable parity bit
18 R/W PARITY_TYPE 0 Parity type bit. 0: even parity. 1: odd parity
17:16 R/W STOP_BIT_LEN 0 Stop bit length.
u
10-11: reserved.
15 R/W TWO_WIRE_EN 0 Two-wire mode enables. 0: four-wire mode. 1: Two-wire mode
14 - - 0 Reserved
tr
transmit function
11:0 R/W BAUD_RATE 0x120 Baud rate setup. Please refer to Baud Rate Generation Section
for detail.
D
r!
25 R UART_XMIT_BUSY 0 Transmit state machine busy indicator. Being set to 1
indicates transmit state machine is busy
24 R RECV_FIFO_OVERFLOW 0 Receive FIFO overflow indicator. Being set to 1 indicates
o
receive FIFO overflows
23 R CTS_LEVEL 0 CTS signal level.
o
22 R TX_FIFO_EMPTY 0 Transmit FIFO Empty indicator. Being set to 1 indicates
Transmit FIFO is empty
d
21 R TX_FIFO_FULL 0 Transmit FIFO Full indicator. Being set to1 indicates
Transmit FIFO is full.
20 R RX_FIFO_EMPTY 0 Receive FIFO Empty indicator. Being set to 1 indicates
m
Receive FIFO is empty
19 R RX_FIFO_FULL 0 Receive FIFO Full indicator. Being set to 1 indicates
Receive FIFO is full.
E
18 R TX_FIFO_WERR 0 Transmit FIFO writing error indicator. The bit is set to 1 if
writing data to Transmit FIFO when Transmit FIFO is full.
Note: Please use register UART_C_CONTROL bit 24 to
clear this bit. Refer to UART_C_CONTROL register
to
definition.
17 R FRAME_ERR 0 Frame Error indicator. The bit is set to 1if frame error
detected.
Note: Please use register UART_C_CONTROL bit 24 to
clear this bit. Refer to UART_C_CONTROL register
te
definition.
16 R PARITY_ERR 0 Parity Error indicator. The bit is set to 1 if parity error
detected.
u
15 - - 0 Reserved
14:8 R TX_FIFO_DCNT 0 Transmit FIFO data count. The value is the number of
bytes in the Transmit FIFO.
7 R - 0 Reserved
tr
6:0 R RX_FIFO_DCNT 0 Receive FIFO data count. The value is the number of
bytes in the Receive FIFO.
is
D
r!
you can set this bit to 1.
29 R/W ASYNC_FIFO_PURGE 0 Set to 1 after all UART bytes have been received in order to
purge the data into the async FIFO
o
28 R/W ASYNC_FIFO_EN 0 Automatically send to async FIFO module enable
1: enable automatic sending
o
0:disable automatic sending
27 R/W CTS_FIL_TB_SEL 0 CTS input filter time base selection.
A digital signal filter can be used to filter the UART CTS signal
d
input.
The filter has two parameters, the time base and the number
m
of time base.
0: The time base is 111nS.
1: The time base is 1uS.
E
26-24 R/W CTS_FIL_SEL 0 CTS input filter times
000: No filter.
…
111: Maximum filter time. The time is 7x 111= 777nS
to
(CTS_FIL_TB_SEL = 0) or 7x 1=7uS (CTS_FIL_TB_SEL = 1)
23-20 R/W BAUD_RATE_EXT 0 Extend the baud rate divider to 16-bits together with
UART_C_STATUS[11:0]
Baud_Rate = [BAUD_RATE_EXT: BAUD_RATE]
19 R/W RX_FIL_TB_SEL 0 RX input filter time base selection.
te
time base.
0: The time base is 111nS.
1: The time base is 1uS.
ib
UART_C_REG5
Table 21. UART_C_REG5 register definition
Name UART_C_REG5 Offset 0x21c5 Width 32-bit
Bit R/W Name Default Description
31-24 R/W - 0 unused
23 R/W USE New Baud rate. 0 Over the years, the baud rate has been extended by
concatenating bits from different registers. To take
advantage of the full 23-bit baud rate generate (extended to
23 bits to accommodate very low baud rates), you must set
r!
this bit. If this bit is set, then the baud rate is configured
using bits [22:0] below
22:0 R/W NEW_BAUD_RATE: 0 If bit[23] = 1 above, then the baud rate for the UART is
o
computed using these bits. This was added in MX to
accommodate lower baud rates.
o
d
m
E
to
te
u
ib
tr
is
D
9.4. UART_AO
The following registers are for UART_AO module and located in the AO power domain.
r!
Bit R/W Name Default Description
31:8 - - 0 Reserved
o
7:0 W FIFO_WDATA - Write UART Transmit FIFO.
o
Read Buffer Register (AO_UART_RFIFO)
AO_UART_RFIFO is the data entry of UART Read FIFO. It latches the value of data byte at the front of UART
d
Read FIFO.
m
Name AO_UART_RFIFO Offset 0x0131 Width 32-bit
Bit R/W Name Default Description
31:8 - - 0 Reserved
7:0 R FIFO_RDATA 0x00
E
Read a byte from UART FIFO.
to
te
u
ib
tr
is
D
r!
28 R/W UART_TX_INT_EN 0 Transmit byte interrupt enable. When enabled, an interrupt will be
generated whenever a byte is read from Transmit FIFO.
0: disable transmit byte interrupt
o
1: enable transmit byte interrupt
27 R/W UART_RX_INT_EN 0 Receive byte interrupt enable. When enabled, an interrupt will be
o
generated whenever a byte is written to Read FIFO.
0: disable receive byte interrupt
1: enable receive byte interrupt
d
26 R/W UART_TX_INV 0 Invert TX signal. 0: TX active HIGH. 1: TX active LOW
25 R/W UART_RX_INV 0 Invert RX signal. 0: RX active HIGH. 1: RX active LOW
m
24 R/W UART_CLR_ERR 0 Clear error. Writing 1 to this register bit clears error.
Note: This bit does not clear to 0 automatically. Please set the bit
to 0 after clearing error manually.
E
23 R/W UART_RX_RST 0 Reset receive state machine. Writing 1 to this register bit resets
receive state machine.
22 R/W UART_TX_RST 0 Reset transmit state machine. Write 1 to this register bit reset
transmit state machine.
to
21:20 R/W UART_DATA_LEN 00 Character length of data.
00: 8-bit
01: 7-bit
10: 6-bit
11: 5-bit
te
19 R/W PARITY_EN 1 Parity enable bit. 0: disable parity bit. 1: enable parity bit
18 R/W PARITY_TYPE 0 Parity type bit. 0: even parity. 1: odd parity
17:16 R/W STOP_BIT_LEN 0 Stop bit length.
u
10-11: reserved.
15 R/W TWO_WIRE_EN 0 Two-wire mode enables. 0: four-wire mode. 1: Two-wire mode
14 R/W - 0 Reserved
tr
transmit function
11:0 R/W BAUD_RATE 0x120 Baud rate setup. Please refer to Baud Rate Generation Section
for detail.
D
r!
25 R UART_XMIT_BUSY 0 Transmit state machine busy indicator. Being set to 1
indicates transmit state machine is busy
24 R RECV_FIFO_OVERFLOW 0 Receive FIFO overflow indicator. Being set to 1 indicates
o
receive FIFO overflows
23 R CTS_LEVEL 0 CTS signal level.
o
22 R TX_FIFO_EMPTY 0 Transmit FIFO Empty indicator. Being set to 1 indicates
Transmit FIFO is empty
d
21 R TX_FIFO_FULL 0 Transmit FIFO Full indicator. Being set to1 indicates
Transmit FIFO is full.
20 R RX_FIFO_EMPTY 0 Receive FIFO Empty indicator. Being set to 1 indicates
m
Receive FIFO is empty
19 R RX_FIFO_FULL 0 Receive FIFO Full indicator. Being set to 1 indicates
Receive FIFO is full.
E
18 R TX_FIFO_WERR 0 Transmit FIFO writing error indicator. The bit is set to 1 if
writing data to Transmit FIFO when Transmit FIFO is full.
Note: Please use register AO_UART_CONTROL bit 24 to
clear this bit. Refer to AO_UART_CONTROL register
to
definition.
17 R FRAME_ERR 0 Frame Error indicator. The bit is set to 1if frame error
detected.
Note: Please use register AO_UART_CONTROL bit 24 to
clear this bit. Refer to AO_UART_CONTROL register
te
definition.
16 R PARITY_ERR 0 Parity Error indicator. The bit is set to 1 if parity error
detected.
u
15 - - 0 Reserved
14:8 R TX_FIFO_DCNT 0 Transmit FIFO data count. The value is the number of
bytes in the Transmit FIFO.
7 R - 0 Reserved
tr
6:0 R RX_FIFO_DCNT 0 Receive FIFO data count. The value is the number of
bytes in the Receive FIFO.
is
D
r!
you can set this bit to 1.
29 R/W ASYNC_FIFO_PURGE 0 Set to 1 after all UART bytes have been received in order to
purge the data into the async FIFO
o
28 R/W ASYNC_FIFO_EN 0 Automatically send to async FIFO module enable
1: enable automatic sending
o
0:disable automatic sending
27 R/W CTS_FIL_TB_SEL 0 CTS input filter time base selection.
A digital signal filter can be used to filter the UART CTS signal
d
input.
The filter has two parameters, the time base and the number
m
of time base.
0: The time base is 111nS.
1: The time base is 1uS.
E
26-24 R/W CTS_FIL_SEL 0 CTS input filter times
000: No filter.
…
111: Maximum filter time. The time is 7x 111= 777nS
to
(CTS_FIL_TB_SEL = 0) or 7x 1=7uS (CTS_FIL_TB_SEL = 1)
23-20 R/W BAUD_RATE_EXT 0 Extend the baud rate divider to 16-bits together with
AO_UART_STATUS[11:0]
Baud_Rate = [BAUD_RATE_EXT: BAUD_RATE]
19 R/W RX_FIL_TB_SEL 0 RX input filter time base selection.
te
time base.
0: The time base is 111nS.
1: The time base is 1uS.
ib
UART_AO_REG5(AO_UART_REG5)
Table 33. AO_UART_REG5 register definition
Name AO_UART_REG5 Offset 0x0135 Width 32-bit
Bit R/W Name Default Description
31-24 R/W - 0 unused
23 R/W USE New Baud rate. 0 Over the years, the baud rate has been extended by
concatenating bits from different registers. To take
advantage of the full 23-bit baud rate generate (extended to
23 bits to accommodate very low baud rates), you must set
r!
this bit. If this bit is set, then the baud rate is configured
using bits [22:0] below
22:0 R/W NEW_BAUD_RATE: 0 If bit[23] = 1 above, then the baud rate for the UART is
o
computed using these bits. This was added in MX to
accommodate lower baud rates.
o
d
m
E
to
te
u
ib
tr
is
D
r!
where:
REG_ADDR: physical register address that software can access the register
BASE_ADDR: the base address of the address bus
o
REG_OFFSET: the register address offset
o
The value of base address (BASE_ADDR) may be different in different software implementation. In Amlogic ported
Linux kernel and the boot loader uBoot, the base addresses for those registers which are not in the AO domain
d
are:
m
uBoot: 0xC1100000
Linux Kernel:
uBoot:
0xF3100000
0xC8100000 E
to
Software needs to choose BASE_ADDR according to the implementation environment.
te
u
ib
tr
is
D
r!
Some Macros are defined for UART programming.
o
Operation Marco
Writing a 32bit register WRITE_CBUS_REG(reg, val)
o
Read a 32bit register READ_CBUS_REG(reg)
Write a serial bit of register WRITE_CBUS_REG_BITS(reg, val, start, len)
d
Read a serial bit of register READ_CBUS_REG_BITS(reg, start, len)
reg: Register address index
m
val: Value of register
start: Start bit address of register
len: The length of bits
UART_A_STATUS
UART_A_MISC UART_A_MISC
UART_A_REG5 UART_A_REG5
UART_B_WFIFO UART_B_WFIFO
u
UART_B_RFIFO UART_B_RFIFO
UART_B_CONTROL UART_B_CONTROL
ib
UART_B_REG5 UART_B_REG5
UART_C_RFIFO UART_C_RFIFO
UART_C_CONTROL UART_C_CONTROL
is
UART_C_STATUS UART_C_STATUS
UART_C
UART_C_MISC UART_C_MISC
UART_C_WFIFO UART_C_WFIFO
D
UART_C_REG5 UART_C_REG5
AO_UART_RFIFO AO_UART_RFIFO
AO_UART_CONTROL AO_UART_CONTROL
AO_UART_STATUS AO_UART_STATUS
UART_AO
AO_UART_MISC AO_UART_MISC
AO_UART_WFIFO AO_UART_WFIFO
AO_UART_REG5 AO_UART_ REG5