CN111315036A - Universal docking method, system and equipment for MCU and 2G module - Google Patents

Universal docking method, system and equipment for MCU and 2G module Download PDF

Info

Publication number
CN111315036A
CN111315036A CN202010088509.1A CN202010088509A CN111315036A CN 111315036 A CN111315036 A CN 111315036A CN 202010088509 A CN202010088509 A CN 202010088509A CN 111315036 A CN111315036 A CN 111315036A
Authority
CN
China
Prior art keywords
mcu
module
instruction
serial port
data
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.)
Granted
Application number
CN202010088509.1A
Other languages
Chinese (zh)
Other versions
CN111315036B (en
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.)
Hangzhou Tuya Information Technology Co Ltd
Original Assignee
Hangzhou Tuya Information 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 Hangzhou Tuya Information Technology Co Ltd filed Critical Hangzhou Tuya Information Technology Co Ltd
Priority to CN202010088509.1A priority Critical patent/CN111315036B/en
Publication of CN111315036A publication Critical patent/CN111315036A/en
Application granted granted Critical
Publication of CN111315036B publication Critical patent/CN111315036B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W76/00Connection management
    • H04W76/10Connection setup
    • H04W76/14Direct-mode setup
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/26Special purpose or proprietary protocols or architectures
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W28/00Network traffic management; Network resource management
    • H04W28/02Traffic management, e.g. flow control or congestion control
    • H04W28/10Flow control between communication endpoints
    • H04W28/14Flow control between communication endpoints using intermediate storage
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W80/00Wireless network protocols or protocol adaptations to wireless operation

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computing Systems (AREA)
  • Computer Security & Cryptography (AREA)
  • Communication Control (AREA)

Abstract

The invention relates to a universal docking method, which comprises the following steps: configuring a general protocol corresponding to the 2G module; generating a development description document corresponding to the MCU according to the general protocol; compiling the MCU SDK code according to the development instruction document to generate the MCU; and the MCU establishes connection with the 2G module through the general protocol to complete communication between the MCU and the 2G module. In the technical scheme of the invention, a user does not need to deeply know the bottom layer implementation of a 2G communication principle, a communication format and the like, and can complete the 2G communication of data only by developing an application layer code according to own requirements.

Description

