CN111414326A - Method for analyzing serial peripheral interface communication data, computing equipment and storage medium - Google Patents

Method for analyzing serial peripheral interface communication data, computing equipment and storage medium Download PDF

Info

Publication number
CN111414326A
CN111414326A CN202010104882.1A CN202010104882A CN111414326A CN 111414326 A CN111414326 A CN 111414326A CN 202010104882 A CN202010104882 A CN 202010104882A CN 111414326 A CN111414326 A CN 111414326A
Authority
CN
China
Prior art keywords
data
peripheral interface
serial peripheral
communication bus
interface communication
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
CN202010104882.1A
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.)
Qingdao Goertek Intelligent Sensor Co Ltd
Original Assignee
Qingdao Goertek Intelligent Sensor 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 Qingdao Goertek Intelligent Sensor Co Ltd filed Critical Qingdao Goertek Intelligent Sensor Co Ltd
Priority to CN202010104882.1A priority Critical patent/CN111414326A/en
Publication of CN111414326A publication Critical patent/CN111414326A/en
Pending legal-status Critical Current

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/40Bus coupling
    • G06F2213/4004Universal serial bus hub with a plurality of upstream ports

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Transfer Systems (AREA)

Abstract

The invention discloses an analytic method of serial peripheral interface communication data, a computing device and a storage medium, comprising the following steps: s10, monitoring whether data transmission is started on the serial peripheral interface communication bus; s12, reading data on the serial peripheral interface communication bus and storing the read data until monitoring that the data transmission on the serial peripheral interface communication bus is finished; s14, comparing the stored data with pre-stored standard data, wherein the pre-stored standard data is a read-write instruction sent by the micro-processing unit to the serial peripheral interface device through the serial peripheral interface; s16, outputting the comparison result to a display device for displaying, without manually identifying the SPI communication data packet, automatically identifying the SPI communication process through software codes, and automatically calculating all data in the SPI communication according to a standard SPI communication protocol and storing the data, thereby quickly and accurately judging error data in the SPI communication process.

Description

