CN115361263A - AT command processing system and method based on embedded system - Google Patents

AT command processing system and method based on embedded system Download PDF

Info

Publication number
CN115361263A
CN115361263A CN202211065447.8A CN202211065447A CN115361263A CN 115361263 A CN115361263 A CN 115361263A CN 202211065447 A CN202211065447 A CN 202211065447A CN 115361263 A CN115361263 A CN 115361263A
Authority
CN
China
Prior art keywords
data
command
urc
client module
unit
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.)
Pending
Application number
CN202211065447.8A
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.)
Shanghai Rt Thread Electronic Technology Co ltd
Original Assignee
Shanghai Rt Thread Electronic Technology Co ltd
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 Shanghai Rt Thread Electronic Technology Co ltd filed Critical Shanghai Rt Thread Electronic Technology Co ltd
Priority to CN202211065447.8A priority Critical patent/CN115361263A/en
Publication of CN115361263A publication Critical patent/CN115361263A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/02Standardisation; Integration
    • H04L41/0246Exchanging or transporting network management information using the Internet; Embedding network management web servers in network elements; Web-services-based protocols
    • H04L41/0266Exchanging or transporting network management information using the Internet; Embedding network management web servers in network elements; Web-services-based protocols using meta-data, objects or commands for formatting management information, e.g. using eXtensible markup language [XML]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/42Bus transfer protocol, e.g. handshake; Synchronisation
    • G06F13/4282Bus transfer protocol, e.g. handshake; Synchronisation on a serial bus, e.g. I2C bus, SPI bus
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/08Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
    • H04L43/0805Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability
    • H04L43/0811Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability by checking connectivity

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Environmental & Geological Engineering (AREA)
  • Computer And Data Communications (AREA)

Abstract

The invention provides an AT command processing system based on an embedded system, which comprises: the system comprises an application interface, a data analysis unit, a data receiving unit, a data sending unit, a serial port driving unit and a data processing unit, wherein the application interface is connected with the sending unit, the data receiving unit is sequentially connected with the data analysis unit and the data processing unit, the serial port driving unit is arranged in the system and is connected with external hardware, and according to an interaction mechanism of an AT command, under the processing of an AT Client module, the response condition of the corresponding AT command can be accurately analyzed, whether the AT command is responded by the module can be timely distinguished, and meanwhile, the data returned by the module can be acquired by using an analysis interface provided by the AT Client module.

Description