Universal docking method, system and equipment for MCU and 2G module
Technical Field
The invention relates to the technical field of UART communication, in particular to a universal docking method and a universal docking system for an MCU and a 2G module, a computer readable storage medium and computer equipment.
Background
In the application of the Internet of things, each piece of equipment can be networked, and the modes of wifi, 2/3/4G and the like are provided. Wifi is applicable to situations where the devices are more centralized, such as indoor scenes. There are some devices that are distributed relatively discretely, such as children's watches, shared bicycles, positioners, mobile POS, etc., that require 2/3/4G for networking. Because the data volume of many types of equipment needing to be uploaded to the cloud is small, compared with 3/4G and 2G signals, the data transmission method has the advantages of cheap hardware, low cost, simple use and the like, and is widely applied to the field of Internet of things and used for transmitting small data such as control instructions, state information, low-code-rate voice and the like.
Disclosure of Invention
The present invention is directed to solving at least one of the problems of the prior art or the related art.
Therefore, the invention aims to provide a general docking method and system for an MCU and a 2G module, a computer readable storage medium and computer equipment, which can enable a user to complete data 2G communication by only developing application layer codes according to own requirements without deeply knowing bottom layer implementation such as a 2G communication principle, a communication format and the like.
In order to achieve the above object, a technical solution of a first aspect of the present invention provides a general docking method for an MCU and a 2G module, including the following steps: configuring a general protocol corresponding to the 2G module; generating a development description document corresponding to the MCU according to the general protocol; compiling the MCU SDK code according to the development instruction document to generate the MCU; and the MCU establishes connection with the 2G module through the general protocol to complete communication between the MCU and the 2G module.
In the above technical solution, preferably, the communication between the MCU and the 2G module includes the following steps: initializing the MCU configuration; calling a serial port receiving function, and receiving data from the 2G module; judging whether the data exist or not, if not, calling the serial port receiving function again; if so, calling a serial port data processing function, and processing the data to obtain at least one control instruction; and executing the processing action of the corresponding instruction according to at least one control instruction.
The technical solution of the second aspect of the present invention provides a general docking system for an MCU and a 2G module, comprising: a protocol configuration module configured to configure a common protocol corresponding to the 2G module; the file description module is used for generating a development description file corresponding to the MCU according to the general protocol; the code compiling module is used for compiling the MCU SDK code according to the development instruction document and generating the MCU; and the communication connection module is used for establishing the connection between the MCU and the 2G module through the general protocol to complete the communication between the MCU and the 2G module.
In the above technical solution, preferably, the communication connection module includes: an initialization unit arranged to initialize the MCU configuration; the receiving serial port calling unit is used for calling a serial port receiving function to receive data from the 2G module; the judging unit is set to be used for judging whether the data exist or not, and if not, the serial port receiving function is called again; the processing serial port calling unit is used for calling a serial port data processing function and processing the data to obtain at least one control instruction; and the action execution unit is arranged for executing the processing action of the corresponding instruction according to at least one control instruction.
In any of the above technical solutions, preferably, the data is data stored in a serial port receiving buffer by the 2G module.
In any of the above technical solutions, preferably, the development instruction document includes an instruction of the general protocol, an instruction of a program architecture of the MCU SDK, and an instruction of a problem of developing MCU code.
An aspect of the third aspect of the present invention provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the steps of the general interfacing method between the MCU and the 2G module provided in any one of the above-mentioned aspects.
The technical scheme of the fourth aspect of the invention provides computer equipment, which comprises a storage medium and a processor; a storage medium for storing a computer program; a processor, configured to execute a computer program to implement the steps of the general interfacing method between the MCU and the 2G module provided in any of the above technical solutions of the first aspect.
Compared with the prior art, the universal docking method and system of the MCU and the 2G module, the computer readable storage medium and the computer equipment provided by the invention have the advantages that the technical scheme can meet part of 2G-applicable scenes, and UART communication between the 2G module and the MCU of a user is realized. In order to facilitate the user to use the 2G module quickly, the universal docking scheme is established. By using the general docking scheme, a user does not need to deeply know the bottom layer implementation of a 2G communication principle, a communication format and the like, and can complete data 2G communication by only developing application layer codes according to own requirements.
Drawings
The above and/or additional aspects and advantages of the present invention will become apparent and readily appreciated from the following description of the embodiments, taken in conjunction with the accompanying drawings of which:
FIG. 1 illustrates a flow diagram of a generic docking method according to an embodiment of the present invention;
FIG. 2 shows a block flow diagram of step S4 according to an embodiment of the present invention;
FIG. 3 shows a block diagram of a generic docking system according to an embodiment of the invention;
fig. 4 shows a block diagram of a communication connection module according to an embodiment of the present invention.
Detailed Description
In order that the above objects, features and advantages of the present invention can be more clearly understood, a more particular description of the invention will be rendered by reference to the appended drawings. It should be noted that the embodiments and features of the embodiments of the present application may be combined with each other without conflict.
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present invention, however, the present invention may be practiced in other ways than those specifically described herein, and therefore the scope of the present invention is not limited to the specific embodiments disclosed below.
General interfacing methods and systems of an MCU and a 2G module, a computer-readable storage medium, and a computer device according to some embodiments of the present invention are described below with reference to fig. 1 to 4.
As shown in fig. 1, the general interfacing method of the MCU and the 2G module according to an embodiment of the present invention includes the following steps:
s1, configuring a general protocol corresponding to the 2G module;
in the step, a 2G general protocol is established inside a development company and aims at the protocol established by 2G serial port communication. The protocol can be opened for users, and is used for the users to butt against the 2G type modules of a development company and develop own MCU.
S2, generating a development instruction document corresponding to the MCU according to the general protocol;
in this step, a development instruction document is used to guide the user to develop the MCU. The content mainly comprises the introduction of a 2G general protocol, the introduction of a program architecture of an MCU SDK and the problem of attention required in MCU code development.
S3, compiling the MCU SDK code according to the development instruction document to generate the MCU;
in the step, the MCU is developed according to a 2G universal protocol, and comprises serial data receiving, serial data sending, serial data processing, serial data frame format analysis and framing, dp analysis, function entry realization of each function and the like, and all codes irrelevant to MCU function realization are realized by an MCU SDK.
And S4, the MCU establishes connection with the 2G module through the general protocol to complete the communication between the MCU and the 2G module.
In the embodiment, partial scenes suitable for 2G can be met, and UART communication between the 2G module and the MCU of the user is realized. In order to facilitate the user to use the 2G module quickly, the universal docking scheme is established. By using the general docking scheme, a user does not need to deeply know the bottom layer implementation of a 2G communication principle, a communication format and the like, and can complete data 2G communication by only developing application layer codes according to own requirements.
As shown in fig. 2, in some possible embodiments of the present invention, S4, the communication between the MCU and the 2G module includes the following steps:
s41, initializing the MCU configuration;
s42, calling a serial port receiving function, and receiving data from the 2G module;
s43, judging whether the data exist, if not, calling the serial port receiving function again;
if yes, S44, calling a serial port data processing function, and processing the data to obtain at least one control instruction;
and S45, executing the processing action of the corresponding instruction according to at least one control instruction.
As shown in fig. 3, a general docking system 100 for an MCU and a 2G module according to an embodiment of the present invention includes:
a protocol configuration module 10 configured to configure a general protocol corresponding to the 2G module;
a document description module 20 configured to generate a development description document corresponding to the MCU according to the general protocol;
a code writing module 30 configured to write the MCU SDK code according to the development instruction document, and generate the MCU;
and the communication connection module 40 is configured to establish a connection between the MCU and the 2G module through the general protocol, and complete communication between the MCU and the 2G module.
The embodiment can meet the partial scene of being suitable for 2G, and realizes UART communication between the 2G module and the MCU of the user. In order to facilitate the user to use the 2G module quickly, the universal docking scheme is established. By using the general docking scheme, a user does not need to deeply know the bottom layer implementation of a 2G communication principle, a communication format and the like, and can complete data 2G communication by only developing application layer codes according to own requirements.
As shown in fig. 4, in some possible embodiments of the invention, the communication connection module 40 includes:
an initialization unit 41 arranged for initializing the MCU configuration;
an accept serial port calling unit 42 configured to call a serial port receive function to receive data from the 2G module;
a judging unit 43, configured to judge whether the data exists, and if not, re-invoke the serial port receiving function;
a serial port processing calling unit 44 configured to call a serial port data processing function, and process the data to obtain at least one control instruction;
and the action execution unit 45 is configured to execute the processing action of the corresponding instruction according to at least one control instruction.
In any of the above embodiments, preferably, the data is data stored in a serial port receiving buffer by the 2G module.
In any of the above embodiments, preferably, the development instruction document includes an instruction of the general protocol, an instruction of a program architecture of the MCUSDK, and an instruction of a problem of developing MCU code.
Based on the methods shown in fig. 1 and fig. 2, correspondingly, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the general docking method for the MCU and the 2G module in any of the embodiments described above are implemented.
Based on such understanding, the technical solution of the present application may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (which may be a CD-ROM, a usb disk, a removable hard disk, etc.), and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method of the embodiments of the present application.
In order to achieve the above object, based on the method shown in fig. 1 and fig. 2 and the virtual device embodiment shown in fig. 3 and fig. 4, the present application further provides a computer device, including a storage medium and a processor; a storage medium for storing a computer program; and the processor is used for executing a computer program to realize the steps of the general docking method of the MCU and the 2G module in any embodiment.
Optionally, the computer device may also include a user interface, a network interface, a camera, Radio Frequency (RF) circuitry, sensors, audio circuitry, a WI-FI module, and so forth. The user interface may include a Display screen (Display), an input unit such as a keypad (Keyboard), etc., and the optional user interface may also include a USB interface, a card reader interface, etc. The network interface may optionally include a standard wired interface, a wireless interface (e.g., a bluetooth interface, WI-FI interface), etc.
It will be appreciated by those skilled in the art that the present embodiment provides a computer device architecture that is not limiting of the computer device, and that may include more or fewer components, or some components in combination, or a different arrangement of components.
The storage medium may further include an operating system and a network communication module. An operating system is a program that manages and maintains the hardware and software resources of a computer device, supporting the operation of information handling programs, as well as other software and/or programs. The network communication module is used for realizing communication among components in the storage medium and other hardware and software in the entity device.
Compared with the prior art, the universal docking method and system of the MCU and the 2G module, the computer readable storage medium and the computer equipment provided by the invention have the advantages that the technical scheme can meet part of 2G-applicable scenes, and UART communication between the 2G module and the MCU of a user is realized. In order to facilitate the user to use the 2G module quickly, the universal docking scheme is established. By using the general docking scheme, a user does not need to deeply know the bottom layer implementation of a 2G communication principle, a communication format and the like, and can complete data 2G communication by only developing application layer codes according to own requirements.
In the present invention, the terms "first", "second", and "third" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance; the term "plurality" means two or more unless expressly limited otherwise. The terms "mounted," "connected," "fixed," and the like are to be construed broadly, and for example, "connected" may be a fixed connection, a removable connection, or an integral connection; "coupled" may be direct or indirect through an intermediary. The specific meanings of the above terms in the present invention can be understood by those skilled in the art according to specific situations.
In the description of the present invention, it is to be understood that the terms "upper", "lower", "left", "right", "front", "rear", and the like indicate orientations or positional relationships based on those shown in the drawings, and are only for convenience of description and simplification of description, but do not indicate or imply that the referred device or unit must have a specific direction, be constructed in a specific orientation, and be operated, and thus, should not be construed as limiting the present invention.
In the description herein, the description of the terms "one embodiment," "some embodiments," "specific embodiments," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, the schematic representations of the terms used above do not necessarily refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