Method for analyzing serial peripheral interface communication data, computing equipment and storage medium
Technical Field
The invention relates to the field of communication data analysis. And more particularly, to a method for parsing serial peripheral interface communication data, a computing device, and a storage medium.
Background
In the software development process, the MCU often uses the SPI communication protocol to send read/write commands to the external device, thereby achieving the purpose of controlling the operating state of the device. Because the device commands are numerous, in the communication process, once a certain command is sent incorrectly, the device can not work normally. At present, the conventional solution is to detect the SPI communication timing sequence through an oscilloscope, and then calculate the instruction data manually, thereby determining whether the data is normal. When the SPI commands are few (within 10 bytes), the method can solve the problems well, but once the commands are many, the SPI sends dozens of bytes at one time, even more bytes, data signals detected by the oscilloscope are very dense, and at the moment, the method for distinguishing the data through a manual calculation mode is extremely difficult, easy to make mistakes and very low in efficiency.
Disclosure of Invention
The invention aims to provide a method for analyzing communication data of a serial peripheral interface, a computing device and a storage medium.
In order to achieve the purpose, the invention adopts the following technical scheme:
In a first aspect, the present invention provides a method for analyzing serial peripheral interface communication data, including:
S10, monitoring whether data transmission is started on the serial peripheral interface communication bus;
S12, reading data on the serial peripheral interface communication bus and storing the read data until the monitoring of the end of data transmission on the serial peripheral interface communication bus is monitored;
S14, comparing the stored data with pre-stored standard data, wherein the pre-stored standard data is a read-write instruction sent by the micro-processing unit to the serial peripheral interface device through the serial peripheral interface;
And S16, outputting the comparison result to a display device for displaying.
Preferably, the step S12 further includes:
And converting the read data transmitted on the serial peripheral interface communication bus into octal or hexadecimal data for storage.
Preferably, the step S10 further includes:
Monitoring whether data transmission is started on a serial peripheral interface communication bus through an input/output port which is communicated with the serial peripheral interface, wherein the input/output port comprises an enabling line, and monitoring that the level on the enabling line is changed from high level to low level to confirm that the data transmission is started.
Preferably, step S12 further includes
Monitoring the level on the enable line to change from a low level to a high level confirms that the data transmission is ended.
Preferably, step S16 further includes
And outputting the comparison result and the stored data to a display device for displaying.
Preferably, after step S14, the method further comprises
And under the condition that the stored data is different from the pre-stored standard data, sending a notice for suspending sending of the read-write command to the micro-processing unit.
In a second aspect, the invention provides a computing device comprising
The analysis device of the serial peripheral interface communication data is configured to monitor whether data transmission is started on the serial peripheral interface communication bus; reading data on the serial peripheral interface communication bus and storing the read data until monitoring that the data transmission on the serial peripheral interface communication bus is finished; comparing the stored data with pre-stored standard data, wherein the pre-stored standard data is a read-write instruction sent by the micro-processing unit to the serial peripheral interface equipment through the serial peripheral interface;
And the display displays the comparison result.
Preferably, the analysis device is a computer or a single chip microcomputer.
Preferably, the parsing device for the serial peripheral interface communication data is further configured to convert the read data transmitted on the serial peripheral interface communication bus into octal or hexadecimal data for storage
In a third aspect, the invention provides a storage medium, characterized in that a program is stored which, when executed, implements the method of any one of claims 1-6
The invention has the following beneficial effects:
The invention provides an analysis method, a computing device and a storage medium for serial peripheral interface communication data, which can automatically identify the SPI communication process through software codes without manually identifying SPI communication data packets, automatically calculate all data in SPI communication according to a standard SPI communication protocol and store the data, thereby quickly and accurately judging error data in the SPI communication process
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings used in the description of the embodiments will be briefly introduced 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 that other drawings can be obtained according to these drawings without creative efforts.
Fig. 1 is a schematic flow chart illustrating a method for analyzing serial peripheral interface communication data according to the present invention.
Fig. 2 shows a schematic structural diagram of a computing device provided in an embodiment of the present invention.
FIG. 3 illustrates the manner in which the computing device of the present invention interfaces with a serial peripheral device.
Detailed Description
In order to make the technical solutions and advantages of the present invention more apparent, embodiments of the present invention will be described in detail with reference to the accompanying drawings.
It should be noted that the term [ the embodiment of the present invention ] does not limit the execution sequence of steps a to e, for example, step c and step a ] can be executed in sequence
All numerical designations of the invention (e.g., temperature, time, concentration, weight, and the like, including ranges for each) may generally be approximations that vary (+) or (-) in increments of 0.1 or 1.0, as appropriate. All numerical designations should be understood as preceded by the term "about". "C (B)
In one aspect, an embodiment of the present invention provides a method for analyzing serial peripheral interface communication data,
Hereinafter, each step in the method for analyzing the serial peripheral interface communication data will be described in detail.
S10, monitoring whether data transmission is started on the serial peripheral interface communication bus;
Monitoring whether data transmission is started on a serial peripheral interface communication bus or not through an input/output port communicated with a serial peripheral interface, wherein the input/output port comprises an enable line, and monitoring that the level on the enable line is changed from a high level to a low level to confirm that the data transmission is started;
In one embodiment, the SPI bus comprises four wires,
(1) SDO-master device data out, slave device data in;
(2) SDI-master device data input, slave device data output;
(3) an SC L K-clock signal generated by the master device;
(4) A CS-slave enable signal, controlled by the master device;
the enabling line is an SC L K clock signal line, and when the level on the SC L K clock signal line is monitored to be changed from a high level to a low level, data transmission is confirmed to be started;
S12, reading data on the serial peripheral interface communication bus and storing the read data until the monitoring of the end of data transmission on the serial peripheral interface communication bus is monitored;
Converting the read data transmitted on the serial peripheral interface communication bus into octal or hexadecimal data for storage,
In one embodiment, the data sent by the upper processor or the MCU is hexadecimal data, when the transmission data is "39", the data is converted into binary data "111001" through the SPI bus, if the data on the SPI bus is not processed, the monitored data is also in binary representation, and the obtained data has many disadvantages such as complexity, large memory, and inconvenience for observation, and at this time, the binary "111001" is converted into the octal "71", and is converted into the hexadecimal "39", which facilitates observation and comparison;
Monitoring the level on the enabling line to change from low level to high level to confirm that the data transmission is ended;
in one embodiment, the enable line is selected from the SC L K clock signal line, and the start of data transmission is confirmed when the level on the SC L K clock signal line is changed from low level to high level.
S14, comparing the stored data with pre-stored standard data, wherein the pre-stored standard data is a read-write instruction sent by the micro-processing unit to the serial peripheral interface device through the serial peripheral interface;
Under the condition that the stored data is different from the pre-stored standard data, sending a notice for suspending sending of a read-write instruction to the micro-processing unit;
S16, outputting the comparison result to a display device for display,
And outputting the comparison result and the stored data to a display device for displaying.
As shown in fig. 2, a further embodiment of the present invention provides a computer device, including a serial peripheral interface communication data analysis device configured to monitor whether data transmission is started on a serial peripheral interface communication bus; reading data on the serial peripheral interface communication bus and storing the read data until monitoring that the data transmission on the serial peripheral interface communication bus is finished; comparing the stored data with pre-stored standard data, wherein the pre-stored standard data is a read-write instruction sent by the micro-processing unit to the serial peripheral interface device through the serial peripheral interface;
The display displays the comparison result;
The system also comprises a memory, a processor and a computer program which is stored on the memory and can run on the processor, and the processor realizes the analysis method of the communication data of the serial peripheral interface when executing the program. A computer system adapted to be used to implement the server provided by the present embodiment includes a Central Processing Unit (CPU) that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) or a program loaded from a storage section into a Random Access Memory (RAM). The RAM also stores various programs and data necessary for the operation of the computer system. The CPU, ROM, and RAM are connected thereto via a bus. An input/output (I/O) interface is also connected to the bus.
A drive is also connected to the I/O interface as necessary, a removable medium such as a magnetic disk, AN optical disk, a magneto-optical disk, a semiconductor memory, and the like is mounted on the drive as necessary, so that a computer program read out therefrom is installed into the storage section as necessary.
Fig. 3 shows a connection mode of the computing device and the serial peripheral interface according to the present invention, in which the computing device is directly connected to the SPI communication bus.
In particular, the processes described in the above flowcharts may be implemented as computer software programs according to the present embodiment. For example, the present embodiments include a computer program product comprising a computer program tangibly embodied on a computer-readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via the communication section, and/or installed from a removable medium.
The flowcharts and schematic diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to the present embodiments. In this regard, each block in the flowchart or schematic diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the schematic and/or flowchart illustration, and combinations of blocks in the schematic and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
As another aspect, the present application also provides a computer-readable storage medium, which may be the computer-readable storage medium included in the apparatus in the above-described embodiments; or it may be a separate computer-readable storage medium not incorporated in the terminal. The computer-readable storage medium stores one or more programs for use by one or more processors in performing the method for parsing SPI communication data described in the present invention.
It should be understood that the above-mentioned embodiments of the present invention are only examples for clearly illustrating the present invention, and are not intended to limit the embodiments of the present invention, and it will be obvious to those skilled in the art that other variations or modifications may be made on the basis of the above description, and all embodiments may not be exhaustive, and all obvious variations or modifications belonging to the technical solutions of the present invention are within the scope of the present invention.

