Documente Academic
Documente Profesional
Documente Cultură
T TM
R1 L
EP9315 Features
UARTs
Three 16550 - compatible UARTs are supplied UART1 with HDLC (High-Level Data Link Control ) & modem control signals
Supports modem bit rates up to 115.2 kbps Supports HDLC and includes a 16 byte FIFO for receive and a 16 byte FIFO for transmit. Interrupts are generated on Rx, Tx and Modem status change. Contains an IrDA encoder operating at either the slow (up to 115 kbps), medium (0.576 or 1.152 Mbps), or fast (4 Mbps) IR data rates. It also has a 16 byte FIFO for receive and a 16 byte FIFO for transmit.
UART2
ED500
TM
UART1
Transmit & Receive data transfers through UART1 can be managed by the DMA, interrupt driven or CPU polled operations
ED500
TM
UART1
Common tx & rx internal clock from internal ref input UARTCLK Free running counter Generate internal x 16 clocks & Baud16 signal Baud16 stream of pulses
Provides Timing for Tx & RX control Pulse width width of one UART Clock period Frequency 16 times the baud rate
Transmit FIFO
8-bit wide, 16 entry deep, first in first out Disabled to 1-byte holding register
ED500
TM
Receive FIFO
Transmit Logic
Receive Logic
UART Operation
Control data is written to UART line control register UARTLCR (23 bits wide internally) & externally accessed through 8-bit wide register locations UARTLCR_H, UARTLCR_M & UARTLCR_L Defines baud rate divisor, transmission parameters, word length, no of stop bits, parity etc.
ED500
TM
UART Operation
Baud rate generator has 16-bit down counter (clocked by the UART reference clock) When baud rate divisor is decremented to zero
Down counter is reloaded with baud rate divisor Baud 16 signal is generated (divided by 16 to generate the transmit clock)
ED500
TM
UART Operation
Transmission
Data is written to transmit FIFO Data frame starts transmitting according to UARTLCR configuration BUSY signal is asserted HIGH until the FIFO is empty and last character is transmitted, becomes low after last character stop bit is transmitted
ED500
TM
UART Operation
Reception
When a low is detected, receive counter with Baud16 clock is started Data is sampled on the 8th cycle of that counter Valid start bit if UARTRXD bit is low on 8th cycle of baud16 Successive data bits sampled on the every 16th cycle A valid stop bit is confirmed if UARTRXD is HIGH
ED500
TM
UART Operation
Receive FIFO (16 x 11 bits)
Data Bits 0:7 Error bits 8 - Framing error 9 - Parity error 10 - Break error Overrun error Disabling FIFOs 1- byte holding register Loop back testing setting LBE bit UARTxCtrl reg
ED500
TM
10
10
Configure PwrCnt as 0 BAUDDIV = (Fuartclk /(16 * Baud rate))-1 For baud rate 9600, BAUDDIV=47
11 8 bits 10 7 bits 01 6 bits 00 5 bits 1 - Tx & Rx FIFO buffers are enabled 0 FIFO are disabled, ie FIFOs become 1-byte-deep holding registers
ED500
TM
11
11
1 Two STOP bits are transmitted at the end of the frame 0 One STOP bit is transmitted at the end of the frame 1 - Even parity generation and checking is performed during transmission and reception which checks for an even number of 1s in data and parity bits 0 - Odd parity checking is performed which checks for add number of 1s 1 - Parity checking and generation is enabled 0 - Parity checking and generation is disabled and no parity bit is added to the data frame 1- A low level is continuously output on the UARTTXD output, after completing transmission of current character 0- for normal use
ED500
TM
12
12
UART1 cntrl
UART Enable (Bit0) Check if Transmit FIFO empty (Bit 7) polling method
UART1Flag
ED500
TM
13
13
Program
#include<stdio.h> #define #define #define #define #define #define #define PWRCNT UART_DATA UART_CONTROL_HIGH UART_CONTROL_MID UART_CONTROL_LOW UART_CONTROL UART_FLAG ((volatile unsigned *)(0x80930004)) ((volatile unsigned *)(0x808C0000)) ((volatile unsigned *)(0x808C0008)) ((volatile unsigned *)(0x808C000C)) ((volatile unsigned *)(0x808C0010)) ((volatile unsigned *)(0x808C0014)) ((volatile unsigned *)(0x808C0018)) //DATA TO BE LOADED //LENGTH,FIFO..ETC. //BAUD RATE DIVISOR(MSB) //BAUD RATE DIVISOR(LSB) //INTERRUPT, "UART ENABLE"...ETC. //FLAGS
int main(void)
{ unsigned int i; *PWRCNT=0x00; *UART_CONTROL_LOW=0x002F; *UART_CONTROL_MID=0x0000; *UART_CONTROL_HIGH=0x0060; // 8 bit frame *UART_CONTROL=0x0001; // UART ENABLE // BAUD RATE 9600
ED500
TM
14
14
for(i=0;i<11;i++) {
*UART_DATA=s[i];
ED500
TM
15
15