Home

DSP chip, the RS232 interface design based on SCl6C750B with program

Abstract: TMS320C32 is a 32-bit floating point DSP chips, digital signal processing and automation has been widely used; and RS232 (EIA232) is the field of automation and control a basic serial asynchronous communication protocol. In the development of the thermal system based on TMS320C32 monitoring device, used SCl6C750BUART chip to achieve expansion of the RS232 serial port communications statute. This article describes the design of serial transceiver interrupt procedures and C language based on the serial communication interrupt routine issues.

Introduction

 U.S. TI (Texas Instruments) DSP chip is the company's family of Harvard architecture, pipelining, dedicated hardware multiplier, fast DSP instructions, so the digital signal processing, communications and industrial automation and other fields has been widely used [1]. TMS320C32 is a 32-bit floating-point processor. It addition to these features, but also with enhanced memory interface, a flexible boot loader (boot loader), relocatable interrupt vector table, and flexible interrupt and other peripherals [2]; its communications-chip integrated only a serial port, but in the design of the serial port is generally the serial A / D or D / A chips occupy, or be used with another piece of DSP chips in the "handshake mode" (handshakemode) under the direct connection [3].
    Although there are several kinds of TMS320C32 serial port [3,4], but the appropriate register through the serial port and can not directly configure the RS232 standard serial interface consistent. The RS Serial communication is a basic automation and control communications equipment, such as PC, or other microprocessor-based control device. RS232 standard ISO 1991 by EIA (ElectronicIndustries Association) renamed to EIA232 standards [5], is an asynchronous serial communication standards, including mechanical connection, the signal function, voltage characteristics and communication protocols, and several other provisions.
    Using a SC16C750B UART chip [6] to complete the design of TMS320C32's RS232 serial port. The UART serial data rates up to a maximum of 3 Mbps, pin-compatible with TLl6C750, and has 64-byte receive and transmit FIFOs and automatic hardware flow function. These features make serial communication more efficient and reliable.
1 TMS320C32's RS232 serial port hardware design

RS232

 Figure 1 -  "zero-Modem" connection

As the standard RS232 asynchronous communication protocol data frames are with the start bit and stop bit, and SC16C750B UART chip has automatic hardware flow control, so you can further ignore the control signals associated with the Modem (DTR, DSR, CD, RTS, CTS) simplify the connection.

1.1 SCl6C750B UART chip

SCl6C750B for asynchronous serial communication chips [6], with a standard Modem Interface. It has the following main features:

Standard asynchronous error bit and frame format bits (start bit, stop bits, parity bit), and programmable frame format;
Software selectable baud rate;
Send and receive the 64-byte FIFOs;
Send, receive, line status, and interrupts can be individually controlled and programmable interrupt priority;
Separate receiver clock;
In the 5V supply voltage, to send or receive rates up to 5Mbps;
Automatic hardware flow control;
4 selectable Receive interrupt level;
Standard Modem interface;
Pin and STl6C> t50/550, TLl6C450/550, PC16C450/550, the software is compatible with SCl6C750 and TL16C750. Other features will not repeat them.

Principle of Hardware

Hardware design of the general idea:

UART address is assigned to TMS320CC32 the IOSTRB external memory space, chip select signal corresponding to the address shall be the base address of UART.
RXRDY, TXRDY respectively as receiving, sending interrupt signals, then the external interrupt pin C32 INT0, INT1, and C32 LOW interrupt trigger mode set to trigger.
UART of Tx, RX pins are CMOS level, while the RS232 is used "negative logic level." This design uses a MAX3232 [7] level between the completion of their conversion and drive, its data transfer rate up to 1 Mbps,.
The receiving and sending some of the same part of the baud rate, then take BAUDOUT RCLK pin.
External reference clock frequency of 1.8432 MHz.

DSP chip, the RS232 interface design based on SCl6C750B circuit

Figure 2 port signals, such as data and address bus, reset signals, interrupt signals, to complete the connection between the TMS320C32. The design of the chip-select signal corresponding to TMS320C32's IOSTRB space 0x810100h, that SCl6C750B the base address of internal registers.