1. A general docking method for an MCU and a 2G module is characterized by comprising the following steps:
configuring a general protocol corresponding to the 2G module;
generating a development description document corresponding to the MCU according to the general protocol;
compiling the MCU SDK code according to the development instruction document to generate the MCU;
and the MCU establishes connection with the 2G module through the general protocol to complete communication between the MCU and the 2G module.
2. The universal docking method for the MCU and the 2G module according to claim 1, wherein the communication between the MCU and the 2G module comprises the following steps:
initializing the MCU configuration;
calling a serial port receiving function, and receiving data from the 2G module;
judging whether the data exist or not, if not, calling the serial port receiving function again;
if so, calling a serial port data processing function, and processing the data to obtain at least one control instruction;
and executing the processing action of the corresponding instruction according to at least one control instruction.
3. The universal docking method for the MCU and the 2G module according to claim 2, wherein: the data is stored in a serial port to receive and cache by the 2G module.
4. The universal interfacing method of an MCU and a 2G module according to any one of claims 1 to 3, characterized in that: the development instruction document comprises an instruction of the general protocol, an instruction of the program architecture of the MCU SDK and an instruction of the problem of developing the MCU code.
5. The utility model provides a general butt joint system of MCU and 2G module which characterized in that includes:
a protocol configuration module configured to configure a common protocol corresponding to the 2G module;
the file description module is used for generating a development description file corresponding to the MCU according to the general protocol;
the code compiling module is used for compiling the MCU SDK code according to the development instruction document and generating the MCU;
and the communication connection module is used for establishing the connection between the MCU and the 2G module through the general protocol to complete the communication between the MCU and the 2G module.
6. The MCU and 2G module universal docking system according to claim 5, wherein the communication connection module comprises:
an initialization unit arranged to initialize the MCU configuration;
the receiving serial port calling unit is used for calling a serial port receiving function to receive data from the 2G module;
the judging unit is set to be used for judging whether the data exist or not, and if not, the serial port receiving function is called again;
the processing serial port calling unit is used for calling a serial port data processing function and processing the data to obtain at least one control instruction;
and the action execution unit is arranged for executing the processing action of the corresponding instruction according to at least one control instruction.
7. The universal docking system for MCU and 2G module according to claim 6, wherein: the data is stored in a serial port to receive and cache by the 2G module.
8. The universal docking system of an MCU and a 2G module according to any one of claims 5 to 7, wherein: the development instruction document comprises an instruction of the general protocol, an instruction of the program architecture of the MCU SDK and an instruction of the problem of developing the MCU code.
9. A computer-readable storage medium, characterized in that a computer program is stored thereon, which program, when being executed by a processor, realizes the steps of the universal interfacing method of an MCU with a 2G module according to any one of claims 1 to 4.
10. A computer device comprising a storage medium and a processor; a storage medium for storing a computer program; a processor for executing a computer program for implementing the steps of the universal interfacing method of an MCU with a 2G module according to any one of claims 1 to 4.
CN202010088509.1A 2020-02-12 2020-02-12 Universal docking method, system and equipment for MCU and 2G module Active CN111315036B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010088509.1A CN111315036B (en) 2020-02-12 2020-02-12 Universal docking method, system and equipment for MCU and 2G module

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010088509.1A CN111315036B (en) 2020-02-12 2020-02-12 Universal docking method, system and equipment for MCU and 2G module