AT command processing system and method based on embedded system
Technical Field
The invention relates to the technical field of communication, in particular to an AT command processing system and method based on an embedded system.
Background
The existing AT command interaction function is a specific module aiming AT a specific service function; for the embedded type, along with the development of the industry, various modules supporting the AT server are updated and issued, richer AT command interaction scenes exist, which causes troubles to the analysis work, and the continuously updated AT commands and the command differences among different modules complicate the maintenance work.
Disclosure of Invention
In order to solve the technical problem, the invention provides an AT command processing system and method based on an embedded system.
The invention is realized by the following technical scheme.
The invention provides an AT command processing system based on an embedded system, which comprises: the system comprises an application interface, a data analysis unit, a data receiving unit, a data sending unit, a serial port driving unit and a data processing unit, wherein the application interface is connected with the sending unit, the data receiving unit is sequentially connected with the data analysis unit and the data processing unit, and the serial port driving unit is arranged in the system and is connected with external hardware.
Further, the method comprises the following steps:
the method comprises the following steps that an AT system is initialized, an AT command processing thread, a semaphore, a mutex, a data structure and a data algorithm are created, the data structure comprises a data structure used for storing an AT command replied by an AT server and a data structure used for making a URC list for AT URC data, and in the creation stage, protection on a critical resource area is set AT the same time, and bottom-layer serial port hardware is taken over;
receiving and transmitting AT commands, binding an AT command receiving and transmitting unit of the system after taking over bottom serial port hardware, packaging a transmitting interface AT the stage of transmitting the AT commands, and acquiring the state of response of the transmitted AT commands; after receiving AT command data, the thread analyzes the AT data, truncates the AT data according to the characteristic that the AT data takes '\ r \ n' or other specified characters as data, and a specified data interface stores the AT data;
the AT command analysis, the AT command processing system analyzes the original data, the AT Client module provides a character analysis function to obtain the required data, and the actions are executed step by step according to the requirements of the modules through the processing of the analyzed data; or processing the URC data by using the corresponding URC service function on the URC table;
and providing an API interface, and providing the API interface which is convenient to use to an upper layer through abstracting AT command analysis work to realize an AT interaction scene.
Further, the initialization of the AT system comprises the following steps:
(S101) acquiring a bottom-layer serial port handle;
(S102) acquiring the handle of the AT Client module;
(S103) initializing AT Client module resources, wherein the initializing AT Client module resources comprise receiving cache, creating mutexes and semaphores;
(S104) initializing an AT Client module receiving thread;
(S105) opening and configuring a serial port;
(S106) configuring a URC list.
Further, the AT command sending process includes the following steps:
(S201) starting an application unit;
(S202) creating response data;
(S203) the AT Client module sends an AT command, if the response is awakened, the AT command response is successful; if response is not awakened, the AT command response fails.
Further, the process of receiving AT commands includes the following steps:
(S301) the serial port receives AT data and releases semaphore;
(S302) the AT Client module receives serial port data and stores the serial port data in a buffer;
(S303) judging whether a line of data is received, if so, transmitting the line of data to a data analysis module for function analysis; if not, the reception is continuously waited for, and the process returns to S301.
Further, the AT command parsing process includes the following steps:
(S401) waiting for the data receiving unit to wake up;
(S402) judges whether or not the line data is URC data. If yes, calling the registered URC processing function, and returning after processing (S401); if not, entering (S403);
(S403) setting the end of the line data to "\0";
(S404) recording the line number and storing it in response;
(S405) judging whether the line data is OK, if so, setting response to OK and entering (S410); if not, entering (S406);
(S406) judging whether the row data is 'ERROR', if so, setting response to 'ERROR', and entering (S410); if not, entering (S407);
(S407) judging whether the line is a custom tail symbol, if so, setting response to be 'OK';
(S410) the response semaphore is released and then the operation returns to (S401).
Further, processing the URC data includes the steps of:
initializing a URC list during initialization of an AT Client module;
registering URC information and a processing function thereof by using an instruction at _ obj _ set _ URC _ table;
the AT Client module checks the data matched with the URC information during the analysis period;
and processing the data by using the URC information processing function corresponding to the URC list.
Further, the step of designating the data interface to store the AT data comprises the steps of:
storing the common data according to the data structure of the AT command;
the URC data retrieves the registered service function according to the URC list and calls the service function.
The invention has the beneficial effects that: the invention can enable the MCU equipment to use a high-level application interface to realize the interactive work of the AT command, can accurately analyze the response condition of the corresponding AT command under the processing of the AT Client module according to the interactive mechanism of the AT command, distinguish whether the module responds to the AT command in time, and can also use the analysis interface provided by the AT Client module to acquire the data returned by the module; both common AT command data and complex URC data can be processed timely and efficiently, and the abstracted AT function can realize complex and various AT command interaction requirements only by slight adjustment, thereby providing a simple, easy-to-use and stable solution for applications using AT mode communication.
Drawings
FIG. 1 is a schematic diagram of the module connection relationship of the present invention;
FIG. 2 is a schematic diagram of the initialization flow of the AT command processing system of the present invention;
FIG. 3 is a schematic diagram illustrating the transmission flow of AT commands according to the present invention;
FIG. 4 is a flow chart illustrating the AT command reception process according to the present invention;
FIG. 5 is a schematic diagram illustrating the AT command parsing process according to the present invention;
fig. 6 is a flow diagram illustrating the processing of URC data according to the present invention.
Detailed Description
The technical solution of the present invention is further described below, but the scope of the claimed invention is not limited to the described.
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention will be described in detail with reference to the accompanying drawings and specific embodiments.
Example 1:
in this example, two portions are included. The STM32 is loaded with the code of the AT Client module, the ESP8266 is used as a device supporting AT command response, and the two devices are basic devices for realizing the function of the AT Client module.
The AT Client module performs initialization work of the AT Client module after the STM32 is powered on, after the initialization work is completed, the STM32 can use an AT command sending flow of the AT Client module to send AT commands such as AT, ATE0, AT + GMR and the like to the module to test the connection between the STM32 and the ESP8266, close the command echo of the ESP8266 end and acquire the firmware information of the current ESP 8266.
In the logic of information acquisition of the AT + GMR, the functions of AT command sending, AT command receiving and AT command analyzing of the AT Client module are fully used. Firstly, an AT Client module is used for sending an AT command, an ESP8266 module receives a command start response, and data are sent to an STM32 through a serial port; the data receiving function of the AT Client module starts to acquire data from the corresponding buffer space of the STM32, and the data is arranged into a structure managed by response and is delivered to the analysis function of the AT Client module for processing; and feeding back the corresponding response state to the sending function of the AT Client module in the analysis process of the AT Client module to judge whether the AT command is correctly responded.
The ESP8266 is a wireless communication module capable of being connected with WIFI, and under the scene of WIFI connection, the URC processing mechanism of the AT Client module is used. After connecting to the network using the AT + CWJAP command, ESP8266 responds first to whether the AT command successfully responds, but does not indicate whether to connect to the corresponding WIFI. Only after ESP8266 replies "WIFI CONNECTED" through the URC mechanism, WIFI indicates successful connection; AT this stage, "WIFI CONNECTED" is a piece of data that needs to be processed using the URC processing logic of the AT Client module. The ESP8266 module receives a command start response, and data are sent to the STM32 through a serial port; the data receiving function of the AT Client module starts to acquire data from the corresponding cache space of the STM32, the data are matched with the preset URC data of 'WIFI CONNECTED' when the data are acquired, then the corresponding URC processing function is given, namely, the updating of the corresponding WIFI state is processed, and the WIFI connection and disconnection state can be monitored in real time.

