A SPI read-write control system and method

By using control signal circuits and relays in the SPI read and write control system, autonomous control and mode switching of SPI signals are achieved, and the problem that 1pin SPI_Data cannot be controlled freely during read and write is solved, and flexible read and write operations are realized.

CN112306923BActive Publication Date: 2025-04-25SUZHOU GUANGLINDA ELECTRONIC TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202011306716.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-11-20
Publication Date
2025-04-25
Estimated Expiration
2040-11-20

AI Technical Summary

Technical Problem

In the prior art, 1pin SPI_Data cannot control read and write freely when reading and writing SPI signals, resulting in the problem of limited reading data.

Method used

An SPI read and write control system is adopted, which includes a first control signal circuit, a second control signal circuit, a relay and an SPI read and write mode control circuit. The control of the relay is realized through these circuits and circuit components, thereby switching the read and write signals during the SPI read and write process.

Benefits of technology

It realizes the autonomous control of SPI signals, and can switch read and write modes freely in high-speed state, solving the problem of 1pin SPI_Data being limited during read and write.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112306923B_ABST
    Figure CN112306923B_ABST
Patent Text Reader

Abstract

The present invention provides an SPI read-write control system and method, including a method for realizing the separation of SPI signal reading and writing of a master device, and a connection method for reading and writing common ends of SPI signals from an IC end of a slave device. The present invention adopts two control signals of a signal machine, controls the on-off switching of a relay by means of a switching diode and a triode, and realizes the need for fast conversion of reading and writing in practical applications.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of SPI communication, and in particular to an SPI read-write control system and method. Background Art

[0002] SPI (Serial Peripheral Interface) is the abbreviation of serial peripheral interface. It is a synchronous serial interface technology launched by Motorola. It is a high-speed, full-duplex, synchronous communication bus.

[0003] Now SPI signal reading and writing are implemented using different 2-pin ports (SPI_MOSI and SPI_MISO). The host uses the SPI_MOSI port to write data to the slave, and the host uses the SPI_MISO port to read data from the slave. Some special IC chips have only 1-pin SPI_Data, and the same pin is used for reading and writing. When writing the address bit first and then reading the data, the reading and writing cannot be controlled freely, and the read data is limited. Summary of the invention

[0004] The technical problem to be solved by the present invention is: in order to overcome the shortcomings of the prior art that 1pin SPI_Data cannot freely control reading and writing when reading and writing SPI signals, and the read data is limited, the present invention provides an SPI read and write control system and method.

[0005] The technical solution to be adopted by the present invention to solve the technical problem is: an SPI read-write control system, including a first control signal circuit, a second control signal circuit, a relay and an SPI read-write mode control circuit, wherein:

[0006] A first control signal circuit outputs a first control signal for controlling the on-off switching of the relay RY5;

[0007] A second control signal circuit outputs a second control signal for controlling the on-off switching of the relay RY5;

[0008] Relay RY5, as a switching device, is used to control the on and off of the SPI_MOSI signal and SPI_MISO signal of the signal machine, as well as the on and off of the SPI read and write common pin signal of the IC chip; and the power pin of relay RY5 is connected to the (+5V) power supply VDD, and the ground pin of relay RY5 is connected to the first control signal and the second control signal; the SPI_MOSI signal of the signal machine is connected to the input contact 5 on one side of relay RY5, the SPI_MISO signal of the signal machine is connected to another input contact 7 on the same side of relay RY5, and the SPI read and write common pin signal of the IC chip is connected to the output terminal contact 6 on the same side of relay RY5;

[0009] The SPI read-write mode control circuit is used to realize the switching between the SPI read-write separate mode and the SPI read-write common mode.

[0010] Considering the differences in control signals that can be provided by traffic lights, the present invention is applicable to the principle that both control signals can achieve control.

