Application of Multi-Serial Port Expander in Single Chip Microcomputer System

Publisher:VolareLatest update time:2012-03-10 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1 Overview
In recent years, intelligent modules with complete measurement or control functions have emerged continuously, and such modules need to communicate with the host microcontroller or microcomputer through RS-232S or RS-485 serial ports to form a hierarchical distributed measurement and control system. However, most microcontrollers at this stage have only one UART serial port, which is difficult to meet the requirements of communicating with both intelligent modules and host microcomputers. Looking at the existing serial port expansion solutions, there are disadvantages such as more software and hardware resources of the microcontroller, complicated programming, fewer serial port expansions, complex hardware circuits and high costs. The use of UART multi-serial port expander SP2337 can well solve the expansion problem of multiple serial ports of the microcontroller.

2SP2337 main features and pin functions
SP2337 is a UART multi-serial port expander designed with low-power CMOS technology. This device can expand a high-baud rate UART serial port into three higher-baud rate UART serial ports, thus providing a good solution for systems that need multiple serial ports. The main features of this device are: it
can expand one UART serial port into three UART serial ports;
full-duplex asynchronous operation, all four UART serial ports are full-duplex asynchronous operation mode;
high working speed, up to 1200b/s~9600b/s (any non-standard baud rate can be set by the crystal oscillator frequency);
simple baud rate setting, only need to change the input clock frequency;
small baud rate error, the data output baud rate error of each serial port is less than 0.25%;
wide receiving baud rate range, requiring each serial port data baud rate to be less than 2.5%;
extremely low data transmission bit error rate, less than 10-9 (received data baud rate error is less than 2%);
with power saving mode, after entering the power saving mode, the typical quiescent current is 0.5μA;


It can automatically wake up when data appears at the receiving end of any serial port;
wide operating power supply voltage ( 2.4V~5.5V);
low operating current, typical operating current is 4.4mA.
The device has multiple packaging forms such as DIP, SOIC and SSOP. The pin arrangement is shown in Figure 1. The pin functions are shown in Table 1.

3 Application Technology
There are many principles to follow
when using SP2337. SP2337 is suitable for applications where serial data is 7 bits. Serial port 0-serial port 2 are three serial ports with higher baud rates (sub-serial ports). Serial port 3 is a high baud rate serial port (mother serial port), and its data transmission rate is 4 times that of the sub-serial port. For example, when the input clock frequency fos,cin is 10MHz, the baud rate of serial port 3 is 19200b/s. The baud rate of serial port 0-2 is 19200b/s/4=4800b/s; if you need to obtain the baud rate K on serial port 0-serial port 2, you need to change the clock frequency according to the following formula. ADRI1 and ADRI0 are the downstream address lines. When ADRI1ADRI0=00, 01, 10, they correspond to sub-serial ports 0, 1, 2 respectively. When ADR1ADR0=11, it is the address of serial port 3, and it is also the command/data port address of SP2337. ADRO1 and ADRO0 are the serial port address lines for uplink data. When ADRO1ADRO0=00, 01, and 10, they correspond to sub-serial ports 0, 1, and 2 respectively. When the UART of the host computer receives data sent by serial port 3, it immediately reads the status of address lines ADRO1 and ADRO0, and determines which serial port the data is sent from based on the status of ADRO1 and ADRO0. The wake-up condition is to write a byte of data to any data receiving port of serial port 0-serial port 3. Since the wake-up time of SP2337 is about 25ms, the data used for chip wake-up will not be received correctly. Therefore, the following chip wake-up process should be adopted: first send a byte of data to wake up the chip, and then send valid data after a delay of 25ms. In order to quickly and reliably transmit bulk data, the following method can be used to achieve fast and reliable data reception and transmission. If the host computer only needs to send data to one serial port, it can send one byte of data to the serial port, and then send four bytes of "0X00" to address 11 (the address of serial port 3), and then send one byte of data to the serial port that needs to send data. Then send four bytes of "0X00" to serial port 3, and send them in this way in a loop. [page] If the host computer needs to send two data blocks to two serial ports respectively, it can send one byte of data to the two corresponding sub-serial ports respectively, and then send four bytes of "0X00" to serial port 3, and then send the next byte of the two data blocks to the two sub-serial ports respectively. If the host computer has three data blocks that need to be sent to three sub-serial ports respectively, it can first send one byte of valid data to each of the three sub-serial ports, and then send two bytes of "0X00" to serial port 3, and then send valid data to the three sub-serial ports in a loop. Note that the data written to serial port 3 for delay can only be "0X00". If other data is written, unpredictable results will occur. The data transmission process of SP2337 is as follows: If the host computer needs to send data "0X28" from serial port 2, it needs to set ADRI1 to "1" and ADRI0 to "0" first, and then send the data "0X28" to serial port 3 through the UART port of the host computer. SP2337 has only two executable commands, namely reset and sleep commands. When the host computer writes data "0X35" or "0XB5" through serial port 3 (address "11"), the chip performs a software reset, and the reset time is about 21.75ms. When the written data is "0X55" or "0XD5", the chip enters the sleep state.












4 Specific Applications
SP2337 can be used to expand a microcontroller with only one UART serial port to a microcontroller with three UART serial ports. The following takes the commonly used AT89C51 microcontroller as an example to give the corresponding serial port expansion circuit, as shown in Figure 2.

In Figure 2, the UART port of AT89C51 is connected to the serial port 3 of SP2337. Serial port 3 also serves as the command/data port. ADRI1 and ADRI0 are connected to the P2.3 and P2.2 lines of AT89C51, which are used to select the corresponding serial ports 0-2 when sending data. ADRO1 and ADRO0 are connected to the P2.1 and P2.0 lines of AT89C51, which are used to determine which serial port 0-2 the received data comes from. The clock frequency of SP2337 is selected as 20MHz. At this time, the baud rate of serial port 3 is 19200b/s, and the baud rate of serial port 0-2 is 9600b/s. The communication program supporting the above circuit is given below. The program is compiled in C51.
#include


[page]









5 Conclusion
SP2337 multi-serial port expander can be widely used in industrial control, data acquisition, instrumentation, smart home appliances, computer RS232 port expansion, wired and wireless data transmission and other fields. The multi-serial port circuit composed of this device has the characteristics of low hardware cost, high cost performance, high working speed, simple baud rate setting, etc. It is a good solution for multi-serial port application system.

Reference address:Application of Multi-Serial Port Expander in Single Chip Microcomputer System

Previous article:Automatic calibration and adjustment of calendar clock in single chip microcomputer system
Next article:A method for measuring engine speed and acceleration time based on single chip microcomputer

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
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号