Research and Design of UART between TMS320VC5402 and PC

Publisher:PeacefulSoulLatest update time:2014-12-09 Source: laoguKeywords:TMS320VC5402 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1 Introduction

TMS320VC5402 has been widely used in the fields of communication and control due to its low cost, low power consumption and abundant resources. It integrates a maximum storage space of 192kB (64kB RAM, 64kB ROM, 64kB I/O) on the chip, and has time-division multiplexed serial port TMD, 2 buffered serial ports BSP, 8-bit parallel host interface HPI, programmable wait state generator, etc., which can fully meet the requirements of data processing and control. The design of various data communication interfaces is indispensable in the application system built on 5402. Compared with the parallel port, the serial interface is characterized by reducing the number of device pins, saving the volume of the hardware system, and reducing the complexity of the interface design. In practical applications, asynchronous serial data transmission and communication need to be realized between systems, and DSP5402 has a synchronous serial port, which is different from the standard asynchronous serial interface. Aiming at this application, this paper designs and implements asynchronous serial communication between DSP5402 and PC.

2 Serial communication and DSP5402 serial port

In industrial control and practical applications, the application of serial communication has been very common. Figure 1 shows three common 232 communication methods. Here, the author chooses the short-distance wired transmission method. At present, the serial ports of most PCs adopt the RS-232 standard, which stipulates the use of a 25-pin DB25 connector. In fact, many of the 25 pins of RS-232 are rarely used, so the more commonly used serial ports are 9-pin and 25-pin. In ordinary circuit design, the simplest and most commonly used is the three-wire connection method, that is, the RS-232 control communication signal is not required in communication. The three pins of sending data (TXD), receiving data (RXD), and ground (GND) are connected to achieve full-duplex asynchronous serial communication. This article uses this method to realize serial communication between PC and DSP.


Figure 1 Three RS-232 communication modes
Since there is no clock signal in RS-232, it is transmitted at a fixed baud rate. A signal includes a start bit, a stop bit, and a data bit, and the parity bit can be selected. The data bit is 5-8 bits, and there are 5 options for the parity bit: odd parity, even parity, always 1, always 0, and empty; there are also three options for the stop bit: 1 bit, 11/2 bits, and 2 bits. When the serial port transmits data, the low bit is first, and the start bit indicates data transmission.

DSP5402 has two multi-buffered synchronous serial ports, which control the data flow through frame signals. Each serial port has six signals: CLKR/X: receive and send clock signals, DR/DX: receive and send serial data signals, FSR/FSX: receive and send frame synchronization signals; the serial interface has five registers: data receive register (DRR), data send register (DXR), serial interface control register (SPC), data receive shift register (RSR), and data send shift register (XSR). Three of them are memory mapped registers (SPC, DXR, and DRR) and two registers that cannot be directly accessed by the program (RSR and XSR). RSR and XSR are very useful when performing double buffering functions. The send data is written to DXR, and the receive data is read from DRR. For the configuration and control of each register, please refer to reference [2].

3 Software and Hardware Implementation of Serial Communication between DSP and PC

3.1 DSP and PC UART hardware connection

As mentioned above, the asynchronous serial port of the PC and the synchronous serial port of the DSP5402 are different in data format and transmission control, but the communication between the DSP5402 and the standard serial port can be realized through necessary hardware control and software simulation. There are two main hardware methods and two software simulation methods for the UART implementation of the DSP5402 and the PC. The hardware methods are as follows: synchronous to asynchronous implementation based on MAX3100 and using the DSP5402 I/O simulation timing method.

MAX3110E integrates a full-function UART and an RS-232 transceiver with built-in pump capacitors and 15kV ESD protection. Among them, the UART part uses a serial interface compatible with SPITM/QSPITM/MICROWIRETM, which can save circuit board space and the I/O pins of the microcontroller. Because the RS-232 part uses a unique low-voltage dropout output stage, the dual receive/transmit interface can provide true RS-232 characteristics under high-speed communication and normal power supply, and the power consumption is only 600μA. The MAX3110E can realize the conversion of synchronous serial data interface to asynchronous serial communication port (RS-232), which can be directly connected to the serial port (COM) of the PC. MAX3110E has the characteristics of small size, low price, low power consumption, and high communication rate, so it has a good application prospect. MAX3110E includes two independent parts: UART and RS-232. The UART part includes a serial interface compatible with SPI, a programmable baud rate generator, a transmit buffer and a transmit shift register, a receive buffer and a receive shift register, an 8-byte receive FIFO, and an interrupt generator with four maskable interrupt sources. The RS-232 part includes a self-capacitor electric pump and a hardware shutdown by SHDN.