Claims (10)

1. A method for analyzing communication data of a serial peripheral interface is characterized by comprising the following steps:
S10, monitoring whether data transmission is started on the serial peripheral interface communication bus;
S12, reading data on the serial peripheral interface communication bus and storing the read data until monitoring that the data transmission on the serial peripheral interface communication bus is finished;
S14, comparing the stored data with pre-stored standard data, wherein the pre-stored standard data is a read-write instruction sent by the micro-processing unit to the serial peripheral interface device through the serial peripheral interface;
And S16, outputting the comparison result to a display device for displaying.
2. The parsing method according to claim 1, wherein step S12 further comprises:
And converting the read data transmitted on the serial peripheral interface communication bus into octal or hexadecimal data for storage.
3. The parsing method according to claim 1, wherein step S10 further comprises:
Monitoring whether data transmission is started on a serial peripheral interface communication bus through an input/output port which is communicated with the serial peripheral interface, wherein the input/output port comprises an enabling line, and monitoring that the level on the enabling line is changed from high level to low level to confirm that the data transmission is started.
4. The parsing method as claimed in claim 3, wherein step S12 further comprises
Monitoring the level on the enable line to change from a low level to a high level confirms that the data transmission is ended.
5. The method according to any one of claims 1 to 4, wherein step S16 further comprises outputting both the comparison result and the stored data to a display device for display.
6. The parsing method of any one of claims 1-4, wherein after step S14, the method further comprises
And sending a notice for suspending sending the read-write instruction to the micro-processing unit under the condition that the stored data is different from the pre-stored standard data.
7. A computing device, comprising
The analysis device of the serial peripheral interface communication data is configured to monitor whether data transmission is started on the serial peripheral interface communication bus or not; reading data on the serial peripheral interface communication bus and storing the read data until monitoring that the data transmission on the serial peripheral interface communication bus is finished; comparing the stored data with pre-stored standard data, wherein the pre-stored standard data is a read-write instruction sent by the micro-processing unit to the serial peripheral interface device through the serial peripheral interface;
And the display displays the comparison result.
8. The computing device of claim 7,
The analysis device is a computer or a single chip microcomputer.
9. The computing device as claimed in claim 7 or 8, wherein the means for parsing the SPI communication data is further configured to convert the read data transmitted on the SPI communication bus into octal or hexadecimal data for storage.
10. A storage medium, characterized in that a program is stored which, when executed, implements the method of any one of claims 1-6.
CN202010104882.1A 2020-02-20 2020-02-20 Method for analyzing serial peripheral interface communication data, computing equipment and storage medium Pending CN111414326A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010104882.1A CN111414326A (en) 2020-02-20 2020-02-20 Method for analyzing serial peripheral interface communication data, computing equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010104882.1A CN111414326A (en) 2020-02-20 2020-02-20 Method for analyzing serial peripheral interface communication data, computing equipment and storage medium