[0011] Specifically, the first control signal circuit includes a transistor Q1 and resistors R31, R32 and R33. The base of the transistor Q1 is connected in series with the resistor R31 and then connected to the first control signal input terminal. The emitter of the transistor Q1 is connected in series with the resistor R32 and then connected to the ground. The collector of the transistor Q1 is connected in series with the resistor R33 and then connected to the ground pin of the relay RY5. The transistor Q1 acts as a switch, and the resistors R31, R32 and R33 act as current limiters.

[0012] Specifically, when the signal machine can provide an IO control signal for High / Low switching, the IO control signal that the signal machine can provide, that is, the EXT IO signal, is connected to the first control signal input terminal, and the relay RY5 is switched by switching between high and low, thereby realizing SPI read and write switching.

[0013] Specifically, the second control signal circuit includes a resistor R21 and a switching diode D7, the cathode of the switching diode D7 is connected to the power supply VDD, and the anode is connected to the ground pin of the relay RY5; one end of the resistor R21 is connected to the second control signal input end, and the other end is connected to the ground pin of the relay RY5.

[0014] Resistor R21 and switching diode D7 are connected to control the voltage of the grounding angle of relay RY5, thereby changing the voltage difference between the positive and negative poles of the relay to achieve switching control of relay RY5.

[0015] Specifically, when the signal machine can provide an IO control signal of Low / NC switching, the signal machine can provide an IO control signal connected to the second control signal as a SOL signal, and through the switching between low and NC, the relay RY5 is switched, thereby realizing the SPI read and write switching.

[0016] Specifically, the SPI read-write mode control circuit includes: the dip switch SW1 can select the RY5 output end to connect the SPI read-write common pin signal of the IC chip to the pin O_SPIMISO or the pin O_SPIMOSI. At this time, the resistor R29 is removed, the signal SPIMOSI input end is disconnected from the O_SPIMOSI output end, the resistor R30 is removed, the signal SPIMISO input end is disconnected from the signal O_SPIMISO output end, and the connection of the read-write signal is controlled by the relay RY5; when the SPI read-write non-common end mode of the IC chip is connected, the dip switch SW1 is OFF, the signal SPIMOSI input end is connected in series with the resistor R29 and the O_SPIMOSI output end, and the signal SPIMISO input end is connected in series with the signal O_SPIMISO output end after the resistor R30 is connected.

[0017] A SPI read-write control method includes two processes: relay mode control and SPI read-write mode control, wherein:

[0018] The relay mode control process includes:

[0019] (1) The first control signal EXT and transistor Q1 are used to control the on-off switching of relay RY5; the first control signal EXT switches between high level and low level to realize SPI read-write switching;

[0020] When the first control signal EXT input terminal is "ON", the EXT signal is high level and given to the base of transistor Q1, the emitter and collector of transistor Q1 are turned on, the ground pin of relay RY5 is GND, the SPI read and write common pin signal of IC chip at contact 6 of relay RY5 and the signal SPI_MOSI at contact 5 of RY5 are turned on.

[0021] When the first control signal EXT input terminal is input as "OFF", the EXT signal is at a low level and is given to the base of the transistor Q1, the emitter and collector of the transistor Q1 are not conducting, the switching diode D7 is reversely conducting, the ground pin of the relay RY5 is at a high voltage of 5V, the SPI read and write common pin signal of the IC chip at contact 6 of the relay RY5 and the signal SPI_MISO at contact 7 of RY5 are turned on.

[0022] (2) The second control signal SOL and the switching diode D7 are used to control the on-off switching of the relay RY5; the second control signal SOL switches between the low level "low level" and the floating "NC" to realize the SPI read-write switching;

[0023] When the second control signal SOL input terminal is input as "ON", the SOL signal is at a low level, the ground pin of relay RY5 is GND, the SPI read and write common pin signal of IC chip at contact 6 of relay RY5 and the signal SPI_MOSI at contact 5 of RY5 are turned on.

[0024] When the second control signal SOL input terminal is input as "OFF", the SOL signal is suspended "NC", the ground pin of relay RY5 is suspended, the switching diode D7 is reversed, the ground pin of RY5 is a high voltage 5V, the contact 6 of relay RY5, the SPI read and write common pin signal of the IC chip and the contact 5 signal SPI_MOSI of RY5 are turned on.

