Design of RS232 Asynchronous Serial Port IP Core Based on FPGA

Publisher:QuailLatest update time:2010-05-12 Source: 中北大学Keywords:FPGA  RS232  IP core Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1 Introduction

Data acquisition systems often require asynchronous serial data transmission. The widely used RS232 asynchronous serial interface, such as 8250, NS16450 and other dedicated integrated devices, is simple to use, but has disadvantages such as occupying circuit board area and complex wiring. System on Chip (SoC) is a design method that integrates software and hardware with embedded systems as the core and IP reuse technology as the basis. Using IP reuse technology to integrate UART into FPGA devices can increase system reliability and reduce PCB board area; secondly, due to the characteristics of IP cores, using IP cores can make the entire system more flexible, and can also achieve functional upgrades, expansions and reductions as needed. Here, the UART module is written in VHDL language, integrated into the FPGA, and constitutes a system on chip SoC with other functional modules of the device.

2 Design and implementation of asynchronous serial port module

2.1 UART Structure

Figure 1 shows a complete UART interface, including a transmit module (txmit) consisting of a transmit latch, a transmit shift register, and logic control, and a receive module (rxcver) consisting of a receive latch, a receive shift register, and logic control. In addition to sharing a reset signal, a clock signal, and parallel data lines, the transmit module and the receive module each have input and output and a logic control unit.

Complete UART interface

2.2 UART frame format

Figure 2 shows the frame format of UART. The frame format includes line idle state (idie, high level), start bit (start bit, low level), 5 to 8 data bits (databit), check bit (parity bit, optional) and stop bit (stop bit, the number of bits can be 1, 1.5, 2 bits). This format uses the start bit and stop bit to achieve character synchronization. UART generally has a configuration register inside, which can configure the number of data bits (5 to 8 bits), whether there is a check bit and the type of check, the number of stop bits, etc.

UART frame format

2.3 Baud rate clock control

Since the baud rates of the digital interface, working mode selection, and real-time monitoring interface are all different, the UART core contains a programmable baud rate generator that can flexibly configure the baud rate. The baud rate generator provides the reference clock for sending and receiving data to the sending module and the receiving module. The clock mclkx16 generated by the baud rate generator is 16 times the serial data baud rate. It divides the system clock n, n = system clock / baud rate × 16. Setting the corresponding value for different baud rates can get the desired baud rate clock. [page]

2.4 Sending module design

The transmission module is divided into three modes: idle, loading data, and shifting. As shown in Figure 3. When the parallel 8-bit data is written from the bus to the transmission module, the transmission module loads the parallel data into the latch thr, and then shifts the data in the shift register tsr to generate a complete transmission sequence (including start bit, data bit, parity bit and stop bit), which is sent from tx at the corresponding baud rate. The input clock mclkx16 of the transmission module is 16 times the baud rate of the serial data. The module divides it by 16 to get the baud rate clock txclk.

Sending state transitions

The VHDL program of the sending module is as follows:

program

2.5 Receiving module design

The receiving module is also divided into three modes: idle, start bit detection, and shift. As shown in Figure 4. First, the start bit is captured, and the start bit of the data input from the rx end is continuously detected under the mclkx16 clock. When the start bit is detected, the receiving module switches from the idle mode to the shift mode, and the 16-divided mclkx16 generates the rxclk baud rate clock. At this time, the rising edge of the rxclk clock is in the middle of each bit of the serial data, so that the following data is sampled at the midpoint of each bit. Then the rxclk controls the data bit to be written into the rsr[7] bit of the shift register rgr at the rising edge, and the rsr is shifted right by 1 bit, and all 8 bits of data are written to the rsr in sequence, and the generation of the rxclk baud rate clock is stopped. After judging that the parity check, frame structure and overflow flag are correct, the data in the rsr register is written into the rhr data latch register, and finally the converted data is output by the 8-bit data bus.

Receive state transition

The VHDL program of the receiving module is as follows:

program [page]

3 Hardware Circuit Design

After the UART IP core design is completed, it needs to be embedded in the FPGA system to run. The system uses Xilinx's Spartan-IIE XC2S50 FPGA and its matching EPROM XC18V01, as shown in Figure 5. The system has realized the functions required by the design and realized the verification of the IP core.

FPGA system connection circuit

4 Results Analysis

