User manual

Table Of Contents
Zynq-7000 AP SoC Technical Reference Manual www.xilinx.com 597
UG585 (v1.11) September 27, 2016
Chapter 19: UART Controller
5. Configure interrupts: Interrupts are used to manage the Rx/Tx FIFOs in all modes. Refer to
section 19.2.10 Status and Interrupts and the program example in section 19.3.5 RxFIFO Trigger
Level Interrupt.
6. Configure modem controls (optional): Polling and interrupt driven options. Refer to section
19.2.11 Modem Control.
7. Manage transmit and receive data: Polling and interrupt driven handlers are supportable. Refer
to sections 19.3.3 Transmit Data and 19.3.4 Receive Data.
19.3.2 Configure Controller Functions
Example: Configure Controller Functions
This example configures the character frame, the baud rate, the FIFO trigger levels, the Rx timeout
mechanism, and enables the controller. All of these steps are necessary after a reset, but not
necessary between enabling and disabling the controller.
1. Configure UART character frame. Write 0x0000_0020 into the uart.mode_reg0:
a. Disables clock pre-divider, UART_REF_CLK/8: [CLKS] = 0
b. Selects 8-bit character length: [CHRL] = 00
c. Selects no parity: [PAR] = 100
d. Selects 1 stop bit: [NBSTOP] = 00
e. Selects normal channel mode (Mode Switch): [CHMODE] = 00
2. Configure the Baud Rate. Write to three registers: uart.Control_reg0, uart.Baud_rate_gen_reg0,
and uart.Baud_rate_divider_reg0. Examples for the calculated CD and BDIV values are shown in
table Table 19-1, page 587. The baud rate generator is described in section 19.2.3 Baud Rate
Generator.
a. Disable the Rx path: set uart.Control_reg0 [RXEN] = 0 and [RXDIS] = 1.
b. Disable the Txpath: set uart.Control_reg0 [TXEN] = 0 and [TXDIS] = 1.
c. Write the calculated CD value into the uart.Baud_rate_gen_reg0 [CD] bit field.
d. Write the calculated BDIV value into the uart.Baud_rate_divider_reg0 [BDIV] bit value.
e. Reset Tx and Rx paths: uart.Control_reg0 [TXRST] and [RXRST] = 1. These bits are
self-clearing.
f. Enable the Rx path: Set [RXEN] = 1 and [RXDIS] = 0.
g. Enable the Tx path: Set [TXEN] = 1 and [TXDIS] = 0.
3. Set the level of the RxFIFO trigger level. Write the trigger level into the
uart.Rcvr_FIFO_trigger_level0 register.
°
Option a: Enable the Rx trigger level: Write a value of 1 to 63 into the [RTRIG] bit field.
°
Option b: Disable the Rx trigger level: Write 0 into the [RTRIG] bit field.
4. Enable the Controller. Write 0x0000_0117 into the uart.Control_reg0 register.
a. Reset Tx and Rx paths: uart.Control_reg0 [TXRST] and [RXRST] = 1. These bits are
self-clearing.
b. Enables the Rx path: [RXEN] = 1 and [RXDIS] = 0.