[go: up one dir, main page]

CN201303348Y - Universal multi-serial bus converter - Google Patents

Universal multi-serial bus converter Download PDF

Info

Publication number
CN201303348Y
CN201303348Y CNU200820174181XU CN200820174181U CN201303348Y CN 201303348 Y CN201303348 Y CN 201303348Y CN U200820174181X U CNU200820174181X U CN U200820174181XU CN 200820174181 U CN200820174181 U CN 200820174181U CN 201303348 Y CN201303348 Y CN 201303348Y
Authority
CN
China
Prior art keywords
bus
microcontroller
pin
controller
usb
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
CNU200820174181XU
Other languages
Chinese (zh)
Inventor
何波
任红恩
韩盈盈
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ocean University of China
Original Assignee
Ocean University of China
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ocean University of China filed Critical Ocean University of China
Priority to CNU200820174181XU priority Critical patent/CN201303348Y/en
Application granted granted Critical
Publication of CN201303348Y publication Critical patent/CN201303348Y/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Landscapes

  • Information Transfer Systems (AREA)
  • Bus Control (AREA)

Abstract

本实用新型涉及一种控制信号的传输系统,尤其涉及一种多串行总线的转换装置。本实用新型的通用多串行总线转换装置,包括微控制器、USB接口单元、CAN总线接口单元、以太网接口单元、RS232及RS485接口单元,其中USB接口单元、CAN总线接口单元、以太网接口单元分别通过并行总线与微控制器相连,RS232及RS485接口单元通过光电隔离器件与微控制器连接。本实用新型通过多串口系统增强了网络的兼容性问题,并彻底隔离装置与网络间的电气干扰,具有广泛的应用范围。

Figure 200820174181

The utility model relates to a control signal transmission system, in particular to a multi-serial bus conversion device. The universal multi-serial bus conversion device of the present utility model comprises a microcontroller, a USB interface unit, a CAN bus interface unit, an Ethernet interface unit, RS232 and RS485 interface units, wherein the USB interface unit, the CAN bus interface unit, and the Ethernet interface The units are respectively connected to the microcontroller through a parallel bus, and the RS232 and RS485 interface units are connected to the microcontroller through a photoelectric isolation device. The utility model enhances the compatibility problem of the network through the multi-serial port system, completely isolates the electrical interference between the device and the network, and has a wide range of applications.

Figure 200820174181

Description

通用多串行总线转换装置 Universal Multiple Serial Bus Converter

技术领域 technical field

本实用新型涉及一种控制信号的传输系统,尤其涉及一种多串行总线的转换装置。The utility model relates to a control signal transmission system, in particular to a multi-serial bus conversion device.

背景技术 Background technique

现有协议转换装置大多是针对两种协议的转换,比如RS232转CAN总线,RS232转USB总线等,这些转换装置只是针对特定应用场合而定制的,缺乏一定的通用性。对于通过PC控制多个不同网络的应用场合,要求转换装置与PC传输速率大于所控制网络的速率,才不会出现传输速率的“瓶颈”现象。现有网络协议多种多样,有时要求多个不同网络进行无缝连接,或通过接入采用各种通信接口的第三方设备实现网络扩展,显然现有装置难以满足上述应用场合和要求。Most of the existing protocol conversion devices are for the conversion of two protocols, such as RS232 to CAN bus, RS232 to USB bus, etc. These conversion devices are only customized for specific applications and lack certain versatility. For applications where multiple different networks are controlled by a PC, the transfer rate between the conversion device and the PC is required to be greater than the rate of the controlled network, so that there will be no "bottleneck" phenomenon of the transfer rate. There are many kinds of existing network protocols, and sometimes multiple different networks are required to be seamlessly connected, or to achieve network expansion through access to third-party devices using various communication interfaces. Obviously, existing devices are difficult to meet the above-mentioned application scenarios and requirements.

如2008年1月16日公开的中国专利申请,公开号为CN101105890A,其公开了一种基于AT91M40800的多串口总线系统,具有CAN、以大网、RS485和红外遥控接口的多串口总线系统。RS232是应用最广泛的通信协议之一,很多串行设备都是采用RS232接口,同时由于USB通信协议具有传输速率快,支持即插即用等特点,USB技术在嵌入式系统中的应用越来越广泛。显然此发明难以支持采用RS232接口的第三方设备接入网络,也不支持USB技术,其通用性还有一定的欠缺。Such as the Chinese patent application disclosed on January 16, 2008, the publication number is CN101105890A, which discloses a multi-serial bus system based on AT91M40800, which has CAN, Ethernet, RS485 and infrared remote control interfaces. RS232 is one of the most widely used communication protocols. Many serial devices use RS232 interface. At the same time, because the USB communication protocol has the characteristics of fast transmission rate and support for plug and play, the application of USB technology in embedded systems is increasing. more extensive. Obviously, this invention is difficult to support third-party devices using RS232 interface to access the network, nor does it support USB technology, and its versatility still has a certain lack.

实用新型内容 Utility model content

本实用新型的技术效果能够克服上述缺陷,提供一种通用多串行总线转换装置,其集成了多种通信协议端口,通用性好。The technical effects of the utility model can overcome the above defects, and provide a universal multi-serial bus conversion device, which integrates multiple communication protocol ports and has good versatility.

为实现上述目的,本实用新型采用如下技术方案:其于包括微控制器、USB接口单元、CAN总线接口单元、以太网接口单元、RS232及RS485接口单元,其中USB接口单元、CAN总线接口单元、以太网接口单元分别通过并行总线与微控制器相连,RS232及RS485接口单元通过光电隔离器与微控制器连接。In order to achieve the above object, the utility model adopts the following technical scheme: it includes a microcontroller, a USB interface unit, a CAN bus interface unit, an Ethernet interface unit, RS232 and RS485 interface units, wherein the USB interface unit, the CAN bus interface unit, The Ethernet interface unit is connected to the microcontroller through a parallel bus, and the RS232 and RS485 interface units are connected to the microcontroller through a photoelectric isolator.