[0025] The SPI read and write mode control process includes: using the dial switch SW1 to control the SPI read and write modes.

[0026] (1) Normal SPI read and write separate mode;

[0027] When the SPI reading and writing of the IC chip are separated, turn the 1st and 2nd positions of the dip switch SW1 to the OFF state, the signal machine SPIMOSI and the IC read signal O_SPIMOSI are connected through the resistor R29, and the signal machine SPIMISO and the IC read signal O_SPIMISO are connected through the resistor R30.

[0028] (2) The SPI read and write common pin signal of the IC chip is led to O_SPIMISO;

[0029] When the SPI read / write common pin signal of the IC chip is led to O_SPIMISO, remove the resistors R29 and R30, turn the 1st position of the dip switch SW1 to the OFF state, and turn the 2nd position of the dip switch SW1 to the ON state, then the contact 6 of the relay RY5 sends the SPI read / write common pin signal of the IC chip to O_SPIMISO.

[0030] (3) The SPI read and write common pin signal of the IC chip is led to O_SPIMOSI;

[0031] When the SPI read / write common pin signal of the IC chip is led to O_SPIMOSI, remove the resistors R29 and R30, turn the 1st bit of the dip switch SW1 to the ON state, and turn the 2nd bit of the dip switch SW1 to the OFF state, then the contact 6 of the relay RY5 sends the SPI read / write common pin signal of the IC chip to O_SPIMOSI.

[0032] The beneficial effects of the present invention are as follows: the present invention provides an SPI read-write control system and method, which adopts software to freely control the SPI read and write switching to achieve mode conversion in a high-speed state. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] The present invention will be further described below in conjunction with the accompanying drawings and embodiments.

[0034] Figure 1 It is a schematic diagram of the principle of a connector for connecting the SPI output terminal of the present invention with an IC.

[0035] Figure 2 It is a schematic diagram of the SPI reading and writing principle of the present invention. DETAILED DESCRIPTION

[0036] The present invention will now be described in detail with reference to the accompanying drawings. This figure is a simplified schematic diagram, which only illustrates the basic structure of the present invention in a schematic manner, and therefore only shows the components related to the present invention.

[0037] like Figure 1-Figure 2 As shown, an SPI read-write control system of the present invention includes a first control signal circuit, a second control signal circuit, a relay and an SPI read-write mode control circuit, wherein:

[0038] A first control signal circuit outputs a first control signal for controlling the on-off switching of the relay RY5;

[0039] A second control signal circuit outputs a second control signal for controlling the on-off switching of the relay RY5;

[0040] Relay RY5, as a switching device, is used to control the on and off of the SPI_MOSI signal and SPI_MISO signal of the signal machine, as well as the on and off of the SPI read and write common pin signal of the IC chip; and the power pin of relay RY5 is connected to the (+5V) power supply VDD, and the ground pin of relay RY5 is connected to the first control signal and the second control signal; the SPI_MOSI signal of the signal machine is connected to the input contact 5 on one side of relay RY5, the SPI_MISO signal of the signal machine is connected to another input contact 7 on the same side of relay RY5, and the SPI read and write common pin signal of the IC chip is connected to the output terminal contact 6 on the same side of relay RY5;

[0041] The SPI read-write mode control circuit is used to realize the switching between the SPI read-write separate mode and the SPI read-write common mode.

[0042] Considering the differences in control signals that can be provided by traffic lights, the present invention is applicable to the principle that both control signals can achieve control.

[0043] Specifically, the first control signal circuit includes a transistor Q1 and resistors R31, R32 and R33. The base of the transistor Q1 is connected in series with the resistor R31 and then connected to the first control signal input terminal. The emitter of the transistor Q1 is connected in series with the resistor R32 and then connected to the ground. The collector of the transistor Q1 is connected in series with the resistor R33 and then connected to the ground pin of the relay RY5. The transistor Q1 acts as a switch, and the resistors R31, R32 and R33 act as current limiters.