Publications (1)

Publication Number Publication Date
CN111414326A true CN111414326A (en) 2020-07-14

Family

ID=71494131

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010104882.1A Pending CN111414326A (en) 2020-02-20 2020-02-20 Method for analyzing serial peripheral interface communication data, computing equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111414326A (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH02121451A (en) * 1988-10-31 1990-05-09 Toshiba Corp System bus monitor for electronic exchange
EP0665666A1 (en) * 1994-01-28 1995-08-02 Halliburton Company Data monitoring apparatus and method
CN101571555A (en) * 2009-06-10 2009-11-04 东南大学 Triggering method for serial peripheral interface bus signal
US20150160993A1 (en) * 2013-12-10 2015-06-11 Hyundai Motor Company Serial communication test device, system including the same and method thereof

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH02121451A (en) * 1988-10-31 1990-05-09 Toshiba Corp System bus monitor for electronic exchange
EP0665666A1 (en) * 1994-01-28 1995-08-02 Halliburton Company Data monitoring apparatus and method
CN101571555A (en) * 2009-06-10 2009-11-04 东南大学 Triggering method for serial peripheral interface bus signal
US20150160993A1 (en) * 2013-12-10 2015-06-11 Hyundai Motor Company Serial communication test device, system including the same and method thereof

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
张涛: "《高档8位单片机ATmega 128原理与开发应用指南 上》", 《北京航空航天大学出版社》, pages: 124 *

Similar Documents

Publication Publication Date Title
US10621797B2 (en) System and method for transferring diagnostic commands to a vehicle
US11509505B2 (en) Method and apparatus for operating smart network interface card
US6173339B1 (en) System for monitoring execution of commands from a host for shared I/O devices by setting a time-out period based on control parameters sent by the host
US20240126356A1 (en) Power redundancy control system and method for gpu server, and medium
CN114089713A (en) Communication method based on UDS, ECU and upper computer
CN112565036A (en) Data transmission method, device, storage medium and communication system
CN110995533A (en) Ethernet streaming test system
CN111414326A (en) Method for analyzing serial peripheral interface communication data, computing equipment and storage medium
CN115543872A (en) Equipment management method and device and computer storage medium
CN111413899A (en) SWD-based data acquisition method and system and MCU
JP2000049891A (en) Programmable logic controller and communication condition setting method and communication condition setting device therefor
CN114338270B (en) Data communication method, device, electronic equipment and storage medium
CN114326669A (en) Vehicle IO test method and device, electronic equipment and storage medium
CN113556210B (en) Upper computer and method for establishing communication connection
CN110932930B (en) Detection method, device and medium for server PCIE link stability
JPH10185634A (en) Measuring system
CN112084099B (en) Method, device, equipment and storage medium for acquiring alarm state value based on host
CN112669956A (en) Method and equipment for collecting medical instrument data
CN110958166A (en) Secondary equipment and information interaction method thereof
CN111487920A (en) Data acquisition and processing system
CN114371978B (en) Method, device, apparatus and system for android to acquire data
CN116302754A (en) Solid state disk detection method, system, device and storage medium
CN117834750B (en) Device, method, system, equipment, medium and server for acquiring protocol data
CN113096269A (en) Information acquisition method and device, electronic equipment and storage medium
CN116684281A (en) Network card enumeration method and related device

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