Application of SC16IS752 in ARM extended serial port

Publisher:hxcp18Latest update time:2012-03-24 Source: 微计算机信息 Keywords:SC16IS752 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

The serial port is the most commonly used and simplest interface in embedded devices. How to expand the serial port of the CPU is of great significance for multi-functional embedded devices. SC16IS752 is a conversion chip with I2C/SPI bus interface to dual-channel UART launched by NXP. It can provide a rate of up to 5Mbit/s and is compatible with the widely used 16C450, which is conducive to software transplantation and writing. The microcontroller in this article uses the LPC2214 launched by NXP, based on the 16/32-bit ARM7TDMI-STM core, 144-pin package, and extremely low power consumption, which is particularly suitable for industrial control.

The main features of SC16IS752 are as follows:

●Operating voltage: 3.3 or 2.5V, operating temperature range: -40~+85°C, low power consumption, sleep current of 3.3V is less than 30uA;

●Two full-duplex UARTs, 64-byte FIFO, fully programmable character format, RTS/CTS automatic flow control;

●Small package, easy to connect to CPU, available in HVQFN32 and TSSOP28 packages.

This article uses SPI to expand the CPU serial port, and SC16IS752 is set to slave mode. The following introduces its hardware characteristics.

1. Pin functions and registers of SC16IS752


Figure 1 shows the pinout of the SC16IS752, and Table 1 shows the functions of each pin.

Figure 1 Pin Diagram

Table 1: SPI interface pin functions

Pins

Function

Pins

Function

Pins

Function

1

Channel A Request to Send

11

SPI data input pin

twenty one

I/O or modem RIB

2

Channel A Clear to Send

12

SPI data output pin

twenty two

land

3

Channel A Send Output

13

SPI input clock

twenty three

Channel B Send Output

4

Channel A accepts input

14

Idle connected to VDD

twenty four

Channel B accepts input

5

Hardware Reset

15

Interrupt

25

I/O or modem DSRA

6

Crystal input

16

Channel B Clear to Send

26

I/O or modem DTRA

7

Crystal output

17

Channel B Request to Send

27

I/O or modem CDA

8

Supply voltage

18

DSRB for I/O or modem

28

I/O or modem RIA

9

SPI interface selection

19

I/O or modem DTRB

10

SPI chip select

20

I/O or modem CDB

The registers mainly include the transmit register (THR), receive register (RHR), control register (FCR), line control register (LCR), status register (MCR), MODEM status register (MSR), interrupt enable register (IER), interrupt identification register (IIR), divisor register (DLH/DLL), transmit control register (TCR), trigger point register (TLR), I/O pin control register, etc. [page]

2. SPI timing diagram in SC16IS752

As shown in the following figure:

3. SC16IS752 and LPC2214 interface circuit diagram

Figure 4 is a partial circuit diagram of the extended serial port. The 3-wire serial port connection method is used, and the SC16IS752 is powered by a 3.3V power supply. The chip package is TSSOP28, the crystal is 1.8432MHZ, and the oscillation circuit is composed of C3 and C4. The SC16IS752 hardware uses a resistor-capacitor reset, which is composed of R3 and C2. It can also be reset by the I/O port of the microprocessor. The author has tested both methods in practice. This article uses a resistor-capacitor reset, which can save I/O ports. The pin 15 of the SC16IS752 is connected to the INT3 of the LPC2214. In this way, the software can be written in an interrupt mode or in a scanning mode. R4 is a pull-up resistor to ensure reliable level. The SPI1 of the CPU is the main mode, and an I/O is connected to the SELL1 of the SC16IS752. It should be noted that the 60th pin SELL1 of the LPC2214 must be connected to a high level, and R5 is used as a pull-up resistor. R1 and R2 are set for the internal FLASH startup of LPC2214. Pay special attention to the use of the CPU's P0.14 pin. The FLASH boot loader code is executed when the CPU is powered on or reset. When the device is reset, when P0.14 is low, ISP is started and software changes are made. When the ISP function is not needed, connect the pull-up resistor R6 to keep P0.14 in a stable state. CPU reset is not given due to space limitations.

Figure 4 SC16IS752 and LPC2214 interface circuit diagram

4. Level conversion


The level conversion uses the SP3232E chip of SIPEX, which meets the EIA/TIA-232-standard. The operating voltage is +3.0V~5.5V. In addition, the pins provide ESD protection. The pins of the driver and receiver can withstand ±15KV human body discharge mode and IEC1000-4-2 air gap discharge mode. As shown in the following figure:

Figure 5 Level conversion

5. Initialize registers

The procedure for initializing the registers of SC16IS752 is as follows:

/*SC16IS752 initialization*/

void init_is752(void) {

/*Initialize the first serial port A of SC16IS752.*/

write_is752_rega(IS752_CH_A,IS752_LCR,0xbf); write_is752_rega(IS752_CH_A,IS752_EFR,IS752_EFR_VAL);

write_is752_rega(IS752_CH_A,IS752_LCR,0x00);

/*Set SC16IS752 serial port A interrupt.*/

write_is752_rega(IS752_CH_A, IS752_IER, IS752_IER_VAL);

write_is752_rega(IS752_CH_A, IS752_FCR, IS752_FCR_VAL);

write_is752_rega(IS752_CH_A, IS752_MCR, IS752_MCR_VAL);

write_is752_rega(IS752_CH_A, IS752_EFCR, IS752_EFCR_VAL);

/* Initialize the second serial port B of SC16IS752, same as serial port A, omitted. Clear register program, omitted*/

}[page]

