CN112565036B - Data transmission method, device, storage medium and communication system - Google Patents
Data transmission method, device, storage medium and communication system Download PDFInfo
- Publication number
- CN112565036B CN112565036B CN202011331245.4A CN202011331245A CN112565036B CN 112565036 B CN112565036 B CN 112565036B CN 202011331245 A CN202011331245 A CN 202011331245A CN 112565036 B CN112565036 B CN 112565036B
- Authority
- CN
- China
- Prior art keywords
- target
- equipment
- spi bus
- sending
- module
- 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.)
- Active
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L12/00—Data switching networks
- H04L12/28—Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
- H04L12/40—Bus networks
- H04L12/40006—Architecture of a communication node
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F13/00—Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
- G06F13/38—Information transfer, e.g. on bus
- G06F13/42—Bus transfer protocol, e.g. handshake; Synchronisation
- G06F13/4282—Bus transfer protocol, e.g. handshake; Synchronisation on a serial bus, e.g. I2C bus, SPI bus
- G06F13/4291—Bus transfer protocol, e.g. handshake; Synchronisation on a serial bus, e.g. I2C bus, SPI bus using a clocked protocol
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L12/00—Data switching networks
- H04L12/28—Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
- H04L12/40—Bus networks
- H04L12/403—Bus networks with centralised control, e.g. polling
-
- Y—GENERAL 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
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE 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/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Abstract
The present disclosure relates to a data transmission method, apparatus, storage medium, and communication system to efficiently and quickly transmit data. The method is applied to first equipment, the first equipment is provided with a Serial Peripheral Interface (SPI) bus, and the first equipment is communicated with second equipment through the SPI bus, and the method comprises the following steps: judging whether a data acquisition instruction sent by the second equipment is received; if the data acquisition instruction is received, analyzing the data acquisition instruction to obtain an analysis result; if the analysis result indicates that the data acquisition instruction is used for acquiring debugging information of a specified module in the first equipment, determining a target module indicated by the data acquisition instruction, and debugging the target module to obtain target debugging information; and sending the target debugging information to the second equipment through the SPI bus.
Description
Technical Field
The present disclosure relates to the field of communications, and in particular, to a data transmission method, apparatus, storage medium, and communication system.
Background
When an embedded device (also called an embedded system) is debugged, a large amount of debugging data such as scheduling of threads, processing of timers and the like is required to be recorded. At present, the traditional serial port printing mode is usually used for debugging. However, some embedded devices (e.g., bluetooth controllers) have high requirements on code execution timing, and interrupts are generated frequently, and there may be thousands of interrupts per second, so that the amount of data required to record data during debugging is also large. Therefore, if a serial port printing method is still used, on one hand, the transmission speed of the method is slow, and the transmission requirement of a large amount of data cannot be met, and on the other hand, the data transmission timing sequence is easily affected, for example, because there is no synchronous clock, when the baud rate exceeds a certain value (for example, 1M), code confusion is easily generated, the execution flow of the device cannot be completely recorded, and debugging is not convenient.
Disclosure of Invention
An object of the present disclosure is to provide a data transmission method, apparatus, storage medium, and communication system to efficiently and quickly transmit data.
In order to achieve the above object, according to a first aspect of the present disclosure, there is provided a data transmission method applied to a first device, where the first device is provided with a serial peripheral interface SPI bus, and the first device communicates with a second device through the SPI bus, the method including:
judging whether a data acquisition instruction sent by the second equipment is received;
if the data acquisition instruction is received, analyzing the data acquisition instruction to obtain an analysis result;
if the analysis result indicates that the data acquisition instruction is used for acquiring debugging information of a specified module in the first equipment, determining a target module indicated by the data acquisition instruction, and debugging the target module to obtain target debugging information;
and sending the target debugging information to the second equipment through the SPI bus.
Optionally, the sending the target debugging information to the second device through the SPI bus includes:
writing the target debugging information into a target storage space in the first device;
and calling an SPI (serial peripheral interface) driver through a target thread so as to send the target debugging information in the target storage space to the second equipment.
Optionally, the sending the target debugging information to the second device through the SPI bus includes:
determining the raised target clock frequency according to the current clock frequency of the SPI bus;
and according to the target clock frequency, sending the target debugging information to the second equipment through the SPI bus in a direct memory access mode.
Optionally, before the step of sending the target debug information to the second device through the SPI bus, the method further includes:
and taking the first device as a master device of the SPI bus, and taking the second device as a slave device of the SPI bus.
Optionally, the method further comprises:
if the analysis result indicates that the data acquisition instruction is used for acquiring the equipment information of the first equipment, acquiring the equipment information of the first equipment as target equipment information;
sending the target device information to the second device through the SPI bus;
wherein the device information of the first device comprises at least one of:
the current thread list of the first equipment and the information of each module in the first equipment.
According to a second aspect of the present disclosure, there is provided a data transmission method applied to a second device, the second device communicates with a first device and a third device respectively, and the second device communicates with the first device through an SPI bus, the method comprising:
sending a data acquisition instruction to the first device;
receiving response content sent by the first device in response to the data acquisition instruction;
and sending the response content to the third equipment.
Optionally, the second device communicates with the third device over a USB interface or an MMC interface;
if the second device communicates with the third device through the USB interface, the sending the response content to the third device includes:
transmitting the response content to the third device through the USB interface;
if the second device communicates with the third device through the MMC interface, the sending the response content to the third device includes:
and sending the response content to the third equipment through the MMC interface.
According to a third aspect of the present disclosure, there is provided a data transmission apparatus applied to a first device, where the first device is provided with a serial peripheral interface SPI bus, and the first device communicates with a second device through the SPI bus, the apparatus including:
the judging module is used for judging whether a data acquisition instruction sent by the second equipment is received or not;
the analysis module is used for analyzing the data acquisition instruction to obtain an analysis result if the data acquisition instruction is received;
the first determining module is used for determining a target module indicated by the data obtaining instruction and debugging the target module to obtain target debugging information if the analysis result indicates that the data obtaining instruction is used for obtaining the debugging information of the specified module in the first equipment;
and the first sending module is used for sending the target debugging information to the second equipment through the SPI bus.
Optionally, the first sending module includes:
the storage submodule is used for writing the target debugging information into a target storage space in the first equipment;
and the first sending submodule is used for calling an SPI drive through a target thread so as to send the target debugging information in the target storage space to the second equipment.
Optionally, the first sending module comprises:
the determining submodule is used for determining the raised target clock frequency according to the current clock frequency of the SPI bus;
and the second sending submodule is used for sending the target debugging information to the second equipment through the SPI bus in a direct memory access mode according to the target clock frequency.
Optionally, the apparatus further comprises:
before the first sending module sends the target debugging information to the second device through the SPI bus, the first device is used as a master device of the SPI bus, and the second device is used as a slave device of the SPI bus.
Optionally, the apparatus further comprises:
an obtaining module, configured to obtain device information of the first device if the analysis result indicates that the data obtaining instruction is used to obtain the device information of the first device, and obtain the device information of the first device as target device information;
the second sending module is used for sending the target equipment information to the second equipment through the SPI bus;
wherein the device information of the first device comprises at least one of:
the current thread list of the first equipment and the information of each module in the first equipment.
According to a fourth aspect of the present disclosure, there is provided a data transmission apparatus applied to a second device, the second device communicates with a first device and a third device respectively, and the second device communicates with the first device through an SPI bus, the apparatus comprising:
a third sending module, configured to send a data acquisition instruction to the first device;
a receiving module, configured to receive response content sent by the first device in response to the data acquisition instruction;
a fourth sending module, configured to send the response content to the third device.
Optionally, the second device communicates with the third device over a USB interface or an MMC interface;
if the second device communicates with the third device through a USB interface, the fourth sending module is configured to send the response content to the third device through the USB interface;
if the second device communicates with the third device through the MMC interface, the fourth sending module is configured to send the response content to the third device through the MMC interface.
According to a fifth aspect of the present disclosure, there is provided a computer readable storage medium, having stored thereon a computer program which, when executed by a processor, performs the steps of the method of the first aspect of the present disclosure, or which, when executed by a processor, performs the steps of the method of the second aspect of the present disclosure.
According to a sixth aspect of the present disclosure, a communication system is provided, the communication system includes a first device and a second device, the first device and the second device are both provided with a serial peripheral interface SPI bus, and the first device and the second device communicate through the SPI bus, wherein the first device is configured to perform the steps of the method of the first aspect of the present disclosure, and the second device is configured to perform the steps of the method of the second aspect of the present disclosure.
Optionally, the communication system further comprises a third device, the second device communicating with the third device through a USB interface or an MMC interface.
According to the technical scheme, the SPI bus is arranged on the first equipment, the first equipment is communicated with the second equipment through the SPI bus, and then the first equipment judges whether a data acquisition command sent by the second equipment is received or not, if the data acquisition command is received, the data acquisition command is analyzed to obtain an analysis result, if the analysis result indicates that the data acquisition command is used for acquiring debugging information of a designated module in the first equipment, a target module indicated by the data acquisition command is determined, the target module is debugged to obtain target debugging information, and the target debugging information is sent to the second equipment through the SPI bus. Therefore, the debugging information of each module in the first equipment is transmitted by using the universal high-speed SPI interface, special hardware does not need to be additionally developed, the equipment is conveniently debugged, a large amount of debugging data can be rapidly transmitted, and the debugging performance is favorably improved.
Additional features and advantages of the disclosure will be set forth in the detailed description which follows.
Drawings
The accompanying drawings, which are included to provide a further understanding of the disclosure and are incorporated in and constitute a part of this specification, illustrate embodiments of the disclosure and together with the description serve to explain the disclosure without limiting the disclosure. In the drawings:
fig. 1 is a flow chart of a data transmission method provided according to an embodiment of the present disclosure;
fig. 2 is a schematic diagram of data transmission of an SPI bus in the data transmission method provided according to the present disclosure;
fig. 3 is a timing sequence of a first device determining whether to receive a query command in a data acquisition command process in a data transmission method provided according to the present disclosure;
FIG. 4 is a schematic diagram of a data structure of target debug information in the data transmission method provided according to the present disclosure;
fig. 5 is a flow chart of a data transmission method provided according to an embodiment of the present disclosure;
FIG. 6 is a block diagram of a data transmission device provided in accordance with one embodiment of the present disclosure;
fig. 7 is a block diagram of a data transmission device provided according to an embodiment of the present disclosure.
Detailed Description
The following detailed description of specific embodiments of the present disclosure is provided in connection with the accompanying drawings. It should be understood that the detailed description and specific examples, while indicating the present disclosure, are given by way of illustration and explanation only, not limitation.
Fig. 1 is a flowchart of a data transmission method provided according to an embodiment of the present disclosure. The method can be applied to a first device, which is provided with an SPI (Serial Peripheral Interface/Serial Peripheral Interface) bus, and communicates with a second device through the SPI bus.
The first device may be any kind of embedded device, and for example, the first device may be a bluetooth controller. The second device is for recording data and may be a device having the capability of recording data, for example, a data recorder.
The SPI bus is briefly described below. The SPI bus is a synchronous serial bidirectional transmission interface and has the advantages of simple use and high data transmission speed. The SPI bus adopts a master-slave mode structure, and generally includes a master (also referred to as a master device) and one or more slaves (also referred to as slaves), and data is transmitted in bits under a shift clock pulse of the master device, and may be transmitted in the order of the front (MSB first) with the high bits and the back (mos signaling Bit first) with the low bits, or in the order of the front (MSB) with the low bits and the back (lsb) with the high bits. The SPI bus has 4 signal lines in total, which are a device select line (chip select), a clock line, a serial data output line, and a serial data input line, as shown in fig. 2:
sclk (spi clock) characterizes the clock signal, which can only be generated by the master device; the SS # characterizes a device selection line (chip select) controlled by the master device, which is in a selected state when a slave device chip select signal is input at a low level, the SS # being for the slave device; the MOSI (Master Out Slave in) represents data output of the master device and data input of the Slave device, and is used for data transmission from the master device to the Slave device; miso (master In Slave out) characterizes master data input, Slave data output, for data transmission from Slave to master.
In the method provided by the present disclosure, either the first device or the second device may be a master device according to different data transmission requirements.
As shown in fig. 1, the method may include the steps of:
in step 11, judging whether a data acquisition instruction sent by the second device is received;
in step 12, if a data acquisition instruction is received, analyzing the data acquisition instruction to obtain an analysis result;
in step 13, if the analysis result indicates that the data acquisition instruction is used to acquire debugging information of a specified module in the first device, determining a target module indicated by the data acquisition instruction, and debugging the target module to acquire target debugging information;
in step 14, the target debug information is sent to the second device over the SPI bus.
Optionally, in step 11, the first device may send an inquiry command to the SPI bus to determine whether a data acquisition instruction sent by the second device is received. Wherein the first device may periodically send the query command in a polling manner, or the first device may send the query command in an interrupted manner.
For example, when sending the query command, the first device may first send a 1-byte Poll command 0x5a, and then send 1-byte padding data, so as to implement sending of the query command, and further determine whether a data acquisition instruction sent by the second device is received.
In addition, optionally, in the process of sending the query command by the SPI bus of the first device box, since the first device does not need to send data to the second device, the first device may serve as a slave device in the SPI bus master-slave mode, and meanwhile, the second device used for sending the data acquisition command to the first device may serve as a master device in the SPI center master-slave mode.
The data obtaining instruction may be used to obtain debugging information of a specified module in the first device or to obtain device information of the first device. For example, the data acquisition instruction may include a command of 1 byte and a parameter of 4 bytes, and it may be determined which data is acquired by the data acquisition instruction by using 5 bytes of data included in the data acquisition instruction.
For example, if the data obtaining instruction is used to obtain debugging information of a specified module in the first device, the second device may specify one or more modules in the first device according to an instruction of related personnel or a preset setting, and the data obtaining instruction sent by the second device to the first device may include a debugging start instruction for the specified module, so as to trigger debugging of the corresponding module. For example, in this process, the parameter included in the data obtaining instruction may be a module mask with 32 bits, and the module corresponding bit being 1 is characterized by enabling debugging of the module. Therefore, the second equipment can dynamically enable the debugging module according to the selection of related personnel or the actual requirement, avoid recording and transmitting unnecessary debugging information, and further save bandwidth and resources.
Optionally, in consideration of overhead, it may be default that the debugging function in the first device is disabled, and whether a data obtaining instruction of the second device is received is determined by sending a query command to the SPI interface, and when the first device end receives the data obtaining instruction sent by the second device to obtain the debugging information of the specified module in the first device, the first device end may debug and send the debugging information to the second device.
Fig. 3 shows a time sequence process of sending an inquiry command in the process of determining, by the first device, whether a data acquisition command is received, where a MOSI line indicates that the first device sends the inquiry command to the SPI bus, and a MISO line indicates that the second device sends the data acquisition command to the first device.
Returning to fig. 2, in step 12, if the data acquisition instruction is received, the data acquisition instruction is analyzed to obtain an analysis result.
In this step, the data acquisition instruction is analyzed according to a preset analysis mode to determine what kind of instruction the data acquisition instruction is, and what kind of data is to be acquired to obtain an analysis result. The manner of analyzing the data acquisition command may be predetermined according to the first device and the second device.
In step 13, if the analysis result indicates that the data obtaining instruction is used to obtain debugging information of the specified module in the first device, the target module indicated by the data obtaining instruction is determined, and the target module is debugged to obtain target debugging information.
As described above, the data obtaining instruction may be used to obtain the debugging information of the specified module in the first device, and therefore, if the parsing result of the data obtaining instruction indicates that the data obtaining instruction is used to obtain the debugging information of the specified module in the first device, the module specified by the data obtaining instruction may be used as the target module, and further, the target module is debugged to obtain the target debugging information.
Illustratively, the target debug information may be composed of a header of 8 bytes and data of 0 to 247bytes, and the data structure thereof may be as shown in fig. 4. The packet header can record the current thread id and the current timestamp, so that the related problems of the time sequence can be conveniently analyzed. The target debugging information can be binary original data which is directly output, and compared with a mode that serial port printing needs to be converted into ASCII characters, the method can save the bandwidth and the expenses of formatting processing.
Optionally, after determining that the data obtaining instruction is used to obtain the debugging information of the specified module in the first device, the first device may stop determining whether the data obtaining instruction sent by the second device is received. For example, referring to the embodiments given above, the first device may stop sending the query command to the SPI bus after determining that the data acquisition instruction is used to acquire the debugging information of the specified module in the first device.
Optionally, before step 14, the first device (and the second device) may also be subjected to master-slave switching, so that the first device serves as a master device in the SPI bus master-slave mode, and meanwhile, the second device serves as a slave device in the SPI center master-slave mode. In this way, the first device can send debug information to the second device at any time without waiting for polling by the second device.
In step 14, the target debug information is sent to the second device over the SPI bus.
After the target debugging information is obtained, the target debugging information can be sent to the second device through the SPI bus. Also, since commissioning may be a round-robin process, the target commissioning information may be sent to the second device in a round-robin fashion.
In one possible embodiment, step 14 may include the steps of:
writing the target debugging information into a target storage space in the first equipment;
and calling the SPI drive through the target thread so as to send the target debugging information in the target storage space to the second equipment.
By way of example, a common memory space may be opened up in the first device as the target memory space. Thereafter, the SPI driver is invoked with another independent thread (the target thread) to have sent the data in the target memory space to the second device. This embodiment is equivalent to an asynchronous output. The target storage space can be named as trace buffer, the trace buffer can be managed in a ring buffer mode, effective data are processed through a read-write pointer, and wrap-around coverage is avoided.
By adopting the mode, the caller only needs the expense of one-time memory copy, and the method is suitable for the use scene with higher real-time requirement.
The asynchronous output mode needs a storage space and the overhead of a thread stack, and is difficult to meet for equipment with a tight memory. Thus, in another possible embodiment, step 14 may comprise the steps of:
determining the raised target clock frequency according to the current clock frequency of the SPI bus;
and sending the target debugging information to the second equipment through the SPI bus by adopting a direct memory access mode according to the target clock frequency.
That is, the mode of directly outputting the call context through the SPI interface is adopted, the clock frequency of the SPI is increased, and the transmission is performed in a DMA (Direct Memory Access) mode. This embodiment corresponds to a synchronous output.
By adopting the mode, the CPU overhead can be reduced, and the transmission speed can be improved.
In this way, through steps 11 to 14, the debug information of the first device can be output to the second device through the SPI interface, so that the second device can receive, record, and perform subsequent processing.
According to the technical scheme, the SPI bus is arranged on the first equipment, the first equipment is communicated with the second equipment through the SPI bus, then the first equipment judges whether a data acquisition instruction sent by the second equipment is received or not, if the data acquisition instruction is received, the data acquisition instruction is analyzed to obtain an analysis result, if the analysis result indicates that the data acquisition instruction is used for acquiring debugging information of a specified module in the first equipment, a target module indicated by the data acquisition instruction is determined, the target module is debugged to obtain target debugging information, and the target debugging information is sent to the second equipment through the SPI bus. Therefore, the debugging information of each module in the first equipment is transmitted by using the universal high-speed SPI interface, special hardware does not need to be additionally developed, the equipment is conveniently debugged, a large amount of debugging data can be rapidly transmitted, and the debugging performance is favorably improved.
Optionally, on the basis of the steps shown in fig. 1, the method provided by the present disclosure may further include the following steps:
if the analysis result indicates that the data acquisition instruction is used for acquiring the equipment information of the first equipment, acquiring the equipment information of the first equipment as target equipment information;
and sending the target equipment information to the second equipment through the SPI bus.
Wherein the device information of the first device comprises at least one of:
a current thread list of the first equipment and information of each module in the first equipment.
For example, the second device may first send a data obtaining instruction for obtaining the device information of the first device to obtain the device information of the first device, further determine a module to be enabled according to information of each module in the device information, specify the module to be enabled in a new data obtaining instruction to be sent, and then send the new data obtaining instruction to the first device to obtain debugging information of the specified module.
Fig. 5 is a flowchart of a data transmission method provided according to an embodiment of the present disclosure. The method may be applied to a second device, the second device communicating with the first device and a third device, respectively, and the second device communicating with the first device through the SPI bus.
As shown in fig. 5, the method may include the steps of:
in step 51, sending a data acquisition instruction to the first device;
in step 52, response content sent by the first device in response to the data acquisition instruction is received;
in step 53, the responsive content is sent to the third device.
The manner in which the second device sends the data acquisition instruction to the first device is given above, and is not described herein again.
After receiving the data acquisition instruction sent by the second device, the first device responds to the data acquisition instruction in the manner given in the foregoing, and returns the response content to the second device, and the second device can receive the response content. As described above, the response content may be device information of the first device, or may be target debugging information of a target module in the first device.
And after receiving the response content, the second equipment can send the response content to the third equipment.
In one possible embodiment, the third device may be a PC (Personal Computer), and accordingly, the second device may communicate with the third device through a USB (Universal Serial Bus) interface.
If the second device communicates with the third device through the USB interface, the sending of the response content to the third device may be:
and transmitting the response content to the third equipment through the USB interface.
In this way, the response content (e.g., the target debugging information) can be forwarded to the PC in real time through the USB interface of the second device for synchronous recording and analysis, so that the response content can be parsed and displayed by the PC.
In another possible implementation, the third device may be a Secure Digital Memory Card (SD Card), and accordingly, the second device may communicate with the third device through an MMC (MultiMedia Memory Card) interface.
If the second device communicates with the third device through the MMC interface, the sending of the response content to the third device may be:
and sending the response content to the third equipment through the MMC interface.
In this way, the second device may save the debug information offline to the SD card for subsequent analysis.
Fig. 6 is a block diagram of a data transmission device provided according to an embodiment of the present disclosure. The device 60 is applied to a first device, the first device is provided with a Serial Peripheral Interface (SPI) bus, and the first device communicates with a second device through the SPI bus, the device 60 comprises:
the judging module 61 is configured to judge whether a data obtaining instruction sent by the second device is received;
the analysis module 62 is configured to, if the data acquisition instruction is received, analyze the data acquisition instruction to obtain an analysis result;
a first determining module 63, configured to determine, if the analysis result indicates that the data obtaining instruction is used to obtain debugging information of a specified module in the first device, a target module indicated by the data obtaining instruction, and debug the target module to obtain target debugging information;
a first sending module 64, configured to send the target debug information to the second device through the SPI bus.
Optionally, the first sending module 64 includes:
the storage submodule is used for writing the target debugging information into a target storage space in the first equipment;
and the first sending submodule is used for calling an SPI (serial peripheral interface) driver through a target thread so as to send the target debugging information in the target storage space to the second equipment.
Optionally, the first sending module 64 includes:
the determining submodule is used for determining the raised target clock frequency according to the current clock frequency of the SPI bus;
and the second sending submodule is used for sending the target debugging information to the second equipment through the SPI bus in a direct memory access mode according to the target clock frequency.
Optionally, the apparatus 60 further comprises:
before the first sending module 64 sends the target debugging information to the second device through the SPI bus, the first device is used as a master device of the SPI bus, and the second device is used as a slave device of the SPI bus.
Optionally, the apparatus 60 further comprises:
an obtaining module, configured to obtain device information of the first device if the analysis result indicates that the data obtaining instruction is used to obtain the device information of the first device, and obtain the device information of the first device as target device information;
the second sending module is used for sending the target equipment information to the second equipment through the SPI bus;
wherein the device information of the first device comprises at least one of:
the current thread list of the first equipment and the information of each module in the first equipment.
Fig. 7 is a block diagram of a data transmission device provided according to an embodiment of the present disclosure. The apparatus is applied to a second device, the second device communicates with a first device and a third device respectively, and the second device communicates with the first device through an SPI bus, the apparatus 70 includes:
a third sending module 71, configured to send a data obtaining instruction to the first device;
a receiving module 72, configured to receive response content sent by the first device in response to the data obtaining instruction;
a fourth sending module 73, configured to send the response content to the third device.
Optionally, the second device communicates with the third device over a USB interface or an MMC interface;
if the second device communicates with the third device through the USB interface, the fourth sending module 73 is configured to send the response content to the third device through the USB interface;
if the second device communicates with the third device through the MMC interface, the fourth sending module 73 is configured to send the response content to the third device through the MMC interface.
With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
The present disclosure also provides a computer-readable storage medium on which a computer program is stored, which when executed by a processor implements the steps of the data transmission method applied to a first device provided in any of the embodiments of the present disclosure, or which when executed by a processor implements the steps of the data transmission method applied to a second device provided in any of the embodiments of the present disclosure.
The present disclosure also provides a communication system, where the communication system includes a first device and a second device, where the first device and the second device are both provided with a serial peripheral interface SPI bus, and the first device and the second device communicate via the SPI bus, where the first device is configured to execute the steps of the data transmission method applied to the first device provided in any embodiment of the present disclosure, and the second device is configured to execute the steps of the data transmission method applied to the second device provided in any embodiment of the present disclosure.
Optionally, the communication system further comprises a third device, the second device communicating with the third device through a USB interface or an MMC interface.
The preferred embodiments of the present disclosure are described in detail with reference to the accompanying drawings, however, the present disclosure is not limited to the specific details of the above embodiments, and various simple modifications may be made to the technical solution of the present disclosure within the technical idea of the present disclosure, and these simple modifications all belong to the protection scope of the present disclosure.
It should be noted that the various features described in the above embodiments may be combined in any suitable manner without departing from the scope of the invention. To avoid unnecessary repetition, the disclosure does not separately describe various possible combinations.
In addition, any combination of various embodiments of the present disclosure may be made, and the same should be considered as the disclosure of the present disclosure, as long as it does not depart from the spirit of the present disclosure.
Claims (11)
1. A data transmission method is applied to first equipment, the first equipment is provided with a Serial Peripheral Interface (SPI) bus, and the first equipment is communicated with second equipment through the SPI bus, and the method comprises the following steps:
judging whether a data acquisition instruction sent by the second equipment is received;
if the data acquisition instruction is received, analyzing the data acquisition instruction to obtain an analysis result;
if the analysis result indicates that the data acquisition instruction is used for acquiring debugging information of a specified module in the first equipment, determining a target module indicated by the data acquisition instruction, and debugging the target module to obtain target debugging information, wherein the target debugging information is directly output by binary original data;
sending the target debugging information to the second equipment through the SPI bus;
the sending the target debugging information to the second device through the SPI bus includes:
determining the raised target clock frequency according to the current clock frequency of the SPI bus;
and sending the target debugging information to the second equipment through the SPI bus in a direct memory access mode according to the target clock frequency.
2. The method of claim 1, wherein sending the target debug information to the second device over the SPI bus comprises:
writing the target debugging information into a target storage space in the first device;
and calling an SPI drive through a target thread to send the target debugging information in the target storage space to the second equipment.
3. The method of claim 1, wherein prior to the step of sending the target debug information to the second device over the SPI bus, the method further comprises:
and taking the first device as a master device of the SPI bus, and taking the second device as a slave device of the SPI bus.
4. The method of claim 1, further comprising:
if the analysis result indicates that the data acquisition instruction is used for acquiring the equipment information of the first equipment, acquiring the equipment information of the first equipment as target equipment information;
sending the target device information to the second device through the SPI bus;
wherein the device information of the first device comprises at least one of:
the current thread list of the first equipment and the information of each module in the first equipment.
5. A data transmission method applied to a second device, wherein the second device communicates with a first device and a third device respectively, and the second device communicates with the first device through an SPI bus, the method comprising:
sending a data acquisition instruction to the first device;
receiving response content sent by the first device in response to the data acquisition instruction, wherein the response content comprises target debugging information, the target debugging information is sent to the second device by the first device through the SPI bus according to a target clock frequency and by adopting a direct memory access mode, the target clock frequency is obtained after the clock frequency of the SPI bus is increased by the first device, and the target debugging information is directly output by binary original data;
transmitting the response content to the third device.
6. The method according to claim 5, wherein the second device communicates with the third device over a USB interface or an MMC interface;
if the second device communicates with the third device through the USB interface, the sending the response content to the third device includes:
transmitting the response content to the third device through the USB interface;
if the second device communicates with the third device through the MMC interface, the sending the response content to the third device includes:
and sending the response content to the third equipment through the MMC interface.
7. The utility model provides a data transmission device which characterized in that is applied to first equipment, first equipment is provided with serial peripheral interface SPI bus, and first equipment passes through SPI bus and second equipment communication, the device includes:
the judging module is used for judging whether a data acquisition instruction sent by the second equipment is received or not;
the analysis module is used for analyzing the data acquisition instruction to obtain an analysis result if the data acquisition instruction is received;
a first determining module, configured to determine a target module indicated by the data obtaining instruction and debug the target module to obtain target debugging information if the parsing result indicates that the data obtaining instruction is used to obtain debugging information of a specified module in the first device, where the target debugging information is directly output by binary original data;
the first sending module is used for sending the target debugging information to the second equipment through the SPI bus;
the first transmitting module includes:
the determining submodule is used for determining the raised target clock frequency according to the current clock frequency of the SPI bus;
and the second sending submodule is used for sending the target debugging information to the second equipment through the SPI bus in a direct memory access mode according to the target clock frequency.
8. A data transmission apparatus, applied to a second device, the second device communicating with a first device and a third device, respectively, and the second device communicating with the first device through an SPI bus, the apparatus comprising:
a third sending module, configured to send a data acquisition instruction to the first device;
a receiving module, configured to receive response content sent by the first device in response to the data acquisition instruction, where the response content includes target debugging information, the target debugging information is sent by the first device to the second device through the SPI bus in a direct memory access manner according to a target clock frequency, the target clock frequency is obtained after the clock frequency of the SPI bus is raised by the first device, and the target debugging information is obtained by directly outputting binary original data;
and the fourth sending module is used for sending the response content to the third equipment.
9. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 4 or which, when being executed by a processor, carries out the steps of the method of claim 5 or 6.
10. A communication system comprising a first device and a second device, both provided with a serial peripheral interface, SPI, bus, and communicating over the SPI bus, wherein the first device is configured to perform the steps of the method of any one of claims 1-4 and the second device is configured to perform the steps of the method of claim 5 or 6.
11. A communication system according to claim 10, characterized in that the communication system further comprises a third device, the second device communicating with the third device over a USB interface or an MMC interface.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011331245.4A CN112565036B (en) | 2020-11-24 | 2020-11-24 | Data transmission method, device, storage medium and communication system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011331245.4A CN112565036B (en) | 2020-11-24 | 2020-11-24 | Data transmission method, device, storage medium and communication system |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112565036A CN112565036A (en) | 2021-03-26 |
CN112565036B true CN112565036B (en) | 2022-08-30 |
Family
ID=75044993
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011331245.4A Active CN112565036B (en) | 2020-11-24 | 2020-11-24 | Data transmission method, device, storage medium and communication system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112565036B (en) |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113900419A (en) * | 2021-10-13 | 2022-01-07 | 北谷电子有限公司 | Communication interface device, system and method used between LabVIEW and MES systems |
CN114090485A (en) * | 2021-11-24 | 2022-02-25 | 广东乐心医疗电子股份有限公司 | Wireless data acquisition method and system and electronic equipment |
CN115576887B (en) * | 2022-11-22 | 2023-06-30 | 永联科技(常熟)有限公司 | Data communication processing method, system, device, electronic equipment and storage medium |
Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
TW200943050A (en) * | 2008-04-09 | 2009-10-16 | Ene Technology Inc | Embedded programmable chip with debugging circuit and debugging method with SPI propotcol |
CN102902624A (en) * | 2012-11-09 | 2013-01-30 | 上海斐讯数据通信技术有限公司 | Software debugging system and method |
CN102916833A (en) * | 2012-09-20 | 2013-02-06 | 瑞斯康达科技发展股份有限公司 | Remote debugging method, remote debugging system and debugging target equipment |
CN104714908A (en) * | 2013-12-13 | 2015-06-17 | 上海华虹集成电路有限责任公司 | SPI capable of supporting master/slave mode |
CN105550118A (en) * | 2016-01-27 | 2016-05-04 | 珠海格力电器股份有限公司 | Debugging system and debugging method |
CN105808492A (en) * | 2014-12-30 | 2016-07-27 | 联想(北京)有限公司 | Information processing method and serial peripheral interface main controller |
US10042692B1 (en) * | 2015-09-29 | 2018-08-07 | Xilinx, Inc. | Circuit arrangement with transaction timeout detection |
CN109669906A (en) * | 2018-12-28 | 2019-04-23 | 武汉盛硕电子有限公司 | A kind of ancillary equipment and method recording tune-up data |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US10963328B2 (en) * | 2018-09-05 | 2021-03-30 | Mikroelektronika D.O.O. | WiFi programmer and debugger for microcontroller and method thereof |
-
2020
- 2020-11-24 CN CN202011331245.4A patent/CN112565036B/en active Active
Patent Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
TW200943050A (en) * | 2008-04-09 | 2009-10-16 | Ene Technology Inc | Embedded programmable chip with debugging circuit and debugging method with SPI propotcol |
CN102916833A (en) * | 2012-09-20 | 2013-02-06 | 瑞斯康达科技发展股份有限公司 | Remote debugging method, remote debugging system and debugging target equipment |
CN102902624A (en) * | 2012-11-09 | 2013-01-30 | 上海斐讯数据通信技术有限公司 | Software debugging system and method |
CN104714908A (en) * | 2013-12-13 | 2015-06-17 | 上海华虹集成电路有限责任公司 | SPI capable of supporting master/slave mode |
CN105808492A (en) * | 2014-12-30 | 2016-07-27 | 联想(北京)有限公司 | Information processing method and serial peripheral interface main controller |
US10042692B1 (en) * | 2015-09-29 | 2018-08-07 | Xilinx, Inc. | Circuit arrangement with transaction timeout detection |
CN105550118A (en) * | 2016-01-27 | 2016-05-04 | 珠海格力电器股份有限公司 | Debugging system and debugging method |
CN109669906A (en) * | 2018-12-28 | 2019-04-23 | 武汉盛硕电子有限公司 | A kind of ancillary equipment and method recording tune-up data |
Non-Patent Citations (1)
Title |
---|
基于ENC28J60的新型自动气象站网络通信系统;黄宏智等;《电子测量技术》;20170415(第04期);全文 * |
Also Published As
Publication number | Publication date |
---|---|
CN112565036A (en) | 2021-03-26 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN112565036B (en) | Data transmission method, device, storage medium and communication system | |
CN110213143B (en) | 1553B bus IP core and monitoring system | |
CN114564427B (en) | Bus bridge, system and method from AHB bus to I2C bus | |
EP0260459A2 (en) | Terminal communications circuit | |
CN110851388A (en) | Debugging system and debugging signal transmission method for RISC-V processor | |
CN107992439B (en) | Extensible data interaction method and system | |
CN113312284A (en) | Data transmission method, device, system, storage medium and electronic device | |
CN110798386B (en) | Configurable CAN bus protocol transceiving test method and system | |
CN113852533B (en) | Multi-channel data communication system and method and electronic equipment | |
CN113703843B (en) | Register data processing method, device and memory | |
US20010043361A1 (en) | Printer detecting data precisely in response to change in data transmission speed | |
CN116541329A (en) | Data transmission method, device, equipment and medium | |
CN112148537A (en) | Bus monitoring device and method, storage medium, and electronic device | |
CN111026691B (en) | OWI communication equipment based on APB bus | |
CN116383116A (en) | Communication method and device based on SPI bus | |
CN113608889A (en) | Message data processing method, device, equipment and storage medium | |
CN111538688B (en) | Data processing method, device, module and chip | |
CN116185936B (en) | SPI communication data receiving and transmitting abnormity detection control system and detection method | |
CN109474707B (en) | Two-layer protocol design and data transmission method and system based on serial port protocol | |
CN116684506B (en) | Data processing method, system, electronic device and computer readable storage medium | |
US20230208676A1 (en) | Data communication method and apparatus, electronic device, and storage medium | |
CN114884768B (en) | Detection device, system and detection method for bus idle state | |
CN110336641B (en) | Relay protection test method, relay test equipment, storage medium and device | |
CN115695176A (en) | Method for configuring physical interface chip and related device | |
CN117834750A (en) | Device, method, system, equipment, medium and server for acquiring protocol data |
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 |