New method of replacing RS232 serial port with RS485 serial port

ARM (Advanced RISC Machines) is a general term for a class of microprocessors. ARM is a well-known enterprise in the microprocessor industry. It has designed a large number of high-performance, cheap, and low-power RISC processors, related technologies and software. The ARM microprocessor is a high-performance, low-power 32-bit microprocessor, which is widely used in embedded systems. ARM 9 represents ARM's mainstream processor, and has been widely used in handheld phones, set-top boxes, digital cameras, GPS, personal digital assistants, and Internet devices. Here, using the typical STR912FW44X6 chip in the ARM 9 series produced by ST as the MCU of the hardware development platform, the hardware design of the data acquisition and transmission system in the solar power generation system based on ARM is completed, and a serial port using RS 485 is proposed. A new method of communication instead of RS 232 string 121.

l Overall hardware design framework

The overall hardware design framework is shown in Figure 1.

2 Hardware introduction

The STR912FW44X6 chip is now used as a hardware development platform for MCUs. STR912FW44X6 expands the dot matrix LCD display, input buttons, UART interface, IrDA, CAN, USB, ETM interface, audio amplifier / microphone amplifier and Ethernet interface. Among them, the UART interface and Ethernet interface are used in this article. The UART interface is divided into an RS 232 serial port and two RS 485 serial ports. The RS 232 serial port is used to connect with the RS 232 serial port of the GSM module to realize the wireless transmission of GPRS; two RS 485 serial ports, one is used as a MODBUS communication interface, and the other is used to connect a power meter to collect statistics and display The amount of electricity generated by the solar power system. Ethernet is connected to the network through a network cable to achieve wireless transmission of data.

3 hardware circuit design and function realization

3.1 Circuit design and function realization of RS 232 serial port

RS 232 is a serial data interface standard, and is currently the most commonly used serial interface standard for data transmission between computers and computers, and between computers and peripherals. RS 232 serial interface bus is suitable for the communication distance between the equipment is not more than 15 m, the maximum transmission rate is 20 KB / s.

The RS 232 serial port is realized by ST3232EAR produced by ST Company. ST3232EAR is a chip that converts the computer's serial port RS 232 signal level (-lO V, +10 V) to the TTL signal level (OV, +3.3 V) used by the microcontroller. Its internal structure is composed of three parts: the first part is the charge pump circuit, which is composed of 1 to 6 feet and 4 capacitors. Its function is to generate two power supplies of +12 V and -12 V, which is needed to provide the level for the RS 232 serial port. The second part is the data conversion channel, which consists of 7 to 14 feet to form 2 data channels. Among them, 13 feet (RlIN), 12 feet (R1OUT), 11 feet (TlIN), 14 feet (T1OUT) are the first data channel; 8 feet (R2IN), 9 feet (R2OUT), 10 feet (T2IN), 7 Pin (T2OUT) is the second data channel. TTL / CMOS data is converted into RS 232 data from TlIN, T2IN input, and sent to computer DP9 plug from T1OUT, T20UT; RS 232 data of DP9 plug is converted from RlIN, R2IN input to TTL / CMOS data, then output from R1OUT, R2OUT. The third part is the power supply, which is composed of 15-pin GND and 16-pin VCC (+5 V).

By connecting the RXD and TXD of GPIO in the MCU with the 12 pins (R1OUT) and 11 pins (T1IN) of ST3232, make the 14 pins (T10UT) and 13 pins (R1IN) output RS 232 level, and then connect the GSM module RS 232 The serial port and the RS 232 serial port on the MCU board can achieve the purpose of controlling the functions of the GSM module by writing AT commands to the RS 232 interface, so as to realize data transmission through GPRS.

3.2 Circuit design and function realization of RS 485 serial port

RS 485 is used to collect solar power system data. The reason why RS 485 is used instead of RS 232 is because RS 485 has many advantages over RS ​​232. RS 232 adopts an unbalanced transmission method, that is, single-ended communication, and the data signals at the transceiver end are relative to the ground signal. Therefore, its common-mode suppression capability is poor, and coupled with the distributed capacitance of the twisted pair, the maximum transmission distance is about 15 m, the maximum rate is 20 KB / s, and it can only support point-to-point communication. The RS 485 uses balanced transmission and differential reception to achieve communication. Because the transmission line usually uses twisted pair, sometimes differential transmission, it has strong resistance to common mode interference. The sensitivity of the bus transceiver is very high and can be detected as low as 200. The voltage of mV, so the transmission signal can be recovered above 1000 kilometers. The maximum communication distance of RS 485 is about 1 219 m, and the maximum transmission rate is 10 MB / s. It uses a double-half-duplex working mode and can support multi-point data communication. Its bus generally supports up to 32 nodes.

The RS 485 interface chip uses ADM3485. ADM3485 uses a single power supply +3.3 V work, half-duplex communication mode, can complete the function of converting TTL level to RS 485 level. The structure and pins of the ADM34185 chip are very simple. It contains a driver and a receiver inside. The RO and DI terminals are the receiver output and the driver input, respectively. When connecting to the MCU, they only need to be connected to the MCU's RXD and TXD. Just connect. The RE and DE terminals are the enable terminals for receiving and transmitting. When RE is logic 0, the device is in the receiving state; when DE is logic 1, the device is in the transmitting state. Because the ADM3485 works in half-duplex state, it only needs to You can control these two pins with one pin of the single chip microcomputer. Terminal A and Terminal B are the differential signal terminals for receiving and transmitting, when the level of the A pin is higher than B, it means that the data sent is 1; when the level of A is lower than the B terminal. The data sent by the representative is O. The wiring is very simple when connecting with the single chip, and only one signal is needed to control the reception and transmission of the ADM3485. At the same time, add a matching resistor between the A and B terminals, generally select a 100 Ω resistor. The design has two RS 485, one of which is used as a MODBUS communication interface, and the other is used to connect an electricity meter to collect statistics and display the power generation amount of the solar power generation system.

3.3 Circuit design and function realization of Ethernet

The Ethernet network port uses 0880-1X1T-01, and the Ethernet physical layer interface chip uses ST's STEOOOP fast Ethernet physical layer chip. The STEl00P Ethernet interface chip provides a set of media independent interfaces (MII). Media independent means that any type of PHY device can work normally without redesigning or replacing the MAC hardware. The MII interface is a standard interface between the Fast Ethernet MAC layer and the PHY layer, and is the standard of the Ethernet industry defined by IEEE 802.3. It includes a data interface and a management interface between MAC and PHY. The data interface includes two independent channels for the transmitter and receiver. Each channel has its own data, clock and control signals. The MII data interface requires a total of 16 signals. The management interface is a dual-signal interface: one is a clock signal and the other is a data signal.

Through the management interface, the upper layer monitors and controls the PHY. The TCP / IP communication based on Ethernet enables ARM to be connected via a network cable and communicates with a computer in real time to transmit real-time data of the solar power generation system.

A new method of using RS 485 serial port instead of RS 232 serial port for communication is proposed. This method solves the limitation of the transmission distance and the number of nodes of the RS 232 serial port, and greatly improves the data transmission capability.

Midi fuse holder

Midi Fuse Block,Midi Fuse Box,Bussmann Midi Fuse Holder,Victron Midi Fuse Holder

Dongguan Andu Electronic Co., Ltd. , https://www.idofuseholder.com