MAX3110E communicates with DSP5402 in full duplex mode with 16-bit data via SPI interface. The 16-bit serial data sequence sent by DSP5402 to MAX3110 via BDX line includes transmission format control words, such as baud rate setting, interrupt mask, parity bit, etc. The McBSP serial interface of DSP5402 can be directly connected to MAX3110 when it works in SPI mode. BDX1 of DSP5402 is connected to DIN of MAX3110 as the transmission data line, BDR1 is connected to DOUT as the reception data line, the synchronization pulse signal BFSX1 is sent as the chip select signal, and the clock signal BCLKX1 is sent as the serial clock input of MAX3110. The hardware interface diagram is shown in Figure 2:


Figure 2 DSP5402 and MAX3110 hardware interface diagram
At the same time, the McBSP register of DSP5402 must be set according to the timing, so that this UART method can be realized. The timing diagram is shown in Figure 3:

Figure 3 Timing of MAX3110 and DSP5402
The analysis using DSP5402 I/O simulation timing method is as follows: use timer interrupt to process data, use I/O port to configure as input and output. Since DSP5402 has few individual I/O pins, it saves resources. Here, the flag pin XF of DSP5402 is used and the software is matched to achieve the hardware schematic diagram as shown in Figure 4:

Figure 4 Hardware schematic diagram
3.2 DSP and PC UART software implementation

The programming of DSP5402 based on MAX3100 synchronous to asynchronous conversion is as follows:

stm SPCR11,SPSA1 ; configure SPCR11
stm #1800h,MCBSP1
stm SPCR21,SPSA1 ; configure SPCR21
stm #0000h,MCBSP1
stm PCR1, SPSA1 ; configure PCR1
stm #0a0ch,MCBSP1
stm RCR11,SPSA1 ; configure RCR11
stm #0040h,MCBSP1
… … ; configure RCR21
stm XCR11,SPSA1 ; configure XCR11
stm #0040h,MCBSP1
… … ; configure XCR21
stm SRGR11,SPSA1 ; configure SRGR11
stm #0027h,MCBSP1
… … ; configure SRGR21
rpt #20 ; wait for 2 CLKSRG clock cycles
nop
stm SPCR21,SPSA1 ; Configure SPCR21
stm #0040h,MCBSP1
; Start MCBSP1 sampling rate generator
rpt #20 ; Wait for 2 CLKG clock cycles
nop
stm SPCR11,SPSA1
stm #1801h,MCBSP1 ; Start receiving
stm SPCR21,SPSA1 ; Configure SPCR21
stm #0041h,MCBSP1 ; Start MCBSP1 transmitting end
stm SPCR21,SPSA1 ; Configure SPCR21
stm #00c1h,MCBSP1 ; Start frame synchronization pulse
rpt #80 ; Wait for 8 CLKG clock cycles
nop
ld #0h,A
stm #0c042h,DXR11
; Configure MAX3110, 2 stop bits

After the configuration is completed, data can be sent, and the receiving program only needs to configure the corresponding receiving register according to the mode. Figure 5 shows the test interface.


Figure 5 Serial port debugging assistant test interface

For I/O simulation software programming, the communication baud rate can be set through timer interrupts. For DSP5402 timing, three registers, TIM0, PRD0, and TCR0, need to be set.

Timing time = TX (1 + TDDR) X (1 + PRD).

At the same time, the communication baud rate can also be set through software delay, the method is as follows:

DELAY: stm #1004h,AR6 ;communication rate: 1200bps
banz $,*AR6-
nop
ret

The software simulation program is shown in Figure 6.

