SPI communication circuit and electronic equipment

By introducing a chip select signal generation module into the SPI communication circuit, the chip select signal is generated based on the clock signal, the problem of eliminating chip select signal lines in SPI communication is solved, the signal lines are simplified, the cost is reduced and the normality of communication is ensured. .

CN221977378UActive Publication Date: 2024-11-08SUZHOU BLUE STONE NEW POWER CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202420406761.6
Authority / Receiving Office
CN · China
Patent Type
Utility models(China)
Current Assignee / Owner
Filing Date
2024-03-04
Publication Date
2024-11-08
Estimated Expiration
2034-03-04

AI Technical Summary

Technical Problem

In SPI communication, the prior art requires the use of chip select signal lines to notify slaves to prepare data, increasing the number of signal lines and system complexity, resulting in technicians hoping to save chip select signal lines without affecting the normality of communication .

Method used

A SPI communication circuit is designed, by introducing a chip select signal generation module between the host and the slave, which generates a chip select signal based on the clock signal sent by the host and passes it to the slave, including the first and second Chip select signal generation module is used for clock signals with clock polarity 0 and 1, respectively. It uses NPN transistors and diodes and other components to achieve chip select signal generation to ensure that the clock signal waveform is not affected.

Benefits of technology

It realizes the elimination of chip select signal lines in SPI communication, reduces the number of I/O ports of the host, simplifies signal lines, reduces system complexity and cost, and ensures the normality of communication.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN221977378U_ABST
    Figure CN221977378U_ABST
Patent Text Reader

Abstract

The utility model provides an SPI communication circuit and electronic equipment, and relates to the technical field of communication. The SPI communication circuit comprises a host computer, a slave computer, a clock signal line and a chip selection signal generation module, the host computer is connected with the slave computer through the clock signal line, and a chip selection signal port of the slave computer is further connected to the clock signal line through the chip selection signal generation module; wherein the chip selection signal generation module is used for generating a chip selection signal according to a clock signal sent by the host, and transmitting the chip selection signal to the slave. According to the SPI communication circuit and the electronic equipment provided by the invention, a chip selection signal line can be saved under the condition that SPI communication is normal, so that the cost is saved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communication technology, and in particular to an SPI communication circuit and electronic equipment. Background Art

[0002] SPI (Serial Peripheral Interface) is a master-slave data communication protocol that is used in a standardized manner because of its simple protocol and efficient communication. It generally includes a clock signal line, two data signal lines, and a chip select signal line. Although the chip select signal is not required in the application, it must be used for multi-slave communication or when the slave needs to prepare data in real-time communication.

[0003] In real-time SPI communication, the host needs to provide a chip select signal to notify the slave to prepare the data and start data exchange when the clock signal arrives. This increases the number of signal lines and the complexity of the system.

[0004] In summary, how to ensure that the chip select signal line is omitted when the SPI communication is normal is a technical problem that needs to be solved urgently by those skilled in the art. Utility Model Content

[0005] The purpose of the present application is to provide an SPI communication circuit to solve the technical problem in the prior art of how to ensure that a chip select signal line is omitted when the SPI communication is normal.

[0006] Another object of the present application is to provide an electronic device to solve the technical problem in the prior art of how to ensure that the chip select signal line is omitted when the SPI communication is normal.

[0007] In order to achieve the above purpose, the technical solution adopted in the embodiment of the present application is as follows:

[0008] On the one hand, an embodiment of the present application provides an SPI communication circuit, the SPI communication circuit comprising: a host, a slave, a clock signal line and a chip select signal generation module, the host and the slave are connected through the clock signal line, and the chip select signal port of the slave is also connected to the clock signal line through the chip select signal generation module;

[0009] The chip select signal generating module is used to generate a chip select signal according to the clock signal sent by the host, and transmit the chip select signal to the slave.

[0010] Further, the chip select signal generating module includes a first chip select signal generating module and a second chip select signal generating module, and the slave is connected to the clock signal line through the first chip select signal generating module or the second chip select signal generating module;