Claims (8)

1. An AT command processing system based on an embedded system is characterized by comprising an AT Client module and a hardware interface, wherein the AT Client module comprises an application interface, a data analysis unit, a data receiving unit, a data transmitting unit, a serial port driving unit and a data processing unit, the application interface is connected with the data transmitting unit, the data receiving unit is sequentially connected with the data analysis unit and the data processing unit, and the serial port driving unit is arranged in the system and connected with the hardware interface.
2. An AT command processing method based on an embedded system is characterized by comprising the following steps:
the AT command processing system is initialized, an AT command processing thread, a semaphore, a mutex, a data structure and a data algorithm are created, the data structure comprises a data structure used for storing the AT command replied by the AT server and a data structure of a URC list made for AT URC data, and the critical resource area is protected AT the same time in the creation stage to take over the hardware of the bottom-layer serial port;
receiving and transmitting AT commands, binding an AT command receiving and transmitting unit of the system after taking over the bottom-layer serial port hardware, and encapsulating a transmitting interface AT the stage of transmitting the AT commands to acquire the state of transmitting AT command responses; after receiving AT command data, the thread analyzes the AT data, truncates the AT data according to the characteristic that the AT data takes '\ r \ n' or other specified characters as data, and a specified data interface stores the AT data;
the AT command is analyzed, original data are analyzed, needed data are obtained through a character analysis function provided by an AT Client module, and actions are executed step by step according to the requirements of the module through the processing of the analyzed data; or processing the URC data by using the corresponding URC service function on the URC table;
and providing an API interface, and providing the API interface which is convenient to use to an upper layer through abstracting AT command analysis work to realize an AT interaction scene.
3. The AT command processing method based on embedded system according to claim 2, wherein the AT command processing system initialization comprises the steps of:
(S101) acquiring a bottom serial port handle;
(S102) acquiring an AT Client module handle;
(S103) initializing AT Client module resources, wherein the initializing AT Client module resources comprise receiving cache, creating mutexes and semaphores;
(S104) initializing an AT Client module receiving thread;
(S105) opening and configuring a serial port;
(S106) configuring a URC list.
4. The AT command processing method based on embedded system as claimed in claim 2, wherein the transmission flow of the AT command comprises the following steps:
(S201) starting an application unit;
(S202) creating response data;
(S203) the AT Client module sends an AT command, and if response is awakened, the AT command response is successful; if response is not awakened, the AT command response fails.
5. The AT command processing method based on embedded system as claimed in claim 2, wherein the receiving procedure of the AT command comprises the steps of:
(S301) the serial port receives AT data and releases semaphore;
(S302) the AT Client module receives the serial port data and stores the serial port data in a buffer;
(S303) judging whether a line of data is received, if so, transmitting the line of data to a data analysis module for function analysis; if not, the reception is continuously waited for, and the process returns to S301.
6. The AT command processing method based on embedded system according to claim 2, wherein the AT command parsing process comprises the following steps:
(S401) waiting for the data receiving unit to wake up;
(S402) judges whether or not the line data is URC data. If yes, calling the registered URC processing function, and returning after processing (S401); if not, entering (S403);
(S403) setting the end of the line data to be "\0";
(S404) recording the line number and storing it in response;
(S405) judging whether the line data is OK, if so, setting response to OK and entering (S410); if not, entering (S406);
(S406) judging whether the row data is 'ERROR', if so, setting response to 'ERROR', and entering (S410); if not, entering (S407);
(S407) judging whether the line is a custom tail symbol, if so, setting response to be 'OK';
(S410) the response semaphore is released and then the process returns to (S401).
7. The AT command processing method based on embedded system according to claim 2, wherein said processing the URC data comprises the steps of:
initializing a URC list during initialization of an AT Client module;
registering URC information and a processing function thereof by using an instruction at _ obj _ set _ URC _ table;
checking data matched with URC information during the analysis of the AT Client module;
and processing the data by using the URC information processing function corresponding to the URC list.
8. The AT command processing method based on the embedded system as claimed in claim 2, wherein: the step of storing AT data by the designated data interface comprises the following steps:
storing the common data according to the data structure of the AT command;
the URC data retrieves the registered service function according to the URC list and calls the service function.
CN202211065447.8A 2022-09-01 2022-09-01 AT command processing system and method based on embedded system Pending CN115361263A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211065447.8A CN115361263A (en) 2022-09-01 2022-09-01 AT command processing system and method based on embedded system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211065447.8A CN115361263A (en) 2022-09-01 2022-09-01 AT command processing system and method based on embedded system