TMS320C32's RS232 serial port software functional design

    Serial mode control and data transceivers are related through the TMS320C32 internal UART registers on the read and write operation to complete. Therefore, the first analysis of the function SCl6C750B chip registers, and then determine the design SCl6C750B work mode, and given the serial port initialization, interrupt and interrupt receiving process to send procedures. Procedures written in C language.

Programming

First, initialize the program to determine the TMS320C32 and SCl6c750B mode of operation between the data transmission frame format, SCl6C750B own mode of data transfer baud rate settings and so on. Settings:

  • SCl6C7 150B work in DMA mode 0 (DMA mode O). In this mode, whenever the THR is empty send register, TXRDY signal will be reduced to logic low. RHR registers are loaded as long as the receiver of a character, RXRDY immediately reduced to logic low.
  • TMS320C32 and SCl6C750B UART mode of operation between the mode of operation using interrupts, interrupt relative to the query method can improve the work efficiency TMS3320C32. The INT0 interrupt pin connected TMS320C32 UART's RXRDY signal, INT1 access TXRDY signal. Thus, by the INT0, INT1 interrupt service routine corresponding to the completion of the receive and transmit data.
  • Data transmission frame format: 8-bit data word length, 2 stop bit, even check.
  • Set the baud rate.

In the logic-level RS232 serial data rate (serial data rate) is equivalent to the baud rate (baud rate). If the external clock frequency (XTAL1clock frequency) is 1.8432 MHz, the baud rate 19 200 bps, the corresponding baud rate divisor (divisor) is 6.
Using C language development [8] TMS320C32 serial communication program. Initialization procedure is as follows:
# Include <stdlib. h>
# Include <ioports. h>
/ / Declare the structure SCl6C750B register
typedef struet (
unsigned RHR, / / Receive Holding Register
unsigned THR # / / Transmit Holding Register
unsigned IER; / / Interrupt Enable Register
unsigned FCR; / / FIFO Control Register
unsigned ISR; / / interrupt status register
unsigned LCR; / / Line Control Register
unsigned MCR; / / Modem Control Register
unsigned LSR; / / Line status register
unsigned MSR; / / Modem Status Register
unsigned SPR; / / Scratch registers
unsigned DLL; / / Baud rate divisor latch low byte
unsigned DLM; / / Baud rate divisor latch high byte
) SerialPort;
/ / SCl6C750B register base address is 0x810100h
SerialPort SD = (
0x810100h, 0x810100h, 0x810101h,
0x810102h, 0x810102h, 0x810103h,
0x810104h. 0x810105h, Ox810106h
0x810107h 0x810100h, 0x810101h
);
void main (void) (
;
/ / Baud rate setting
outport (sp.LCR, 0x80); / / LCR [7] = 0
outport (sp.DLL, 0x06); / / baud rate of 19 200 bps
outport (sp.DLM, 0x00);
outport (sp.LCR, 0xlF); / / Data frame format
outport (sD.FCR, 0xAl)) / / DMA mode 0
outport (sp.IER, 0x07); / / interrupt enable
;
)
/ / INTO interrupt service routine - Data received

unsigned char recvdata;

void c_int-1 (void) (

  recvdata = inport (sp.RHR);
  ;
)

/ / INT interrupt service routines - Data sent
void c_int02 (void) (
  outport (sp.THR, transdata);

  ;

)

3 Conclusions
    TMS320C32 is a highly cost-effective 32-bit floating point DSP film, but the communication is relatively weak. By SC16C750B UART chip TMS320C32's RS232 serial port expansion, for the actual temperature and pressure monitoring devices, proven, reliable data communications.

In the development of automatic control device based on microprocessor design, generally do not require long-distance transmission of serial communication, so generally used "zero-Modem" mode (Null-Modem or Zero-Modem) to achieve a pair of asynchronous serial connection. Figure 1 is a "zero-Modem" connection (see the significance of the specific signal RS232 standard).