[0011] Wherein, the first chip select signal generating module is used to generate a chip select signal according to the clock signal with a clock polarity of 0 sent by the host, and transmit it to the slave;

[0012] The second chip select signal generating module is used to generate a chip select signal according to a clock signal with a clock polarity of 1 sent by the host, and transmit the chip select signal to the slave.

[0013] Further, the first chip select signal generating module includes a first control unit and a first charge and discharge unit, one end of the first control unit is connected to the clock signal line, the other end of the first control unit is connected to the first charge and discharge unit, and the first charge and discharge unit is also connected to the chip select signal port of the slave;

[0014] The first control unit is used to control the first charge and discharge unit to generate a chip select signal according to a clock signal with a clock polarity of 0.

[0015] Furthermore, the first control unit includes a first switch tube and a first resistor, and the first charge and discharge unit includes a first capacitor and a second resistor;

[0016] One end of the first capacitor is connected to the chip select signal port of the slave, one end of the second resistor, and the second port of the first switch tube respectively, and the other end of the first capacitor is connected to the first port of the first switch tube and is grounded;

[0017] The other end of the second resistor is connected to a reference power supply, the control port of the first switch tube is connected to one end of the first resistor, and the other end of the first resistor is connected to the clock signal line.

[0018] Furthermore, the first switch tube is an NPN transistor, the control port of the first switch tube is the base of the NPN transistor, the first port of the first switch tube is the emitter of the NPN transistor, and the second port of the first switch tube is the collector of the NPN transistor.

[0019] Further, the second chip select signal generating module includes a second control unit and a second charge and discharge unit, one end of the second control unit is connected to the clock signal line, the other end of the second control unit is connected to the second charge and discharge unit, and the second charge and discharge unit is also connected to the chip select signal port of the slave;

[0020] The second control unit is used to control the second charge and discharge unit to generate a chip select signal according to a clock signal with a clock polarity of 1.

[0021] Further, the second control unit includes a diode, and the second charge and discharge unit includes a second capacitor and a third resistor;

[0022] One end of the second capacitor is respectively connected to the anode of the diode, one end of the third resistor, and the chip select signal port of the slave, and the other end of the second capacitor is grounded;

[0023] The cathode of the diode is connected to the clock signal line, and the other end of the third resistor is connected to a reference power supply.

[0024] Further, the second control unit includes a second switch tube and a fourth resistor, and the second charge and discharge unit includes a third capacitor;

[0025] One end of the third capacitor is connected to the second port of the second switch tube and the chip select signal port of the slave respectively, and the other end of the third capacitor is grounded;

[0026] The first port of the second switch tube is connected to the clock signal line, the control port of the second switch tube is connected to one end of the fourth resistor, and the other end of the fourth resistor is connected to a reference power supply.

[0027] Furthermore, the second charge and discharge unit further includes a fifth resistor, one end of the fifth resistor is respectively connected to one end of the fourth resistor and a reference power source, and the other end of the fifth resistor is connected to the second port of the second switch tube.

[0028] On the other hand, an embodiment of the present application further provides an electronic device, comprising the SPI communication circuit as described in any one of the aforementioned implementations.

[0029] Compared with the prior art, this application has the following beneficial effects:

[0030] The present application provides an SPI communication circuit and an electronic device, wherein the SPI communication circuit includes: a host, a slave, a clock signal line and a chip select signal generation module, wherein the host and the slave are connected via the clock signal line, and the chip select signal port of the slave is also connected to the clock signal line via the chip select signal generation module. The chip select signal generation module is used to generate a chip select signal according to the clock signal sent by the host, and transmit it to the slave. Moreover, the waveform of the clock signal will not be affected by the chip select signal generation module, thereby ensuring that when the SPI communication is normal, the chip select signal line is omitted, the number of I / O ports of the host is reduced, the signal line is simplified, and the cost is reduced.