Publications (1)

Publication Number Publication Date
CN115361263A true CN115361263A (en) 2022-11-18

Family

ID=84004951

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211065447.8A Pending CN115361263A (en) 2022-09-01 2022-09-01 AT command processing system and method based on embedded system

Country Status (1)

Country Link
CN (1) CN115361263A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116055578A (en) * 2023-03-06 2023-05-02 北京朝歌数码科技股份有限公司 Lightweight AT protocol stack, communication method and system

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102271155A (en) * 2011-07-19 2011-12-07 中兴通讯股份有限公司 Equipment and method for remotely operating same
CN103580942A (en) * 2012-08-02 2014-02-12 重庆重邮信科通信技术有限公司 Simulation serial port testing method and device
CN111722938A (en) * 2020-05-08 2020-09-29 深圳市广和通无线股份有限公司 AT instruction processing method, AT instruction processing device, computer equipment and storage medium
CN113254075A (en) * 2021-06-09 2021-08-13 上海移远通信技术股份有限公司 Instruction execution method, instruction execution device, electronic device, and storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102271155A (en) * 2011-07-19 2011-12-07 中兴通讯股份有限公司 Equipment and method for remotely operating same
CN103580942A (en) * 2012-08-02 2014-02-12 重庆重邮信科通信技术有限公司 Simulation serial port testing method and device
CN111722938A (en) * 2020-05-08 2020-09-29 深圳市广和通无线股份有限公司 AT instruction processing method, AT instruction processing device, computer equipment and storage medium
CN113254075A (en) * 2021-06-09 2021-08-13 上海移远通信技术股份有限公司 Instruction execution method, instruction execution device, electronic device, and storage medium

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
HUAWEI, HISILICON /CHRISTIAN: "C1-206012 "Introduction of +CVAEACT; AT command for VAE layer activation"", 3GPP TSG_CT\\WG1_MM-CC-SM_EX-CN1, no. 1 *
RTTHREADLOTOS: "RT-Thread AT组件应用笔记—客户端篇1", Retrieved from the Internet <URL:https://blog.csdn.net/FILLMOREad/article/details/81364121> *
内鬼: "RT-Thread学习笔记【AT组件】", Retrieved from the Internet <URL:https://blog.csdn.net/qq_40500005/article/details/114140362> *
学无-止境: "RT-Thread AT组件架构分析", Retrieved from the Internet <URL:https://blog.csdn.net/qq_27718231/article/details/117552892> *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116055578A (en) * 2023-03-06 2023-05-02 北京朝歌数码科技股份有限公司 Lightweight AT protocol stack, communication method and system

Similar Documents

Publication Publication Date Title
CN111835837B (en) Message pushing method and system with multi-terminal adaptation
CN102780613A (en) Method and device for communication of boards of distributed device
CN109946991B (en) Satellite counting simulation platform based on 1553B bus protocol encapsulation
CN111083168A (en) Configurable data transmission method and device of Internet of things platform gateway and gateway
CN113031591B (en) Exception handling method and device for material pushing robot, server and storage medium
CN115361263A (en) AT command processing system and method based on embedded system
CN116055578B (en) Lightweight AT protocol stack, communication method and system
CN112202605A (en) Service configuration method, device, equipment and storage medium
CN116647490A (en) Aviation AFDX network data detection system
CN116302621A (en) Method and system for picking up information-created environment elements based on QT interface library
US20030154288A1 (en) Server-client system and data transfer method used in the same system
CN113852610B (en) Message processing method, device, computer equipment and storage medium
CN105404557A (en) Interprocess communication method based on message queue
CN112511636B (en) Data transmission system, method, device, computer equipment and storage medium
CN114924891A (en) Cloud service platform for multi-device intelligent collaboration
CN110968491B (en) Operation and maintenance operation method and system
CN110096002A (en) A kind of automatization test system and test method based on CANFD bus
CN110908963B (en) DF file loading method of airborne display control library
CN113485412B (en) Method and system for distinguishing return by using multilink data signal source by unmanned aerial vehicle
US11431820B1 (en) Method and system for implementing inter-process communications
CN116232798B (en) Method, system, equipment and terminal for controlling various CAN bus equipment in cross-platform mode
CN115086387B (en) Control method and device of domain controller, storage medium and electronic device
CN108111612B (en) Online registration method and device for book self-service equipment
CN112039847A (en) Debugging system and method based on distributed equipment
KR100323109B1 (en) Method for processing operator command between tmn and bsm

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination