A communication module adaptation and control method and system apparatus
By adapting the communication module to the control system and using the RIL communication subsystem and proprietary protocol, the adaptation process between the communication module and the host is simplified, the complexity of the AT command method is solved, and the development difficulty and cost are reduced.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- PANDA ELECTRONICS
- Filing Date
- 2023-10-24
- Publication Date
- 2026-07-31
AI Technical Summary
In existing technologies, the transmission, sending, and response parsing of AT commands in communication modules are complex, especially the adaptation work is large on communication hosts without operating systems, such as microcontrollers and FPGAs.
Design a communication module adaptation and control system device. The terminal of the RIL communication subsystem is connected to the communication host. Data transmission is carried out through virtual serial port and network port. The proprietary protocol and UDP protocol are used for data packet management to simplify communication protocol parsing and transmission.
It enables rapid adaptation between the communication module and the host, reducing the difficulty and cost of host software development.
Smart Images

Figure CN117478755B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of communication control technology, specifically to a communication module adaptation and control system device, and also to a communication module adaptation and control method. Background Technology
[0002] With the development of smart mobile operating systems, especially the open-source Android system, its Ril communication subsystem provides support for rapid adaptation of various communication modules.
[0003] Currently, most communication modules on the market use AT commands for control. However, the reliable transmission, sending, and parsing of AT commands, as well as state machine control under concurrent conditions, are quite complex. This is especially true for communication hosts that are microcontrollers, FPGAs, or other devices without an operating system, making adaptation even more challenging. Summary of the Invention
[0004] The purpose of this invention is to provide a communication module adaptation and control method and system device to quickly adapt the communication module to the host.
[0005] To achieve the above functions, the present invention designs a communication module adaptation and control system device, including a terminal with a RIL communication subsystem and a communication host connected to it.
[0006] The terminal includes RIL interface adapter software for compatibility with the RIL communication subsystem, and two virtual serial ports and a network port. One virtual serial port is / dev / pts / 1, used for control command transmission, and the other is / dev / pts / 2, used for data transmission. The terminal's network port and the communication host communicate via sockets. The communication host includes a main control board, a communication module, and an antenna. The main control board implements its functions based on the module interface adapter software, which connects to the communication module through two actual serial ports, namely actual serial port 1 and actual serial port 2. The module interface adapter software communicates with the terminal's network port through the network port. The communication module is connected to the antenna to establish a wireless communication channel.
[0007] As a preferred embodiment of the present invention, the Ril interface adapter software includes:
[0008] The virtual serial port management module is used to create, destroy, and manage virtual serial ports on the terminal.
[0009] The transparent forwarding module is used for transparently forwarding data between the virtual serial port and the terminal network port;
[0010] The protocol management module is used for parsing and packaging communication protocols between the terminal and the communication host.
[0011] The communication transmission module is used for socket communication management between the terminal and the communication host.
[0012] As a preferred embodiment of the present invention, the module interface adaptation software includes:
[0013] The serial communication module is used for communication between the communication host and the actual serial port connected to the communication module.
[0014] The transparent forwarding module is used to transparently forward data between the network port of the communication host, the module interface adapter software of the communication host, and the actual serial port connected to the communication module.
[0015] The protocol management module is used for parsing and packaging communication protocols between the terminal and the communication host.
[0016] The communication transmission module is used for socket communication management between the terminal and the communication host.
[0017] As a preferred technical solution of the present invention: the terminal adopts the Android operating system, and the main control board of the communication host is based on the Linux system.
[0018] This invention also designs a communication module adaptation and control method, implemented based on the aforementioned communication module adaptation and control system device, comprising the following steps:
[0019] Step S1: Create two virtual serial ports on the terminal, with device nodes / dev / pts / 1 and / dev / pts / 2 respectively. Set the RILC code control serial port to / dev / pts / 1 and the data dialing serial port to / dev / pts / 2.
[0020] Step S2: Pack the data from the virtual serial port / dev / pts / 1 using the defined private protocol, set the module channel number to 1, and send it to the corresponding port 8000 of the main control board of the communication host via UDP protocol; and parse the data from the UDP protocol receiving port 3000 through the private protocol, forward it to the corresponding virtual serial port / dev / pts / 1 with the module channel number 1.
[0021] Step S3: Pack the data from the virtual serial port / dev / pts / 2 using the specified private protocol, set the module channel number to 2, and send it to the corresponding port 8000 of the main control board of the communication host via UDP protocol; and parse the data from the UDP protocol receiving port 3000 through the private protocol, forward it to the corresponding virtual serial port / dev / pts / 2 with the module channel number 2.
[0022] Step S4: The main control board of the communication host receives the private protocol data through the UDP protocol receiving port 8000, parses the corresponding module channel number through the private protocol, forwards the data with the module channel number of 1 to the corresponding actual serial port 1, and packages the data read from the actual serial port 1 through the private protocol, sets the module channel number to 1, and sends it to the corresponding UDP protocol receiving port 3000.
[0023] Step S5: The main control board of the communication host receives the private protocol data through the UDP protocol receiving port 8000, and forwards the corresponding module channel number after parsing the private protocol. The module channel number is 2 and forwards it to the corresponding actual serial port 2. The data read from the actual serial port 2 is packaged through the private protocol, the module channel number is set to 2, and sent to the corresponding UDP protocol receiving port 3000.
[0024] As a preferred technical solution of the present invention, the established proprietary protocol includes:
[0025] Start byte: 1 byte, fixed padding is 0x7E;
[0026] Device type: Identifies the communication host model;
[0027] Module model: Communication module identifier;
[0028] Module channel number: Serial port number of the communication module;
[0029] Length byte: 2 bytes, which is the total number of bytes from the end of the length byte to the beginning of the check byte;
[0030] Command word: 1 byte, indicating the type of command;
[0031] Parameter body: Variable in bytes, containing the parameter content of the corresponding frame;
[0032] Checksum byte: 1 byte, accumulated from all bytes in the parameter body, from device type to all other bytes in the parameter body;
[0033] End byte: 1 byte, with fixed padding of 0x7E.
[0034] Beneficial effects: Compared with the prior art, the advantages of the present invention include:
[0035] This invention designs a communication module adaptation and control method and system device, which uses the terminal's RIL communication subsystem to control the host's communication module, quickly completes the adaptation of the communication module and the host, reduces the difficulty and workload of host software development, and saves R&D costs. Attached Figure Description
[0036] Figure 1 This is a structural diagram of a communication module adaptation and control system device provided according to an embodiment of the present invention;
[0037] Figure 2 This is a system diagram of a communication module adaptation and control system device provided according to an embodiment of the present invention. Detailed Implementation
[0038] The present invention will be further described below with reference to the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solution of the present invention, and should not be used to limit the scope of protection of the present invention.
[0039] This invention provides a communication module adaptation and control system device, referring to... Figure 1 This includes terminals equipped with RIL communication subsystems, and communication hosts connected to them.
[0040] Reference Figure 2 The terminal includes RIL interface adapter software for compatibility with the RIL communication subsystem, and two virtual serial ports and a network port. One virtual serial port is / dev / pts / 1, used for control command transmission, and the other is / dev / pts / 2, used for data transmission. The terminal's network port and the communication host communicate via sockets. The communication host includes a main control board, a communication module, and an antenna. The main control board implements its functions based on the module interface adapter software, which connects to the communication module through two actual serial ports, namely actual serial port 1 and actual serial port 2. The module interface adapter software communicates with the terminal's network port through the network port. The communication module is connected to the antenna to establish a wireless communication channel.
[0041] The Ril interface adapter software includes:
[0042] The virtual serial port management module is used to create, destroy, and manage virtual serial ports on the terminal.
[0043] The transparent forwarding module is used for transparently forwarding data between the virtual serial port and the terminal network port;
[0044] The protocol management module is used for parsing and packaging communication protocols between the terminal and the communication host.
[0045] The communication transmission module is used for socket communication management between the terminal and the communication host.
[0046] The RIL interface adapter software creates two virtual serial ports: one for AT control signaling transmission and the other for data transmission. It modifies the serial port of the RILC in the RIL communication subsystem to the created virtual serial port device node, transmits the data to the network port through the transparent forwarding module, and then packages and sends it to the communication host network port according to the defined private protocol through the protocol management module.
[0047] The module interface adapter software includes:
[0048] The serial communication module is used for communication between the communication host and the actual serial port connected to the communication module.
[0049] The transparent forwarding module is used to transparently forward data between the network port of the communication host, the module interface adapter software of the communication host, and the actual serial port connected to the communication module.
[0050] The protocol management module is used for parsing and packaging communication protocols between the terminal and the communication host.
[0051] The communication transmission module is used for socket communication management between the terminal and the communication host.
[0052] The module interface adapter software and protocol management module forward protocol data to the corresponding serial port by parsing the module channel number. One is a transmission channel for AT control signaling, and the other is a transmission channel for user data transmission.
[0053] The terminal uses the Android operating system, while the main control board of the communication host is based on the Linux system.
[0054] This invention also provides a communication module adaptation and control method, implemented based on the aforementioned communication module adaptation and control system device, comprising the following steps:
[0055] Step S1: Create two virtual serial ports on the terminal Android operating system, with device nodes / dev / pts / 1 and / dev / pts / 2 respectively. Set the control serial port of the RILC code to / dev / pts / 1 and the data dialing serial port to / dev / pts / 2.
[0056] Step S2: Pack the data from the virtual serial port / dev / pts / 1 using the defined private protocol, set the module channel number to 1, and send it to the corresponding port 8000 of the main control board of the communication host via UDP protocol; and parse the data from the UDP protocol receiving port 3000 through the private protocol, forward it to the corresponding virtual serial port / dev / pts / 1 with the module channel number 1.
[0057] Step S3: Pack the data from the virtual serial port / dev / pts / 2 using the specified private protocol, set the module channel number to 2, and send it to the corresponding port 8000 of the main control board of the communication host via UDP protocol; and parse the data from the UDP protocol receiving port 3000 through the private protocol, forward it to the corresponding virtual serial port / dev / pts / 2 with the module channel number 2.
[0058] Step S4: The main control board of the communication host receives the private protocol data through the UDP protocol receiving port 8000. After parsing the corresponding module channel number through the private protocol, the module channel number is 1. The actual parameter body content is forwarded to the corresponding actual serial port 1. The data read from the actual serial port 1 is packaged through the private protocol, the module channel number is set to 1, and sent to the corresponding Android operating system's UDP protocol receiving port 3000.
[0059] Step S5: The main control board of the communication host receives the private protocol data through the UDP protocol receiving port 8000. After parsing the corresponding module channel number through the private protocol, the module channel number is 2. The actual parameter body content is forwarded to the corresponding actual serial port 2. The data read from the actual serial port 2 is packaged through the private protocol, the module channel number is set to 2, and sent to the corresponding Android operating system's UDP protocol receiving port 3000.
[0060] The established private agreements include:
[0061] Start byte: 1 byte, fixed padding is 0x7E;
[0062] Device type: Identifies the communication host model;
[0063] Module model: Communication module identifier;
[0064] Module channel number: Serial port number of the communication module;
[0065] Length byte: 2 bytes, which is the total number of bytes from the end of the length byte to the beginning of the check byte;
[0066] Command word: 1 byte, indicating the type of command;
[0067] Parameter body: Variable in bytes, containing the parameter content of the corresponding frame;
[0068] Checksum byte: 1 byte, accumulated from all bytes in the parameter body, from device type to all other bytes in the parameter body;
[0069] End byte: 1 byte, with fixed padding of 0x7E.
[0070] The format of the proprietary protocol is as follows:
[0071]
[0072] The following is an embodiment of the present invention, which briefly describes the data flow using data PS service as an example:
[0073] 1. On the terminal Android operating system, enable the PS data service switch. Read "AT+CGREG?" from / dev / pts / 1, package it according to the protocol, set the module channel number to 1, and send it. The communication host main control board receives and parses "AT+CGREG?" through UDP receive port 8000 and sends it to the module's serial port 1.
[0074] 2. The main control board of the communication host reads the +CGREG:0,1 returned by the module serial port 1, packages it according to the protocol and sends it. The terminal Ril interface adapter software receives the data on port 3000 and parses out +CGREG:0,1 and forwards it to / dev / pts / 1.
[0075] 3. The AT+CGDCONT=1,"IP","CMNET" read from / dev / pts / 1 is packaged and sent according to the protocol. The main control board of the communication host receives and parses AT+CGDCONT=1,"IP","CMNET" through UDP receiving port 8000 and sends it to the serial port 1 of the module.
[0076] 4. The main control board of the communication host reads the OK response from the module's serial port 1, packages it according to the protocol, and sends it. The terminal Ril interface adapter software receives the data on port 3000, parses out the OK response, and forwards it to / dev / pts / 1.
[0077] 5. The ATD*99# is read from / dev / pts / 1, packaged and sent according to the protocol. The main control board of the communication host receives and parses the ATD*99# through UDP receiving port 8000 and sends it to the serial port 1 of the module.
[0078] 6. The main control board of the communication host reads the CONNECT returned by the module serial port 1, packages it according to the protocol and sends it. The terminal Ril interface adapter software receives the data on port 3000 and parses out CONNECT to forward it to / dev / pts / 1.
[0079] 7. The PPP data read from / dev / pts / 2 is packaged according to the protocol, the module channel number is set to 2, and sent. The main control board of the communication host receives and parses the PPP data through UDP receiving port 8000 and sends it to the module's serial port 2.
[0080] 8. The main control board of the communication host reads the PPP data returned by the module serial port 2, packages it according to the protocol and sends it. The terminal Ril interface adapter software receives the data on port 3000 and parses the PPP data and forwards it to / dev / pts / 2. At this point, the terminal Android operating system ppp0 obtains the IP address assigned by the network, and the data PS service is started.
[0081] The above are merely preferred embodiments of the present invention, but do not limit the patent scope of the present invention. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing specific embodiments, or make equivalent substitutions for some of the technical features. Furthermore, the virtual device nodes, ports, and other parameters described in the embodiments of the present invention can be adaptively changed according to the specific application environment. Specific adaptive changes and equivalent structures made using the content of the present invention's specification and drawings, directly or indirectly applied to other related technical fields, are similarly within the protection scope of the communication module adaptation and control method and system device designed in this patent.
[0082] The embodiments of the present invention have been described in detail above with reference to the accompanying drawings. However, the present invention is not limited to the above embodiments. Within the scope of knowledge possessed by those skilled in the art, various changes can be made without departing from the spirit of the present invention.
Claims
1. A communication module adaptation and control system apparatus, characterized by, This includes terminals equipped with RIL communication subsystems, and communication hosts connected to them. The terminal includes RIL interface adapter software for compatibility with the RIL communication subsystem, and two virtual serial ports and a network port. One virtual serial port is / dev / pts / 1, used for control command transmission, and the other is / dev / pts / 2, used for data transmission. The terminal's network port and the communication host communicate via sockets. The communication host includes a main control board, a communication module, and an antenna. The main control board implements its functions based on the module interface adapter software, which connects to the communication module through two actual serial ports, namely actual serial port 1 and actual serial port 2. The module interface adapter software communicates with the terminal's network port through the network port. The communication module is connected to the antenna to establish a wireless communication channel. The Ril interface adapter software includes: The virtual serial port management module is used to create, destroy, and manage virtual serial ports on the terminal. The transparent forwarding module is used for transparently forwarding data between the virtual serial port and the terminal network port; The protocol management module is used for parsing and packaging communication protocols between the terminal and the communication host. The communication transmission module is used for managing socket communication between the terminal and the communication host. The module interface adapter software includes: The serial communication module is used for communication between the communication host and the actual serial port connected to the communication module. The transparent forwarding module is used to transparently forward data between the network port of the communication host, the module interface adapter software of the communication host, and the actual serial port connected to the communication module. The protocol management module is used for parsing and packaging communication protocols between the terminal and the communication host. The communication transmission module is used for socket communication management between the terminal and the communication host.
2. A communication module adaptation and control system apparatus according to claim 1, wherein, The terminal uses the Android operating system, while the main control board of the communication host is based on the Linux system.
3. A method of communication module adaptation and control, the method comprising: The communication module adaptation and control system device based on any one of claims 1-2 includes the following steps: Step S1: Create two virtual serial ports on the terminal, with device nodes / dev / pts / 1 and / dev / pts / 2 respectively. Set the RILC code control serial port to / dev / pts / 1 and the data dialing serial port to / dev / pts / 2. Step S2: Pack the data from the virtual serial port / dev / pts / 1 using the defined private protocol, set the module channel number to 1, and send it to the corresponding port 8000 of the main control board of the communication host via UDP protocol; and parse the data from the UDP protocol receiving port 3000 through the private protocol, forward it to the corresponding virtual serial port / dev / pts / 1 with the module channel number 1. Step S3: Pack the data from the virtual serial port / dev / pts / 2 using the specified private protocol, set the module channel number to 2, and send it to the corresponding port 8000 of the main control board of the communication host via UDP protocol; and parse the data from the UDP protocol receiving port 3000 through the private protocol, forward it to the corresponding virtual serial port / dev / pts / 2 with the module channel number 2. Step S4: The main control board of the communication host receives the private protocol data through the UDP protocol receiving port 8000, parses the corresponding module channel number through the private protocol, forwards the data with the module channel number of 1 to the corresponding actual serial port 1, and packages the data read from the actual serial port 1 through the private protocol, sets the module channel number to 1, and sends it to the corresponding UDP protocol receiving port 3000. Step S5: The main control board of the communication host receives the private protocol data through the UDP protocol receiving port 8000, and forwards the corresponding module channel number after parsing the private protocol. The module channel number is 2 and forwards it to the corresponding actual serial port 2. The data read from the actual serial port 2 is packaged through the private protocol, the module channel number is set to 2, and sent to the corresponding UDP protocol receiving port 3000.
4. The method of claim 3, wherein, The established private agreements include: Start byte: 1 byte, fixed padding is 0x7E; Device type: Identifies the communication host model; Module model: Communication module identifier; Module channel number: Serial port number of the communication module; Length byte: 2 bytes, which is the total number of bytes from the end of the length byte to the beginning of the check byte; Command word: 1 byte, indicating the type of command; Parameter body: Variable in bytes, containing the parameter content of the corresponding frame; Checksum byte: 1 byte, accumulated from all bytes in the parameter body, from device type to all other bytes in the parameter body; End byte: 1 byte, with fixed padding of 0x7E.