[0044] Specifically, when the signal machine can provide an IO control signal for High / Low switching, the signal machine can provide an IO control signal connected to the first control signal as an EXT IO signal, and through high and low switching, the relay RY5 is switched, thereby realizing SPI read and write switching.

[0045] Specifically, the second control signal circuit includes a resistor R21 and a switching diode D7, the cathode of the switching diode D7 is connected to the power supply VDD, and the anode is connected to the ground pin of the relay RY5; one end of the resistor R21 is connected to the second control signal input end, and the other end is connected to the ground pin of the relay RY5.

[0046] Resistor R21 and switching diode D7 are connected to control the voltage of the grounding angle of relay RY5, thereby changing the voltage difference between the positive and negative poles of the relay to achieve switching control of relay RY5.

[0047] Specifically, when the signal machine can provide an IO control signal of Low / NC switching, the signal machine can provide an IO control signal connected to the second control signal as a SOL signal, and through the switching between low and NC, the relay RY5 is switched, thereby realizing the SPI read and write switching.

[0048] Specifically, the SPI read-write mode control circuit includes: the dip switch SW1 can select the RY5 output end to connect the SPI read-write common pin signal of the IC chip to the pin O_SPIMISO or the pin O_SPIMOSI. At this time, the resistor R29 is removed, the signal SPIMOSI input end is disconnected from the O_SPIMOSI output end, the resistor R30 is removed, the signal SPIMISO input end is disconnected from the signal O_SPIMISO output end, and the connection of the read-write signal is controlled by the relay RY5; when the SPI read-write non-common end mode of the IC chip is connected, the dip switch SW1 is OFF, the signal SPIMOSI input end is connected in series with the resistor R29 and the O_SPIMOSI output end, and the signal SPIMISO input end is connected in series with the signal O_SPIMISO output end after the resistor R30 is connected.

[0049] A SPI read-write control method includes two processes: relay mode control and SPI read-write mode control, wherein:

[0050] The relay mode control process includes:

[0051] (1) The first control signal EXT and transistor Q1 are used to control the on-off switching of relay RY5; the first control signal EXT switches between high level and low level to realize SPI read-write switching;

[0052] When the first control signal EXT input terminal is "ON", the EXT signal is high level and given to the base of transistor Q1, the emitter and collector of transistor Q1 are turned on, the ground pin of relay RY5 is GND, contact 6 of relay RY5, the SPI read and write common pin signal of the IC chip and contact 5 signal SPI_MOSI of RY5 are turned on.

[0053] When the first control signal EXT input terminal is input as "OFF", the EXT signal is at a low level and is given to the base of the transistor Q1, the emitter and collector of the transistor Q1 are not conducting, the switching diode D7 is reversely conducting, the ground pin of the relay RY5 is at a high voltage of 5V, the SPI read and write common pin signal of the IC chip at contact 6 of the relay RY5 and the signal SPI_MISO at contact 7 of RY5 are turned on.

[0054] (2) The second control signal SOL and the switching diode D7 are used to control the on-off switching of the relay RY5; the second control signal SOL switches between the low level "low level" and the floating "NC" to realize the SPI read-write switching;

[0055] When the second control signal SOL input terminal is input as "ON", the SOL signal is at a low level, the ground pin of relay RY5 is GND, the SPI read and write common pin signal of IC chip at contact 6 of relay RY5 and the signal SPI_MOSI at contact 5 of RY5 are turned on.

[0056] When the second control signal SOL input terminal is input to "OFF", the SOL signal is suspended "NC", the ground pin of relay RY5 is suspended, the switching diode D7 is reversed, the ground pin of RY5 is a high voltage 5V, the SPI read and write common pin signal of the IC chip at contact 6 of relay RY5 and the contact 5 signal SPI_MOSI of RY5 are turned on.

[0057] The SPI read and write mode control process includes: using the dial switch SW1 to control the SPI read and write modes.

[0058] (1) Normal SPI read and write separate mode;