所述微控制器单元采用Microchip公司的高性能PIC24FJ128GA006的16位单片机,最高运行速度达16MIPS,具有128K ROM和8K SRAM。此单片机自带两个UART端口,支持RS232和RS485通信模式,可用于本系统中RS232和RS485接口单元扩展,充分利用了片上资源并节省外围器件,同时提高了模块的可靠性。根据每个模块的实际需要,在微控制器中为每个端口开辟了不同的数据缓冲区。装置工作机理是:各个通信端口由接收任务和发送任务构成,各任务由信号量实现挂起或激活。当一个端口接收到数据时,便把接收到的数据发送到其余各端口数据缓冲区,同时向其余端口的发送任务发送信号量,用于通知缓冲区有数据,其余端口发送任务在接收到信号量后即被激活,然后把缓冲区中数据发送到网络,从而实现了各不同网络之间的数据传输,其中USB端口用于USB存储设备,存储其余通信端口的数据或连接上位机用于实现上位机通过USB端口对其余网络的控制。Described microcontroller unit adopts 16 single-chip microcomputers of the high-performance PIC24FJ128GA006 of Microchip Company, and the highest running speed reaches 16MIPS, has 128K ROM and 8K SRAM. This MCU comes with two UART ports, supports RS232 and RS485 communication modes, and can be used to expand the RS232 and RS485 interface units in this system, making full use of on-chip resources and saving peripheral devices, while improving the reliability of the module. According to the actual needs of each module, different data buffers are opened up for each port in the microcontroller. The working mechanism of the device is: each communication port is composed of a receiving task and a sending task, and each task is suspended or activated by a semaphore. When a port receives data, it sends the received data to the data buffers of the other ports, and at the same time sends a semaphore to the sending tasks of the other ports to notify that there is data in the buffer, and the sending tasks of the other ports receive the signal It is activated after the amount of data, and then the data in the buffer is sent to the network, thus realizing the data transmission between different networks, in which the USB port is used for the USB storage device, storing the data of the other communication ports or connecting the upper computer for realization The upper computer controls the rest of the network through the USB port.

所述USB接口单元包含USB控制器和USB插座,其中USB控制器采用泌恒电子公司的CH375,支持USB1.1和USB2.0协议,可以工作于USB主机和USB设备两种模式。工作于USB主机方式时,用于连接USB存储设备,使用内置固件程序,微控制器只需若干指令即可对其实现各种操作,用于把通过装置其它端口传输的数据存储到USB存储设备中。工作于USB设备方式时,用于连接上位机,可实现上位机通过USB接口控制不同网络。USB插座包括USB-A和USB-B插座,分别用于连接USB设备和USB主机。USB接口工作在USB主机或USB设备模式采用跳线选择。The USB interface unit includes a USB controller and a USB socket, wherein the USB controller adopts CH375 of Biheng Electronics Company, supports USB1.1 and USB2.0 protocols, and can work in two modes of USB host and USB device. When working in the USB host mode, it is used to connect the USB storage device. Using the built-in firmware program, the microcontroller can realize various operations on it with only a few instructions, and is used to store the data transmitted through other ports of the device to the USB storage device. middle. When working in the USB device mode, it is used to connect to the host computer, which can realize the host computer to control different networks through the USB interface. The USB sockets include USB-A and USB-B sockets, which are respectively used to connect USB devices and USB hosts. The USB interface works in USB host or USB device mode with a jumper selection.

所述以太网接口单元包含以太网控制器和以太网变压器,其中以太网控制器采用Silabs公司的新型独立以太网控制芯片CP2200,内部集成了IEEE 802.3以太网媒体访问控制器(MAC)和10BASE-T PHY,完全兼容100/1000BASE-T网络,支持广播或多播MAC寻址,CP2200的多种集成功能有效地减轻了单片机的载荷;以太网变压器采用PRJ系列的PRJ-010型变压器,该变压器集成了RJ45网络接头,具有2kV以上的电压隔离性能。The Ethernet interface unit includes an Ethernet controller and an Ethernet transformer, wherein the Ethernet controller adopts a new independent Ethernet control chip CP2200 of Silabs Company, which integrates an IEEE 802.3 Ethernet media access controller (MAC) and 10BASE- T PHY, fully compatible with 100/1000BASE-T network, supports broadcast or multicast MAC addressing, the various integrated functions of CP2200 effectively reduce the load of the single-chip computer; the Ethernet transformer adopts the PRJ-010 transformer of the PRJ series, the transformer Integrated RJ45 network connector, with voltage isolation performance of more than 2kV.

所述CAN总线接口单元包含CAN总线控制器和CAN总线驱动器及光电隔离器件,其中CAN总线控制器采用Philips公司的SJA1000,支持CAN2.0B通信协议,最大通信速率1Mbit/s,支持标准帧和扩展帧模式,光电隔离选用高速器件6N137。The CAN bus interface unit includes a CAN bus controller, a CAN bus driver and a photoelectric isolation device, wherein the CAN bus controller adopts SJA1000 of Philips Company, supports the CAN2.0B communication protocol, and has a maximum communication rate of 1Mbit/s, and supports standard frames and extensions. Frame mode, photoelectric isolation selects high-speed device 6N137.

所述RS232和RS485接口单元由微控制器自带UART通信模块外接MAX232和MAX485电平转换器实现,此外还有光电隔离器件。应用微控制器自带UART方式充分利用了片上资源并且节省了外围器件,光电隔离选用高速器件6N137。The RS232 and RS485 interface units are implemented by the microcontroller with its own UART communication module and externally connected with MAX232 and MAX485 level converters, and in addition there are photoelectric isolation devices. The UART mode of the microcontroller is used to make full use of the on-chip resources and save peripheral devices, and the high-speed device 6N137 is selected for photoelectric isolation.

PC端的配置软件由VC实现,可以配置CAN总线、以太网、RS232和RS485。The configuration software on the PC side is implemented by VC, which can configure CAN bus, Ethernet, RS232 and RS485.