/* Write data */

void write_is752_rega(unsigned char chx, unsigned char addr, unsigned char data){

unsigned char temp;

if((IS752_CH_A == chx) ||(IS752_CH_B == chx)){

CLR_IS752_CS;

temp = addr<<3;

temp |= chx;

spi_send_byte(SPI1,tmp);

spi_send_byte(SPI1,data); /*Send data.*/

SET_IS752_CS;

}

}

/*Read data*/

unsigned char read_is752_rega(unsigned char chx, unsigned char addr){

unsigned char temp;

if((IS752_CH_A == chx) ||(IS752_CH_B == chx)){

CLR_IS752_CS;

temp = addr<<3;

temp |= 0x80|chx;

spi_send_byte(SPI1,temp);

spi_send_byte(SPI1,0xff);

SET_IS752_CS;

return(S1SPDR);

}

}

The SPI programming interface is described in detail in other books and will not be described here (see Reference 1).

5. Conclusion

There are many serial port expansion chips on the market. We have used parallel ports to expand serial ports before, such as 16C552, 16C554, etc. Compared with them, SC16IS752 has simple connection, low power consumption, small size, and good stability in practical applications. It has been used in our designed products. At the same time, it has a small size and low power consumption, and will have broad application prospects in handheld devices.

The author's innovations: 1. Only five CPU lines are needed to expand two serial ports, saving CPU resources;

2. Small size, low power consumption, and broad application prospects in handheld devices;

3. Simple connection and good stability.

Figure 6 Size comparison of SC16IS752 and surrounding devices

References

1. Zhou Ligong et al. ARM Embedded System Basic Tutorial. Beijing: Beijing University of Aeronautics and Astronautics Press. 2005www

2. NXP SC16IS752 /SC15IS762 datasheet. Rev0.12-19 September 2005

3. Li Chunguang et al. Design and implementation of interface between embedded microprocessor and FLASH flash memory, Microcomputer Information, (2006) 07-2-0154-04

Keywords:SC16IS752 Reference address:Application of SC16IS752 in ARM extended serial port

Previous article:Implementation of high-speed device driver based on embedded Linux system
Next article:Research on image acquisition method based on S3C44B0 development board

Recommended ReadingLatest update time:2024-11-16 23:56

ARM Shift Instructions
 
[Microcontroller]
Take you through the workflow of ARM code compilation and linking
 Let's sort out the workflow of ARM code compilation and linking, as well as the relevant conceptual information required in the process, without focusing on the specific commands of compilation and linking. 1. Compilation process The compilation process is the process of compiling source code into target code. Us
[Microcontroller]
Microsoft embraces Qualcomm and ARM to strengthen the integration of computers and mobile phones
Microsoft's new product launch conference has just been held in the United States. At this conference, Microsoft welcomed several new partners, namely AMD, ARM and Qualcomm. It is not difficult to see that Microsoft is welcoming new strategic partners with a more open attitude; at the same time, Microsoft is seizing t
[Mobile phone portable]
Program Status Register (CPSR) in ARM
31 30 29 28 27 ~ 8 7 6 5 4 3 2 1 0 N WITH C IN reserve I F T M4 M3 M2 M1 M0 N Negative/Less Than I IRQ disable WITH Zero F FIQ disable C Carry/Borrow/Extend T State bit IN Overflow M0~4 Mode bits 1. Condition code flag   N,
[Microcontroller]
How ARM processors handle exceptions
When an exception occurs, the ARM processor completes the current instruction as much as possible (except for reset exceptions) before handling the exception. It performs the following actions: 1. Enter the operating mode corresponding to the specific exception. 2. Save the address of the next instruction that cause
[Microcontroller]
GIS coal mine safety real-time monitoring system based on ARM embedded technology
    1 Introduction     Due to the special working environment of coal mine production, the production process is more dangerous and unsafe than the general industry. With the continuous increase in coal mining, safety issues have become increasingly serious, and various major accidents are often reported in the media.
[Microcontroller]
Exclusive access instructions LDREX and STREX on ARM platform
In order to achieve synchronization between threads, a mutex lock is usually added before executing the critical code segment, and unlocked after the critical code segment is executed. In order to realize the so-called concept of mutex lock, the platform generally needs to provide support. This article mainly e
[Microcontroller]
Exclusive access instructions LDREX and STREX on ARM platform
ARM7 embedded in uc/os to do running lights practice
#include "config.h" #define    TASK_STK_SIZE    100    #define   LedFlowSpeed    5    OS_STK    TaskStartStk ; OS_STK    TaskKeyScanStk ; OS_EVENT  *LedFlowMbox;            #define    Led1    (1 22) #define    Led2    (1 23) #define    Led3    (1 24) #define    Led4    (1 25) #define   KEY1    (1 16) #def
[Microcontroller]
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号