CN113177014A - Serial port communication method based on inspection mode and serial port chip - Google Patents

Serial port communication method based on inspection mode and serial port chip Download PDF

Info

Publication number
CN113177014A
CN113177014A CN202110565736.3A CN202110565736A CN113177014A CN 113177014 A CN113177014 A CN 113177014A CN 202110565736 A CN202110565736 A CN 202110565736A CN 113177014 A CN113177014 A CN 113177014A
Authority
CN
China
Prior art keywords
verification
serial port
protocol
target data
mode
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
CN202110565736.3A
Other languages
Chinese (zh)
Other versions
CN113177014B (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.)
Shijiazhuang Tonghe Electronics Co Ltd
Original Assignee
Shijiazhuang Tonghe Electronics 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 Shijiazhuang Tonghe Electronics Co Ltd filed Critical Shijiazhuang Tonghe Electronics Co Ltd
Priority to CN202110565736.3A priority Critical patent/CN113177014B/en
Publication of CN113177014A publication Critical patent/CN113177014A/en
Application granted granted Critical
Publication of CN113177014B publication Critical patent/CN113177014B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • 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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2213/00Indexing scheme relating to interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F2213/0002Serial port, e.g. RS232C
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Communication Control (AREA)

Abstract

The invention is suitable for the technical field of data communication, and provides a serial communication method and a serial chip based on a checking mode, wherein the serial communication method based on the checking mode comprises the following steps: receiving target data; according to a preset check mode array, checking the target data; the preset check mode array comprises a plurality of check modes, and each check mode uniquely corresponds to a protocol object constructed in advance based on an object-oriented principle; and under the condition that the target data passes the verification, sending the target data to the protocol object corresponding to the verification mode adopted when the verification passes. By adopting the invention, multiple protocols can be adapted without the need of technical personnel to modify internal programs.

Description