本实用新型具有多种用途,可用于多个不同网络间的互联或通过PC控制多个网络及通过接入采用不同接口的第三方设备实现网络扩展,具有一定的通用性。通过跳线可选择装置进入配置模式或正常工作模式。在配置模式下,通过装置中RS232端口连接PC中的配置软件,可对CAN总线、以太网及RS232和RS485的参数及各网络间数据交换的方式进行配置,PC中的配置软件用VC实现。通过对CAN总线、以太网及RS232和RS485的配置,可任意选择这三个端口的工作参数,从而可使装置工作于各种场合,此外还可通过跳线选择USB接口工作在主机模式或设备模式,大大提高了装置的通用性。The utility model has multiple uses, and can be used for the interconnection between multiple different networks or controlling multiple networks through a PC and realizing network expansion through accessing third-party devices with different interfaces, and has certain versatility. The device can be selected to enter the configuration mode or the normal operation mode through the jumper. In the configuration mode, connect the configuration software in the PC through the RS232 port of the device, and configure the parameters of CAN bus, Ethernet, RS232 and RS485 and the data exchange mode between each network. The configuration software in the PC is realized by VC. Through the configuration of CAN bus, Ethernet, RS232 and RS485, the working parameters of these three ports can be selected arbitrarily, so that the device can work in various occasions. In addition, the USB interface can be selected to work in host mode or equipment through jumpers mode, greatly improving the versatility of the device.

CAN总线接口单元,RS232及RS485接口单元均采用光电隔离器件实现连接,避免了网络中的干扰进入转换装置,保证了工作的可靠性,并同时采用DC/DC电源隔离器件给光电隔离及后端器件供电,彻底隔离网络与装置之间的电气干扰。The CAN bus interface unit, RS232 and RS485 interface units are connected by photoelectric isolation devices, which prevents the interference in the network from entering the conversion device and ensures the reliability of the work. The device is powered, and the electrical interference between the network and the device is completely isolated.

微控制器中嵌入了实时操作系统uC/OS-II,它是一个基于优先级的抢占式多任务实时内核,系统中的每个任务都是基于事件驱动的。在装置中,每个端口分别由发送任务和接收任务负责通信,每个任务都由对应的信号量控制启动或挂起。接收任务的信号量是由相应端口的接收中断程序发送的,发送任务的信号量是由其它端口把接收到的数据存入此任务的数据缓冲区后发送的。通过植入uC/OS-II系统,使系统运行于多任务模式下,大大提高了系统的实时性。The real-time operating system uC/OS-II is embedded in the microcontroller, which is a priority-based preemptive multi-task real-time kernel, and each task in the system is event-driven. In the device, each port is responsible for communication by a sending task and a receiving task, and each task is started or suspended by a corresponding semaphore control. The semaphore of the receiving task is sent by the receiving interrupt program of the corresponding port, and the semaphore of the sending task is sent by other ports after storing the received data into the data buffer of this task. By implanting the uC/OS-II system, the system runs in multi-task mode, which greatly improves the real-time performance of the system.

RS232及RS485接口单元由片上自带UART通信模块和少量外围电路实现,充分利用了片上资源,节省了外围器件,同时增加了系统可靠性。The RS232 and RS485 interface units are realized by the on-chip UART communication module and a small amount of peripheral circuits, making full use of on-chip resources, saving peripheral devices, and increasing system reliability.

本实用新型通过多串口系统增强了网络的兼容性问题,并彻底隔离装置与网络间的电气干扰,具有广泛的应用范围。The utility model enhances the compatibility problem of the network through the multi-serial port system, completely isolates the electrical interference between the device and the network, and has a wide range of applications.

附图说明 Description of drawings

图1为本实用新型的结构框图。Fig. 1 is a structural block diagram of the utility model.

具体实施方式 Detailed ways

所述USB接口单元U2采用CH375作为USB总线控制器,U2 TXD引脚接地用于选定并行总线工作方式。U2数据总线D[7:0]连接到微控制器U1地址/数据复用总线PMA[7:0]/PMD[7:0],U2片选信号CS接U1片选输出引脚PMCS1,命令/数据选择信号A0接U1地址位PMA3,当CS有效同时A0引脚为高电平时选择命令端口,可以写入命令;当CS有效同时A0引脚为低电平时选择数据端口,可以读写数据,所有操作都是由命令码和若干个输入或输出数据组成,部分命令不需要输入数据或没有输出数据。A0=1向命令端口写入命令,随后A0=0写入或读出数据。U2中断输出信号INT接U1外部中断输入引脚INT1,读写控制信号WR_N、RD_N分别与U1读写信号WR、RD信号相连.The USB interface unit U2 adopts CH375 as the USB bus controller, and the U2 TXD pin is grounded for selecting the parallel bus working mode. The U2 data bus D[7:0] is connected to the microcontroller U1 address/data multiplexing bus PMA[7:0]/PMD[7:0], the U2 chip select signal CS is connected to the U1 chip select output pin PMCS1, and the command /Data selection signal A0 is connected to U1 address bit PMA3, when CS is valid and A0 pin is high level, select the command port, and you can write commands; when CS is valid and A0 pin is low level, select the data port, you can read and write data , all operations are composed of command codes and several input or output data, and some commands do not require input data or have no output data. A0=1 writes a command to the command port, then A0=0 writes or reads data. The U2 interrupt output signal INT is connected to the U1 external interrupt input pin INT1, and the read and write control signals WR_N and RD_N are respectively connected to the U1 read and write signals WR and RD.

