Software implementation method of serial communication between TMS320C32 and PC

According to the characteristics of TMS320C32 and PC serial communication, the software implementation method of serial communication between the two is designed. The design method is simple in principle and reliable in operation.
Keywords: TMS320C32, PC, serial communication, code bit inversion


1 Introduction TMS320C32 (hereinafter referred to as C32) is a high-performance digital signal processor, it has a serial port on the chip, can achieve full-duplex serial communication, PC also has a serial communication interface, but two kinds of serial The communication protocol of the port is very different:
(1) C32 is synchronous mode, PC is asynchronous mode. The frame synchronization signal line of the C32 serial port is used separately from the data line. There are independent receiving frame synchronization FSR and sending frame synchronization FSX, independent receiving data line DR and sending data line DX; PC serial port has no separate frame Synchronization, data and synchronization are on the same signal line, and the receiving device relies on detecting the start bit to achieve synchronization.
(2) When C32 serial data is transmitted, the high bit of the byte is first and the low bit is behind, while the PC is low bit first and high bit second.
(3) When C32 data is transmitted, there is no start bit, and the PC has a start bit, a programmable stop bit and a check bit.
(4) C32 supports 8-bit, 16-bit, 32-bit serial data transfer, while PC supports 5-bit, 6-bit, 7-bit, 8-bit data transfer.
In some applications, when the C32 needs to communicate serially with a PC, the differences in these interface protocols will cause some trouble. Adding hardware circuits, such as TI's 16C754 chip, can directly implement protocol conversion.
In practice, I used the characteristics of the two to communicate, and designed a method for software to realize serial communication between TMS320C32 and PC. The implementation principle is described in detail below.
2 Serial communication conventions Serial communication conventions are:
Communication method: serial asynchronous. Interface mode: RS-232. Baud rate: 38400bit / s. Data character length: 8 bits. Start bit: 1 bit. Stop bits: 2 bits. No check digit.
3 Circuit connection C32 uses serial port 0, PC uses serial port A. The circuit connection of serial communication is shown in Figure 1.

In Figure 1, the abbreviations, names and definitions of communication signal lines are as follows:
TxD is Transfer Data, RxD is Receive Data, RTS is Request to Send, DX0 is data transmission, DR0 is data reception, FSR0 is data reception frame synchronization pulse, and GND is ground.
The Max232E in the picture is the inverter driver produced by Maxim, which is used to realize the level conversion. The TxD and RxD of the serial port of the PC are connected to the DR0 and DX0 of the C32 serial port 0 after level conversion. Here, the RTS (request to send) of the serial port of the PC needs to be level converted and connected to the frame synchronization pulse FSR0 of C32. The RTS generates the frame synchronization pulse signal required by C32 to receive.
4 Communication principle
4.1 TMS320C32 sends data to the PC. The data transmission from C32 to the PC is carried out on the DX1-RxD communication line. The operation steps of C32 are as follows:
(1) Initialization; (2) Fetch data (see Figure 2a); (3) Invert the code of 8-bit data (see Figure 2b). The code bit inversion is because the C32 serial data is transmitted with the high bit first and the low bit back, while the PC is the low bit first and the high bit back; (4) Left shift by 4 and 16 bits, see Figure 2c; (5) Add start and stop bits, see Figure 2d. There is no separate frame synchronization for the serial port of the PC. Data transmission and synchronization are on a signal line. The receiving device synchronizes by detecting the start bit. Therefore, the start bit and the stop bit must be added; (6) Write data to Send data register; (7) Repeat steps (2) ~ (6) to send the next byte of data.
The data receiving program or process of the PC is the same as that of the conventional serial asynchronous communication, and does not need to be changed. The received data is the data sent by the C32.
Figure 2 shows the change of data bytes during the data transfer of C32.


