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 |
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 |
Figure 3 Timing of MAX3110 and DSP5402 |
Figure 4 Hardware schematic diagram |
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.
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
- Popular Resources
- Popular amplifiers
- Siemens Motion Control Technology and Engineering Applications (Tongxue, edited by Wu Xiaojun)
- Virtualization Technology Practice Guide - High-efficiency and low-cost solutions for small and medium-sized enterprises (Wang Chunhai)
- 2024 DigiKey Innovation Contest
- MCU C language programming and Proteus simulation technology (Xu Aijun)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- EEWORLD University Hall----Live Replay: TI DLP? Products Empower Industrial Light Control Field and Innovation
- Help with two solidification methods in micropython
- LPS22HH Threshold Interrupt
- Live presentation: Fujitsu FRAM and glasses-free 3D video technology
- Just a few words
- Millimeter wave radar IWR1443
- mpy starts supporting USB for STM32L432
- TFT LCD Display Principle
- Voltage follower composed of op amp
- What sampling rate is required for an oscilloscope to measure various types of signals?