软件设计主要包括CH375的初始化,装置工作于USB主机和USB设备时的接收和发送数据操作。由跳线选择USB工作在主机或设备模式。作为USB主机工作时,应用CH375内置的处理Mass-Storage海量存储设备的专用通讯协议的固件,可自动检测并识别包括USB硬盘和USB闪存盘等常用的USB存储设备的连接。应用CH375专用内置固件,微控制器可直接以扇区为基本单位读写USB存储设备。作为USB设备工作时,使用CH375内置固件模式,可自动检测USB主机的连接。具体工作机理是:作为USB主机工作时,如检测到有USB存储设备接入,微控制器在存储设备中分别建立名称为CAN.txt,Ethernet.txt,RS232.txt,RS485.txt的文件,用于存储对应端口中的数据,存储格式为16进制;作为USB设备工作时,如接收到USB主机下传的数据,先把接收到的数据分别存入各端口缓冲区,然后再向各端口发送一个信号量用于通知数据缓冲区有数据,各端口在接收到信号量之后便把缓冲区中的数据发送到网络中,从而实现了PC通过USB接口连接不同的网络。The software design mainly includes the initialization of CH375, and the operation of receiving and sending data when the device works as a USB host and a USB device. Select USB to work in host or device mode by a jumper. When working as a USB host, the built-in firmware of the CH375 that handles the Mass-Storage mass storage device's dedicated communication protocol can automatically detect and identify the connection of commonly used USB storage devices including USB hard disks and USB flash drives. Using CH375 dedicated built-in firmware, the microcontroller can directly read and write USB storage devices with sectors as the basic unit. When working as a USB device, use the built-in firmware mode of CH375 to automatically detect the connection of the USB host. The specific working mechanism is: when working as a USB host, if a USB storage device is detected, the microcontroller will create files named CAN.txt, Ethernet.txt, RS232.txt, and RS485.txt respectively in the storage device. It is used to store the data in the corresponding port, and the storage format is hexadecimal; when working as a USB device, if the data downloaded from the USB host is received, the received data is first stored in the buffer of each port, and then sent to each port. The port sends a semaphore to inform the data buffer that there is data, and each port sends the data in the buffer to the network after receiving the semaphore, thus realizing the connection of the PC to different networks through the USB interface.

所述CAN总线接口单元采用SJA1000(U3)作为CAN总线控制器U3,U3地址/数据复用总线接口AD[7:0]与U1地址/数据复用总线PMA[7:0]/PMD[7:0]相连,地址锁存输入信号ALE接U1地址锁存输出信号PMA0,用于分离地址和数据信息。片选输入引脚CS接U1 PMA4引脚用于片选,U3中断输出引脚INT接U1外部中断输入INT2,读写控制输入信号分别接U1读写控制输出信号RD、WR。U3内部共32个寄存器,微控制器通过对这些寄存器的读写操作实现了CAN总线的控制,微控制器读写这些寄存器与操作片上自带寄存器一样。CAN总线驱动器U7采用PCA82C250,U3与U7之间具有光电隔离电路,避免CAN网络中的干扰进入该装置,DC/DC电源隔离模块给光电隔离和U7供电,使装置与CAN网络从电气上彻底隔离。Described CAN bus interface unit adopts SJA1000 (U3) as CAN bus controller U3, U3 address/data multiplexing bus interface AD[7:0] and U1 address/data multiplexing bus PMA[7:0]/PMD[7 :0] connected, the address latch input signal ALE is connected to the U1 address latch output signal PMA0, which is used to separate address and data information. The chip select input pin CS is connected to the U1 PMA4 pin for chip selection, the U3 interrupt output pin INT is connected to the U1 external interrupt input INT2, and the read and write control input signals are respectively connected to the U1 read and write control output signals RD and WR. U3 has a total of 32 registers. The microcontroller realizes the control of the CAN bus through the read and write operations of these registers. The read and write of these registers by the microcontroller is the same as the operation of the on-chip registers. CAN bus driver U7 adopts PCA82C250. There is a photoelectric isolation circuit between U3 and U7 to prevent the interference in the CAN network from entering the device. The DC/DC power isolation module supplies power to the photoelectric isolation and U7, so that the device is completely isolated from the CAN network electrically. .

软件设计包括CAN总线的初始化,数据的发送和接收。CAN总线的初始化包括工作方式、接收滤波方式、接收屏蔽寄存器、波特率参数设置、中断使能寄存器参数设置,其中接收滤波方式、接收屏蔽寄存器和波特率参数设置可由PC端设置软件自由设置,这里只是初始化为默认设置。中断使能寄存器开通接收中断和错误中断,进入错误中断后检查产生错误的原因,如果是发送或接收错误,则清零相应标志位,然后返回,如果是总线错误且错误计数器值大于255,则复位总线。默认发送方式为发送标准帧,且所有发送帧的ID为0,可设置为发送固定ID的标准帧和扩展帧或由发送缓冲区中的前两个字节提供ID的标准帧和扩展帧。当发送任务收到缓冲区满信号量后,便按照预先设置发送缓冲区中数据。默认接收方式为接收并转发所有帧中的数据域,即不过滤接收数据,可设置为过滤接收方式,只接收ID与过滤寄存器一致的帧,同时可设置转发的数据是否包括接收帧的ID。在接收中断返回之前,把接收到的数据分别存入其余端口数据缓冲区,然后分别向各端口发送任务发送一个信号量用于通知缓冲区已有数据,其余各端口发送任务收到信号量后便把各自缓冲区中数据按照预先设置发送到各自网络中。默认波特率为500Kbps,可设置为10K-1000K之间的任意波特率,但所设置波特率需和所接网络中一致才可以正常工作。The software design includes CAN bus initialization, data sending and receiving. CAN bus initialization includes working mode, receiving filtering mode, receiving mask register, baud rate parameter setting, and interrupt enable register parameter setting, among which the receiving filtering mode, receiving mask register and baud rate parameter setting can be freely set by the PC-side setting software , here it is just initialized to the default settings. The interrupt enable register enables the receiving interrupt and error interrupt, and checks the cause of the error after entering the error interrupt. If it is a sending or receiving error, then clear the corresponding flag and return. If it is a bus error and the error counter value is greater than 255, then Reset the bus. The default sending method is to send standard frames, and the ID of all sent frames is 0, which can be set to send standard frames and extended frames with fixed IDs or standard frames and extended frames whose IDs are provided by the first two bytes in the sending buffer. When the sending task receives the buffer full semaphore, it sends the data in the buffer according to the preset settings. The default receiving method is to receive and forward the data fields in all frames, that is, the received data is not filtered. It can be set to filter receiving method, and only receive frames whose ID is consistent with the filter register. At the same time, it can be set whether the forwarded data includes the ID of the received frame. Before the receiving interrupt returns, store the received data into the data buffers of the remaining ports respectively, and then send a semaphore to each port sending task to notify that the buffer has data, and the sending tasks of the other ports receive the semaphore Then send the data in the respective buffers to the respective networks according to the preset settings. The default baud rate is 500Kbps, which can be set to any baud rate between 10K-1000K, but the set baud rate must be consistent with the connected network to work properly.