Publications (2)

Publication Number Publication Date
CN111315036A true CN111315036A (en) 2020-06-19
CN111315036B CN111315036B (en) 2022-02-18

Family

ID=71160106

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010088509.1A Active CN111315036B (en) 2020-02-12 2020-02-12 Universal docking method, system and equipment for MCU and 2G module

Country Status (1)

Country Link
CN (1) CN111315036B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103262099A (en) * 2011-05-25 2013-08-21 万讯科技系统有限公司 Radio frequency identification reader pad
US20170168813A1 (en) * 2015-12-13 2017-06-15 Microsoft Technology Licensing, Llc. Resource Provider SDK
CN108377232A (en) * 2018-01-29 2018-08-07 杭州鸿泉物联网技术股份有限公司 A kind of multi-protocol communication method and device
CN108923935A (en) * 2018-06-29 2018-11-30 天津杰出科技发展有限公司 A kind of narrowband internet of things data analysis management control system, method and application
CN110471654A (en) * 2019-07-17 2019-11-19 深圳文理子科技有限公司 The cloud development system and computer software program product of communication protocol
CN110780630A (en) * 2019-11-25 2020-02-11 广州邦讯信息系统有限公司 Protocol library docking execution system suitable for Internet of things and working method

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103262099A (en) * 2011-05-25 2013-08-21 万讯科技系统有限公司 Radio frequency identification reader pad
US20170168813A1 (en) * 2015-12-13 2017-06-15 Microsoft Technology Licensing, Llc. Resource Provider SDK
CN108377232A (en) * 2018-01-29 2018-08-07 杭州鸿泉物联网技术股份有限公司 A kind of multi-protocol communication method and device
CN108923935A (en) * 2018-06-29 2018-11-30 天津杰出科技发展有限公司 A kind of narrowband internet of things data analysis management control system, method and application
CN110471654A (en) * 2019-07-17 2019-11-19 深圳文理子科技有限公司 The cloud development system and computer software program product of communication protocol
CN110780630A (en) * 2019-11-25 2020-02-11 广州邦讯信息系统有限公司 Protocol library docking execution system suitable for Internet of things and working method