4.2 PC sends data to TMS320C32 When PC sends data to C32, it needs to generate a frame synchronization pulse signal FSR, which is sent by RTS of serial port (see Figure 1). When generating the FSR signal, two delays must be generated by software, delay 1 and delay 2. Delay 1 (see Figure 3a) ensures that the FSR pulse width corresponds to the baud rate. When the baud rate is 38 400bit / s, the time extension is about 26μs; Delay 2 (see Figure 3b) ensures that the FSR falling edge The time interval between the start bits of the transmitted data is equal to one bit. When the baud rate is 38 400bit / s, the elongation at this time is also 26μs. The operation steps of PC sending data are as follows:
(1) Initialization. (2) The software sets RTS = '1' to generate the rising edge of the FSR signal. (3) Software delay 1. (4) The software clears RTS = '0', and generates the falling edge of the FSR signal. Steps (2) ~ (4) generate a complete FSR pulse signal (see Figure 3a). (5) Software delay 2 (see Figure 3b). (6) Write data to the send data register. (7) Repeat steps (2) to (6) to send the next byte of data.
When C32 receives data, it first reads the received data register, and then performs shift and code bit inversion processing. The operation steps are as follows:
(1) Initialization. (2) Read the receive data register, 16-bit operation (see Figure 3c). (3) Right shift by 6 bits, valid 8-bit data is d13 ~ d6 (see Figure 3d). (4) The code bit is inverted, and the lower 8 bits of data are the data sent by the PC (see Figure 3e). (5) Repeat steps (2) to (4) to read the next byte of data.
When the PC sends data to C32, the corresponding relationship between the frame synchronization pulse signal and the transmitted data, and the data change process are shown in Figure 3.
5 Conclusion The software communication implementation method introduced in the concluding article only requires a small amount of software workload and no hardware circuit. The design principle is very simple, and the actual application also proves that this communication method is very reliable, which can be used for similar serial communication. .

references

1 Zhang Zaihong. Microcomputer interface control tutorial. Beijing: Tsinghua University Press, 1992

4G UFI

4G Ufi and 5G Ufi are two Wireless Router devices in mobile communication technology. All of them can provide wireless Internet connectivity, but the main difference is the network technology and speed they support.

4G Ufi is a wireless router device that uses fourth-generation mobile communication technology (4G). It can connect to the Internet over a 4G network and provide network connectivity to other devices via Wi-Fi or wired connections. Key benefits of 4G Ufi include:

1. High-speed network connection: 4G Ufi can provide faster network speed than the traditional 3G network, which can meet the needs of users for high-speed Internet. This is important for applications with high bandwidth requirements such as online video, games, and downloading large files.

2. Stable connection: 4G Ufi uses 4G network connection, which provides a more stable and reliable connection compared to 3G network. This means users can better enjoy a seamless web experience, whether at home or on the move.

3. Mobility: Since 4G Ufi uses a wireless connection, users can use it anytime, anywhere. This is very convenient for people who need to use the network in different locations, such as travelers, business people, and students.

5G Ufi is a wireless router device that uses fifth-generation mobile communication technology (5G). It can connect to the Internet via 5G networks and offer faster speeds and lower latency. Key benefits of 5G Ufi include:

1. Extremely high Internet speed: 5G Ufi can provide higher Internet speed than 4G networks. According to the specifications of 5G technology, its theoretical peak speed can reach hundreds of megabits per second or even higher. This allows users to download and upload files faster, watch HD videos smoothly, and enjoy a faster Internet experience.

2. Low latency: 5G Ufi can provide lower latency than 4G networks. Latency refers to the time interval between sending and receiving data and is important for real-time applications such as online games, video calls and iot devices. Low latency provides faster response times and a better user experience.

3. Large capacity: 5G Ufi can support more device connections. Due to the high speed and low latency of 5G networks, it can connect more devices at the same time without degrading network performance. This is useful for scenarios where multiple devices need to be connected, such as homes, offices, and public places.

In summary, 4G Ufi and 5G Ufi are both wireless router devices, and the main difference between them is the supported mobile communication technology and speed. 4G Ufi provides high-speed, stable and mobile network connections, while 5G Ufi provides higher network speeds, low latency and large-capacity connections. Which device you choose depends on the user's specific requirements for network performance and requirements.

4G UFI,4G UFI oem,best 4G UFI,cheapest 4G UFI

Shenzhen MovingComm Technology Co., Ltd. , https://www.szmovingcomm.com

Posted on