Design of Serial Communication Interface Circuit Based on TMS320F2812 and MAX3160 Transceiver

Design of Serial Communication Interface Circuit Based on TMS320F2812 and MAX3160 Transceiver

At present, the microcontroller system has been widely used in the national economy and people’s lives, and the data transmission industry is still a very important field. For these man-machine switching equipment and serial storage peripherals (such as terminals, printers, logic analyzers, disks, etc.) that are not far from the computer, it is very common to use serial communication to exchange data.

Authors: Cao Junjun; Chen Xiaoqin; Wu Chao

introduction

At present, the microcontroller system has been widely used in the national economy and people’s lives, and the data transmission industry is still a very important field. For these man-machine switching equipment and serial storage peripherals (such as terminals, printers, logic analyzers, disks, etc.) that are not far from the computer, it is very common to use serial communication to exchange data.

In the serial communication between DSP and PC in the past, the real-time performance of the system is generally poor due to the difference in operating speed and the limitation of programming software between upper and lower computers. In view of these problems, this article discusses the communication scheme of TMS320F2812 and PC from both hardware and software aspects, and introduces the serial communication interface circuit of the scheme and the software flow of data communication by interrupt and query methods.

Design of Serial Communication Interface Circuit Based on TMS320F2812 and MAX3160 Transceiver

1 The hardware interface circuit of serial communication

This design uses the MAX3160 transceiver produced by Maxim, which is a programmable multi-protocol transceiver that can support RS-232/RS-485/RS-422 and other transmission methods.

The RS-485/RS-232 pin of MAX3160 is used to select RS-422/RS-485 or RS-232 interface standard; the pin HDPLX is used to select RS-422 or RS-485; the pin FAST is used to Control signal conversion rate; pin DE485 is used to control whether the transmitter is enabled in RS-422/RS-485 mode, and the multiplexing of RTS signal in RS-485 and RS-232 mode. The circuit in Figure 1 uses the RS-232 mode of the MAX3160, so the 11-pin RS-485/RS-232 and the 12-pin HDPLC are set to low level.

Design of Serial Communication Interface Circuit Based on TMS320F2812 and MAX3160 Transceiver

This design integrates these control pins in a register UART_SCI, and maps this register in the 0X4010 storage unit on Zone1 of the TMS320F 2812 circuit. The definition of each bit of the register is shown in Figure 2. TMS320F2812 can operate MAX3160 through this register.

2 Serial communication software package realization

Design TMS320F2812 serial communication software can adopt two ways of inquiry and interruption. In this design, the query mode is used to send the data, and the interrupt mode is used to receive the data.

Design of Serial Communication Interface Circuit Based on TMS320F2812 and MAX3160 Transceiver

2.1 Initialization of SCI

The two SCI of TMS320F2812 include a total of 26 registers, of which the control registers are SCICCR, SCIPRI, SCICTL1 and SCICTL2; the device baud rate registers are SCIHBAUD and SCILBAUD; the status register is SCIRXST; the buffer registers are SCIRXEMU, SCIRXBUF and SCITXBUF; in addition, There are SCI unique FIFO registers SCIFFTX, SCIFFRX and SCIFFCT of TMS320F2812. Some of these registers should be initialized at the beginning of the program.

The initialization procedure of SCI is as follows:

#include “DSP28_Device.h”
unsigned int * UART_SCI=(unsigned int *) 0x4010;
void InitSci(void)
{*UART_SCI=0x44; //Set MAX3160 as RS-232 working mode
EALLOW;
GpioMuxRegs.GPFMUX.all=0x0030;
EDIS;
SciaRegs.SCICCR.all=0x07;//Set the transmission data length to 8 bits
SciaRegs.SCICTL1.all=0x03;//Start sending and receiving
SciaRegs.SCICTL2.all=0x03;//Allow RXRDY/BRKDT and TXRDY interrupt
SicaRegs.SCIHBAUD=0x00;
SicaRegs.SCILBAUD=0xF3;//Set the baud rate of the transmission
SicaRegs.SCICTL1.all=0x23;//The register has been set up, set SW RESET to 1, start sending and receiving
PieCtrl.PIEIER9.bit.INTx1=1;/Start interrupt
PieCtr1.PIEIER9.bit.INTX2=1;
}
2.2 Data sending and receiving

The data transmission adopts the inquiry mode, and its flow chart is shown as in Fig. 3. The receiving of the data adopts the interrupt mode, and the process is shown in Figure 4. SCIATX_Ready is the sending ready bit of register SCICTL2, Send_Flag is a sending flag set by TMS320F2812. SCIARX_Ready is the ready bit of the register SCIRXST. The receiving interrupt of SCIA is INT9.1, and the sending interrupt is INT9.2; and the receiving interrupt of SCIB is INT9.3, and the sending interrupt is INT9.4. This design scheme only uses SCIA’s receiving interrupt INT9.1. In the interrupt service subroutine, by checking the value of the peripheral interrupt vector register, it can be transferred to the corresponding receive interrupt handler.

Design of Serial Communication Interface Circuit Based on TMS320F2812 and MAX3160 Transceiver

3 Conclusion

This communication scheme has been applied to the operation of a certain upper computer control data acquisition card, and the result shows that it is feasible. Although this scheme has the characteristics of simple hardware circuit and easy implementation, it can only be used for short-distance data transmission and reception due to the limitation of RS-232/485/422 serial communication. In addition, TI’s TMS320F/C2XX series DSP has the same serial communication module, so this design is also applicable to other TMS320F/C2xx series DSP devices.

The Links:   LM171WX3-TLC2 MID200-12A4

Health & Medical 315
Logo
Enable registration in settings - general
Shopping cart