[0031] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] In order to make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all of the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians of the art without making creative work are within the scope of protection of the present application.

[0033] Figure 1 A schematic diagram of the structure of an SPI communication circuit provided in an embodiment of the present application;

[0034] Figure 2 An SPI timing diagram with a clock phase of 0 provided in an embodiment of the present application;

[0035] Figure 3 An SPI timing diagram with a clock phase of 1 provided in an embodiment of the present application;

[0036] Figure 4 One of the structural schematic diagrams of an SPI communication circuit with a clock polarity of 0 provided in an embodiment of the present application;

[0037] Figure 5 One of the structural schematic diagrams of an SPI communication circuit with a clock polarity of 1 provided in an embodiment of the present application;

[0038] Figure 6 A second structural diagram of an SPI communication circuit with a clock polarity of 0 provided in an embodiment of the present application;

[0039] Figure 7 A circuit diagram of a first chip select signal generating module provided in an embodiment of the present application;

[0040] Figure 8 A waveform diagram of a clock signal with a clock polarity of 0 and a generated chip select signal provided in an embodiment of the present application;

[0041] Fig. 9 A second structural diagram of an SPI communication circuit with a clock polarity of 1 provided in an embodiment of the present application;

[0042] Fig.10 One of the circuit schematic diagrams of a second chip select signal generating module provided in an embodiment of the present application;

[0043] Fig.11 A waveform diagram of a clock signal with a clock polarity of 1 and a generated chip select signal provided in an embodiment of the present application;

[0044] Fig.12 A second circuit diagram of a second chip select signal generating module provided in an embodiment of the present application;

[0045] Fig.13 The third circuit diagram of a second chip select signal generating module provided in an embodiment of the present application.

[0046] Icons: 10 - SPI communication circuit; 100 - host; 200 - slave; 300 - chip select signal generation module; 310 - first chip select signal generation module; 311 - first control unit; 312 - first charge and discharge unit; 320 - second chip select signal generation module; 321 - second control unit; 322 - second charge and discharge unit. DETAILED DESCRIPTION

[0047] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.

[0048] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.

[0049] In the description of this application, it should be noted that relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. The term "connection" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be directly connected or indirectly connected through an intermediate medium.

[0050] SPI is a master-slave data communication protocol, which stipulates that the communication between two SPI devices must be controlled by the master. The master generates corresponding clock pulses according to the data to be exchanged. The clock pulses constitute the clock signal (SCK). The clock signal SCK controls when the two SPI devices exchange data and when to sample the received data through the clock polarity (CPOL) and clock phase (CPHA), thereby ensuring that the data is transmitted synchronously between the two devices.

[0051] Although the chip select signal (NSS) is not required in the application, it must be used for multi-slave communication or when the slave needs to prepare data in real-time communication.

[0052] In real-time SPI communication, the host needs to provide a chip select signal to notify the slave to prepare the data and start data exchange when the clock signal arrives. This increases the number of signal lines and the complexity of the system.

[0053] In summary, how to ensure that the chip select signal line is omitted when the SPI communication is normal is a technical problem that needs to be solved urgently by those skilled in the art.

[0054] See also Figure 1 , Figure 1 The structural diagram of a SPI communication circuit 10 provided in an embodiment of the present application is shown, and the SPI communication circuit 10 includes: a host 100, a slave 200, a clock signal line, and a chip select signal generation module 300. Among them, the host 100 is connected to the slave 200 through the clock signal line, and the chip select signal port of the slave 200 is also connected to the clock signal line through the chip select signal generation module 300.

[0055] The chip select signal generating module 300 is used to generate a chip select signal according to the clock signal (SCK) sent by the host 100, and transmit it to the slave 200. In addition, the waveform of the clock signal will not be affected by the chip select signal generating module 300, thereby ensuring that when the SPI communication is normal, the chip select signal line is omitted, the number of I / O ports of the host 100 is reduced, the signal line is simplified, and the cost is reduced.