所述以太网接口单元采用CP2200作为以太网控制器U4,U4地址/数据复用总线A[7:0]/D[7:0]接U1地址/数据复用总线PMA[7:0]/PMD[7:0],U4片选引脚CS接微控制器U1的PMA5引脚,U4中断输出信号INT接U1中断输入信号引脚INT3,U4地址锁存输入引脚ALE接U1地址锁存输出引脚PMA0,U4读写输入引脚RD_N、WR_N分别接U1读写输出引脚RD、WR,U4总线复用使能引脚MUXEN接VCC高电平,选择复用总线工作方式。The Ethernet interface unit adopts CP2200 as Ethernet controller U4, U4 address/data multiplexing bus A[7:0]/D[7:0] is connected to U1 address/data multiplexing bus PMA[7:0]/ PMD[7:0], U4 chip select pin CS is connected to PMA5 pin of microcontroller U1, U4 interrupt output signal INT is connected to U1 interrupt input signal pin INT3, U4 address latch input pin ALE is connected to U1 address latch The output pin PMA0, the U4 read and write input pins RD_N, WR_N are respectively connected to the U1 read and write output pins RD, WR, and the U4 bus multiplex enable pin MUXEN is connected to the high level of VCC to select the multiplex bus working mode.

以太网接口单元的软件设计包括TCP/IP协议栈的实现和主应用程序的设计。由于TCP/IP协议种类繁多,考虑到嵌入式系统的实际要求和资源,不可能也没有必要实现TCP/IP的所有协议,对TCP/IP协议进行裁剪之后,最后保留了ARP、ICMP、IP、TCP、UDP协议模块。本系统所实现的协议是基于Microchip公司的TCP/IP协议栈实现的,协议栈是不同模块的集合,接收到某种类型的包时调用相应的协议模块(IP、TCP、UDP、ICMP、ARP)完成各模块的处理。为减轻主应用程序管理各模块的负担,协议栈使用了一个特殊的应用程序层模块,为“StackTask”。“StackTask”以协同式任务处理方式来实现,被赋予处理时间后,将轮询MAC层是否存在有效的数据包,如果接收到一个包,将对其进行解码并路由到相应的模块进行下一步的处理。The software design of the Ethernet interface unit includes the realization of the TCP/IP protocol stack and the design of the main application program. Due to the variety of TCP/IP protocols, considering the actual requirements and resources of the embedded system, it is impossible and unnecessary to implement all protocols of TCP/IP. After tailoring the TCP/IP protocol, ARP, ICMP, IP, TCP, UDP protocol module. The protocol implemented in this system is based on Microchip's TCP/IP protocol stack. The protocol stack is a collection of different modules. When a certain type of packet is received, the corresponding protocol module (IP, TCP, UDP, ICMP, ARP ) to complete the processing of each module. In order to reduce the burden of the main application program to manage each module, the protocol stack uses a special application layer module called "StackTask". "StackTask" is implemented in a cooperative task processing mode. After being given a processing time, it will poll the MAC layer for valid data packets. If a packet is received, it will be decoded and routed to the corresponding module for the next step processing.

主应用程序包括CP2200的初始化,数据的接收和发送。初始化包括中断使能寄存器,初始化物理层,配置IOPWR寄存器,用于设置Activity、Link LED指示灯,初始化MAC层,配置接收过滤器和工作模式的选择,使初始化后的CP2200已准备好接收和发送数据。数据接收是通过中断产生的,一旦接收到一个数据包,CP2200会产生中断通知微控制器U1,微控制器U1可以用自动读接口读取数据包,或通过把RXSKIP1置位来跳过该包。CP2200提供了一个发送以太网包的简单接口,微控制器U1只需要把源和目的地址,长度/类型和数据加载到发送缓冲区,所有以太帧其它部分如前同步码,帧开始定界符,CRC填充都是自动生产的。其中数据的发送任务由其余端口的接收操作发送信号量激活。The main application program includes CP2200 initialization, data reception and transmission. Initialization includes the interrupt enable register, initializes the physical layer, configures the IOPWR register, is used to set the Activity and Link LED indicators, initializes the MAC layer, configures the selection of the receiving filter and the working mode, and makes the initialized CP2200 ready to receive and send data. Data reception is generated through an interrupt. Once a data packet is received, CP2200 will generate an interrupt to notify the microcontroller U1. The microcontroller U1 can read the data packet with the automatic read interface, or skip the packet by setting RXSKIP1. . The CP2200 provides a simple interface for sending Ethernet packets, the microcontroller U1 only needs to load the source and destination addresses, length/type and data into the send buffer, all other parts of the Ethernet frame such as preamble, frame start delimiter , CRC padding are all produced automatically. The data sending task is activated by the receiving operation sending semaphore of the other ports.

所述RS232和RS485接口单元采用微控制器U1内置UART模块外接电平转换器MAX232和MAX485实现。微控制器U1内置UART模块支持RS232和RS485模式,支持波特率范围15bps-1Mbps。电平转换器和微控制器U1间采用光电隔离器件,彻底隔离装置与网络间的电气干扰。The RS232 and RS485 interface units are realized by using a built-in UART module of the microcontroller U1 and external level converters MAX232 and MAX485. The built-in UART module of the microcontroller U1 supports RS232 and RS485 modes, and supports a baud rate range of 15bps-1Mbps. A photoelectric isolation device is used between the level converter and the microcontroller U1 to completely isolate the electrical interference between the device and the network.