Serial port communication method based on inspection mode and serial port chip
Technical Field
The invention belongs to the technical field of data communication, and particularly relates to a serial port communication method and a serial port chip based on a test mode.
Background
With the rapid development of computer technology, more and more electronic devices utilize serial chips for communication, for example, power modules in electric vehicles and charging piles thereof use the serial chips for module control and monitoring.
At present, a serial port chip can only be suitable for one protocol. In order to meet the requirements of different protocols, the adaptation protocol of the serial port chip can be changed by modifying the internal program of the serial port chip. However, the operation is complicated by modifying the internal program of the serial chip to change the adaptation protocol of the serial chip.
Disclosure of Invention
In view of this, embodiments of the present invention provide a serial communication method and a serial chip based on a verification method, so as to solve the problem of complicated operation in the prior art that an adaptation protocol of the serial chip is changed.
The first aspect of the embodiments of the present invention provides a serial port communication method based on a verification method, including:
receiving target data;
according to a preset check mode array, checking the target data; the preset check mode array comprises a plurality of check modes, and each check mode uniquely corresponds to a protocol object constructed in advance based on an object-oriented principle;
and under the condition that the target data passes the verification, sending the target data to the protocol object corresponding to the verification mode adopted when the verification passes.
Optionally, verifying the target data according to a preset verification mode array, including:
sequentially adopting a check mode in a preset check mode array to check the target data;
and when the verification passes, recording the verification mode adopted at the time, and stopping the verification.
Optionally, the serial port communication method based on the verification mode is applied to a serial port chip, and the serial port chip comprises at least one serial port, a bottom layer configuration module and a protocol verification module;
receiving target data, comprising:
the bottom layer configuration module acquires target data of a target serial port;
the bottom layer configuration module determines a target bottom layer object corresponding to the target serial port in the bottom layer objects so that the target bottom layer object sends target data to the protocol verification module; the bottom layer objects are constructed in advance based on an object-oriented principle, each bottom layer object only corresponds to one serial port, and the serial ports corresponding to the bottom layer objects are different;
a protocol checking module receives target data;
according to a preset check mode array, checking the target data, including:
and the protocol checking module checks the target data according to the preset checking mode array.
Optionally, the serial port chip further includes a protocol parsing module;
correspondingly, the sending of the target data to the protocol object corresponding to the verification mode adopted when the verification passes includes:
the protocol checking module sends the target data and the checking information to the protocol analyzing module; the verification information carries a protocol object corresponding to a verification mode adopted when the verification passes;
and the protocol analysis module sends the target data to a protocol object corresponding to the verification mode adopted when the verification passes.
Optionally, the serial port communication method based on the verification mode further includes:
receiving a check mode registration request for a target check mode; the verification mode registration request carries a target verification mode and a protocol object corresponding to the target verification mode;
and adding the target verification mode to a preset verification mode array.
A second aspect of the embodiments of the present invention provides a serial port chip, configured to:
receiving target data;
according to a preset check mode array, checking the target data; the preset check mode array comprises a plurality of check modes, and each check mode uniquely corresponds to a protocol object constructed in advance based on an object-oriented principle;
and under the condition that the target data passes the verification, sending the target data to the protocol object corresponding to the verification mode adopted when the verification passes.
Optionally, the serial port chip is also used for
Sequentially adopting a check mode in a preset check mode array to check the target data;
and when the verification passes, recording the verification mode adopted at the time, and stopping the verification.
Optionally, the serial port chip includes at least one serial port, a bottom layer configuration module, and a protocol checking module, where:
the bottom layer configuration module is used for:
acquiring target data of a target serial port, and determining a target bottom layer object corresponding to the target serial port in a plurality of bottom layer objects so that the target bottom layer object sends the target data to a protocol checking module; the bottom layer objects are constructed in advance based on an object-oriented principle, each bottom layer object only corresponds to one serial port, and the serial ports corresponding to the bottom layer objects are different;
the protocol checking module is used for:
receiving target data;
the protocol checking module is further configured to:
and verifying the target data according to the preset verification mode array.
Optionally, the serial port chip further includes a protocol parsing module;
the protocol checking module is further configured to:
sending the target data and the check information to a protocol analysis module; the verification information carries a protocol object corresponding to a verification mode adopted when the verification passes;
the protocol analysis module is used for:
and sending the target data to the protocol object corresponding to the verification mode adopted when the verification passes.
Optionally, the serial port chip further includes a configuration module, configured to:
receiving a check mode registration request for a target check mode; the verification mode registration request carries a target verification mode and a protocol object corresponding to the target verification mode;
and adding the target verification mode to a preset verification mode array.
A third aspect of an embodiment of the present invention provides a serial port chip, including a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor implements the steps of the method according to the first aspect when executing the computer program.
Compared with the prior art, the embodiment of the invention has the following beneficial effects:
in the embodiment of the invention, after the target data is received, the target data can be verified according to a preset verification mode array; the preset check mode array comprises a plurality of check modes, and each check mode uniquely corresponds to a protocol object constructed in advance based on an object-oriented principle. And under the condition that the target data passes the verification, sending the target data to a protocol object corresponding to the verification mode adopted when the verification passes. Therefore, the serial port chip can be internally provided with various protocols, can decouple the protocols, can automatically find the protocol corresponding to the data based on the preset check mode in the check mode array, can adapt to the multiple protocols without modifying internal programs by technicians, and is convenient to operate.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the embodiments or the prior art descriptions will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without inventive exercise.
Fig. 1 is a flowchart illustrating steps of a serial communication method based on a verification method according to an embodiment of the present invention;
fig. 2 is a schematic diagram of a serial port chip according to an embodiment of the present invention;
FIG. 3 is a signal flow diagram according to an embodiment of the present invention;
fig. 4 is a schematic processing flow diagram of protocol checking according to an embodiment of the present invention;
fig. 5 is a schematic diagram of another serial communication architecture according to an embodiment of the present invention;
fig. 6 is a schematic diagram of a serial port chip according to an embodiment of the present invention;
fig. 7 is a schematic diagram of a serial port chip according to an embodiment of the present invention.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular system structures, techniques, etc. in order to provide a thorough understanding of the embodiments of the invention. It will be apparent, however, to one skilled in the art that the present invention may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present invention with unnecessary detail.
In order to explain the technical means of the present invention, the following description will be given by way of specific examples.
As described in the background art, at present, a serial port chip can only be applied to one protocol, and although the internal program of the serial port chip can be modified to change the adaptation protocol of the serial port chip, this method requires technical personnel, which is not only time-consuming, but also is prone to error, thus having the problem of complex operation.
In order to solve the problems of the prior art, the embodiment of the invention provides a serial port communication method based on a test mode and a serial port chip. First, a serial communication method based on a verification method provided by an embodiment of the present invention is described below.
The execution main body of the serial communication method based on the verification mode may be a serial chip, such as a Digital Signal Processing (DSP) chip, a Field Programmable Gate Array (FPGA) chip, and the like, and the serial chip may be externally connected to hardware, such as a charging module of an electric vehicle, a power module of a charging pile, a monitoring device, and the like. In addition, the serial port chip can be a multi-serial port chip or a single serial port chip.
As shown in fig. 1, the serial port communication method based on the verification method provided in the embodiment of the present invention may include the following steps:
step S110, receiving target data;
in some embodiments, the target data may be any data received by the serial port chip.
And step S120, checking the target data according to a preset checking mode array.
The preset check mode array comprises a plurality of check modes, and each check mode uniquely corresponds to a protocol object constructed in advance based on an object-oriented principle;
in some embodiments, the checking manner may be a manner of checking the data based on a value of a specific position in the data, such as the function code, the data length, and the like, for example, whether the function code, the data length, and the like in the data frame are the same as the preset value is checked. It should be noted that, when the length of the function code and the length of the data are different, that is, the checking sequence of the checked objects is different, the checking modes are also different.
In some embodiments, a preset check mode array and a preset protocol array may be configured in advance, and elements in the preset check mode array and the preset protocol array are associated, where the preset protocol array may record a protocol object associated with each check mode. Then, the target data can be checked by sequentially adopting a checking mode in a preset checking mode array; and when the verification passes, recording the verification mode adopted at the time, and stopping the verification.
Optionally, the serial port chip may add a check mode in a preset check mode array based on an input check mode registration request to enlarge a protocol application range of the serial port chip, and the corresponding processing may be as follows: receiving a check mode registration request for a target check mode; and adding the target verification mode to a preset verification mode array.
The verification mode registration request carries a target verification mode and a protocol object corresponding to the target verification mode;
in some embodiments, the serial port chip may further modify or delete the verification mode in the preset verification mode array based on the input verification mode modification request, so as to update the protocol use range of the serial port chip.
And step S130, under the condition that the target data passes the verification, sending the target data to the protocol object corresponding to the verification mode adopted when the verification passes.
In some embodiments, when the target data passes the verification, it indicates that the protocol object corresponding to the target data is previously embedded in the internal program of the serial port chip, so that the target data can be sent to the protocol object corresponding to the target frame header to call the protocol object corresponding to the target data to process the target data, thereby implementing communication between the serial port chip and the external device.
Optionally, an embodiment of the present invention provides a serial port chip for implementing a serial port communication method based on a verification method, where the serial port chip includes at least one serial port, a bottom layer configuration module, and a protocol verification module;
specifically, after the bottom layer configuration module obtains the target data of the target serial port, the target bottom layer object corresponding to the target serial port can be determined in the plurality of bottom layer objects, so that the target bottom layer object sends the target data to the protocol verification module; the bottom layer objects are constructed in advance based on an object-oriented principle, each bottom layer object only corresponds to one serial port, and the serial ports corresponding to the bottom layer objects are different; and then, the protocol checking module receives the target data and checks the target data according to the preset checking mode array.
Optionally, the serial port chip capable of implementing the serial port communication method based on the verification mode may further include a protocol analysis module. Correspondingly, the protocol analysis module sends the target data and the check information to the protocol analysis module; the protocol analysis module can send the target data to the protocol object corresponding to the verification mode adopted when the verification passes according to the protocol object corresponding to the verification mode adopted when the verification passes and carried in the verification information.
In order to better understand the frame header-based serial communication method provided in the embodiment of the present invention, the following description is made.
For a single serial port chip, considering that the single serial port chip can only be applied to a single baud rate each time, namely the baud rate is fixed during each communication, however, different protocols can exist under the fixed baud rate, and for the situation, the serial port communication method based on the verification mode provided by the embodiment of the invention can be used for distinguishing. For a multi-serial-port chip, any serial port number of the multi-serial-port chip can be regarded as a single serial-port chip.
As shown in fig. 2 and fig. 3, an architecture schematic diagram and a signal flow direction schematic diagram of a serial port chip are respectively shown, based on the architecture, protocols requiring different verification modes for different manufacturers can be checked, and no matter for a single serial port chip or a multi-serial port chip, a protocol verification module can be used for solving the problem of protocol layer coupling of different chips, so as to achieve decoupling of protocol layers.
Specifically, for the data receiving process, the signal of the bottom configuration module may carry information such as a serial number, a data length, a buffer initial address, and the like, and is connected to the slot of the protocol distribution module, and the protocol verification module performs protocol distribution on the received data according to different verification methods and distributes the data to the protocol object corresponding to the protocol layer. In the data sending process, the signal of the protocol layer is connected with the slot of the bottom layer configuration module, and the data to be sent is directly transmitted to the bottom layer configuration module for sending.
It should be noted that, in order to improve the efficiency of protocol verification, the frame headers may be used to pre-group the verification methods in the preset verification method array, that is, one or more verification methods that may be correspondingly adapted to the frame headers may be used. After receiving the target data, the corresponding check mode grouping can be determined according to the frame header of the target data, and then the target data is checked in sequence by using the check modes included in the check mode grouping, so that the check process which is obviously not in accordance with the check mode of the specific frame header can be reduced, and the protocol check efficiency is improved.
As shown in fig. 4, a processing flow of protocol verification is shown, which specifically includes the following steps:
1. and searching the registered frame head by using a dichotomy, namely reading data in a buffer, comparing the data with the frame head positioned in the middle position of a preset frame head array, and if the data is greater than the frame head value, searching downwards from the position, otherwise, searching upwards.
2. And when the frame header consistent with the data in the read buffer is found, calling a verification mode in the verification mode group corresponding to the frame header to verify the data, and when the verification passes, sending the data to a protocol object corresponding to the verification mode adopted when the verification passes.
In addition, whether the check passes or fails, the final read index value needs to be recorded, so that the data in the receiving buffer can be judged from the read index value next time. In the whole checking process, all data in the receiving buffer area needs to be checked in a traversing mode.
As shown in fig. 5, a serial communication architecture applying the above frame header feature is shown. For the protocol layer, it is necessary to separate the protocol verification process from the subsequent data processing process, and establish different protocols according to different verification methods to perform decoupling. The protocol checking procedure of the protocol layer may be as follows:
1. if the check is correct, the final read index value is returned, and if the check is wrong, 0 is returned.
2. All valid data, except for the frame header and the like invalid data, are temporarily placed for the data processing process.
It is worth mentioning that a multi-serial communication architecture can be designed based on an object-oriented method, such as C + +, and the architecture has the following functions:
function 1, using a protocol checking module, which is located before the protocol analyzing module, and distributes data according to different checking modes of the module, and transmits the data to the protocol analyzing module.
And function 2, a protocol analysis module specifically analyzes protocol contents, different protocols are created according to different verification modes, one-to-one correspondence between frame headers and protocols is realized, and the problem of strong coupling of protocol layers is solved.
Function 3, signal groove mechanism are applied to serial port communication framework, and each module is decoupled from each other and does not interfere with each other.
Therefore, the problem of protocol coupling of the protocol layer can be solved, and the protocol decoupling of the protocol layer is realized, so that after the serial port chip receives data, a protocol object of the protocol can be called for processing after the corresponding protocol is found.
In the embodiment of the invention, after the target data is received, the target data can be verified according to a preset verification mode array; the preset check mode array comprises a plurality of check modes, and each check mode uniquely corresponds to a protocol object constructed in advance based on an object-oriented principle. And under the condition that the target data passes the verification, sending the target data to a protocol object corresponding to the verification mode adopted when the verification passes. Therefore, the serial port chip can be internally provided with various protocols, can decouple the protocols, can automatically find the protocol corresponding to the data based on the preset check mode in the check mode array, can adapt to the multiple protocols without modifying internal programs by technicians, and is convenient to operate.
Based on the serial port communication method based on the inspection mode provided by the embodiment, correspondingly, the invention also provides a specific implementation mode of the serial port chip applied to the serial port communication method based on the inspection mode. Please see the examples below.
A serial port chip is provided, which is used for:
receiving target data;
according to a preset check mode array, checking the target data; the preset check mode array comprises a plurality of check modes, and each check mode uniquely corresponds to a protocol object constructed in advance based on an object-oriented principle;
and under the condition that the target data passes the verification, sending the target data to the protocol object corresponding to the verification mode adopted when the verification passes.
Optionally, the serial port chip is also used for
Sequentially adopting a check mode in a preset check mode array to check the target data;
and when the verification passes, recording the verification mode adopted at the time, and stopping the verification.
Optionally, as shown in fig. 6, the serial chip 600 includes at least one serial port, a bottom layer configuration module 610 and a protocol checking module 620, where:
the bottom layer configuration module 610 is configured to:
acquiring target data of a target serial port, and determining a target bottom layer object corresponding to the target serial port from a plurality of bottom layer objects so that the target bottom layer object sends the target data to a protocol checking module 620; the bottom layer objects are constructed in advance based on an object-oriented principle, each bottom layer object only corresponds to one serial port, and the serial ports corresponding to the bottom layer objects are different;
the protocol checking module 620 is configured to:
receiving target data;
the protocol check module 620 is further configured to:
and verifying the target data according to the preset verification mode array.
Optionally, the serial port chip further includes a protocol parsing module;
the protocol checking module is further configured to:
sending the target data and the check information to a protocol analysis module; the verification information carries a protocol object corresponding to a verification mode adopted when the verification passes;
the protocol analysis module is used for:
and sending the target data to the protocol object corresponding to the verification mode adopted when the verification passes.
Optionally, the serial port chip further includes a configuration module, configured to:
receiving a check mode registration request for a target check mode; the verification mode registration request carries a target verification mode and a protocol object corresponding to the target verification mode;
and adding the target verification mode to a preset verification mode array.
In the embodiment of the invention, after the target data is received, the target data can be verified according to a preset verification mode array; the preset check mode array comprises a plurality of check modes, and each check mode uniquely corresponds to a protocol object constructed in advance based on an object-oriented principle. And under the condition that the target data passes the verification, sending the target data to a protocol object corresponding to the verification mode adopted when the verification passes. Therefore, the serial port chip can be internally provided with various protocols, can decouple the protocols, can automatically find the protocol corresponding to the data based on the preset check mode in the check mode array, can adapt to the multiple protocols without modifying internal programs by technicians, and is convenient to operate.
Fig. 7 is a schematic diagram of a serial port chip according to an embodiment of the present invention. As shown in fig. 7, the serial chip 7 of this embodiment includes: a processor 70, a memory 71 and a computer program 72 stored in said memory 71 and executable on said processor 70. The processor 70 implements the steps of the above-described serial communication method embodiments based on the verification method when executing the computer program 72. Alternatively, the processor 70 implements the functions of the modules/units in the above-described device embodiments when executing the computer program 72.
Illustratively, the computer program 72 may be partitioned into one or more modules/units that are stored in the memory 71 and executed by the processor 70 to implement the present invention. The one or more modules/units may be a series of computer program instruction segments capable of performing specific functions, and the instruction segments are used for describing the execution process of the computer program 72 in the serial port chip 7.
The serial port chip 7 may be a desktop computer, a notebook, a palm computer, a cloud server, or other computing devices. The serial port chip may include, but is not limited to, a processor 70 and a memory 71. Those skilled in the art will appreciate that fig. 7 is only an example of the serial port chip 7, and does not constitute a limitation to the serial port chip 7, and may include more or less components than those shown, or combine some components, or different components, for example, the serial port chip may further include an input-output device, a network access device, a bus, and the like.
The Processor 70 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate array (Field-Programmable Gate array), or a combination thereofyAn FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware components, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 71 may be an internal storage unit of the serial chip 7, such as a hard disk or a memory of the serial chip 7. The memory 71 may also be an external storage device of the serial port chip 7, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, which are provided on the serial port chip 7. Further, the memory 71 may include both an internal storage unit and an external storage device of the serial chip 7. The memory 71 is used for storing the computer program and other programs and data required by the serial port chip. The memory 71 may also be used to temporarily store data that has been output or is to be output.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-mentioned division of the functional units and modules is illustrated, and in practical applications, the above-mentioned function distribution may be performed by different functional units and modules according to needs, that is, the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-mentioned functions. Each functional unit and module in the embodiments may be integrated in one processing unit, or each unit may exist alone physically, or two or more units are integrated in one unit, and the integrated unit may be implemented in a form of hardware, or in a form of software functional unit. In addition, specific names of the functional units and modules are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present application. The specific working processes of the units and modules in the system may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and reference may be made to the related descriptions of other embodiments for parts that are not described or illustrated in a certain embodiment.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus/terminal device and method may be implemented in other ways. For example, the above-described embodiments of the apparatus/terminal device are merely illustrative, and for example, the division of the modules or units is only one logical division, and there may be other divisions when actually implemented, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated modules/units, if implemented in the form of software functional units and sold or used as separate products, may be stored in a computer readable storage medium. Based on such understanding, all or part of the flow of the method according to the embodiments of the present invention may also be implemented by a computer program, which may be stored in a computer-readable storage medium, and when the computer program is executed by a processor, the steps of the method embodiments may be implemented. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution medium, and the like. It should be noted that the computer readable medium may contain content that is subject to appropriate increase or decrease as required by legislation and patent practice in jurisdictions, for example, in some jurisdictions, computer readable media does not include electrical carrier signals and telecommunications signals as is required by legislation and patent practice.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present invention, and not for limiting the same; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present invention, and are intended to be included within the scope of the present invention.

