CN109902046B - Communication method for serial peripheral bus system, related equipment and system - Google Patents
Communication method for serial peripheral bus system, related equipment and system Download PDFInfo
- Publication number
- CN109902046B CN109902046B CN201910105152.0A CN201910105152A CN109902046B CN 109902046 B CN109902046 B CN 109902046B CN 201910105152 A CN201910105152 A CN 201910105152A CN 109902046 B CN109902046 B CN 109902046B
- Authority
- CN
- China
- Prior art keywords
- peripheral bus
- serial peripheral
- signal line
- data
- notification signal
- 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
Landscapes
- Small-Scale Networks (AREA)
- Information Transfer Systems (AREA)
Abstract
The invention relates to a communication method, a related device and a system for a serial peripheral bus system, wherein the serial peripheral bus system comprises a serial peripheral bus, a notification signal line, a master device and a slave device, the master device is connected with the slave device through the serial peripheral bus and the notification signal line, and the method comprises the following steps of: controlling the notification signal line to be in a first level state; initiating a data interaction with the master device on the serial peripheral bus; when a preset condition is met, controlling the notification signal line to be in a second level state; ending the data interaction with the master device on the serial peripheral bus. According to the invention, by adding one path of notification signal line, the data interaction period of the master device and the slave device on the serial peripheral bus is dominated by the slave device, so that the data interaction efficiency and the data real-time performance are improved.
Description
Technical Field
The present invention relates to the field of data transmission technologies, and in particular, to a communication method, related device, and system for a serial peripheral bus system.
Background
A conventional SPI (Serial Peripheral Interface) based communication works in a Master-Slave manner, and generally includes a Master device (Master) and one or more Slave devices (Slave), and an existing SPI standard protocol includes four communication signal lines connecting the SPI Master device and the SPI Slave device, which are a Serial clock signal line SCLK, a Master input Slave output data line MISO, a Master output Slave input data line MOSI, and a chip select signal line CS.
The traditional SPI communication period is determined by a master device, the state of a corresponding chip selection signal line CS is changed before the master device needs to exchange data every time, the corresponding slave device starts to prepare the data needing to be exchanged next after receiving the state change of the chip selection signal line CS, if the data volume is large, the time for preparing the slave device every time is long, so that the whole communication period is prolonged, the real-time performance of the data is reduced, and the SPI communication period is not suitable for data transmission in scenes with large data exchange volume and high real-time performance requirement.
Disclosure of Invention
In order to solve the problems in the prior art, embodiments of the present invention provide a communication method, a related device and a system for a serial peripheral bus system. The technical scheme is as follows:
in a first aspect, a communication method for a serial peripheral bus system is provided, the serial peripheral bus system including a serial peripheral bus, a notification signal line, a master device and a slave device, the master device being connected to the slave device through the serial peripheral bus and the notification signal line, the method including, for the slave device:
controlling the notification signal line to be in a first level state;
initiating a data interaction with the master device on the serial peripheral bus;
when a preset condition is met, controlling the notification signal line to be in a second level state;
ending the data interaction with the master device on the serial peripheral bus.
Further, before controlling the notification signal line to be in the first level state, the method further includes:
judging whether the preparation of data to be sent is finished or not;
when the judgment result is yes, the step of controlling the notification signal line to be in the first level state is executed
Further, the interactive message of the data interaction carries verification information, so that the main device verifies the interactive message according to the verification information;
the interactive information of the data interaction also carries data item information; the data item information comprises a data type identifier and data, so that the main device obtains the target data matched with the data item information according to the data type identifier carried in the received upper-layer instruction.
Further, after finishing the data interaction with the master device on the serial peripheral bus, the method further comprises: preparing data to be sent;
the preparation of the data to be transmitted comprises:
acquiring data to be sent;
and generating the interactive message of the data interaction according to the data to be sent.
In a second aspect, there is provided a communication method for a serial peripheral bus system including a serial peripheral bus, a notification signal line, a master device and a slave device, the master device being connected with the slave device through the serial peripheral bus and the notification signal line, the method including, for the master device:
monitoring the level state of the notification signal line;
when the notification signal line is monitored to be in a first level state, performing data interaction with the slave equipment through the serial peripheral bus;
and finishing the data interaction with the slave equipment on the serial peripheral bus when the notification signal line is monitored to be in the second level state.
Further, the interactive message of the data interaction carries verification information and data item information, and the data item information includes a data type identifier and data;
after ending the data interaction with the slave device on the serial peripheral bus, the method further comprises:
analyzing the interactive message received from the slave equipment to obtain the verification information and the data item information of the interactive message;
and when the verification passes according to the verification information, acquiring the matched target data in the data item information based on the data type identifier carried in the received upper-layer instruction.
In a third aspect, there is provided a communication method for a serial peripheral bus system including a serial peripheral bus, a notification signal line, a master device, and a slave device, the master device being connected to the slave device through the serial peripheral bus and the notification signal line, the method including:
the master device monitors the level state of the notification signal line;
the slave device controls the notification signal line to be in a first level state and initiates data interaction with the master device on the serial peripheral bus;
when monitoring that the notification signal line is in a first level state, the master device performs data interaction with the slave device through the serial peripheral bus;
when a preset condition is met, the slave device controls the notification signal line to be in a second level state, and data interaction with the master device on the serial peripheral bus is finished;
and when monitoring that the notification signal line is in a second level state, the master device finishes data interaction with the slave device on the serial peripheral bus.
In a fourth aspect, there is provided a slave device applied to a serial peripheral bus system further including a serial peripheral bus, a notification signal line, and a master device connected to the slave device through the serial peripheral bus and the notification signal line, the slave device including:
the first control module is used for controlling the notification signal line to be in a first level state;
the initiating module is used for initiating data interaction with the master device on the serial peripheral bus;
the second control module is used for controlling the notification signal line to be in a second level state when a preset condition is met;
a first end module for ending data interaction with the master device on the serial peripheral bus.
In a fifth aspect, there is provided a master device, the master device being applied to a serial peripheral bus system, the serial peripheral bus system further including a serial peripheral bus, a notification signal line, and a slave device, the master device being connected to the slave device through the serial peripheral bus and the notification signal line, the master device including:
the monitoring module is used for monitoring the level state of the notification signal line;
the first interaction module is used for performing data interaction with the slave equipment through the serial peripheral bus when the notification signal line is monitored to be in a first level state;
and the second ending module is used for ending the data interaction with the slave equipment on the serial peripheral bus when the notification signal line is monitored to be in the second level state.
In a sixth aspect, there is provided a serial peripheral bus system comprising a serial peripheral bus, a notification signal line, a master device and a slave device, the master device being connected to the slave device through the serial peripheral bus and the notification signal line;
the slave device is used for controlling the notification signal line to be in a first level state and initiating data interaction with the master device on the serial peripheral bus; when a preset condition is met, controlling the notification signal line to be in a second level state, and finishing data interaction with the master device on the serial peripheral bus;
the master device is used for monitoring the level state of the notification signal line; when the notification signal line is monitored to be in a first level state, performing data interaction with the slave equipment through the serial peripheral bus; and finishing the data interaction with the slave equipment on the serial peripheral bus when the notification signal line is monitored to be in the second level state.
The communication method, the related equipment and the system for the serial peripheral bus system have the following beneficial effects that:
the embodiment of the invention leads the data interaction period of the master device and the slave device on the serial peripheral bus to be dominated by the slave device by adding a path of notification signal line, namely the communication period between the master device and the slave device is determined by the slave device, the master device is not required to send a request signal, the slave device is not required to send a response signal, the two communication parties directly carry out data interaction, the communication frequency of each data interaction is reduced, and the data interaction efficiency is improved. In addition, the embodiment of the invention can obviously reduce the influence of the slave device data preparation time on the communication period, thereby shortening the communication period, reducing the communication time delay and improving the data real-time property, and therefore, the invention is very suitable for being used in scenes with large data interaction amount and higher real-time property requirement.
Drawings
In order to more clearly illustrate the technical solution of the present invention, the drawings used in the description of the embodiment or the prior art will be briefly described below. It is obvious that the drawings in the following description are only some embodiments of the invention, and that for a person skilled in the art, other drawings can be derived from them without inventive effort.
FIG. 1 is a block diagram of a serial peripheral bus system according to an embodiment of the present invention;
FIG. 2 is a flow chart of a communication method for a serial peripheral bus system according to an embodiment of the present invention;
FIG. 3 is a flow chart of another communication method for a serial peripheral bus system according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of an interactive message provided in an embodiment of the present invention;
FIG. 5 is a flow chart of another communication method for a serial peripheral bus system according to an embodiment of the present invention;
FIG. 6 is a flow chart of another communication method for a serial peripheral bus system according to an embodiment of the present invention;
FIG. 7 is a schematic structural diagram of a slave device provided in an embodiment of the present invention;
FIG. 8 is a schematic diagram of another structure of a slave device provided by the embodiment of the present invention;
FIG. 9 is a schematic structural diagram of a master device according to an embodiment of the present invention;
fig. 10 is another schematic structural diagram of a master device provided in the embodiment of the present invention;
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be obtained by a person skilled in the art without any inventive step based on the embodiments of the present invention, are within the scope of the present invention.
Referring to fig. 1, which is a schematic structural diagram of a serial peripheral bus system according to an embodiment of the present invention, as shown in fig. 1, a serial peripheral bus system 100 may include a serial peripheral bus 110, a notification signal line 120, a master device 130, and a slave device 140. The number of the slave devices 140 may be one or more, and the master device 130 and the slave devices 140 are connected through the serial peripheral bus 110 and the notification signal line 120.
It should be noted that, in the embodiment of the present invention, the serial peripheral bus 110 may be inter-integrated circuit (I)2C) Buses, Serial Peripheral Interface (SPI) buses, 1-Wire buses, UNI/0 buses, and similar protocols that may be used to implement the connection of low speed peripherals to a computing device or system. The low speed peripheral devices may include, but are not limited to, an Electronically Erasable Programmable Read Only Memory (EEPROM) device, a memory chip, a digital-to-analog or analog-to-digital converter, a monitor, a speaker, a display screen, a clock, an in-vehicle radar, and an in-vehicle camera.
Specifically, as shown in fig. 1, taking serial peripheral bus 110 as a Serial Peripheral Interface (SPI) bus as an example, master device 130 and slave device 140 are both coupled to the Serial Peripheral Interface (SPI) bus, which includes serial clock signal line SCLK, master device input slave device output data line MISO, master device output slave device input data line MOSI, and chip select signal line CS, in addition to which master device 130 and slave device 140 are connected by notification signal line 120.
The communication method for the serial peripheral bus system in the present invention will be described below from the viewpoint of the device.
Referring to fig. 2, which is a flow chart illustrating a communication method for a serial peripheral bus system according to an embodiment of the present invention, it should be noted that the present specification provides the method operation steps as described in the embodiment or the flow chart, but more or less operation steps may be included based on conventional or non-inventive labor. The order of steps recited in the embodiments is merely one manner of performing the steps in a multitude of orders and does not represent the only order of execution. In practice, the system or apparatus may be implemented in a sequential or parallel manner (e.g., in the context of parallel processors or multi-threaded processing) as the embodiments or methods shown in the figures are executed. Specifically, as shown in fig. 2, the method includes:
and S201, controlling the notification signal line to be in a first level state.
In the embodiments of the present specification, the first level state may be a high level state or a low level state. For example, the notification signal line may be set to a low level state in a normal state, and when the slave device needs to transmit data to the master device, the slave device may control the notification signal line to become a high level state for a given period of time. Of course, the notification signal line may be set to be in a high level state in a normal state, and when the slave device needs to transmit data to the master device, the slave device may control the notification signal line to be in a low level state in a given period of time.
In a specific embodiment, the slave device may determine whether to control the level of the notification signal line in the first level state according to a preparation condition of its own data to be sent, as shown in fig. 3, before controlling the notification signal line in the first level state, the slave device may determine whether to finish preparing the data to be sent, and when a result of the determination is yes, may perform controlling the notification signal line in the first level state.
In practical application, whether the preparation of the data to be sent is completed or not can be judged according to the set data quantity of the sent data, for example, when the data quantity of the data to be sent reaches a preset data quantity threshold value, the preparation can be determined to be completed; otherwise, the preparation can be continued if the preparation is not finished. Of course, whether the preparation of the data to be sent is finished or not can be judged according to the set data preparation duration, and when the preset data preparation duration is reached, the preparation can be determined to be finished; otherwise, the preparation can be continued if the preparation is not finished.
It should be noted that the above only provides two examples for determining whether the data to be sent is ready, and other determination bases may be set according to needs in practical applications, which is not specifically limited in the present invention.
S203, initiating data interaction with the master device on the serial peripheral bus.
In this embodiment, the slave device may initiate sending data to be interacted to the master device, and correspondingly, the master device receives the data sent by the slave device. Specifically, for the serial peripheral bus being a Serial Peripheral Interface (SPI) bus, after the slave device initiates data interaction with the master device on the serial peripheral bus, the master device may also send data to the slave device through the serial peripheral bus, and correspondingly, the slave device may receive the data sent by the master device.
In the embodiment of the present specification, the interactive message of the data interaction carries verification information, so that the master device can verify the interactive message according to the verification information. Specifically, the check information may be an MD5 value of the interactive message, and the like, which may be used to check whether an error occurs in the interactive message during transmission, and is beneficial to improving the reliability of data interaction.
In this embodiment of the present specification, the interaction message of the data interaction may further carry data item information, where the data item information may include a data type identifier and data, so that the master device obtains the target data matched in the data item information according to the data type identifier carried in the received upper layer instruction.
In one embodiment, the structure of the interactive message of the data interaction may be as shown in fig. 4, the total length of each interactive message is fixed, and the interactive message may be logically divided into 4 parts, namely a fixed message header, a dynamic data item, an end character and a padding item.
Specifically, the message header may include a sequence number, a timestamp, handshake information, and check information. The sequence number can be used to determine whether there is duplication, omission, disorder, etc. in practical application, the sequence number can start from 0 and increase by 1 as a step. The timestamp may be used to determine the time interval between two interactive messages. The handshake information may be used to identify the type of the interaction message, such as whether the interaction message is a handshake message or a normal data message. The check information may be used to check whether an error occurs in the interactive message during transmission.
Specifically, the number of data items included in each interactive message may vary, but the logical definition of the data items is fixed. The data item may include a data type identification, length, payload. The data type identifier may be used to identify the type of data in the data item, for example, the type of data may include, but is not limited to, image data, speed data. The length may be used to represent the data length of the present data item in bytes. The payload may be used to represent the data of the present data item.
In particular, an end-pointer may be used to indicate the end of a data item, the value of which is an invalid data item type. The padding will generally vary with the number of data items, which is in increasing and decreasing relationship with the data items, and the value of the padding may be invalid all-zero data.
And S205, controlling the notification signal line to be in a second level state when a preset condition is met.
In this embodiment of the present specification, the preset condition may be that the total amount of data sent from the device in one communication reaches a preset threshold, or that the time duration of one communication reaches a preset time duration. Of course, the preset condition may also be other conditions for triggering the slave device to control the level of the notification signal line to be in the second level state, for example, a preset threshold value reached by the occupancy rate of a buffer of the slave device for receiving data, or the like.
The second level state is a level state different from the first level state, and may be a high level state or a low level state. Specifically, when the first level state is set to the high level state, the second level state may be set to the low level state; when the first level state is set to the low level state, the second level state may be set to the high level state.
And S207, finishing the data interaction with the master device on the serial peripheral bus.
In this specification embodiment, the slave device may actively end the data interaction with the master device on the serial peripheral bus to end the one-cycle communication.
In practical applications, as shown in fig. 3, after the slave device finishes data interaction with the master device on the serial peripheral bus, the slave device may enter preparation of data to be transmitted in the next communication cycle. Specifically, the preparing of the data to be sent may include: acquiring data to be sent; generating the interactive message of data interaction according to the data to be sent, where the structure of the interactive message may refer to fig. 4, which is not described herein again.
In a specific application scenario, the slave device may be a sensing chip of a vehicle-mounted radar or a vehicle-mounted camera, and the master device may be a vehicle controller chip, so that the data to be sent may be based on distance data, image data, speed data, acceleration data, and the like acquired by the vehicle-mounted radar or the vehicle-mounted camera.
It can be seen from the above embodiments of the present invention that, by adding one notification signal line, the data interaction period of the master device and the slave device on the serial peripheral bus is dominated by the slave device, that is, the communication period between the master device and the slave device is determined by the slave device, and it is not necessary for the master device to send a request signal nor for the slave device to send a response signal, and both communication parties directly perform data interaction, thereby reducing the communication frequency of each data interaction and improving the data interaction efficiency. In addition, the embodiment of the invention can obviously reduce the influence of the data preparation time of the slave device on the communication period, thereby shortening the communication period, reducing the communication time delay and improving the data real-time performance, therefore, the invention is very suitable for being used in scenes with large data interaction amount and higher real-time performance requirement, such as SPI communication between a sensing chip (slave device) for processing radar and camera data and a vehicle controller chip (master device) in a vehicle-mounted environment.
In addition, the communication period of the invention is determined by the slave device, if the slave device and the master device have any communication delay, the period is only lengthened, the data communication interaction failure is not caused, and the robustness of data interaction is improved.
The above-described embodiments describe the communication method for the serial peripheral bus system in the present invention from the viewpoint of the slave device, and the communication method for the serial peripheral bus system in the present invention will be described below from the viewpoint of the master device.
Referring to fig. 5, which is a flow chart illustrating another communication method for a serial peripheral bus system according to an embodiment of the present invention, it should be noted that the present specification provides the method operation steps as described in the embodiment or the flow chart, but may include more or less operation steps based on conventional or non-inventive labor. The order of steps recited in the embodiments is merely one manner of performing the steps in a multitude of orders and does not represent the only order of execution. In practice, the system or apparatus may be implemented in a sequential or parallel manner (e.g., in the context of parallel processors or multi-threaded processing) as the embodiments or methods shown in the figures are executed. Specifically, as shown in fig. 5, the method includes:
and S501, monitoring the level state of the notification signal line.
In the embodiments of the present specification, the master device may monitor the level state of the notification signal line in real time.
And S503, when the notification signal line is monitored to be in the first level state, performing data interaction with the slave device through the serial peripheral bus.
Specifically, for the content related to the notification signal line being in the first level state, reference may be made to the method embodiment shown in fig. 2, and details are not repeated here.
In an embodiment of this specification, the interactive message of the data interaction carries verification information and data item information, where the data item information includes a data type identifier and data. For the interactive messages related to data interaction, reference may be made to the foregoing method embodiments related to the slave device side, and details are not described here.
And S505, when the notification signal line is monitored to be in the second level state, ending the data interaction with the slave device on the serial peripheral bus.
Specifically, for the content related to the notification signal line being in the second level state, reference may be made to the method embodiment shown in fig. 2, which is not described herein again.
In this embodiment of the present specification, after finishing data interaction with the slave device on the serial peripheral bus, the master device may parse an interaction message received from the slave device to obtain verification information and data item information of the interaction message; and verifying the corresponding interactive message according to the verification information, and acquiring the matched target data in the data item information based on the data type identifier carried in the received upper-layer instruction when the verification is passed.
It can be seen from the above embodiments of the present invention that, by adding one notification signal line, the data interaction period of the master device and the slave device on the serial peripheral bus is dominated by the slave device, that is, the communication period between the master device and the slave device is determined by the slave device, and it is not necessary for the master device to send a request signal nor for the slave device to send a response signal, and both communication parties directly perform data interaction, thereby reducing the communication frequency of each data interaction and improving the data interaction efficiency. In addition, the embodiment of the invention can obviously reduce the influence of the data preparation time of the slave device on the communication period, thereby shortening the communication period, reducing the communication time delay and improving the data real-time performance, therefore, the invention is very suitable for being used in scenes with large data interaction amount and higher real-time performance requirement, such as SPI communication between a sensing chip (slave device) for processing radar and camera data and a vehicle controller chip (master device) in a vehicle-mounted environment.
In addition, the communication period of the invention is determined by the slave device, if the slave device and the master device have any communication delay, the period is only lengthened, the data communication interaction failure is not caused, and the robustness of data interaction is improved.
Referring to fig. 6, a flow chart of another communication method for a serial peripheral bus system according to an embodiment of the present invention is shown, as shown in fig. 6, the method may include:
s601, the master device monitors the level state of the notification signal line.
S603, the slave device controls the notification signal line to be in a first level state, and initiates data interaction with the master device on the serial peripheral bus.
And S605, when monitoring that the notification signal line is in a first level state, the master device performs data interaction with the slave device through the serial peripheral bus.
And S607, when a preset condition is met, the slave device controls the notification signal line to be in a second level state, and finishes data interaction with the master device on the serial peripheral bus.
And S609, when monitoring that the notification signal line is in the second level state, the master device finishes data interaction with the slave device on the serial peripheral bus.
Specifically, steps S601 to S609 may refer to the method embodiments shown in fig. 2 and fig. 5, and are not described herein again.
It can be seen from the above embodiments of the present invention that, by adding one notification signal line, the data interaction period of the master device and the slave device on the serial peripheral bus is dominated by the slave device, that is, the communication period between the master device and the slave device is determined by the slave device, and it is not necessary for the master device to send a request signal nor for the slave device to send a response signal, and both communication parties directly perform data interaction, thereby reducing the communication frequency of each data interaction and improving the data interaction efficiency. In addition, the embodiment of the invention can obviously reduce the influence of the data preparation time of the slave device on the communication period, thereby shortening the communication period, reducing the communication time delay and improving the data real-time performance, therefore, the invention is very suitable for being used in scenes with large data interaction amount and higher real-time performance requirement, such as SPI communication between a sensing chip (slave device) for processing radar and camera data and a vehicle controller chip (master device) in a vehicle-mounted environment.
In addition, the communication period of the invention is determined by the slave device, if the slave device and the master device have any communication delay, the period is only lengthened, the data communication interaction failure is not caused, and the robustness of data interaction is improved.
Referring to fig. 7, the slave device in the embodiment of the present invention is applied to a serial peripheral bus system in the embodiment of the present invention, the serial peripheral bus system further includes a serial peripheral bus, a notification signal line, and a master device, and the master device is connected to the slave device through the serial peripheral bus and the notification signal line. The slave device has a function of implementing the slave device side in the foregoing method embodiment, where the function may be implemented by hardware, or may be implemented by hardware executing corresponding software, and specifically, the slave device may include:
a first control module 710 for controlling the notification signal line to be in a first level state;
an initiating module 720, configured to initiate data interaction with the master device on the serial peripheral bus;
the second control module 730 is configured to control the notification signal line to be in a second level state when a preset condition is met;
a first end module 740, configured to end data interaction with the master device on the serial peripheral bus.
In a specific embodiment, as shown in fig. 8, the slave device may further include:
the determining module 750 is configured to determine whether the data to be sent is ready.
A data preparation module 760, configured to obtain data to be sent; and generating the interactive message of the data interaction according to the data to be sent.
The following describes the master device in the present invention in detail, please refer to fig. 9, where the master device in the embodiment of the present invention is applied to a serial peripheral bus system in the embodiment of the present invention, the serial peripheral bus system further includes a serial peripheral bus, a notification signal line, and a slave device, the master device is connected to the slave device through the serial peripheral bus and the notification signal line, the master device has a function of implementing the master device side in the embodiment of the method, and the function may be implemented by hardware or by hardware executing corresponding software, and specifically, the master device may include:
a monitoring module 910, configured to monitor a level state of the notification signal line;
a first interaction module 920, configured to perform data interaction with the slave device through the serial peripheral bus when it is monitored that the notification signal line is in a first level state;
a second ending module 930, configured to end the data interaction with the slave device on the serial peripheral bus when it is monitored that the notification signal line is in the second level state.
In a specific embodiment, as shown in fig. 10, the master device may further include:
an analyzing module 940, configured to analyze the interactive message received from the slave device to obtain verification information and data item information of the interactive message;
and a target data obtaining module 950, configured to obtain, based on the data type identifier carried in the received upper-layer instruction, the target data matched in the data item information when the verification passes according to the verification information.
An embodiment of the present invention also provides a serial peripheral bus system, as shown in fig. 1, including a serial peripheral bus, a notification signal line, a master device, and a slave device, the master device being connected to the slave device through the serial peripheral bus and the notification signal line;
the slave device is used for controlling the notification signal line to be in a first level state and initiating data interaction with the master device on the serial peripheral bus; when a preset condition is met, controlling the notification signal line to be in a second level state, and finishing data interaction with the master device on the serial peripheral bus;
the master device is used for monitoring the level state of the notification signal line; when the notification signal line is monitored to be in a first level state, performing data interaction with the slave equipment through the serial peripheral bus; and finishing the data interaction with the slave equipment on the serial peripheral bus when the notification signal line is monitored to be in the second level state.
It should be noted that, when the device provided in the foregoing embodiment implements the functions thereof, only the division of the functional modules is illustrated, and in practical applications, the functions may be distributed by different functional modules according to needs, that is, the internal structure of the device may be divided into different functional modules to complete all or part of the functions described above. In addition, the apparatus and method embodiments provided by the above embodiments belong to the same concept, and specific implementation processes thereof are described in the method embodiments for details, which are not described herein again.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The foregoing description has disclosed fully preferred embodiments of the present invention. It should be noted that those skilled in the art can make modifications to the embodiments of the present invention without departing from the scope of the appended claims. Accordingly, the scope of the appended claims is not to be limited to the specific embodiments described above.
Claims (10)
1. A communication method for a serial peripheral bus system, the serial peripheral bus system including a serial peripheral bus, a notification signal line, a master device, and a slave device, the master device being connected to the slave device through the serial peripheral bus and the notification signal line, the method comprising, for the slave device:
the slave device controls the notification signal line to be in a first level state;
the slave device initiating a data interaction with the master device on the serial peripheral bus;
when a preset condition is met, the slave device controls the notification signal line to be in a second level state;
the slave device finishes data interaction with the master device on the serial peripheral bus;
wherein the preset conditions are as follows: the total amount of data transmitted in one communication reaches a preset threshold, or the time length of one communication reaches a preset time length, or the occupancy rate of a buffer of the slave device for receiving data reaches a preset threshold.
2. The communication method for the serial peripheral bus system according to claim 1, wherein before controlling the notification signal line to be in the first level state, the method further comprises:
judging whether the preparation of data to be sent is finished or not;
and when the judgment result is yes, the step of controlling the notification signal line to be in a first level state is executed.
3. The communication method for the serial peripheral bus system according to claim 1, wherein the interactive message of the data interaction carries verification information, so that the master device verifies the interactive message according to the verification information;
the interactive information of the data interaction also carries data item information; the data item information comprises a data type identifier and data, so that the main device obtains the target data matched with the data item information according to the data type identifier carried in the received upper-layer instruction.
4. The communication method for the serial peripheral bus system according to claim 1, wherein after finishing the data interaction with the master device on the serial peripheral bus, the method further comprises: preparing data to be sent;
the preparation of the data to be transmitted comprises:
acquiring data to be sent;
and generating the interactive message of the data interaction according to the data to be sent.
5. A communication method for a serial peripheral bus system, the serial peripheral bus system including a serial peripheral bus, a notification signal line, a master device, and a slave device, the master device being connected to the slave device through the serial peripheral bus and the notification signal line, the method comprising, for the master device:
monitoring the level state of the notification signal line;
when the notification signal line is monitored to be in a first level state, performing data interaction with the slave equipment through the serial peripheral bus;
when the notification signal line is monitored to be in a second level state, finishing data interaction with the slave device on the serial peripheral bus;
when a preset condition is met, the slave device controls the notification signal line to be in a second level state, wherein the preset condition is as follows: the total amount of data transmitted in one communication reaches a preset threshold, or the time length of one communication reaches a preset time length, or the occupancy rate of a buffer of the slave device for receiving data reaches a preset threshold.
6. The communication method for the serial peripheral bus system according to claim 5, wherein the interactive message of the data interaction carries verification information and data item information, and the data item information comprises data type identification and data;
after ending the data interaction with the slave device on the serial peripheral bus, the method further comprises:
analyzing the interactive message received from the slave equipment to obtain the verification information and the data item information of the interactive message;
and when the verification passes according to the verification information, acquiring the matched target data in the data item information based on the data type identifier carried in the received upper-layer instruction.
7. A communication method for a serial peripheral bus system, the serial peripheral bus system including a serial peripheral bus, a notification signal line, a master device, and a slave device, the master device being connected to the slave device through the serial peripheral bus and the notification signal line, the method comprising:
the master device monitors the level state of the notification signal line;
the slave device controls the notification signal line to be in a first level state and initiates data interaction with the master device on the serial peripheral bus;
when monitoring that the notification signal line is in a first level state, the master device performs data interaction with the slave device through the serial peripheral bus;
when a preset condition is met, the slave device controls the notification signal line to be in a second level state, and data interaction with the master device on the serial peripheral bus is finished;
when monitoring that the notification signal line is in a second level state, the master device finishes data interaction with the slave device on the serial peripheral bus;
wherein the preset conditions are as follows: the total amount of data transmitted in one communication reaches a preset threshold, or the time length of one communication reaches a preset time length, or the occupancy rate of a buffer of the slave device for receiving data reaches a preset threshold.
8. A slave device for a serial peripheral bus system, wherein the slave device is applied to a serial peripheral bus system, the serial peripheral bus system further comprising a serial peripheral bus, a notification signal line, and a master device, the master device being connected to the slave device through the serial peripheral bus and the notification signal line, the slave device comprising:
the first control module is used for controlling the notification signal line to be in a first level state;
the initiating module is used for initiating data interaction with the master device on the serial peripheral bus;
the second control module is used for controlling the notification signal line to be in a second level state when a preset condition is met;
a first ending module for ending data interaction with the master device on the serial peripheral bus;
wherein the preset conditions are as follows: the total amount of data transmitted in one communication reaches a preset threshold, or the time length of one communication reaches a preset time length, or the occupancy rate of a buffer of the slave device for receiving data reaches a preset threshold.
9. A master device for a serial peripheral bus system, the master device being applied to the serial peripheral bus system, the serial peripheral bus system further including a serial peripheral bus, a notification signal line, and a slave device, the master device being connected to the slave device through the serial peripheral bus and the notification signal line, the master device comprising:
the monitoring module is used for monitoring the level state of the notification signal line;
the first interaction module is used for performing data interaction with the slave equipment through the serial peripheral bus when the notification signal line is monitored to be in a first level state;
the second ending module is used for ending data interaction with the slave equipment on the serial peripheral bus when the notification signal line is monitored to be in a second level state;
when a preset condition is met, the slave device controls the notification signal line to be in a second level state, wherein the preset condition is as follows: the total amount of data transmitted in one communication reaches a preset threshold, or the time length of one communication reaches a preset time length, or the occupancy rate of a buffer of the slave device for receiving data reaches a preset threshold.
10. A serial peripheral bus system, comprising a serial peripheral bus, a notification signal line, a master device and a slave device, the master device being connected to the slave device through the serial peripheral bus and the notification signal line;
the slave device is used for controlling the notification signal line to be in a first level state and initiating data interaction with the master device on the serial peripheral bus; when a preset condition is met, controlling the notification signal line to be in a second level state, and finishing data interaction with the master device on the serial peripheral bus;
the master device is used for monitoring the level state of the notification signal line; when the notification signal line is monitored to be in a first level state, performing data interaction with the slave equipment through the serial peripheral bus; when the notification signal line is monitored to be in a second level state, finishing data interaction with the slave device on the serial peripheral bus;
wherein the preset conditions are as follows: the total amount of data transmitted in one communication reaches a preset threshold, or the time length of one communication reaches a preset time length, or the occupancy rate of a buffer of the slave device for receiving data reaches a preset threshold.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910105152.0A CN109902046B (en) | 2019-02-01 | 2019-02-01 | Communication method for serial peripheral bus system, related equipment and system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910105152.0A CN109902046B (en) | 2019-02-01 | 2019-02-01 | Communication method for serial peripheral bus system, related equipment and system |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109902046A CN109902046A (en) | 2019-06-18 |
CN109902046B true CN109902046B (en) | 2020-03-20 |
Family
ID=66944568
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910105152.0A Active CN109902046B (en) | 2019-02-01 | 2019-02-01 | Communication method for serial peripheral bus system, related equipment and system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109902046B (en) |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113079073A (en) * | 2020-01-06 | 2021-07-06 | 广州汽车集团股份有限公司 | Full-duplex communication device based on SPI and communication method thereof |
CN111581011A (en) * | 2020-04-30 | 2020-08-25 | 广东芬尼克兹节能设备有限公司 | Data verification method and device based on RS-485 communication |
CN113176751B (en) * | 2021-04-28 | 2022-09-20 | 青岛歌尔智能传感器有限公司 | Data transmission method, device and computer readable storage medium |
Family Cites Families (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN2746666Y (en) * | 2004-10-20 | 2005-12-14 | 天津市英克瑞电子技术有限公司 | Semi-duplex serial bus communication device with clock signal |
CN102819512B (en) * | 2012-06-28 | 2015-11-18 | 惠州市德赛西威汽车电子股份有限公司 | A kind of full-duplex communication device based on SPI and method thereof |
CN103744811A (en) * | 2013-12-27 | 2014-04-23 | 华中科技大学 | Serial data transmission system and method |
CN104869560B (en) * | 2014-02-26 | 2018-09-07 | 宇龙计算机通信科技(深圳)有限公司 | Message informing method, message informing device, mobile device and messaging systems |
US10055376B1 (en) * | 2015-01-15 | 2018-08-21 | Maxim Integrated Products, Inc. | Serial peripheral interface system with slave expander |
US9798643B2 (en) * | 2015-07-17 | 2017-10-24 | Goodrich Corporation | System and method of monitoring a serial bus |
US9990316B2 (en) * | 2015-09-21 | 2018-06-05 | Qualcomm Incorporated | Enhanced serial peripheral interface |
CN106201973B (en) * | 2016-06-30 | 2020-08-11 | 珠海智融科技有限公司 | Method and system for single-wire serial communication interface |
CN106528484A (en) * | 2016-10-28 | 2017-03-22 | 中国科学院上海微系统与信息技术研究所 | Serial communication method |
CN107766200A (en) * | 2017-09-22 | 2018-03-06 | 郑州云海信息技术有限公司 | A kind of I2C monitoring bus system and monitoring method |
-
2019
- 2019-02-01 CN CN201910105152.0A patent/CN109902046B/en active Active
Also Published As
Publication number | Publication date |
---|---|
CN109902046A (en) | 2019-06-18 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109902046B (en) | Communication method for serial peripheral bus system, related equipment and system | |
US10621797B2 (en) | System and method for transferring diagnostic commands to a vehicle | |
CN109660391B (en) | Method, system and related device for upgrading firmware of pooling server system | |
CN115345122B (en) | Chip verification device for non-standard bus protocol of simulation | |
CN111949470B (en) | Chip verification method and device, electronic equipment and storage medium | |
CN108563595B (en) | System and method for long-distance transmission of USB data | |
CN112698640B (en) | ECU upgrading test system | |
US20220324395A1 (en) | Apparatus for diagnostics communication error of vehicle, system having the same, and method thereof | |
CN115994057A (en) | Chip bus detection method and device, electronic equipment and storage medium | |
CN116126754A (en) | Integrated circuit, processing method, electronic device and medium for memory access | |
CN112615739B (en) | Method and system for adapting OCP3.0 network card in multi-host application environment | |
CN115454896A (en) | SMBUS-based SSD MCTP control message verification method and device, computer equipment and storage medium | |
CN109976778B (en) | Software updating method and system of vehicle electronic product, upper computer and storage medium | |
JP2003167756A5 (en) | ||
CN109586832A (en) | Wireless synchronization method, wireless slave, wireless host and wireless synchronization master | |
US8027826B2 (en) | Evaluation device consisting of a logic simulator and a simulation result table | |
CN117407343B (en) | Method and device for processing clock extension in integrated circuit bus transparent transmission mode | |
CN117172205B (en) | Performance analysis method, device, electronic equipment and storage medium | |
CN114019230B (en) | Intelligent electric energy meter design method and system | |
US20230281147A1 (en) | Communication apparatus, communication method, and program | |
CN112203264B (en) | Equipment pairing method applied to equipment group and equipment in equipment group | |
CN108063695B (en) | Communication instruction configuration method and device and data acquisition method and device | |
CN118535395A (en) | Verification method and system for flash memory control chip | |
CN118764543A (en) | Inter-process communication method and device, electronic equipment, storage medium and vehicle-mounted platform | |
CN113965308A (en) | Connection communication method, slave device and device control system |
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 | ||
PE01 | Entry into force of the registration of the contract for pledge of patent right | ||
PE01 | Entry into force of the registration of the contract for pledge of patent right |
Denomination of invention: Communication method, related equipment and system for serial peripheral bus system Effective date of registration: 20200708 Granted publication date: 20200320 Pledgee: Tongxiang Wuzhen intelligent driving industry No.1 investment partnership (L.P.) Pledgor: FREETECH INTELLIGENT SYSTEMS Co.,Ltd. Registration number: Y2019330000117 |