Both software simulations need to be tested using the serial port debugging assistant on a PC. The author's test interface is shown in Figure 6. In order to meet actual application needs, you can use VC to write your own software.


Figure 6 Software simulation program

4 Conclusion

This paper mainly discusses the methods of realizing UART between TMS320VC5402 and PC. The synchronous serial port is simple, easy and stable. The software simulation does not require dedicated hardware, is flexible, convenient and low-cost, and each can meet its own needs. Both methods have been tested and passed. This idea has a certain reference value for studying DSP5402 and serial ports.

Keywords:TMS320VC5402 Reference address:Research and Design of UART between TMS320VC5402 and PC

Previous article:Practical MSP430: TB captures the pulse width of PWM wave
Next article:Clock chip ds1302 program, debugging passed (reprint)

Recommended ReadingLatest update time:2024-11-17 00:40

avr uart simulation experiment PROTEUS virtual terminal
Note that the settings of PROTEUS virtual terminal are as shown below. In advanced properties, be sure to select inverted, otherwise the result will be wrong. #include iom16v.h #include macros.h //#include stdio.h //#include "skey.c" #define uchar unsigned char #define uint unsigned int #define MCLK 80000
[Microcontroller]
avr uart simulation experiment PROTEUS virtual terminal
The microcontroller part of the program for serial communication between C51 microcontroller and PC
Note that the baud rate is 9600 Function: The computer sends a byte to the microcontroller through the serial port, and the microcontroller sends it back to the computer after receiving it. 、#include #define uchar unsigned char #define uint unsigned int uint temp; bit flag; void init_ser1(); main() { init_ser1();
[Microcontroller]
Assembly program for communication between PIC16F877 microcontroller and PC
;PIC16F877 MCU program LIST P=16F876 #INCLUDE P16F876.INC CBLOCK 0X24 COUNT TEMP ENDC ORG 0X0000 NOP START GOTO MAIN ORG 0X020 MAIN MOVLW 0X30 ;Initialize RAM unit MOVWF FSR BCF STATUS,RP0 MOVLW 0X22 MOVWF COUNT INTRAM MOVF COUNT,0 MOVWF INDF IN
[Microcontroller]
Example of communication between ATMEGA48's USART serial port and PC
/******************************************************** CodeWizardAVR http://www.avrdiy.com Chip type : ATmega48V Clock frequency : 7.372800 MHz Memory model : Small External SRAM size : 0 Data Stack size : 128 Baud rate 9600/8 data bits/1 stop bit/no parity M8V20 experiment board hardware settings 1: Short the 2
[Microcontroller]
Hardware Design of Serial Communication between PC and Multiple MCS-51 Single-Chip Microcomputers
1 Introduction In measurement and control systems and engineering applications, it is common to encounter situations where multiple tasks need to be executed simultaneously, so the master-slave multi-machine distributed system has become a widely used model in modern industry. Most of them are composed of IBM-PC micr
[Microcontroller]
Hardware Design of Serial Communication between PC and Multiple MCS-51 Single-Chip Microcomputers
YuanCheng communication between microcontroller and PC based on MODEM
    Abstract: The public telephone network technology is mature and covers a wide range. It is a very effective method to use the existing public telephone network to realize remote communication between microcontrollers and PCs. This article introduces in detail the hardware, software design and implementation metho
[Industrial Control]
As mobile phone manufacturers compete to enter the market, global PC shipments will drop by 9.5% in 2022
Only one month after Huawei released its last commercial notebook, desktop, monitor and other PC products, it has launched a number of new notebooks and monitors for smart office scenarios. This kind of release rhythm is rare in the industry. In addition, this year, domestic mobile phone manufacturers including Xiao
[Embedded]
Lenovo and Qualcomm will launch the industry's first 5G network-enabled PC
Last December, Qualcomm announced the world's first processor based on 7nm production technology for Always Connected PCs - Snapdragon 8cx; at this year's MWC exhibition, Qualcomm announced Snapdragon 8cx 5G, the world's first commercial 5G PC platform. At the upcoming Computex 2019 conference, Lenovo plans to launch
[Mobile phone portable]
Lenovo and Qualcomm will launch the industry's first 5G network-enabled PC
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号