软件设计包括端口的初始化,数据接收和发送。初始化过程包括配置中断使能寄存器,波特率、数据位、停止位、奇偶检验位的设置。初始化采用默认设置,波特率9600bps,8位数据位,1位停止位,无奇偶校验位。这些参数可由PC通过设置软件进行设置。发送任务由其余端口的接收任务激活。当产生接收中断时,便把数据存入其余各端口缓冲区,然后发送一个信号量激活其余端口的发送任务,从而把本网络中接收到的数据发送到其它网络中,实现了不同网络间的交互。此外,RS232接口可以外接RS232接口的第三方设备,极大方便了应用RS232设备实现网络扩展。The software design includes port initialization, data receiving and sending. The initialization process includes configuring the interrupt enable register, baud rate, data bits, stop bits, and parity check bits. The default settings are used for initialization, the baud rate is 9600bps, 8 data bits, 1 stop bit, and no parity bit. These parameters can be set by PC through setting software. Send tasks are activated by receive tasks on the remaining ports. When a receiving interrupt occurs, the data is stored in the buffers of the other ports, and then a semaphore is sent to activate the sending tasks of the other ports, so that the data received in this network is sent to other networks, and the communication between different networks is realized. interact. In addition, the RS232 interface can be connected to third-party equipment with RS232 interface, which greatly facilitates the application of RS232 equipment to realize network expansion.

Claims (9)