[0059] When the SPI reading and writing of the IC chip are separated, turn the 1st and 2nd positions of the dip switch SW1 to the OFF state, the signal machine SPIMOSI and the IC read signal O_SPIMOSI are connected through the resistor R29, and the signal machine SPIMISO and the IC read signal O_SPIMISO are connected through the resistor R30.

[0060] (2) The SPI read and write common pin signal of the IC chip is led to O_SPIMISO;

[0061] When the SPI read / write common pin signal of the IC chip is led to O_SPIMISO, remove the resistors R29 and R30, turn the 1st position of the dip switch SW1 to the OFF state, and turn the 2nd position of the dip switch SW1 to the ON state, then the contact 6 of the relay RY5 sends the SPI read / write common pin signal of the IC chip to O_SPIMISO.

[0062] (3) The SPI read and write common pin signal of the IC chip is led to O_SPIMOSI;

[0063] When the SPI read / write common pin signal of the IC chip is led to O_SPIMOSI, remove the resistors R29 and R30, turn the 1st bit of the dip switch SW1 to the ON state, and turn the 2nd bit of the dip switch SW1 to the OFF state, then the contact 6 of the relay RY5 sends the SPI read / write common pin signal of the IC chip to O_SPIMOSI.

[0064] The master device related to the SPI signal is the signal machine sending end, and the slave device is the back end to which the connector CON3 of this design will be connected. In the middle, the fast control switching of SPI reading and writing is carried out through this design experiment.

[0065] Based on the above ideal embodiments of the present invention, the relevant staff can make various changes and modifications without departing from the scope of the present invention through the above description. The technical scope of this invention is not limited to the contents of the specification, and its technical scope must be determined according to the scope of the claims.

Claims

1. An SPI read-write control system, characterized in that: It includes a first control signal circuit, a second control signal circuit, a relay and an SPI read-write mode control circuit, wherein: A first control signal circuit outputs a first control signal for controlling the on-off switching of the relay RY5; A second control signal circuit outputs a second control signal for controlling the on-off switching of the relay RY5; Relay RY5 is used to control the on and off of the SPI_MOSI signal and the SPI_MISO signal of the signal machine, as well as the on and off of the SPI read and write common pin signal of the IC chip; and the power pin of relay RY5 is connected to the power supply VDD, and the ground pin of relay RY5 is connected to the first control signal and the second control signal; the SPI_MOSI signal of the signal machine is connected to the input contact 5 on one side of relay RY5, the SPI_MISO signal of the signal machine is connected to another input contact 7 on the same side of relay RY5, and the SPI read and write common pin signal of the IC chip is connected to the output terminal contact 6 on the same side of relay RY5; The SPI read-write mode control circuit is used to realize the switching between the SPI read-write separate mode and the SPI read-write common mode.

2. The SPI read-write control system according to claim 1, wherein: The first control signal circuit includes a transistor Q1 and resistors R31, R32 and R33. The base of the transistor Q1 is connected in series with the resistor R31 and then connected to the first control signal input terminal. The emitter of the transistor Q1 is connected in series with the resistor R32 and then connected to the ground. The collector of the transistor Q1 is connected in series with the resistor R33 and then connected to the ground pin of the relay RY5.

3. The SPI read-write control system according to claim 1 or 2, characterized in that: The first control signal is an EXT IO signal, which realizes SPI read-write switching by switching between high and low.

4. The SPI read-write control system according to claim 1, wherein: The second control signal circuit includes a resistor R21 and a switching diode D7, wherein the cathode of the switching diode D7 is connected to the power supply VDD, and the anode is connected to the ground pin of the relay RY5; one end of the resistor R21 is connected to the second control signal input end, and the other end is connected to the ground pin of the relay RY5.

5. The SPI read-write control system according to claim 1 or 4, characterized in that: The second control signal is a SOL signal, which implements SPI read-write switching by switching between low and NC.