[0056] Since the chip selection signal generation module 300 generates the chip selection signal according to the clock signal, Figure 2 and Figure 3 It can be seen that the polarity of the clock signal is divided into two types, namely, a clock signal with a clock polarity of 0 (CPOL=0) and a clock signal with a clock polarity of 1 (CPOL=1).

[0057] It should be noted that the clock polarity of 0 (CPOL=0) indicates that the clock signal is at a low level when in an idle state, and at a high level when the clock signal is valid.

[0058] The clock polarity is 1 (CPOL=1) which means that the clock signal is at a high level when in an idle state and at a low level when the clock signal is valid.

[0059] In order to ensure that clock signals with different clock polarities can generate chip select signals through the chip select signal generation module 300, please refer to Figure 4 and Figure 5 In the embodiment of the present application, the chip select signal generation module 300 includes a first chip select signal generation module 310 and a second chip select signal generation module 320. The chip select signal port of the slave 200 is connected to the clock signal line through the first chip select signal generation module 310 or the second chip select signal generation module 320.

[0060] The first chip select signal generating module 310 is used to generate a chip select signal according to a clock signal with a clock polarity of 0 sent by the host 100 , and transmit the chip select signal to the slave 200 .

[0061] The second chip select signal generating module 320 is used to generate a chip select signal according to a clock signal with a clock polarity of 1 sent by the host 100 , and transmit the chip select signal to the slave 200 .

[0062] Based on the above design, when the clock polarity of the clock signal sent by the host 100 is 0, the clock signal generates a chip select signal through the first chip select signal generating module 310. When the clock polarity of the clock signal sent by the host 100 is 1, the clock signal generates a chip select signal through the second chip select signal generating module 320. It is ensured that the chip select signal generating module 300 can generate chip select signals according to different types of clock signals, and the application scope of the chip select signal generating module 300 is expanded.

[0063] In order to better understand the working principle of the chip selection signal generating module 300, the first chip selection signal generating module 310 and the second chip selection signal generating module 320 will be described below respectively.

[0064] See also Figure 6 In the embodiment of the present application, the first chip select signal generating module 310 includes a first control unit 311 and a first charge and discharge unit 312. One end of the first control unit 311 is connected to the clock signal line, and the other end of the first control unit 311 is connected to the first charge and discharge unit 312. The first charge and discharge unit 312 is also connected to the chip select signal port of the slave 200.

[0065] The first control unit 311 is used to control the first charge and discharge unit 312 to generate a chip selection signal according to a clock signal with a clock polarity of 0.

[0066] Specifically, please refer to 7. In the embodiment of the present application, the first control unit 311 includes a first switch tube Q1 and a first resistor R1, and the first charge and discharge unit 312 includes a first capacitor C1 and a second resistor R2.

[0067] One end of the first capacitor C1 is connected to the chip select signal port of the slave 200, one end of the second resistor R2, and the second port of the first switch tube Q1, respectively, and the other end of the first capacitor C1 is connected to the first port of the first switch tube Q1 and grounded. The other end of the second resistor R2 is connected to the reference power supply VCC, the control port of the first switch tube Q1 is connected to one end of the first resistor R1, and the other end of the first resistor R1 is connected to the clock signal line.

[0068] Optionally, the first switch tube Q1 is an NPN transistor, the control port of the first switch tube Q1 is the base of the NPN transistor, the first port of the first switch tube Q1 is the emitter of the NPN transistor, and the second port of the first switch tube Q1 is the collector of the NPN transistor.

[0069] The working principle of the first chip selection signal generating module 310 can be found in Figure 7 and Figure 8 , before the high level of the clock signal with clock polarity 0 arrives, there is a long low level, causing the first switch tube Q1 to be turned off. The reference power supply VCC charges the first capacitor C1 through the second resistor R2. After the first capacitor C1 is charged, it maintains a high level state. At this time, the chip select signal is also high and is in an invalid state. When the clock signal is high, the first switch tube Q1 is turned on, the first capacitor C1 is quickly discharged through the first switch tube Q1, and the chip select signal is quickly converted to a low level and is in an effective state.