Claims (10)

1. A serial port communication method based on a checking mode is characterized by comprising the following steps:
receiving target data;
according to a preset check mode array, checking the target data; the preset check mode array comprises a plurality of check modes, and each check mode uniquely corresponds to a protocol object constructed in advance based on an object-oriented principle;
and under the condition that the target data passes the verification, sending the target data to a protocol object corresponding to the verification mode adopted when the verification passes.
2. The serial port communication method based on the verification mode as claimed in claim 1, wherein the verifying the target data according to the preset verification mode array comprises:
sequentially adopting the check modes in the preset check mode array to check the target data;
and when the verification passes, recording the verification mode adopted at the time, and stopping the verification.
3. The serial port communication method based on the inspection mode according to claim 1, wherein the method is applied to a serial port chip, and the serial port chip comprises at least one serial port, a bottom layer configuration module and a protocol checking module;
the receiving target data includes:
the bottom layer configuration module acquires target data of a target serial port;
the bottom layer configuration module determines a target bottom layer object corresponding to the target serial port in a plurality of bottom layer objects so that the target bottom layer object sends the target data to the protocol verification module; the bottom layer objects are constructed in advance based on an object-oriented principle, each bottom layer object uniquely corresponds to one serial port, and the serial ports corresponding to the bottom layer objects are different;
the protocol checking module receives the target data;
the verifying the target data according to the preset verification mode array comprises the following steps:
and the protocol checking module checks the target data according to a preset checking mode array.
4. The serial port communication method based on the verification mode as claimed in claim 3, wherein the serial port chip further comprises a protocol analysis module;
the sending the target data to the protocol object corresponding to the verification mode adopted when the verification passes comprises the following steps:
the protocol checking module sends the target data and the checking information to the protocol analysis module; the verification information carries a protocol object corresponding to a verification mode adopted when the verification passes;
and the protocol analysis module sends the target data to a protocol object corresponding to a verification mode adopted when the verification passes.
5. The serial port communication method based on the verification mode as claimed in claim 1, wherein the method further comprises:
receiving a check mode registration request for a target check mode; the check mode registration request carries the target check mode and a protocol object corresponding to the target check mode;
and adding the target verification mode to the preset verification mode array.
6. The serial port chip is characterized in that the serial port chip is used for:
receiving target data;
according to a preset check mode array, checking the target data; the preset check mode array comprises a plurality of check modes, and each check mode uniquely corresponds to a protocol object constructed in advance based on an object-oriented principle;
and under the condition that the target data passes the verification, sending the target data to a protocol object corresponding to the verification mode adopted when the verification passes.
7. The serial port chip of claim 6, wherein the serial port chip is further configured to
Sequentially adopting the check modes in the preset check mode array to check the target data;
and when the verification passes, recording the verification mode adopted at the time, and stopping the verification.
8. The serial port chip of claim 6, wherein the serial port chip comprises at least one serial port, an underlying configuration module, and a protocol check module, wherein:
the bottom layer configuration module is configured to:
acquiring target data of a target serial port, and determining a target bottom layer object corresponding to the target serial port in a plurality of bottom layer objects so that the target bottom layer object sends the target data to the protocol checking module; the bottom layer objects are constructed in advance based on an object-oriented principle, each bottom layer object uniquely corresponds to one serial port, and the serial ports corresponding to the bottom layer objects are different;
the protocol checking module is used for:
receiving the target data;
the protocol checking module is further configured to:
and verifying the target data according to a preset verification mode array.
9. The serial port chip of claim 8, wherein the serial port chip further comprises a protocol parsing module;
the protocol checking module is further configured to:
sending the target data and the check information to the protocol analysis module; the verification information carries a protocol object corresponding to a verification mode adopted when the verification passes;
the protocol analysis module is used for:
and sending the target data to a protocol object corresponding to a verification mode adopted when the verification passes.
10. A serial chip comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the steps of the method according to any of claims 1 to 5 are implemented when the computer program is executed by the processor.
CN202110565736.3A 2021-05-24 2021-05-24 Serial port communication method and serial port chip based on inspection mode Active CN113177014B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110565736.3A CN113177014B (en) 2021-05-24 2021-05-24 Serial port communication method and serial port chip based on inspection mode

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110565736.3A CN113177014B (en) 2021-05-24 2021-05-24 Serial port communication method and serial port chip based on inspection mode

