Friday, March 18, 2011
【 Weak current College 】 serial expansion scenario summary 】
Serial interface device control by virtue of its interface is simple, flexible, consume system resources less, etc., are widely used in industrial control, home security, GPS navigation, as well as water, electricity, gas meter reading meter etc. In the embedded system, may have many from devices via a serial interface to communicate with the host, such as GPRS MODEM, infrared sending and receiving module, RS485 bus interface, and so on. This allows developers often face embedded system host serial communication interface to deficiency, in response to this problem, this article describes a few common solutions. Software simulation software simulation method based on serial communication delivery format, use a timer and host of the I/O port to simulate timings, serial communication in order to achieve the purpose of extending the serial port. Receive process requires testing start bit, which you can use the query pattern, or interruption in the port has the function of the host can also use port interrupt processing. Receive and send process, on the timing of processing you can use query mode you can also use the timer in interrupt mode. In order to ensure the correctness of the data in the receive process can detect asynchronous transfer to the starting signal, plus some anti-jamming, if it is a wireless transmission system, when it receives each bit can be used multiple times for sampling. For cable system, 1 sample, you see, SPI, IIC, who went to a number of sampling. Now software simulation to its low cost, easy to use, has become a trend, but not all are suitable for single-chip microcontroller
For serial port software-software simulation modeling approach in general there are two, one is to read and write I/O, another way is to read and write to the port it is easy to think of adopting-read and write to the port of simulation, the serial baud rate must be consistent. and when the data input time difference only then dozens of microseconds, easily lead to loss of data, although it looks this way you can also enter data-side short circuit withstand high data volume pressure test, but this test method is just landed in the programme best input point so genuine use is likely to go wrong. using our PDK80CXX series in 8-channel (4-channel full duplex communication) serial port emulation, can be used to read and write I/O port to complete, so that we can very easily complete a chafer, the baud rate setting and can reach a very high rate, when an external crystal 8MHz, 3 ways of the maximum speed can reach 38400 above. I think is the baud rate General 38400 SCM also is sufficient. as the saying goes, "strike also dunzi hard", and we are the industry standard PDK80CXX design, strong anti-interference, wide temperature operating range-do not know you, there are currently no used can-40-+ 120 degrees centigrade of SCM simulation therefore adopt PDK80CXX serial port expansion is currently cost-effective solution. Use the parallel port to a serial port expansion serial port based on the serial port extension Intel8251 Intel8251 is a general-purpose synchronous/asynchronous transmitter (USART), it works you can programmatically set, and has a separate receive/dispatcher. Can be either synchronous or asynchronous serial communication mode, auto-complete frame format, has a strange, even parity, and error detection circuit. Based on the serial port extension TL16C554 TL16C554 is a TI company produced 4 channel asynchronous transceiver chip. On TL16C554 serial channel control, the control registers through on LCR, IER, DLL, DLM, MCR and FCR programming. These control Word determines the character length, the number of stop bits, parity, baud rate, and modem interface. Control registers can be written in any order, but must be the last write IER, because it controls the interrupt-enabled. Serial channel with baud rate generator (BRG) allows clock divided by 1 to any number between 65535, BRG according to their different three common frequency in a to determine the standard baud rates. 16C55x series chip also includes 16C550, 16C552, respectively can be extended by 1 and 2 serial port. Use serial-serial port extension based on GM8123/25 series chip serial port extension GM8123/25 series serial expansion chips can all hardware serial expansion, address format can be set, and with standard serial communication format compatibility. GM8125 scalable 5 standard serial port, serial port through the external pin select extended mode: single mode and multi-channel operating mode. Single channel mode, do not need to set the chip communication form, a serial and bus baud rate of serial port to the same, the same time only allows a group of child serial ports and serial communication, working mother child select serial port from address line. Single-channel operating mode applies to all from the machine does not need to be at the same address and communication process is entirely up to the host control system. Multi-channel mode, each child is the same as the serial baud rate, allowing all child serial serial communication with mother, mother son serial baud rate of serial port to 6 times. Sent from address line select to send the data of the child when the child received serial port; proactively respond to the serial port from the machine to send data to the serial port by the mother, and sent to the host from address line returns a child of the received data to the host serial port address in the received a serial port to send data, you can add lines for stateful data which is sent from the machine. Multichannel work mode, the data communication to work on the chip set, including serial frame format settings and communication baud rate setting. Through the serial port and control PIN to complement one another to work on the chip, pin set to 0, and MS STADD2 ~ STADD0 for when you write the command Word 000, pin MS to 1, 000 STADD2 ~ STADD0 to read command. For work setting, chip frame formatand female serial baud rate and the work of the last data communication; and reset the frame format for the serial baud rate 11bit, mother to 7200bps.Based on the serial port extension SP2338 SP2338 adopts low-power CMOS design of universal asynchronous serial port extension chip, it can easily host original 1 x serial port extension into three new full-duplex serial port. SP2338 applies to 1 start bit, eight data bits, 1 stop bit of multi-serial system, that is its frame format is not programmable. Host by changing ADRI1, ADRI0 address line status to select 3 child serial port name, the address of the 3 child serial-00, 01, 10. Address 11 used to perform the reset SP2338 chip itself or instruction 0x35, sleep instruction 0xB5 0x55 or 0xD5, delay directive 0x00. To RX0 ~ RX3 any one receive port to write arbitrary data to SP2338 wake-up, but as the wake-up time needed SP2338 25ms or so, so wake up for chip data will not be the host receiving. Therefore, you can send one byte of data is used to wake-up chips, delay after normal 25ms of data transfer. Unused input ports such as RX0, RX1, RX2 and so must be connected to the VCC; unused output ports, such as TX0, TX1 and TX2, etc. must be vacated; unused ADRI0, ADRI1 must be connected to the GND. Host sends and receives data time series: host TX3 receive
To a byte read immediately after SP2338 output address ADRO0, ADRO1 State, judge the received data from which child serial port; host sends data, first select by ADRI1 ADRI0, one child serial port a, and then write to TX3 will send data. There are also time-division multiplexing of extension methods in the circuit design process, this article to devise a suitable system needs, one serial port extension to 3 serial port options, as shown in Figure 1. Of these, 4001 is Quad 2 input nor gate, 40106 is six Schmitt trigger. 4001 4 feet and 9 feet for RXD and TXD host, 40106 2 feet and 9 feet for a serial port TXD0 and RXD0, 6 foot and 11 feet as a serial port TXD1 andRXD1, 13 4 legs and feet as a serial port TXD2 and RXD2. According to the figure of the connection methods and logic algebra of available: RXD status equal to 9 feet, 40106 11 feet, 13 feet of status and. When the 9 feet, 40106 11 feet, 13 feet in a data signals, due to the asynchronous serial communication, no data transmission of pin status is high, the RXD, would receive the data signals of the pins on the status of the data. 40106 of 2 feet, 4 feet, 6 feet of State of the State equal to TXD, so you can take advantage of 2 feet, 40106 4 feet, 6 feet as a serial port TXD. This design applies to host simultaneously to multiple serial devices to send data to and from the device does not send data to the host at the same time. Then increase the number of signal lines, you can distinguish which data from the device to send and receive data from a slave device. In this system, the host is the communication of the initiator, the received data from which the device is predictable, therefore, simply add three control device enabling signal cable. Several methods in the need to expand the system's serial port, use multiple serial port SCM method is the easiest to think of. Due to the serial port is integrated on the chip, so the device volume is small, high anti-interference ability, but many serial MCU is often more expensive, and, if you are a developer you are not familiar with the models, also requires developers to learn and purchase and accompanying development tools, which extends the product development cycle, increased product development costs. Software simulation method uses less system resources, low cost, easy to realize. Has been more and more people. Especially the simulations based on PDK80CXX series serial application to its moderate price, strong anti-jamming and wide working temperature, it will be more industrial data acquisition are used. Parallel port extended function of serial method, and can provide more powerful MODEM control signals, communication speed is high, but the control of complex, the port occupies the MCU resource, while the price is relatively high. Use serial-serial port extension, the control is simple, to minimize the control line, without taking up too much of a host system resources, and versatile, stable performance, can guarantee the correctness of the data. GM812x shortcomings is that the application does not meet the ultra-low power consumption; multi-channel mode, all child serial baud rate can only be set to work consolidated value, does not apply to the baud rate from the machine work is inconsistent, and requirements at the work of the system. SP2338 while meeting the requirements of the low-power, but its child serial baud rate also needs to be set to uniform, and not data frame format programming, maximum baud rate is 9600bps. This approach, each child serial serial characteristics and the same mother, use a simple serial interface, consume system resources, easy-to-control (at least 2 control signal extension 3 serial port), good stability. Its power is dependent upon the 4001 and 40106, their power consumption in mA-level. Its maximum baud rate depends on 4001 and 40106 response, 4001 and 40106 maximum response delay is 250ns, so theoretically the maximum baud rate up to 4Mbps. This method has been successfully applied to the three-meter-reading system. The disadvantage of this approach is that it cannot be used from the machine work is inconsistent, the baud rate for the work of the system at the same time. Closing this article has designed a kind of extension methods to deal with the serial port in the practical application of the host serial port resources shortage, the method has been successfully applied to the third table in the remote system. To resolve this problem, this article also compares to other solutions.