Also Published As

Publication number Publication date
CN111315036B (en) 2022-02-18

Similar Documents

Publication Publication Date Title
CN111801646A (en) Electronic device with flexible display and operation method thereof
JP2002304283A (en) Portable, interactive computer display system and its method
US8639749B2 (en) Platform independent information handling system, communication method, and computer program product thereof
US20030067624A1 (en) System and method for mobile printing
WO2021121052A1 (en) Multi-screen cooperation method and system, and electronic device
JP2005243011A (en) Character processing apparatus and method of portable terminal
JP2015529878A (en) Providing access to remote applications via a web client
CN109766080B (en) Micro-service registration method, micro-service registration device, electronic equipment and readable storage medium
CN109521978B (en) Content display method and terminal equipment
US10048764B2 (en) Sensor module and device including the same
US20210026531A1 (en) Collaborative drawing method and electronic device therefor
CN110210007A (en) A kind of processing method of document, terminal and computer equipment
KR20170128019A (en) Electronic device and wireless communication method in the electronic device
CN112328356B (en) Intercommunication method and device for Android and Windows, storage medium and computer equipment
CN111315036B (en) Universal docking method, system and equipment for MCU and 2G module
CN111338808B (en) Collaborative computing method and system
US9787746B2 (en) Method and apparatus for processing multimedia content on a graphic cloud
WO2023088198A1 (en) Network connection method and apparatus, and electronic device
CN216927593U (en) Intelligent terminal
WO2022199614A1 (en) Interface input source switching method and apparatus, and electronic device
CN110327620A (en) Operation mapping control system, method and computer readable storage medium between multiterminal
CN111427567B (en) Intelligent product rapid generation method, system and equipment thereof
CN111988357B (en) Task processing method, electronic device, cloud server and system
CN114760309A (en) Business interaction method, device, equipment and medium of terminal based on cloud service
CN114265714A (en) Drive control method and device based on cloud mobile phone and storage medium

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
GR01 Patent grant
GR01 Patent grant