Publications (2)

Publication Number Publication Date
CN113177014A true CN113177014A (en) 2021-07-27
CN113177014B CN113177014B (en) 2023-12-15

Family

ID=76929703

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110565736.3A Active CN113177014B (en) 2021-05-24 2021-05-24 Serial port communication method and serial port chip based on inspection mode

Country Status (1)

Country Link
CN (1) CN113177014B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115284268A (en) * 2022-08-01 2022-11-04 法奥意威(苏州)机器人系统有限公司 Data verification method and device, robot system, electronic device and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102970279A (en) * 2012-10-24 2013-03-13 厦门金龙联合汽车工业有限公司 Adaptive communication system of automobile electronic device based on serial ports
CN105656600A (en) * 2015-12-29 2016-06-08 湖南先步信息股份有限公司 Communication method for slave station to adapt to two communication protocols
CN106878459A (en) * 2017-03-24 2017-06-20 深圳安邦科技有限公司 The intelligent networking gateway implementation method and its equipment of a kind of self adaptation
TW201807583A (en) * 2016-08-26 2018-03-01 致伸科技股份有限公司 Automatic control system and the instrument automatically search method using the same
CN111913905A (en) * 2020-06-30 2020-11-10 中国航发南方工业有限公司 Variable self-adaptive serial port communication method, medium and electronic equipment

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102970279A (en) * 2012-10-24 2013-03-13 厦门金龙联合汽车工业有限公司 Adaptive communication system of automobile electronic device based on serial ports
CN105656600A (en) * 2015-12-29 2016-06-08 湖南先步信息股份有限公司 Communication method for slave station to adapt to two communication protocols
TW201807583A (en) * 2016-08-26 2018-03-01 致伸科技股份有限公司 Automatic control system and the instrument automatically search method using the same
CN106878459A (en) * 2017-03-24 2017-06-20 深圳安邦科技有限公司 The intelligent networking gateway implementation method and its equipment of a kind of self adaptation
CN111913905A (en) * 2020-06-30 2020-11-10 中国航发南方工业有限公司 Variable self-adaptive serial port communication method, medium and electronic equipment

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115284268A (en) * 2022-08-01 2022-11-04 法奥意威(苏州)机器人系统有限公司 Data verification method and device, robot system, electronic device and storage medium
CN115284268B (en) * 2022-08-01 2023-11-21 法奥意威(苏州)机器人系统有限公司 Data verification method, device, robot system, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN113177014B (en) 2023-12-15