6. The SPI read-write control system according to claim 1, characterized in that: The SPI read-write mode control circuit includes: the dip switch SW1 can select the RY5 output end to connect the SPI read-write common pin signal of the IC chip to the pin O_SPIMISO or the pin O_SPIMOSI, at this time, the resistor R29 is removed, the signal SPIMOSI input end is disconnected from the O_SPIMOSI output end, the resistor R30 is removed, the signal SPIMISO input end is disconnected from the signal O_SPIMISO output end, and the connection of the read-write signal is controlled by the relay RY5; when the SPI read-write non-common end mode of the IC chip is connected, the dip switch SW1 is OFF, the signal SPIMOSI input end is connected in series with the resistor R29 and the O_SPIMOSI output end, and the signal SPIMISO input end is connected in series with the resistor R30 and the signal O_SPIMISO output end.

7. A SPI read-write control method, characterized in that: It includes two processes: relay mode control and SPI read-write mode control. The relay mode control process includes: (1) The first control signal EXT and transistor Q1 are used to control the on-off switching of relay RY5; the first control signal EXT switches between high level and low level to realize SPI read-write switching; When the first control signal EXT input terminal is input as "ON", the EXT signal is at a high level and is given to the base of the transistor Q1, the emitter and collector of the transistor Q1 are turned on, the ground pin of the relay RY5 is GND, the contact 6 of the relay RY5, the SPI read / write common pin signal of the IC chip and the contact 5 signal SPI_MOSI of RY5 are turned on; When the first control signal EXT input terminal input is "OFF", the EXT signal is at a low level "low level" and is given to the base of the transistor Q1, the emitter and collector of the transistor Q1 are not conducting, the switch diode D7 is reversely conducting, the ground pin of the relay RY5 is at a high voltage of 5V, the SPI read and write common pin signal of the IC chip of the contact 6 of the relay RY5 and the signal SPI_MISO of the contact 7 of RY5 are conducting; (2) The second control signal SOL and the switch diode D7 are used to control the on-off switching of the relay RY5; the second control signal SOL switches between a low level "low level" and a floating "NC" to realize SPI read-write switching; When the second control signal SOL input terminal is "ON", the SOL signal is at a low level, the ground pin of relay RY5 is GND, the SPI read / write common pin signal of IC chip at contact 6 of relay RY5 and the signal SPI_MOSI at contact 5 of RY5 are turned on; When the second control signal SOL input terminal input is "OFF", the SOL signal is suspended "NC", the ground pin of relay RY5 is suspended, the switch diode D7 is reversely conducted, the ground pin of RY5 is a high voltage 5V, the SPI read and write common pin signal of the IC chip of contact 6 of relay RY5 and the contact 5 signal SPI_MOSI of RY5 are turned on; The SPI read and write mode control process includes: using the dial switch SW1 to control the SPI read and write modes: (1) Normal SPI read and write separate mode; When the SPI reading and writing of the IC chip are separated, turn the 1st and 2nd positions of the DIP switch SW1 to OFF, the signal machine SPIMOSI and the IC read signal O_SPIMOSI are connected through the resistor R29, and the signal machine SPIMISO and the IC read signal O_SPIMISO are connected through the resistor R30; (2) The SPI read and write common pin signal of the IC chip is led to O_SPIMISO; When the SPI read / write common pin signal of the IC chip is led to O_SPIMISO, remove the resistors R29 and R30, turn the 1st position of the dip switch SW1 to OFF, and turn the 2nd position of the dip switch SW1 to ON, then the contact 6 of the relay RY5 sends the SPI read / write common pin signal of the IC chip to O_SPIMISO; (3) The SPI read and write common pin signal of the IC chip is led to O_SPIMOSI; When the SPI read / write common pin signal of the IC chip is led to O_SPIMOSI, remove the resistors R29 and R30, turn the 1st bit of the dip switch SW1 to the ON state, and turn the 2nd bit of the dip switch SW1 to the OFF state, then the contact 6 of the relay RY5 sends the SPI read / write common pin signal of the IC chip to O_SPIMOSI.

Citation Information

Patent Citations

  • SPI read-write control system

    CN213338709U