A communication system and method
By generating an integer clock signal in the signal processing device and processing the data signal according to the number of slave devices, the problem of sending chip select signals during communication between the master device and the slave devices is solved, high-speed communication between the master and slave devices is realized, and management is saved. pin count and improves communication efficiency.
Patent Information
- Application Number
- CN202110276201.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-03-15
- Publication Date
- 2024-08-30
- Estimated Expiration
- 2041-03-15
AI Technical Summary
In the existing technology, when a master device communicates with a slave device, it is necessary to send a chip select signal to each slave device, which results in an increase in the number of pins and a slowdown in communication speed, making it impossible to achieve high-speed communication.
The signal processing device generates an integer clock signal, and determines the byte length information according to the number of slave devices, realizing high-speed communication between slave devices without the need for the master device to send a chip select signal.
It saves the number of pins of the master device and realizes high-speed communication between the master and slave devices, avoiding the process of sequential chip selection and transmission.
Smart Images

Figure CN112882979B
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to communication technology, and in particular, to a communication system and method. Background Art
[0002] With the development of communication technology, the application of chips in production and life is becoming more and more extensive. Chips can communicate using the serial peripheral interface (SPI). SPI is a full-duplex four-wire synchronous serial peripheral interface first proposed by Motorola. It adopts a master-slave mode architecture and supports single-master and multi-slave mode applications.
[0003] Figure 1 A schematic diagram of a connection between a master device and a slave device in the prior art is provided. Figure 1 As shown, the MOSI line is used for master device data output and slave device data input; the MISO line is used for master device data input and slave device data output; the CLK line is used to transmit the clock signal generated by the master device; the CS1 line and the CS2 line are used to transmit the chip select signal controlled by the master device. The clock is controlled by the master device, and the data is transmitted bit by bit under the clock shift pulse. The chip select signal of the master device is used to select the slave device.
[0004] When the master device communicates with multiple slave devices, the master device needs to provide a separate chip select signal for each slave device, so the master device needs to set many pins when communicating with multiple slave devices to send chip select signals to different slave devices. When the master device communicates with each slave device, it takes time to chip select each slave device, and it needs to wait until the transmission is completed before starting to send the next frame of data, so high-speed communication cannot be performed between multiple slave devices. Summary of the invention
[0005] The present invention provides a communication system and method to realize high-speed communication between a master device and a slave device.
[0006] In a first aspect, an embodiment of the present invention provides a communication system, the communication system comprising: a master device, a signal processing apparatus, and at least one slave device;
[0007] The master device is used to generate a data signal of a set format when a data transmission condition is met, and send the data signal to the signal processing device through a data output pin;
[0008] The signal processing device is used to generate an integer clock signal according to the data signal, and send the data signal to each of the slave devices through a data output pin, and send the integer clock signal to each of the slave devices through a counting pin;
[0009] Each of the slave devices is used to receive the data signal according to the integer clock signal;
[0010] The data signal includes: at least one byte length information and byte data information corresponding to each byte length information, and the number of the byte length information is determined by the number of the slave devices.
[0011] Further, the signal processing device includes a digital integrated circuit chip and a shaping circuit;
[0012] The digital integrated circuit chip is used to generate a digital clock signal according to the data signal, and send the data signal to each of the slave devices through a data output pin, and send the digital clock signal to the shaping circuit through a clock pin;
[0013] The shaping circuit is used to convert the digital clock signal into an integer clock signal, and send the integer clock signal to each slave device through a counting pin.
[0014] Furthermore, the digital integrated circuit chip comprises:
[0015] A first signal generating module, used for generating a high level signal of a set byte length and an integrated clock signal according to the data signal;
[0016] The second signal generating module is used to form a digital clock signal according to each of the high-level signals and each integrated clock signal.
[0017] Furthermore, the first signal generating module is specifically used to:
[0018] For each byte length information in the data signal, generating a high level signal for setting the byte length;
[0019] The byte length information is parsed to determine the byte length corresponding to the byte length information, and an integrated clock signal of a corresponding length is generated according to the byte length.
[0020] Furthermore, the shaping circuit is specifically used to: keep the continuous high-level signal in the digital clock signal unchanged, and convert the continuous high- and low-level signals into continuous low-level signals to form a shaping clock signal.
[0021] Furthermore, the integrated circuit chip is also used for:
[0022] After receiving the master device clock signal sent by the master device through the clock pin, the operation is started;
[0023] The master device clock signal is sent to the shaping circuit through a clock pin, so that the shaping circuit starts working according to the master device clock signal and then sends the master device clock signal to each of the slave devices through the clock pin.
[0024] Furthermore, the integrated circuit chip is also used for:
[0025] Receiving a synchronization frame signal sent by the master device through a synchronization pin;
[0026] The synchronization frame signal is sent to each of the slave devices through a synchronization pin, so that each of the slave devices is synchronized with the master device.
[0027] Further, the slave device includes:
[0028] A reset module, used to reset the value of the corresponding slave node counter to zero when receiving a synchronization frame signal;
[0029] An accumulation module, configured to accumulate and add 1 to the value of the corresponding slave node counter when receiving the rising edge of the integer clock signal;
[0030] The receiving module is used to receive the data signal when it is detected that the value of the corresponding slave node counter meets the data receiving condition.
[0031] Furthermore, the receiving module is also used to generate a low level signal when receiving the data signal.
[0032] In a second aspect, an embodiment of the present invention further provides a communication method, which is executed by a communication system described in any one of the embodiments of the present invention, including:
[0033] When the data transmission conditions are met, the master device generates a data signal of a set format and sends it to the signal processing device through the data output pin;
[0034] The signal processing device generates an integer clock signal according to the data signal, and sends the data signal to at least one slave device through a data output pin, and sends the integer clock signal to each of the slave devices through a counting pin;
[0035] Each of the slave devices receives the data signal according to the integer clock signal;
[0036] The data signal includes: at least one byte length information and byte data information corresponding to each byte length information, and the number of the byte length information is determined by the number of the slave devices.
[0037] The embodiment of the present invention provides a communication system and method, the communication system includes a master device, a signal processing device and at least one slave device; the master device is used to generate a data signal of a set format when a data transmission condition is met, and send it to the signal processing device through a data output pin; the signal processing device is used to generate an integer clock signal according to the data signal, and send the data signal to each slave device through the data output pin, and send the integer clock signal to each slave device through a counting pin; each slave device is used to receive the data signal according to the integer clock signal; wherein the data signal includes: at least one byte length information and a byte number corresponding to each byte length information According to the information, the number of byte length information is determined by the number of slave devices, which solves the problem in the prior art that a chip select signal must be sent to the slave device during communication between the master device and the slave device. A data signal is generated according to the number of slave devices, and the data signal is processed by a signal processing device to generate an integer clock signal. The slave device receives the data signal according to the integer clock signal, and there is no need for the master device to send a chip select signal. Therefore, the master device does not need to set a pin for sending a chip select signal for each slave device, saving the number of pins of the master device; the information of all slave devices is sent through one data signal, and there is no need to select the slave devices one by one and send them one by one, thereby achieving the effect of high-speed communication between the master and slave devices. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] Figure 1 It is a connection diagram of a master device and a slave device in the prior art;
[0039] Figure 2 is a schematic diagram of the structure of a communication system in Embodiment 1 of the present invention;
[0040] Figure 3 is a schematic diagram of the structure of a communication system in Embodiment 2 of the present invention;
[0041] Figure 4 is a structural example diagram of a communication system in Embodiment 2 of the present invention;
[0042] Figure 5 It is a communication timing diagram in Embodiment 2 of the present invention;
[0043] Figure 6 It is a flow chart of a communication method in Embodiment 3 of the present invention. DETAILED DESCRIPTION
[0044] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present invention, rather than to limit the present invention. It should also be noted that, for ease of description, only parts related to the present invention, rather than all structures, are shown in the accompanying drawings.
[0045] Embodiment 1
[0046] Figure 2 A schematic diagram of the structure of a communication system provided in Embodiment 1 of the present invention. This embodiment is applicable to the case where a master device and a slave device communicate with each other. The system includes: a master device 11, a signal processing device 12, and at least one slave device 13;
[0047] The master device 11 is used to generate a data signal of a set format when a data transmission condition is met, and send it to the signal processing device 12 through a data output pin;
[0048] The signal processing device 12 is used to generate an integer clock signal according to the data signal, and send the data signal to each slave device 13 through the data output pin, and send the integer clock signal to each slave device 13 through the counting pin;
[0049] Each slave device 13 is used to receive a data signal according to an integer clock signal;
[0050] The data signal includes: at least one byte length information and byte data information corresponding to each byte length information, and the number of byte length information is determined by the number of slave devices.
[0051] In this embodiment, the master device 11 can be specifically understood as a chip that serves as a master control device in a chip that uses an SPI interface for communication; the signal processing device 12 can be specifically understood as a device that processes the signal sent by the master device to form a signal that can be used to chip select a slave device; the slave device 13 can be specifically understood as a chip that receives information sent by the master device and provides corresponding feedback in a chip that uses an SPI interface for communication.
[0052] In this embodiment, the data transmission condition can be understood as a condition for determining whether the master device 11 needs to send data to the slave device 13; the data signal can be specifically understood as a signal containing data sent by the master device 11 to all slave devices 13 communicating with it. The data output pin can be specifically understood as a pin on the master device 11 that can output data, used to send data to the slave device 13, such as the MOSI pin. The byte length information can be specifically understood as a byte used to store length information in a signal; the byte data information can be specifically understood as the actual information that the master device 11 wants to transmit to the slave device 13.
[0053] The master device sends information to the slave device at regular intervals, so every time the data transmission time comes, it is determined that the master device meets the data transmission condition, that is, the master device is triggered to generate a data signal at regular intervals; or, when the master device 11 needs to send data, a data transmission instruction can be generated and sent to the master device through the terminal device, instructing the master device 11 to send a data signal. After receiving the data transmission instruction, the master device determines that the data transmission condition is met. When the data transmission condition is met, the master device 11 generates a data signal in a pre-set format. The data signal includes byte length information and byte data information corresponding to the byte length information, and sends the generated data signal to the signal processing device 12 through the data output pin for subsequent data processing. Exemplarily, the data signal format is as follows: the numbers 8 and 16 are byte length information, and AD is byte data information.
[0054] 8 A 8 B 16 C 8 D
[0055] Generally, when the master device 11 communicates with the slave device, in order to communicate with each slave device 13, the master device 11 needs to send the same number of byte length information and byte data information as the number of slave devices 13, that is, each slave device 13 receives the corresponding byte length information and byte data information to achieve communication with the master device 11.
[0056] When generating a data signal, the size of the byte length information and the content of the byte data information in the data signal can be specified by the user each time, or the data content to be sent can be preset and directly generated. For example, the first byte length information and byte data information in the data signal are sent to the first slave device 13, and it is preset that the byte data information sent each time is event A, and this byte data information is transmitted in 8 bytes, so the first byte length information in the data signal is 8, the first byte data information is event A, and the byte length information 8 is transmitted through 1 byte.
[0057] In this embodiment, the integer clock signal can be specifically understood as a high-low level signal; the counting pin can be specifically understood as a pin for transmitting information. The counting pin is a general term for a type of pin, which can be a pin on the slave device 13 or a pin on the signal processing device 12. Whether it is a pin on the slave device 13 or a pin on the signal processing device 12, its function is to realize information transmission between the slave device 13 and the signal processing device 12. The counting pin in the embodiment of the present application takes the pin on the slave device 13 as an example.
[0058] The signal processing device 12 receives the data signal sent by the master device 11, parses and processes the data signal, generates an integer clock signal according to the byte length corresponding to the byte length information, sends the integer clock signal to each slave device 13 through the counting pin, and sends the data signal to each slave device 13 through the data output pin.
[0059] Each slave device 13 receives the integer clock signal, and determines whether the slave device 13 has chip selected itself (i.e., whether the master device 11 has chip selected this slave device 13) through the rising edge of the integer clock signal. If so, the data signal is received. Thus, the chip selection of each slave device is completed, and the master device 11 does not need to send a chip select signal through the chip select pin to select the slave device 13.
[0060] An embodiment of the present invention provides a communication system, which includes a master device, a signal processing device and at least one slave device; the master device is used to generate a data signal of a set format when a data transmission condition is met, and send it to the signal processing device through a data output pin; the signal processing device is used to generate an integer clock signal according to the data signal, and send the data signal to each slave device through the data output pin, and send the integer clock signal to each slave device through a counting pin; each slave device is used to receive the data signal according to the integer clock signal; wherein the data signal includes: at least one byte length information and a byte data signal corresponding to each byte length information The number of byte length information is determined by the number of slave devices, which solves the problem in the prior art that a chip select signal must be sent to the slave device during communication between the master device and the slave device. A data signal is generated according to the number of slave devices, and the data signal is processed by a signal processing device to generate an integer clock signal. The slave device receives the data signal according to the integer clock signal, and there is no need for the master device to send a chip select signal. Therefore, the master device does not need to set a pin for sending a chip select signal for each slave device, thereby saving the number of pins of the master device. The information of all slave devices is sent through one data signal, and there is no need to select the slave devices one by one and send them one by one, thereby achieving the effect of high-speed communication between the master and slave devices.
[0061] Embodiment 2
[0062] Figure 3 This is a schematic diagram of the structure of a communication system provided in Embodiment 2 of the present invention. The technical solution of this embodiment is further optimized on the basis of the above technical solution, such as Figure 3As shown, the embodiment of the present invention further optimizes the signal processing device 12, specifically including a digital integrated circuit chip 121 and an integer circuit 122; wherein the digital integrated circuit chip 121 is used to generate a digital clock signal according to the data signal, and send the digital clock signal to the integer circuit through the clock pin, and send the data signal to each slave device through the data output pin; the integer circuit 122 is used to convert the digital clock signal into an integer clock signal, and send the integer clock signal to each slave device 13 through the counting pin.
[0063] In this embodiment, the digital integrated circuit chip 121 (Field Programmable Gate Array, FPGA) can also be called a field programmable logic gate array, which is one of the physical implementation methods of digital circuits and has a programmable characteristic, that is, the user can specify the digital integrated circuit chip to implement a specific digital circuit through a program. The digital clock signal can be specifically understood as a high and low level signal formed by the digital integrated circuit 121 according to the data signal; the clock pin can be specifically understood as a pin in the digital integrated circuit chip 121 that sends a signal.
[0064] The digital integrated circuit chip 121 receives the data signal sent by the master device 11, parses the data signal, obtains the byte length carried in each byte length information, and generates a digital clock signal according to the byte length. Then the digital clock signal is sent to the shaping circuit 122 through the clock pin, and the data signal is sent to each slave device 13 through the data output pin.
[0065] In this embodiment, the shaping circuit can be specifically understood as a circuit that corrects the clock signal to achieve shaping. After receiving the digital clock signal sent by the digital integrated circuit chip 121, the shaping circuit performs shaping processing on the high and low level digital clock signals, converts them into an integer clock signal, and then sends the integer clock signal to the counting pin of each slave device 13, and the slave device 13 receives the integer clock signal through the counting pin.
[0066] Furthermore, the digital integrated circuit chip 121 includes:
[0067] A first signal generating module 1211, configured to generate a high level signal of a set byte length and an integrated clock signal according to a data signal;
[0068] The second signal generating module 1212 is used to generate a digital clock signal according to each high level signal and each integrated clock signal.
[0069] In this embodiment, the first signal generating module 1211 can be specifically understood as a module in the digital integrated circuit chip 121 that processes the data signal accordingly and generates high and low level signals. The second signal generating module 1212 can be specifically understood as a module that processes the signal generated by the first signal generating module 1211. The integrated clock signal can be specifically understood as a high and low level signal. The byte length can be set according to the requirements of chip data transmission in actual applications, for example, 8 bits.
[0070] The first signal generating module 1211 receives the data signal sent by the master device, and generates a high-level signal and an integrated clock signal of a set byte length according to the byte length information in the analyzed data signal by parsing the data signal. When parsing the data signal, the first signal generating module 1211 knows in advance the communication protocol used by the data signal, and can parse the data signal according to this communication protocol. The second signal generating module 1212 splices the high-level signals and the integrated clock signals generated by the first signal generating module to form a digital clock signal.
[0071] It is known that the sending of the digital clock signal and the data signal can be completed by any module with a data sending function in the digital integrated circuit 121, or can be completed by the modules mentioned in this embodiment, such as the first signal generating module or the second signal generating module. The embodiment of the present invention does not specifically limit this.
[0072] Furthermore, the first signal generating module 1211 is specifically configured to:
[0073] For each byte length information in the data signal, a high level signal for setting the byte length is generated;
[0074] The byte length information is parsed to determine the byte length corresponding to the byte length information, and an integrated clock signal of a corresponding length is generated according to the byte length.
[0075] Since the data signal may include byte length information and byte data information to be sent to multiple slave devices 13, for each byte length information, a high-level signal of a set byte length is first generated when the byte length information is received, and the length of the high-level signal has nothing to do with the byte length carried in the byte length information. After the high-level signal of the set byte length is generated, the byte length information is parsed to determine the size of the byte length carried in the byte length information, and then an integrated clock signal of the same length is generated according to the byte length.
[0076] After completing the processing of the first associated byte length information and byte data information, the high-level signal and integrated clock signal of the set byte length are continuously generated in the same manner, and the generated signals are sequentially spliced together to form a digital clock signal.
[0077] It should be noted that when the digital integrated circuit chip 121 generates a digital clock signal, it usually generates a digital clock signal while analyzing and processing the data signal to generate a high-level signal and an integrated clock signal, and forms a digital clock signal when the last integrated clock signal is generated. That is, the generated high-level signal and the integrated clock signal are directly used as part of the digital clock signal.
[0078] Furthermore, the shaping circuit 122 is specifically used to keep the continuous high-level signal in the digital clock signal unchanged, and convert the continuous high-level and low-level signals into continuous low-level signals to form a shaped clock signal.
[0079] The shaping circuit 122 has the function of shaping the clock signal. There are continuous high-level parts and continuous high-low-level parts in the digital clock signal. The continuous high-low levels in this embodiment refer to alternating high and low levels. When shaping, the shaping circuit 122 keeps the continuous high-level signal unchanged and converts the continuous high-low-level signal into a continuous low-level signal. In the shaping clock signal formed in this way, the high-level part corresponds to the byte length information, and the low-level part corresponds to the byte data information. When the slave device 13 receives the data signal and the shaping clock signal at the same time, the data sent to each slave device in the data signal can be divided according to the shaping clock signal.
[0080] The integrated circuit chip 121 is also used for:
[0081] After receiving the master device clock signal sent by the master device 11 through the clock pin, the operation is started;
[0082] The master device clock signal is sent to the shaping circuit 122 through the clock pin, so that the shaping circuit 122 starts working according to the master device clock signal and then sends the master device clock signal to each slave device 13 through the clock pin.
[0083] In this embodiment, the master device clock signal can be specifically understood as a clock signal sent by the master device, which is used to instruct the integrated circuit chip 121 and each slave device 13 to work, that is, the integrated circuit chip 121 and the slave device 13 can only start working and perform data processing or signal reception and transmission after receiving the master device clock signal.
[0084] When the master device 11 needs to send a data signal, it sends a master device clock signal to the integrated circuit chip 121 through the clock pin. The integrated circuit chip 121 starts working after receiving the master device clock signal, and then sends the master device clock signal to the shaping circuit 122 through the clock pin. The shaping circuit 122 starts working after receiving the master device clock signal, and sends the master device clock signal to each slave device 13 through the clock pin. After receiving the master device clock signal, the slave device 13 starts working.
[0085] Furthermore, the integrated circuit chip 121 is also used for:
[0086] Receive a synchronization frame signal sent by the master device 11 through a synchronization pin;
[0087] The synchronization frame signal is sent to each slave device 13 through the synchronization pin, so that each slave device 13 is synchronized with the master device 11.
[0088] In this embodiment, the synchronization frame signal can be specifically understood as a signal for instructing each device communicating with the master device 11 to synchronize, and the synchronization frame signal is sent by the master device 11 when sending a data signal. When the integrated circuit chip 121 and the slave device 13 communicate with the master device 11, in order to ensure that the data is authentic and valid, they need to synchronize with the master device 11.
[0089] When the master device 11 needs to send a data signal, it sends a synchronization frame signal to the integrated circuit chip 121 through the synchronization pin. After receiving the synchronization frame signal, the integrated circuit chip 121 synchronizes with the master device 11, and then sends the synchronization frame signal to each slave device 13 through the synchronization pin. After receiving the synchronization frame signal, each slave device 13 synchronizes with the master device 11.
[0090] Further, the slave device 13 includes:
[0091] The zeroing module 131 is used to reset the value of the corresponding slave node counter to zero when receiving the synchronization frame signal;
[0092] The accumulation module 132 is used to accumulate and add 1 to the value of the corresponding slave node counter when receiving the rising edge of the integer clock signal;
[0093] The receiving module 133 is used to receive a data signal when it is detected that the value of the corresponding slave node counter meets the data receiving condition.
[0094] In this embodiment, the zeroing module 131 can be specifically understood as a module that can implement the value zeroing processing; the slave node counter can be specifically a counter that can implement the counting function in the slave device, and each slave device has a corresponding slave node counter. The receiving condition can be specifically understood as a condition for determining whether the slave device needs to receive a data signal.
[0095] When the reset module 131 receives the synchronization frame signal sent by the integrated circuit chip 121, a data signal is transmitted at this time. Since it is necessary to judge whether to receive the data signal at this time based on the value of the slave node counter in the future, in order to avoid the influence of the last data transmission on this time, the value of the slave node counter of this device is reset to zero. Since there are high and low levels in the integer clock signal, the high level part corresponds to the byte length information, and the low level part corresponds to the byte data information. When the cumulative module 132 receives the rising edge of the integer clock signal, the value of the slave node counter of this device is accumulated and added by 1. The receiving module 133 monitors the value of the slave node counter at all times. When the value of the slave node counter meets the data reception condition, the master device 11 chip selects itself for communication, so the data signal can be received, otherwise the data signal is not received.
[0096] The step of determining whether the receiving condition is met may be: whether the value of the slave node counter is equal to the corresponding stored value, and if so, it is determined that the data receiving condition is met. The pre-stored values of each slave device 13 are different, so that each different slave device 13 can be distinguished. In a communication system, the corresponding stored value uniquely corresponds to each slave device.
[0097] It can be known that when the slave device 13 receives the synchronization frame signal and the shaping clock signal, the synchronization frame signal is received first because the synchronization frame signal is sent through the integrated circuit chip 121 and does not pass through the shaping circuit. In the prior art, the slave device is directly selected by the chip select signal, so the synchronization frame signal is not required for synchronization.
[0098] Furthermore, the receiving module 133 is further configured to generate a low level signal when receiving a data signal.
[0099] The receiving module 133 generates a low level signal while receiving the data signal, and the low level signal is used to chip select the slave device 13 .
[0100] Furthermore, the receiving module 133 is further configured to generate a high level signal when the data signal is not received.
[0101] When the slave device 13 is not chip selected, it does not receive data signals, and generates a high level signal to indicate that the slave device 13 is not chip selected by the master device 11. When the signal is high, the master device 11 and the slave device 13 do not communicate.
[0102] Furthermore, the slave device 13 is also used to send feedback information to the master device 11 according to a set feedback format and / or data signal when generating a low level signal and receiving a clock signal from the master device.
[0103] In this embodiment, setting the feedback format can be specifically understood as a pre-set data format. When the slave device 13 generates a low-level signal, it determines that it is selected by the chip select signal, and at the same time receives the master device clock signal sent by the master device 11, and then sends feedback information to the master device to form data exchange and realize synchronous full-duplex communication. When the chip select signal stops (changes from a low-level signal to a high-level signal), the slave device stops sending feedback information.
[0104] It can be known that the content and format of the feedback information can be agreed upon in advance, and when feedback is required to the master device 11, the feedback information is directly generated according to the set feedback format and sent to the master device 11; or after receiving the data signal, the data signal is analyzed to determine the information content required by the master device 11 to be fed back by the slave device 13, and then the feedback information is formed and sent to the master device 11. The feedback information of each slave device is assembled in groups and sent to the master device at the same time as the master device clock signal sent by the master device 11 is received.
[0105] It should be noted that the communication between the master device 11 and the slave device 13 is always initiated by the master device 11. When the master device 11 sends data to the slave device 13, the slave device 13 responds at the same time. The communication between the master device 11 and the slave device 13 is a synchronous full-duplex communication process in which both data output and data input are controlled by the same clock.
[0106] The embodiment of the present invention provides a communication system, which solves the problem in the prior art that a chip select signal must be sent to a slave device during communication between a master device and a slave device. A data signal is generated according to the number of slave devices, and the data signal is processed by a digital integrated circuit chip and an integer circuit to generate an integer clock signal. The slave device receives the data signal according to the integer clock signal, and there is no need for the master device to send a chip select signal. Therefore, the master device does not need to set a pin for sending a chip select signal for each slave device, thereby saving the number of pins of the master device. The information of all slave devices is sent through a data signal, and there is no need to select the slave devices one by one and send them one by one, thereby achieving the effect of high-speed communication between the master and slave devices.
[0107] For example, Figure 4 It is a structural example diagram of a communication system provided by an embodiment of the present invention. The communication system includes a master device 21, a signal processing device 22, a slave device 23 and a slave device 24. The signal processing device 22 includes a digital integrated circuit chip 221 and a shaping circuit 222. Figure 5A communication timing diagram of the communication system provided in an embodiment of the present invention when communicating, the diagram shows waveform examples of the synchronization frame signal, the master device clock signal and the data signal sent by the master device 21, the waveform example diagram of the digital clock signal processed by the digital integrated circuit chip 221, the waveform example diagram of the integer clock signal processed by the integer circuit 222, and the waveform example diagram of the chip select signal generated by the slave device 23 and the slave device 24 when communicating with the master device 21.
[0108] When the master device 21 is ready to send data (satisfies the data sending conditions), it sends a synchronization frame signal to the digital integrated circuit chip 221 through the synchronization pin SYNC. When generating the synchronization frame signal, the master device 21 sends a master device clock signal to the digital integrated circuit chip 221 through the clock pin CLK, and sends a data signal to the digital integrated circuit chip 221 through the data output pin MOSI.
[0109] The digital integrated circuit chip 221 receives the synchronization frame signal, the master device clock signal and the data signal. After receiving the synchronization frame signal, it starts to generate a high-level signal of the set byte length, parses the first byte length information received, and then generates an integrated clock signal of the corresponding byte length. After generating the integrated clock signal, it generates a high-level signal of the set byte length again, parses the next byte length information, and generates an integrated clock signal of the corresponding byte length. The high-level signal and the integrated clock signal of the set byte length are generated in sequence to form a digital clock signal. After the digital clock signal is formed, the digital clock signal is sent to the shaping circuit 222 through the clock pin CLK. At the same time, the synchronization frame signal is sent to the slave device 23 and the slave device 24 respectively through the synchronization pin SYNC, the data signal is sent to the slave device 23 and the slave device 24 through the data output pin MOSI, and the master device clock signal is sent to each slave device through the clock pin CLK.
[0110] After receiving the digital clock signal, the shaping circuit 222 keeps the continuous high-level signal in the digital clock signal unchanged, converts the continuous high and low-level signals into continuous low-level signals, forms an integer clock signal, and sends it to the counting pin CNT of the slave device 23 and the slave device 24. The slave device 23 and the slave device 24 receive the integer clock signal through the counting pin CNT.
[0111] For slave devices 23 and 24, when receiving the synchronization frame signal, the value of their own slave node counter is reset to zero; when receiving the rising edge of the integer clock signal, the value of the slave node counter is accumulated by 1, and the value is accumulated through the slave node counter. When the slave device 23 detects that the value of the slave node counter meets the data reception condition, the slave device 23 is chip selected and receives the data signal. That is, when receiving the first rising edge of the integer clock signal, the value of the slave node counter of the slave device 23 is 1, and the chip selection signal CS1 of the slave device 23 is generated. When the second rising edge of the shaping clock signal is received, the chip selection of the slave device 23 ends, and the chip selection signal CS2 of the slave device 24 is selected, and this is carried out in sequence until the next synchronization frame arrives, and the slave node counters of all slave devices are reset to zero. When receiving the master device clock signal, the slave devices 23 and 24 simultaneously send feedback information to the master device 21 through the data input pin MISO.
[0112] Embodiment 3
[0113] Figure 6 This is a flow chart of a communication method provided in Embodiment 3 of the present invention. The method is executed by the communication system provided in any embodiment of the present invention, and includes the following steps:
[0114] S310. When the data transmission conditions are met, the master device generates a data signal of a set format and sends it to the signal processing device through a data output pin.
[0115] S320. The signal processing device generates an integer clock signal according to the data signal, and sends the data signal to at least one slave device through a data output pin, and sends the integer clock signal to each of the slave devices through a counting pin.
[0116] S330. Each of the slave devices receives the data signal according to the integer clock signal.
[0117] The data signal includes: at least one byte length information and byte data information corresponding to each byte length information, and the number of the byte length information is determined by the number of the slave devices.
[0118] The embodiment of the present invention provides a communication method, which solves the problem in the prior art that a chip select signal must be sent to a slave device during communication between a master device and a slave device. A data signal is generated according to the number of slave devices, and the data signal is processed by a digital integrated circuit chip and an integer circuit to generate an integer clock signal. The slave device receives the data signal according to the integer clock signal, and there is no need for the master device to send a chip select signal. Therefore, the master device does not need to set a pin for sending a chip select signal for each slave device, thereby saving the number of pins of the master device. The information of all slave devices is sent through a data signal, and there is no need to select the slave devices one by one and send them one by one, thereby achieving the effect of high-speed communication between the master and slave devices.
[0119] Further, the signal processing device includes a digital integrated circuit chip and an integer circuit; accordingly, the signal processing device generates an integer clock signal according to the data signal, and sends the data signal to at least one slave device through a data output pin, and sends the integer clock signal to each of the slave devices through a counting pin, including:
[0120] The digital integrated circuit chip generates a digital clock signal according to the data signal, and sends the digital clock signal to the shaping circuit through a clock pin, and sends the data signal to each of the slave devices through a data output pin;
[0121] The shaping circuit converts the digital clock signal into an shaping clock signal, and sends the shaping clock signal to each of the slave devices through a counting pin.
[0122] Furthermore, the digital integrated circuit chip comprises: a first signal generating module and a second signal generating module, and the digital integrated circuit chip generates a digital clock signal according to the data signal, comprising:
[0123] The first signal generating module generates a high level signal and an integrated clock signal of a set byte length according to the data signal;
[0124] The second signal generating module forms a digital clock signal according to each of the high level signals and each integrated clock signal.
[0125] Furthermore, the first signal generating module generates a high level signal and an integrated clock signal of a set byte length according to the data signal, including:
[0126] For each byte length information in the data signal, a high level signal for setting the byte length is generated; the byte length information is parsed to determine the byte length corresponding to the byte length information, and an integrated clock signal of a corresponding length is generated according to the byte length.
[0127] Furthermore, the shaping circuit converts the digital clock signal into an shaping clock signal, and sends the shaping clock signal to each of the slave devices through a counting pin, including: the shaping circuit keeps the continuous high-level signal in the digital clock signal unchanged, and converts the continuous high and low-level signals into a continuous low-level signal to form an shaping clock signal.
[0128] Furthermore, the method further comprises:
[0129] The integrated circuit chip starts working after receiving the master device clock signal sent by the master device through the clock pin;
[0130] The integrated circuit chip sends the master device clock signal to the shaping circuit through the clock pin, so that the shaping circuit starts working according to the master device clock signal and then sends the master device clock signal to each of the slave devices through the clock pin.
[0131] Furthermore, the method further comprises:
[0132] The integrated circuit chip receives the synchronization frame signal sent by the master device through the synchronization pin;
[0133] The integrated circuit chip sends the synchronization frame signal to each of the slave devices through a synchronization pin, so that each of the slave devices is synchronized with the master device.
[0134] Furthermore, the slave device comprises: a zeroing module, an accumulation module and a receiving module. Each of the slave devices receives the data signal according to the integer clock signal, including:
[0135] When the reset module receives the synchronization frame signal, it resets the value of the corresponding slave node counter to zero;
[0136] When the accumulation module receives the rising edge of the integer clock signal, the value of the corresponding slave node counter is accumulated and added by 1;
[0137] The receiving module receives the data signal when monitoring that the value of the corresponding slave node counter meets the data receiving condition.
[0138] Furthermore, the method also includes: the receiving module generates a low level signal when receiving the data signal.
[0139] It is worth noting that in the embodiment of the above-mentioned communication system, the various units and modules included are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be realized; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present invention.
[0140] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.
Claims
1. A communication system, characterized in that: include: A master device, a signal processing device and at least one slave device; The master device is used to generate a data signal of a set format when a data transmission condition is met, and send the data signal to the signal processing device through a data output pin; The signal processing device is used to generate an integer clock signal according to the data signal, and send the data signal to each of the slave devices through a data output pin, and send the integer clock signal to each of the slave devices through a counting pin; Each of the slave devices is used to receive the data signal according to the integer clock signal; The data signal includes: at least one byte length information and byte data information corresponding to each byte length information, the number of the byte length information is equal to the number of the slave devices, the byte length information is used to indicate the length of the actual information transmitted, and the byte data information is the actual information transmitted from the master device to the slave device; The slave device comprises: An accumulation module, configured to add 1 to the value of the corresponding slave node counter when receiving the rising edge of the integer clock signal; The receiving module is used to receive the data signal when it is detected that the value of the corresponding slave node counter meets the data receiving condition.
2. The system according to claim 1, characterized in that The signal processing device comprises a digital integrated circuit chip and a shaping circuit; The digital integrated circuit chip is used to generate a digital clock signal according to the data signal, and send the digital clock signal to the shaping circuit through a clock pin, and send the data signal to each of the slave devices through a data output pin; The shaping circuit is used to convert the digital clock signal into an integer clock signal, and send the integer clock signal to each of the slave devices through a counting pin.
3. The system according to claim 2, characterized in that The digital integrated circuit chip comprises: A first signal generating module, used for generating a high level signal and an integrated clock signal of a set byte length according to the data signal; The second signal generating module is used to form a digital clock signal according to each of the high-level signals and each integrated clock signal.
4. The system according to claim 3, characterized in that The first signal generating module is specifically used for: For each byte length information in the data signal, generating a high level signal for setting the byte length; The byte length information is parsed to determine the byte length corresponding to the byte length information, and an integrated clock signal of a corresponding length is generated according to the byte length.
5. The system according to claim 2, characterized in that The shaping circuit is specifically used to keep the continuous high-level signal in the digital clock signal unchanged, and convert the continuous high-low level signals into continuous low-level signals to form a shaping clock signal.
6. The system according to claim 2, characterized in that The integrated circuit chip is also used for: After receiving the master device clock signal sent by the master device through the clock pin, the operation is started; The master device clock signal is sent to the shaping circuit through a clock pin, so that the shaping circuit starts working according to the master device clock signal and then sends the master device clock signal to each of the slave devices through the clock pin.
7. The system according to claim 2, characterized in that The integrated circuit chip is also used for: Receiving a synchronization frame signal sent by the master device through a synchronization pin; The synchronization frame signal is sent to each of the slave devices through a synchronization pin, so that each of the slave devices is synchronized with the master device.
8. The system according to claim 7, characterized in that The slave device comprises: The reset module is used to reset the value of the corresponding slave node counter to zero when receiving the synchronization frame signal.
9. The system according to claim 8, characterized in that The receiving module is further used to generate a low level signal when receiving the data signal.
10. A communication method, characterized in that: Executed by the communication system according to any one of claims 1 to 9, comprising: When the data transmission conditions are met, the master device generates a data signal of a set format and sends it to the signal processing device through the data output pin; The signal processing device generates an integer clock signal according to the data signal, and sends the data signal to at least one slave device through a data output pin, and sends the integer clock signal to each of the slave devices through a counting pin; Each of the slave devices receives the data signal according to the integer clock signal; The data signal includes: at least one byte length information and byte data information corresponding to each byte length information, the number of the byte length information is equal to the number of the slave devices, the byte length information is used to indicate the length of the actual information transmitted, and the byte data information is the actual information transmitted from the master device to the slave device; The slave device comprises: an accumulation module and a receiving module; When the accumulation module receives the rising edge of the integer clock signal, the value of the corresponding slave node counter is accumulated and added by 1; The receiving module receives the data signal when monitoring that the value of the corresponding slave node counter meets the data receiving condition.
Citation Information
Patent Citations
Enhanced serial peripheral interface
CN108027797A