[0070] In the subsequent clock signal waveform, although there is a low-level process that can turn off the first switch tube Q1, the charging time of the first capacitor C1 is insufficient to convert the chip select signal to a high level, and the high-level pulse of the clock signal arrives again. Figure 8 The slightly upward voltage waveform on the middle chip select signal is caused by the first switch tube Q1 being turned off and the first capacitor C1 being charged.

[0071] Therefore, during the period of the clock signal pulse waveform, the chip select signal can maintain a low level. When the communication is completed, the clock signal no longer sends a waveform and remains at a low level. The first switch tube Q1 is continuously cut off, and the reference power supply VCC charges the first capacitor C1 through the first resistor R1. After a period of time, the chip select signal returns to an invalid high level state again.

[0072] The structure of the second chip selection signal generating module 320 is as follows Fig. 9As shown, in the embodiment of the present application, the second chip select signal generating module 320 includes a second control unit 321 and a second charge and discharge unit 322. One end of the second control unit 321 is connected to the clock signal line, and the other end of the second control unit 321 is connected to the second charge and discharge unit 322, and the second charge and discharge unit 322 is also connected to the chip select signal port of the slave 200.

[0073] The second control unit 321 is used to control the second charge and discharge unit 322 to generate a chip selection signal according to the clock signal with a clock polarity of 1.

[0074] Specifically, referring to FIG10 , as a feasible implementation manner, the second control unit 321 includes a diode D1 , and the second charge and discharge unit 322 includes a second capacitor C2 and a third resistor R3 .

[0075] One end of the second capacitor C2 is connected to the anode of the diode D1, one end of the third resistor R3, and the chip select signal port of the slave 200, and the other end of the second capacitor C2 is grounded. The cathode of the diode D1 is connected to the clock signal line, and the other end of the third resistor R3 is connected to the reference power supply VCC.

[0076] The working principle of the second chip selection signal generating module 320 can be found in Fig.10 and Fig.11 , before the clock signal with a clock polarity of 1 is at a low level, there is a long high level, causing the diode D1 to be cut off. The reference power supply VCC charges the second capacitor C2 through the third resistor R3. After the second capacitor C2 is charged, it maintains a high level state. At this time, the chip select signal is also at a high level and is in an invalid state. When the clock signal is at a low level, the diode D1 is turned on, the second capacitor C2 is quickly discharged through the diode D1, and the chip select signal is quickly converted to a low level and is in a valid state.

[0077] In the subsequent clock signal waveform, although there is a high-level process that can cut off the diode D1, the charging time of the second capacitor C2 is insufficient to convert the chip select signal into a high level, and the low-level pulse of the clock signal arrives again. Fig.11 The slightly upward voltage waveform on the chip select signal is caused by the diode D1 being cut off and the second capacitor C2 being charged.

[0078] Therefore, during the period of the clock signal pulse waveform, the chip select signal can maintain a low level. When the communication is completed, the clock signal no longer sends a waveform and remains at a high level. The diode D1 is continuously cut off, and the reference power supply VCC charges the second capacitor C2 through the third resistor R3. After a period of time, the chip select signal returns to an invalid high level state again.

[0079] In the embodiments of this application, please refer to Fig.12The second control unit 321 includes a second switch tube Q2 and a fourth resistor R4, and the second charge and discharge unit 322 includes a third capacitor C3.

[0080] One end of the third capacitor C3 is connected to the second port of the second switch tube Q2 and the chip select signal port of the slave 200, respectively, and the other end of the third capacitor C3 is grounded. The first port of the second switch tube Q2 is connected to the clock signal line, the control port of the second switch tube Q2 is connected to one end of the fourth resistor R4, and the other end of the fourth resistor R4 is connected to the reference power supply VCC.