1.一种通用多串行总线转换装置,其特征在于包括微控制器、USB接口单元、CAN总线接口单元、以太网接口单元、RS232及RS485接口单元,其中USB接口单元、CAN总线接口单元、以太网接口单元分别通过并行总线与微控制器相连,RS232及RS485接口单元通过光电隔离器件与微控制器连接。1. a general multi-serial bus conversion device is characterized in that comprising microcontroller, USB interface unit, CAN bus interface unit, Ethernet interface unit, RS232 and RS485 interface unit, wherein USB interface unit, CAN bus interface unit, The Ethernet interface unit is connected to the microcontroller through a parallel bus, and the RS232 and RS485 interface units are connected to the microcontroller through a photoelectric isolation device. 2.根据权利要求1所述的通用多串行总线转换装置,其特征在于微控制器采用PIC24FJ128GA006型号。2. The universal multi-serial bus conversion device according to claim 1, wherein the microcontroller adopts the PIC24FJ128GA006 model. 3.根据权利要求1或2所述的通用多串行总线转换装置,其特征在于USB接口单元包括USB控制器和USB插座;USB控制器设有USB主机和USB设备两种工作模式,采用跳线进行工作模式的选择;USB插座包括USB-A和USB-B两插座,分别用于连接USB设备和USB主机。3. according to claim 1 and 2 described universal multi-serial bus converting devices, it is characterized in that the USB interface unit comprises a USB controller and a USB socket; The working mode can be selected through the cable; the USB socket includes two sockets, USB-A and USB-B, which are used to connect USB devices and USB hosts respectively. 4.根据权利要求3所述的通用多串行总线转换装置,其特征在于USB控制器TXD引脚接地用于选定并行总线工作方式;USB控制器的数据总线D引脚连接到微控制器的地址/数据复用总线PMA/PMD引脚;USB控制器的片选信号CS引脚连接微控制器的片选输出引脚PMCS1引脚;USB控制器的命令/数据选择信号A0引脚连接微控制器的地址位PMA3引脚;USB控制器的中断输出信号INT引脚连接微控制器的外部中断输入INT1引脚;USB控制器的读写控制信号WR_N、RD_N引脚分别与微控制器的读写信号WR、RD引脚相连。4. universal multi-serial bus conversion device according to claim 3, is characterized in that USB controller TXD pin grounding is used for selected parallel bus mode of operation; The data bus D pin of USB controller is connected to microcontroller The address/data multiplexing bus PMA/PMD pin; the chip select signal CS pin of the USB controller is connected to the chip select output pin PMCS1 pin of the microcontroller; the command/data selection signal A0 pin of the USB controller is connected to The address bit PMA3 pin of the microcontroller; the interrupt output signal INT pin of the USB controller is connected to the external interrupt input INT1 pin of the microcontroller; the read and write control signals WR_N and RD_N pins of the USB controller are respectively connected to the microcontroller The read and write signals WR and RD pins are connected. 5.根据权利要求1或2所述的通用多串行总线转换装置,其特征在于CAN总线接口单元包括CAN总线控制器、CAN总线驱动器、光电隔离器,CAN总线控制器与CAN总线驱动器之间通过光电隔离器连接;CAN总线控制器采用SJA1000型号;CAN总线驱动采用PCA82C250型号。5. according to claim 1 and 2 described universal multi-serial bus conversion devices, it is characterized in that CAN bus interface unit comprises CAN bus controller, CAN bus driver, photoelectric isolator, between CAN bus controller and CAN bus driver It is connected through a photoelectric isolator; the CAN bus controller adopts the SJA1000 model; the CAN bus driver adopts the PCA82C250 model. 6.根据权利要求5所述的通用多串行总线转换装置,其特征在于CAN总线控制器的地址/数据复用总线接口AD与微控制器的地址/数据复用总线相连;CAN总线控制器的地址锁存输入信号ALE引脚连接微控制器的地址锁存输出信号PMA0引脚;CAN总线控制器的片选输入CS引脚连接微控制器的PMA4引脚用于片选;CAN总线控制器的中断输出INT引脚连接微控制器的外部中断输入INT2引脚;CAN总线控制器的读写控制输入信号引脚分别连接微控制器的读写控制输出信号RD、WR引脚。6. universal multi-serial bus conversion device according to claim 5, is characterized in that the address/data multiplexing bus interface AD of CAN bus controller links to each other with the address/data multiplexing bus of microcontroller; CAN bus controller The address latch input signal ALE pin of the microcontroller is connected to the address latch output signal PMA0 pin of the microcontroller; the chip select input CS pin of the CAN bus controller is connected to the PMA4 pin of the microcontroller for chip selection; the CAN bus control The interrupt output INT pin of the controller is connected to the external interrupt input INT2 pin of the microcontroller; the read and write control input signal pins of the CAN bus controller are respectively connected to the read and write control output signal RD and WR pins of the microcontroller. 7.根据权利要求1或2所述的通用多串行总线转换装置,其特征在于以太网接口单元包括相互连接的以太网控制器和以太网变压器;其中以太网控制器采用CP2200型号;以太网变压器采用PRJ-010型号,该变压器集成了RJ45网络接头。7. according to claim 1 and 2 described universal multi-serial bus switching devices, it is characterized in that the Ethernet interface unit comprises the Ethernet controller and the Ethernet transformer that are connected to each other; Wherein the Ethernet controller adopts the CP2200 model; Ethernet The transformer adopts the model PRJ-010, which integrates the RJ45 network connector. 8.根据权利要求7所述的通用多串行总线转换装置,其特征在于以太网控制器的地址/数据复用总线A/D连接微控制器的地址/数据复用总线PMA/PMD;以太网控制器的片选CS引脚连接微控制器的PMA5引脚;以太网控制器的中断输出信号INT引脚连接微控制器的中断输入信号INT3引脚;以太网控制器的地址锁存输入ALE引脚连接微控制器的地址锁存输出PMA0引脚;以太网控制器的读写输入RD_N、WR_N引脚分别连接微控制器的读写输出RD、WR引脚;以太网控制器的总线复用使能MUXEN引脚接VCC高电平,选择复用总线工作方式。8. universal multi-serial bus switching device according to claim 7, is characterized in that the address/data multiplexing bus A/D of ethernet controller connects the address/data multiplexing bus PMA/PMD of microcontroller; The chip selection CS pin of the network controller is connected to the PMA5 pin of the microcontroller; the interrupt output signal INT pin of the Ethernet controller is connected to the interrupt input signal INT3 pin of the microcontroller; the address latch input of the Ethernet controller The ALE pin is connected to the address latch output PMA0 pin of the microcontroller; the read and write input RD_N and WR_N pins of the Ethernet controller are respectively connected to the read and write output RD and WR pins of the microcontroller; the bus of the Ethernet controller The MUXEN pin is connected to the high level of VCC to select the working mode of the multiplexing bus. 9.根据权利要求1或2所述的通用多串行总线转换装置,其特征在于RS232、RS485接口单元分别通过光电隔离器与微控制器的UART通信端口连接。9. The universal multi-serial bus conversion device according to claim 1 or 2, characterized in that the RS232 and RS485 interface units are respectively connected with the UART communication port of the microcontroller through a photoelectric isolator.
CNU200820174181XU 2008-10-29 2008-10-29 Universal multi-serial bus converter Expired - Fee Related CN201303348Y (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CNU200820174181XU CN201303348Y (en) 2008-10-29 2008-10-29 Universal multi-serial bus converter

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CNU200820174181XU CN201303348Y (en) 2008-10-29 2008-10-29 Universal multi-serial bus converter

Publications (1)

Publication Number Publication Date
CN201303348Y true CN201303348Y (en) 2009-09-02

Family

ID=41086977

Family Applications (1)

Application Number Title Priority Date Filing Date
CNU200820174181XU Expired - Fee Related CN201303348Y (en) 2008-10-29 2008-10-29 Universal multi-serial bus converter

Country Status (1)

Country Link
CN (1) CN201303348Y (en)

Cited By (18)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101894086A (en) * 2010-06-08 2010-11-24 昆山三泰新电子科技有限公司 Serial hub and multi-serial high-speed communication method
CN103107980A (en) * 2011-11-13 2013-05-15 湖南晟通科技集团有限公司 Multifunctional signal transformation network bridge
CN103218334A (en) * 2013-03-30 2013-07-24 西北工业大学 Computer peripheral cascade device based on USB (Universal Serial Bus) and RS485 bus
CN103268304A (en) * 2013-06-02 2013-08-28 国家电网公司 Portable USB Interface Box
CN103268300A (en) * 2013-05-17 2013-08-28 浙江正泰中自控制工程有限公司 Serial interface circuit of serial communication management server
CN103746738A (en) * 2014-01-10 2014-04-23 烽火通信科技股份有限公司 Method for realizing two-way service interruption by GFP (Generic Framing Procedure) frame transmission
CN103885821A (en) * 2014-02-23 2014-06-25 四川艾普特信息产业有限公司 SCADA front-end processor and multi-channel multi-thread real-time scheduling method thereof
CN104320497A (en) * 2014-11-05 2015-01-28 四川省绵阳西南自动化研究所 Switching device of IP network interface and CAN bus interface
CN104794088A (en) * 2015-04-22 2015-07-22 成都为开微电子有限公司 Multi-interface bus converting expanding chip design
CN105068488A (en) * 2015-09-22 2015-11-18 托肯恒山科技(广州)有限公司 Intelligent communication controller applicable to a variety of communication interfaces and control method
CN105353678A (en) * 2015-11-17 2016-02-24 珠海格力电器股份有限公司 CAN bus communication isolation circuit and method
CN105589824A (en) * 2014-10-23 2016-05-18 北京航天计量测试技术研究所 Multi-configuration manner USB/RS232-CAN converting and debugging device
CN107505864A (en) * 2016-06-10 2017-12-22 通用汽车环球科技运作有限责任公司 In the method for the data sharing of semiconductor chip
CN107742371A (en) * 2017-10-19 2018-02-27 前海哆啦阿梦(深圳)数据服务有限公司 Charging, storage all-in-one for shared charger baby
CN110399326A (en) * 2019-08-02 2019-11-01 沈阳民航东北凯亚有限公司 A kind of data conversion equipment
CN111813728A (en) * 2020-09-02 2020-10-23 湖南慧明谦信息技术有限公司 Multi-bus and multi-channel interface realized by single serial port multiplexing mode
CN111913901A (en) * 2020-08-03 2020-11-10 成都九洲迪飞科技有限责任公司 Device and method for converting USB (Universal Serial bus) into various bus interfaces
CN115079597A (en) * 2022-06-01 2022-09-20 宁波迦南智能电气股份有限公司 Method for realizing RS-485 communication module special for energy controller

Cited By (25)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101894086A (en) * 2010-06-08 2010-11-24 昆山三泰新电子科技有限公司 Serial hub and multi-serial high-speed communication method
CN103107980A (en) * 2011-11-13 2013-05-15 湖南晟通科技集团有限公司 Multifunctional signal transformation network bridge
CN103218334A (en) * 2013-03-30 2013-07-24 西北工业大学 Computer peripheral cascade device based on USB (Universal Serial Bus) and RS485 bus
CN103268300B (en) * 2013-05-17 2016-04-20 浙江正泰中自控制工程有限公司 A kind of serial interface circuit of serial communication management server
CN103268300A (en) * 2013-05-17 2013-08-28 浙江正泰中自控制工程有限公司 Serial interface circuit of serial communication management server
CN103268304A (en) * 2013-06-02 2013-08-28 国家电网公司 Portable USB Interface Box
CN103746738A (en) * 2014-01-10 2014-04-23 烽火通信科技股份有限公司 Method for realizing two-way service interruption by GFP (Generic Framing Procedure) frame transmission
CN103746738B (en) * 2014-01-10 2016-06-22 烽火通信科技股份有限公司 Gfp frame transmits the method realizing two-way disconnected business
CN103885821A (en) * 2014-02-23 2014-06-25 四川艾普特信息产业有限公司 SCADA front-end processor and multi-channel multi-thread real-time scheduling method thereof
CN103885821B (en) * 2014-02-23 2017-04-05 四川艾普特信息产业有限公司 SCADA pre-procesors and its Multi-channel multi-line journey real-time scheduling method
CN105589824A (en) * 2014-10-23 2016-05-18 北京航天计量测试技术研究所 Multi-configuration manner USB/RS232-CAN converting and debugging device
CN104320497A (en) * 2014-11-05 2015-01-28 四川省绵阳西南自动化研究所 Switching device of IP network interface and CAN bus interface
CN104794088B (en) * 2015-04-22 2018-05-01 成都为开微电子有限公司 A kind of multiplex roles general line system extended chip design
CN104794088A (en) * 2015-04-22 2015-07-22 成都为开微电子有限公司 Multi-interface bus converting expanding chip design
CN105068488A (en) * 2015-09-22 2015-11-18 托肯恒山科技(广州)有限公司 Intelligent communication controller applicable to a variety of communication interfaces and control method
CN105068488B (en) * 2015-09-22 2017-11-24 托肯恒山科技(广州)有限公司 Suitable for the Intelligent communication controller and control method of various communication interfaces
CN105353678B (en) * 2015-11-17 2017-12-26 珠海格力电器股份有限公司 CAN bus communication isolation circuit and method
CN105353678A (en) * 2015-11-17 2016-02-24 珠海格力电器股份有限公司 CAN bus communication isolation circuit and method
CN107505864A (en) * 2016-06-10 2017-12-22 通用汽车环球科技运作有限责任公司 In the method for the data sharing of semiconductor chip
CN107505864B (en) * 2016-06-10 2022-02-25 通用汽车环球科技运作有限责任公司 Method for sharing data between semiconductor chips
CN107742371A (en) * 2017-10-19 2018-02-27 前海哆啦阿梦(深圳)数据服务有限公司 Charging, storage all-in-one for shared charger baby
CN110399326A (en) * 2019-08-02 2019-11-01 沈阳民航东北凯亚有限公司 A kind of data conversion equipment
CN111913901A (en) * 2020-08-03 2020-11-10 成都九洲迪飞科技有限责任公司 Device and method for converting USB (Universal Serial bus) into various bus interfaces
CN111813728A (en) * 2020-09-02 2020-10-23 湖南慧明谦信息技术有限公司 Multi-bus and multi-channel interface realized by single serial port multiplexing mode
CN115079597A (en) * 2022-06-01 2022-09-20 宁波迦南智能电气股份有限公司 Method for realizing RS-485 communication module special for energy controller

Similar Documents

Publication Publication Date Title
CN201303348Y (en) Universal multi-serial bus converter
CN105785958B (en) Multi-functional data collector, acquisition system and method based on wisdom factory
CN103616927B (en) A kind of data communication server
CN101087235A (en) A FPGA-based multi-functional communication interface conversion device and method
CN105978778A (en) Ethernet and serial port/CAN protocol conversion device based on STM32
CN109525474A (en) A kind of multiplex roles protocol-intelligent converter and conversion method based on Linux platform
CN103178872A (en) Method and device for extending transmission distance of USB system through Ethernet
CN204423111U (en) A kind of SOC (system on a chip) be applied in intelligent grid concentrator
CN207083094U (en) A kind of train real-time ethernet network interface card based on TRDP agreements
CN201571081U (en) CAN bus and serial port bus protocol converter
CN201839452U (en) Wireless sensor network intelligent gateway
CN101778038B (en) Gigabit Ethernet-based high-speed data transmission system of embedded equipment
CN210955050U (en) A USB multi-serial converter
CN202395811U (en) Protocol conversion device used for intelligent BMS
CN103151978A (en) Driving controller for Ethernet stepping motor
CN202282789U (en) SOE (SERCOS OVER EtherCAT) communication conversion card for servo driver
CN209105202U (en) A kind of multiplex roles protocol-intelligent converter based on Linux platform
CN114721317B (en) Network communication control system and method based on SPI controller
CN202353597U (en) Embedded home gateway
CN207926643U (en) A low-power IoT middleware device
CN208094574U (en) A kind of interface convertor of usb bus and high-speed CAN bus
CN2659038Y (en) Inserted network interface circuit
CN202383479U (en) Control system for numerical control machine tool
CN203206485U (en) Electric power demodulator apparatus base station
CN102932357B (en) Accelerator high-frequency digital low-level Ethernet communication system and communication method

Legal Events

Date Code Title Description
C14 Grant of patent or utility model
GR01 Patent grant
C17 Cessation of patent right
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20090902

Termination date: 20101029