Similar Documents

Publication Publication Date Title
CN106598632B (en) Firmware upgrading method and device for optical module
CN110601880B (en) Cloud platform, service processing method, command interface and computer equipment
CN113177015B (en) Frame header-based serial port communication method and serial port chip
CN112422485B (en) Communication method and device of transmission control protocol
CN113177014A (en) Serial port communication method based on inspection mode and serial port chip
CN112699648B (en) Data processing method and device
CN111949470B (en) Chip verification method and device, electronic equipment and storage medium
CN116933702B (en) Verification method, verification device, electronic equipment and readable storage medium
CN112306041A (en) Vehicle configuration information writing method and device and electronic equipment
CN111125168A (en) Data processing method and device, electronic equipment and storage medium
CN109800565B (en) Software upgrading method and terminal equipment
CN115454896A (en) SMBUS-based SSD MCTP control message verification method and device, computer equipment and storage medium
CN111026579B (en) Verification method and device for data error detection capability, terminal equipment and medium
CN114157662A (en) Cloud platform parameter adaptation method and device, terminal equipment and storage medium
CN115858256A (en) Test method and device for Internet of things equipment and electronic equipment
CN114356541B (en) Configuration method, device and system of computing core and electronic equipment
CN111722858A (en) Online upgrading method and terminal equipment
CN111475442A (en) Multi-serial port extension circuit, multi-serial port upgrading method and multi-serial port television board card
CN211628234U (en) Multi-serial port extension circuit and multi-serial port television board card
CN112737872B (en) ARINC664P7 end system cross-network testing system and method
CN114500688B (en) Method, device, terminal and storage medium for identifying equipment protocol
CN112203264B (en) Equipment pairing method applied to equipment group and equipment in equipment group
CN109597813B (en) Vehicle data processing method and device
CN115776178A (en) Electric power monitoring automatic calibration method, electric power monitoring host and acquisition management machine
CN114444423A (en) Data processing method and system based on verification platform and electronic equipment

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