After the program is verified by simulation, the IP core must be synthesized and embedded in the FPGA. The Xilinx ISE tool of Xilinx is used to synthesize the UART module. The FPGA uses the Spartan-IIE XC2S50 of Xilinx and the system clock is 40 MHz. After Xil-inx ISE, the resource usage results are shown in Table 1. It shows that the UART core can be generated by using a small number of FPGA slices and LUT units, saving resources. The UART core can be flexibly divided into two parts, receiving and sending, and can be used as needed. Save system resources; some control flag words can also be deleted and expanded as needed. Finally, the FPGA data acquisition system integrated with the UART core is used for asynchronous serial communication experiments with the test bench. The detection of communication data shows that the data transmission using the UART core is stable and reliable.

Resource usage results

5 Conclusion

Data acquisition systems often use UART asynchronous serial communication interfaces as short-distance serial communication for the system. Compared with traditional UART devices, integrating IP cores with UART functions into FPGAs is more conducive to improving the reliability and stability of data acquisition systems and reducing circuit board area. The UART IP core designed in this system has been verified by simulation, and after synthesis, compilation, and embedding into FPGA, the system communication has been successfully realized.

Keywords:FPGA  RS232  IP core Reference address:Design of RS232 Asynchronous Serial Port IP Core Based on FPGA

Previous article:Multi-core processor SoC design for embedded system applications
Next article:Reducing CPLD Power Consumption in Embedded Design

Recommended ReadingLatest update time:2024-11-17 01:48

Intelligent Thermal Management Using Mixed-Signal FPGAs
However, the cost of these devices increases rapidly if the temperature of multiple test points on the board needs to be measured. This in turn creates an urgent need for efficient, compact and low-cost temperature measurement methods, with applications ranging from high-speed computers, telecommunications network swit
[Analog Electronics]
Design of satellite measurement and control multi-beam system based on DSP and FPGA
I. INTRODUCTION Satellite tracking and control multi-beam system mainly implements tracking and control for satellite signals, which includes two aspects: signal direction of arrival (DOA) estimation and digital beam synthesis. The estimation of the direction of arrival is to perform super-resolution estimation on th
[Embedded]
Design of satellite measurement and control multi-beam system based on DSP and FPGA
Tips for FPGA low power design
The power consumption of FPGA is highly dependent on the user's design. There is no single method to achieve this power consumption reduction. Like most other things, the design to reduce power consumption is an art of coordination and balance. When designing low-power devices, people must carefully weigh many indicato
[Embedded]
Design of 1553B Aircraft Bus System Communication Software Based on FPGA/DSP Technology
At present, with the progress of process and technology, the development of integrated circuit technology has made it possible to integrate a programmable system on a chip (PSOC). Among them, field programmable gate array (FPGA) has been widely used in the design of mathematical application-specific integrated circuit
[Embedded]
Design of 1553B Aircraft Bus System Communication Software Based on FPGA/DSP Technology
FPGA Implementation of Despreading and Synchronization Technology for DS/FH Hybrid Spread Spectrum Receiver
In the DS/FH hybrid spread spectrum communication system, digital down-converters, correlation accumulators and code generators are required to complete down-conversion, correlation despreading and other operations. Dedicated chips are usually used to complete these functions, which increases the size of the system
[Embedded]
FPGA Implementation of Despreading and Synchronization Technology for DS/FH Hybrid Spread Spectrum Receiver
Design of I2C SLAVE Mode Bus Based on FPGA
As FPGA is increasingly used in embedded system development, some embedded CPUs, such as STM32, do not have a dedicated CPU read/write bus to reduce costs and package size, but only provide some interfaces such as SPI and I2C. In addition, in applications, data often needs to be configured in FPGA, such as application
[Power Management]
Design of I2C SLAVE Mode Bus Based on FPGA
Design of Large LED Display System Based on FPGA
  With the continuous updating of flat panel display technology, large-scale LED display systems use dot matrix modules or pixel units composed of light-emitting diodes to form large-area display screens, mainly displaying characters, images and other information, with the advantages of low power consumption, low cost
[Microcontroller]
Design of Large LED Display System Based on FPGA
Design of SPI Flash Controller Based on FPGA
This paper proposes a hardware implementation scheme for SPI Flash read and write based on FPGA. This scheme uses hardware to control SPI Flash, which can easily complete Flash read and write, erase, refresh and precharge operations. At the same time, the SPI Flash controller IP core can be transplanted and reused as
[Analog Electronics]
Design of SPI Flash Controller Based on FPGA
Latest Embedded Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号