[0081] Optionally, the second switch tube Q2 is an NPN transistor, the control port of the second switch tube Q2 is the base of the NPN transistor, the first port of the second switch tube Q2 is the emitter of the NPN transistor, and the second port of the second switch tube Q2 is the collector of the NPN transistor.

[0082] Based on the above design, before the clock signal with a clock polarity of 1 reaches a low level, there is a long high level, causing the second switch tube Q2 to be turned off. The reference power supply VCC charges the third capacitor C3 through the fourth resistor R4. After the third capacitor C3 is charged, it maintains a high level state. At this time, the chip select signal is also a high level and is in an invalid state. When the clock signal is a low level, the second switch tube Q2 is turned on, the third capacitor C3 is quickly discharged through the second switch tube Q2, and the chip select signal is quickly converted to a low level and is in an effective state.

[0083] In the subsequent clock signal waveform, although there is a high-level process that can turn off the second switch tube Q2, the charging time of the third capacitor C3 is insufficient to convert the chip select signal to a high level, and the low-level pulse of the clock signal arrives again. Fig.11 The slightly upward voltage waveform on the middle chip select signal is caused by the second switch tube Q2 being turned off and the third capacitor C3 being charged.

[0084] Therefore, during the period of the clock signal pulse waveform, the chip select signal can maintain a low level. When the communication is completed, the clock signal no longer sends a waveform and remains at a high level. The second switch tube Q2 continues to be cut off, and the reference power supply VCC charges the third capacitor C3 through the fourth resistor R4. After a period of time, the chip select signal returns to an invalid high level state again.

[0085] As another alternative implementation, see Fig.13 The second charge-discharge unit 322 further includes a fifth resistor R5, one end of the fifth resistor R5 is respectively connected to one end of the fourth resistor R4 and the reference power source VCC, and the other end of the fifth resistor R5 is connected to the second port of the second switch tube Q2. When the second switch tube Q2 is turned off, the reference power source VCC charges the third capacitor C3 through the fourth resistor R4 and the fifth resistor R5.

[0086] Please note that Figure 8 and Fig.11 , since the chip select signal obtained after being processed by the chip select signal generating module 300 is triggered by a clock signal, for example Figure 8 After the clock signal with clock polarity 0 is at a high level, the first switch tube Q1 is turned on to generate a low-level chip select signal, so the chip select signal will lag behind the clock signal by one cycle. Fig.11 The chip select signal in the communication will also lag behind the clock signal by one cycle. In order to avoid data misalignment during communication, a clock pulse needs to be added through software to ensure normal communication.

[0087] Furthermore, an embodiment of the present application also provides an electronic device, which includes the SPI communication circuit 10 as described in any of the aforementioned implementations.

[0088] In summary, the present application provides an SPI communication circuit and an electronic device, wherein the SPI communication circuit includes: a host, a slave, a clock signal line and a chip select signal generation module, wherein the host and the slave are connected via the clock signal line, and the chip select signal port of the slave is also connected to the clock signal line via the chip select signal generation module. The chip select signal generation module is used to generate a chip select signal according to the clock signal sent by the host, and transmit it to the slave. Moreover, the waveform of the clock signal will not be affected by the chip select signal generation module, thereby ensuring that when the SPI communication is normal, the chip select signal line is omitted, the number of I / O ports of the host is reduced, the signal line is simplified, and the cost is reduced.

[0089] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

[0090] It will be apparent to those skilled in the art that the present application is not limited to the details of the exemplary embodiments described above, and that the present application can be implemented in other specific forms without departing from the spirit or essential features of the present application. Therefore, the embodiments should be considered exemplary and non-limiting in all respects, and the scope of the present application is defined by the appended claims rather than the above description, and it is intended that all changes falling within the meaning and scope of the equivalent elements of the claims be included in the present application. Any reference numeral in a claim should not be considered as limiting the claim to which it relates.

Claims

