A modular at channel multiplexing method
By using an intermediate layer device to multiplex the AT channel with USB COM and socket, the problem of reduced signal interaction frequency when the PC and the module are connected via network socket is solved, thus improving the convenience of the module and the efficiency of signal transmission.
Patent Information
- Application Number
- CN202310093366.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-01-18
- Publication Date
- 2026-01-09
- Estimated Expiration
- 2043-01-18
AI Technical Summary
When the PC and the module are connected via network socket, the AT channel cannot directly send AT commands, resulting in a decrease in signal interaction frequency and affecting the efficiency of software signal transmission.
By connecting to the AT channel via an intermediate layer device, and connecting to the USB COM port and socket server, multiplexing is achieved, supporting the sending of AT commands via USB COM and socket.
This increases the frequency and possibilities of interaction between the host PC and the module, enhances the convenience and versatility of the module, and reduces development workload and enterprise costs.
Smart Images

Figure CN116233218B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of AT channel command control, in particular to a module AT channel multiplexing method. BACKGROUND
[0002] Currently, the communication module sends AT commands generally through USB and PC connection, a com port is virtually generated on the PC, and each AT sending com port corresponds to an AT channel. However, if there is no USB connection, when the AT command is sent to the module, such as through the network socket, the AT channel has been occupied by the USB com port, and the com port has some flow control characteristics, which the socket does not have, so that the AT command cannot be directly sent through the socket. Therefore, when the PC and the module are connected only through the network socket, the AT command cannot be sent to control the module. If the AT command is sent through the socket, it needs to be redeveloped, which increases the workload.
[0003] The structure system is based on the original AT channel, and an intermediate layer device is added, so that the AT channel directly interacts with the intermediate layer device, and the USB com port and the socket time-share the intermediate layer device, so as to support sending AT commands through the USB com and the socket, increase flexibility, reduce development workload, and greatly reduce enterprise cost.
[0004] For example, a wireless module AT command timeout return processing method disclosed in Chinese patent document CN101720125A includes AT channel and working port binding. In the state that the PC and the external USB are not connected, and only the socket is connected, the AT command cannot be sent in time to control the module. SUMMARY
[0005] The present application is to overcome the problem in the prior art that the AT channel and the USB COM port are bound, and in the case that the PC and the USB interface are not connected, only the socket is connected, the AT command cannot be sent to control the module, which reduces the signal interaction frequency and affects the software signal transmission efficiency. A module AT channel multiplexing method is provided, which can greatly improve the interaction frequency and possibility between the PC and various modules. The port expansion function of the intermediate layer device is suitable for various functional modules, greatly improving the convenience and universality of the module.
[0006] In order to achieve the above technical purpose, the present application adopts the following technical scheme:
[0007] A kind of module AT channel multiplexing method, including AT module software module and host PC, the AT software module includes AT channel module, intermediate layer device module, USB COM corresponding device and socket server port, the AT module is connected with the intermediate layer device signal, the intermediate layer device is electrically connected with the USB COM corresponding device and socket server port, the host PC includes USB COM port and socket client end port, the USB COM port is electrically connected with the USB COM corresponding device, and the socket client end port is electrically connected with the socket server port.
[0008] Through intermediate layer device and AT channel connection, and with USB COM port corresponding device and socket server connection, carry out multiplexing of multiple functions, increase host PC to AT software module and carry out instruction transmission, carry out function extension by intermediate layer device, improve the convenience and universality of module use and the transmission efficiency of AT module instruction.
[0009] As preferred, the method includes the following steps:
[0010] Step S1: AT channel initialization;
[0011] Step S2: complete USB port sends AT data;
[0012] Step S3: complete USB port accepts AT data.
[0013] Through the whole USB port transceiver, the execution of AT data, AT instruction is completed, the function extension of intermediate layer device and the multiplexing of AT channel are completed.
[0014] As preferred, in the step S1, intermediate layer device initializes AT0 channel port for receiving and sending AT data by alrouter and starts socat to bind AT1 with the ttyGS2 of USB COM port, so as to complete AT channel data initialization process.
[0015] AT channel initialization is completed, the receiving and sending function drive of AT0 port to AT data is completed, AT1 port and the data binding of ttyGS2 port of USB COM are completed, and function basis is provided for subsequent function addition.
[0016] As preferred, in the step S2, the intermediate layer device enters the USB port to send the AT flow, the host computer software tool writes data into the ttyGS2 through the USB COM port, and simultaneously transmits the received data to the ttyAT1, and the received data is forwarded by the intermediate layer device to the ttyAT0, and the forwarded data of the intermediate layer is received through the AT channel OA, after the data forwarding is completed, the AT channel processes the AT command sent by the host computer, and the sending AT instruction signal flow is completed.
[0017] The above process enables the host computer PC to send the AT module signal through the USB interface, completes the function of forwarding the received data of the AT channel by the intermediate layer device, and enables the AT channel to process the AT command sent by the host computer PC when only the socket connection exists, and multiplexes the module AT channel.
[0018] As preferred, in the step S3, the intermediate layer device enters the USB port to receive the AT flow, the AT channel receives the return data result of the AT command from the host computer, and the return result is written into the ttyAT0 port by the AT channel, after the writing, the intermediate layer device forwards the data sent by the ttyAT0 to the ttyAT1, after the data forwarding is completed, the socat forwards the data received by the ttyAT1 to the ttyGS2 for the second time, and the return result of the AT command is sent to the host computer tool, the host computer tool receives the return result of the AT command, and the USB port receiving the AT data flow is completed.
[0019] The AT command received through the AT channel returns the data result, the result is input through the ttyAT0 port, the data is forwarded for the second time by the multiple driving channel ports of the intermediate layer device, after the second time forwarding is completed, the host computer PC receives the return result of the AT command, the sending and receiving of the AT signal by the USB port is completed, a whole data cycle is completed, the utilization efficiency of the module AT channel is improved, and the instruction receiving and sending function of the AT command to control the module is realized when only the socket connection exists without the connection between the host computer PC and the USB interface.
[0020] As preferred, the whole flow further includes a USB port and socket port access switching flow, including the following steps:
[0021] Step SA1: cancel the original socat process;
[0022] Step SA2: pull up the socat process for the second time, and bind the ttyAT1 channel and the socket server port.
[0023] Through the above process, the data sent by the socket server port can be transmitted to the AT channel again through the socat, and the function switching of the USB interface and the socket is completed.
[0024] As preferred, the workflow further comprises an intermediate layer device working driving workflow, comprising the following steps:
[0025] Step SB1: intermediate layer kernel registers driving;
[0026] Step SB2: 16 port channels are registered by default, each port name is ttyAT0~ttyAT15;
[0027] Step SB3: ttyAT0 transfers data from the output end to the input end of ttyAT1;
[0028] Step SB4: Step S3 is repeated in a loop to complete the intermediate layer device working driving.
[0029] As preferred, the intermediate layer device is registered as 8 pairs of 16 port channels in the kernel by default, which are ttyAT0~ttyAT1, ttyAT2~ttyAT3, …, ttyAT14~ttyAT15 respectively, each pair is a device channel of the intermediate layer, the ttyAT0 is used to connect the original AT channel, and the ttyAT1 is used to connect the socket or USB COM port.
[0030] Therefore, the beneficial effects of the present application are as follows:
[0031] The intermediate layer device is connected with the AT channel, and is connected with the USB COM port corresponding device and the socket server, multi-channel and multi-functional multiplexing is performed, the host PC is used to perform instruction transmission on the AT software module, the function expansion is performed through the intermediate layer device, and the convenience and universality of the module use and the transmission efficiency of the AT module instruction are improved.
[0032] The AT command received through the AT channel is used to return the data result, the result is input through the ttyAT0 port, the data is secondarily forwarded through the multiple driving channel ports of the intermediate layer device, the host PC receives the return result of the AT command after the secondary forwarding is completed, the USB port is used to transmit and receive the AT signal, a whole data cycle is completed, the utilization efficiency of the module AT channel is improved, the instruction receiving and transmitting function of the AT command control module is realized in the case that the host PC and the USB interface are not connected, and only the socket is connected.
[0033] The intermediate layer device supports the socket and the USB COM port, and can expand the multiplexing function to the UART, SPI and other communication protocol ports, and improve the multiplexing efficiency and functional universality of the intermediate layer device and the module AT channel. BRIEF DESCRIPTION OF DRAWINGS
[0034] Figure 1is the intermediate layer equipment AT channel connection structure diagram of the application;
[0035] Figure 2 is the AT channel initialization flow chart of the application;
[0036] Figure 3 is the USB port sending AT signal flow chart of the application;
[0037] Figure 4 is the USB port receiving AT signal flow chart of the application;
[0038] Figure 5 is the intermediate layer equipment function driver flow chart of the application. DETAILED DESCRIPTION
[0039] The application will be further specifically described below in combination with the drawings and specific embodiments.
[0040] As Figure 1 shown is a kind of equipment connection structure diagram of module AT channel multiplexing method, including AT module software module and host PC, the AT software module includes AT channel module, intermediate layer equipment module, USB COM corresponding equipment and socket server port, the AT module is connected with the intermediate layer equipment signal, the intermediate layer equipment is electrically connected with the USB COM corresponding equipment and socket server port, the host PC includes USB COM port and socket client port, the USB COM port is electrically connected with the USB COM corresponding equipment, and the socket client port is electrically connected with the socket server port.
[0041] Through intermediate layer equipment and AT channel connection, and USB COM port corresponding equipment and socket server connection, carry out multi-channel multi-function multiplexing, increase host PC to AT software module and carry out instruction transmission, carry out function extension by intermediate layer equipment, improve the convenience and universality of module use and the transmission efficiency of AT module instruction.
[0042] As Figure 2 shown, the method comprises the following steps:
[0043] Step S1: AT channel initialization;
[0044] Step S2: complete USB port sending AT data;
[0045] Step S3: complete USB port receiving AT data.
[0046] Through the whole USB port transceiver, the execution of AT data and AT instruction is completed, the function extension of intermediate layer equipment and the multi-channel multiplexing of AT channel are completed.
[0047] Step S1 comprises the following steps:
[0048] Step S1-1: entering the AT channel initialization state;
[0049] Step S1-2: initializing the AT0 channel port for transmitting and receiving AT data by alrouter;
[0050] Step S1-3: starting socat to bind AT1 with the USB COM port ttyGS2 for data transmission;
[0051] Step S1-4: completing the AT channel initialization.
[0052] The AT channel is initialized, the function of transmitting and receiving AT data by the AT0 port is driven, the data binding between the AT1 port and the USB COM port ttyGS2 is completed, and a functional basis is provided for subsequent function addition.
[0053] Step S2 comprises the following steps:
[0054] Step S2-1: entering the USB port sending AT flow;
[0055] Step S2-2: writing data into ttyGS2 by the upper computer software tool through the USB COM port;
[0056] Step S2-3: transmitting the received data to ttyAT1, and transferring and receiving the data through the intermediate layer device to ttyAT0;
[0057] Step S2-4: receiving the data transferred by the intermediate layer device by the AT channel;
[0058] Step S2-5: processing the AT command sent by the upper computer by the AT channel, and completing the sending AT flow.
[0059] The above process enables the upper computer PC to send AT module signals through the USB interface, completes the function of transferring and receiving data by the AT channel through the intermediate layer device, enables the AT channel to process the AT command sent by the upper computer PC when only the socket connection is available, and performs the multiplexing of the module AT channel.
[0060] Step S3 comprises the following steps:
[0061] Step S3-1: entering the USB port receiving AT flow;
[0062] Step S3-2: receiving the return data result of the AT command by the AT channel;
[0063] Step S3-3: writing the return result into the ttyAT0 port by the AT channel;
[0064] Step S3-4: the intermediate layer device forwards the data sent by ttyAT0 to ttyAT1;
[0065] Step S3-5: socat re-transmits the data received by ttyAT1 to ttyGS2;
[0066] Step S3-6: the host tool receives the return result of the AT command, completing the process of receiving AT data stream by the USB port.
[0067] The AT command received through the AT channel returns the data result, the result is input through the ttyAT0 port, the data is re-transmitted by using the multiple groups of driving channel ports of the intermediate layer device, the host PC receives the return result of the AT command after the re-transmission is completed, the sending and receiving of the AT signal by the USB port is completed, the whole data cycle is completed, the utilization efficiency of the module AT channel is improved, and the instruction receiving and sending function of the AT command control module is realized in the case that the host PC and the USB interface are not connected, and only the socket is connected.
[0068] The whole process further includes a USB port and socket port access switching process, including the following steps:
[0069] Step SA1: cancel the original socat process;
[0070] Step SA2: re-launch the socat process, and bind the ttyAT1 channel and the socket server port.
[0071] Through the above process, the data sent by the socket server port can be re-transmitted to the AT channel by socat, and the function switching between the USB interface and the socket is completed.
[0072] As a preferred, the working process further includes an intermediate layer device working driving process, including the following steps:
[0073] Step SB1: register the drive in the intermediate layer kernel;
[0074] Step SB2: register 16 port channels by default, and the port name of each port is ttyAT0~ttyAT15;
[0075] Step SB3: ttyAT0 transmits the data of the output end to the input end of ttyAT1;
[0076] Step SB4: repeat step S3 to complete the working driving of the intermediate layer device.
[0077] The traditional module software AT channel is bound with the device corresponding to the USB COM port, one channel AT can be occupied by one functional device port, other functional modules cannot be additionally added and used, and the work efficiency is low. Figure 1 As shown in the drawings, the application additionally adds an intermediate layer connecting device on the traditional AT channel, so that the module AT channel is connected through the intermediate layer device twice instead of single binding, the intermediate layer device can receive data from the USB COM port and the socket server port, and unify the USB COM and socket data formats into the data format recognizable by the AT channel through the intermediate layer device, receive and send the AT signal, and perform multiplex communication.
[0078] The intermediate layer device is registered as 8 pairs of 16 port channels in the kernel by default, which are ttyAT0~ttyAT1, ttyAT2~ttyAT3, … ttyAT14~ttyAT15, each pair is an intermediate layer device channel, the ttyAT0 is used for connecting the original AT channel, and the ttyAT1 is used for connecting the socket or USB COM port.
[0079] The above embodiment according to the drawings details the structure, features and effect of the application, but the above is only the preferred embodiment of the application, and it should be noted that the technical features involved in the above embodiment and preferred mode can be reasonably combined and matched into various equivalent schemes by the person skilled in the art without departing from, changing the design idea and technical effect of the application, therefore, the application is not limited to the implementation range shown in the drawings, any change or modification made according to the idea of the application, or the equivalent embodiment with equivalent change, still falls within the protection scope of the application as long as it does not exceed the spirit covered by the specification and drawings.
Claims
1. An AT channel multiplexing method based on device connection structure, characterized in that, The device connection structure includes an AT module software module and a host PC. The AT module software module includes an AT channel module, an intermediate layer device module, a USB COM corresponding device, and a socket server port. The intermediate layer device is registered in the kernel by default as 8 pairs of port channels, totaling 16 channels, namely ttyAT0~ttyAT1, ttyAT2~ttyAT3, ... ttyAT14~ttyAT15. The AT channel multiplexing method includes the following steps: Step S1: AT channel initialization; The AT channel initialization includes: completing the AT command transmission and reception function driver for the ttyAT0 port, and completing the data binding between the ttyAT1 port and the USB COM port; Step S2: Complete the sending of AT commands via the USB COM port; the completion of sending AT commands via the USB COM port includes: the host PC sending AT commands through the USB COM port, completing the function of the intermediate layer device to forward the AT channel to receive data, so that the AT channel can process the AT commands sent by the host PC when only a socket connection is available, and perform AT channel multiplexing. Step S3: Complete the reception of AT commands by the USB COM port; the completion of the reception of AT commands by the USB COM port includes: returning the data result of the AT command received by the AT channel, inputting the result through the ttyAT0 port, performing secondary data forwarding using multiple sets of driver channel ports of the intermediate layer device, and after completing the secondary forwarding, the host PC receives the return result of the AT command, thus completing the reception of AT commands by the USB COM port.
2. The AT channel multiplexing method based on device connection structure according to claim 1, characterized in that, In step S1, the intermediate layer device initializes the ttyAT0 channel port through the core controller alrouter for sending and receiving AT commands and starts socat to bind ttyAT1 with ttyGS2 of the USB COM port, thereby completing the AT channel data initialization process.
3. The AT channel multiplexing method based on device connection structure according to claim 1, characterized in that, In step S2, the intermediate layer device sends an AT command through the USB COM port. The host PC writes data to ttyGS2 through the USB COM port and simultaneously transmits the received data to the ttyAT1 port. The received data is then forwarded through the intermediate layer device to the ttyAT0 port. The PC receives the forwarded data through the AT channel. After the data transfer is completed, the AT channel processes the AT command sent by the host PC, thus completing the AT command sending process.
4. The AT channel multiplexing method based on device connection structure according to claim 1, characterized in that, In step S3, the intermediate layer device receives AT commands through the USB COM port. The AT channel receives the return data result of the AT command from the host PC. The return result is written to the ttyAT0 port using the AT channel. After writing, the intermediate layer device forwards the data sent by ttyAT0 to ttyAT1. After completing one data forwarding, socat forwards the data received by ttyAT1 to ttyGS2 and sends the return result of the AT command to the host PC. The host PC receives the return result of the AT command, completing the process of receiving AT commands through the USB COM port.
5. The AT channel multiplexing method based on device connection structure according to claim 1, characterized in that, The method also includes a USB COM port and socket port access switching process, comprising the following steps: Step SA1: Cancel the original socat process; Step SA2: Restart the socat process and bind the ttyAT1 channel to the socket server port.
6. The AT channel multiplexing method based on device connection structure according to claim 1, characterized in that, The method also includes an intermediate layer device operation driving process, comprising the following steps: Step SB1: Register the driver for the intermediate layer device kernel; Step SB2: Register 16 port channels by default, with each port named ttyAT0 to ttyAT15; Step SB3: ttyAT0 transfers the output data to the input of ttyAT1; Step SB4: Repeat step S3 repeatedly to complete the intermediate layer device operation drive.
7. A device connection structure for an AT channel multiplexing method, characterized in that, The device connection structure includes an AT module software module and a host PC. The AT module software module includes an AT channel module, an intermediate layer device, a corresponding USB COM device, and a socket server port. The AT module software module is signal-connected to the intermediate layer device, and the intermediate layer device is electrically connected to the corresponding USB COM device and the socket server port. The intermediate layer device is registered in the kernel by default as 8 pairs of port channels, totaling 16. The host PC includes a USB COM port and a socket client port. The USB COM port is electrically connected to the corresponding USB COM device, and the socket client port is electrically connected to the socket server port.
8. The device connection structure of the AT channel multiplexing method according to claim 7, characterized in that, The intermediate layer device is registered in the kernel by default as 8 pairs of 16 port channels, namely ttyAT0~ttyAT1, ttyAT2~ttyAT3, ... ttyAT14~ttyAT15. Each pair is a device channel of an intermediate layer device. ttyAT0 is used to connect to the original AT channel, and ttyAT1 connects to the socket server port or USB COM port.
Citation Information
Patent Citations
Method for processing overtime and return of AT command of wireless module
CN101720125A
Control system and method of slave module in dual-mode mobile terminal
WO2008037172A1