1. An SPI communication circuit, characterized in that: The SPI communication circuit includes: a host, a slave, a clock signal line and a chip select signal generation module, wherein the host and the slave are connected via the clock signal line, and the chip select signal port of the slave is also connected to the clock signal line via the chip select signal generation module; wherein, The chip select signal generating module is used to generate a chip select signal according to the clock signal sent by the host and transmit the chip select signal to the slave.

2. The SPI communication circuit according to claim 1, wherein: The chip select signal generating module includes a first chip select signal generating module and a second chip select signal generating module, and the slave is connected to the clock signal line through the first chip select signal generating module or the second chip select signal generating module; wherein, The first chip select signal generating module is used to generate a chip select signal according to the clock signal with a clock polarity of 0 sent by the host, and transmit the chip select signal to the slave; The second chip select signal generating module is used to generate a chip select signal according to the clock signal with a clock polarity of 1 sent by the host, and transmit the chip select signal to the slave.

3. The SPI communication circuit according to claim 2, wherein: The first chip select signal generating module includes a first control unit and a first charge and discharge unit, one end of the first control unit is connected to the clock signal line, the other end of the first control unit is connected to the first charge and discharge unit, and the first charge and discharge unit is also connected to the chip select signal port of the slave; wherein, The first control unit is configured to control the first charge and discharge unit to generate a chip select signal according to a clock signal with a clock polarity of 0.

4. The SPI communication circuit according to claim 3, characterized in that: The first control unit includes a first switch tube and a first resistor, and the first charge and discharge unit includes a first capacitor and a second resistor; wherein, One end of the first capacitor is connected to the chip select signal port of the slave, one end of the second resistor, and the second port of the first switch tube respectively, and the other end of the first capacitor is connected to the first port of the first switch tube and is grounded; The other end of the second resistor is connected to a reference power supply, the control port of the first switch tube is connected to one end of the first resistor, and the other end of the first resistor is connected to the clock signal line.

5. The SPI communication circuit according to claim 4, characterized in that: The first switch tube is an NPN transistor, the control port of the first switch tube is the base of the NPN transistor, the first port of the first switch tube is the emitter of the NPN transistor, and the second port of the first switch tube is the collector of the NPN transistor.

6. The SPI communication circuit according to claim 2, characterized in that: The second chip select signal generating module includes a second control unit and a second charge and discharge unit, one end of the second control unit is connected to the clock signal line, the other end of the second control unit is connected to the second charge and discharge unit, and the second charge and discharge unit is also connected to the chip select signal port of the slave; wherein, The second control unit is configured to control the second charge and discharge unit to generate a chip select signal according to a clock signal with a clock polarity of 1.

7. The SPI communication circuit according to claim 6, characterized in that: The second control unit includes a diode, and the second charge and discharge unit includes a second capacitor and a third resistor; wherein, One end of the second capacitor is connected to the anode of the diode, one end of the third resistor, and the chip select signal port of the slave device, respectively, and the other end of the second capacitor is grounded; The cathode of the diode is connected to the clock signal line, and the other end of the third resistor is connected to a reference power supply.

8. The SPI communication circuit according to claim 6, wherein: The second control unit includes a second switch tube and a fourth resistor, and the second charge and discharge unit includes a third capacitor; wherein, One end of the third capacitor is connected to the second port of the second switch tube and the chip select signal port of the slave device respectively, and the other end of the third capacitor is grounded; The first port of the second switch tube is connected to the clock signal line, the control port of the second switch tube is connected to one end of the fourth resistor, and the other end of the fourth resistor is connected to a reference power supply.

9. The SPI communication circuit according to claim 8, characterized in that: The second charge and discharge unit further includes a fifth resistor, one end of which is respectively connected to one end of the fourth resistor and a reference power supply, and the other end of the fifth resistor is connected to the second port of the second switch tube.

10. An electronic device, characterized in that: The electronic device comprises the SPI communication circuit according to any one of claims 1 to 9.