Start signal processing circuit and communication system
Through the polling and switching mechanism of the dual-signal identification circuit and chip selection circuit, the communication interruption problem caused by multiple START signals in I2C communication is solved, ensuring the reliability and robustness of I2C communication.
Patent Information
- Application Number
- CN202510529486.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-25
- Publication Date
- 2025-07-25
- Estimated Expiration
- 2045-04-25
AI Technical Summary
In I2C communication, due to the communication interruption problem caused by multiple consecutive start signals (START signals) occurring, the existing circuit cannot accurately identify and restart the communication.
The dual signal recognition circuit is adopted and the polling and switching mechanism of the chip selection circuit is used to ensure independent working in different chip selection states, the START signal is identified through alternate detection priority, and the I2C communication is forced to restart after a valid signal is detected.
Continuous identification and communication recovery of any number of START signals is realized, the reliability and robustness of I2C communication is improved, and communication blockage caused by timing conflicts is avoided.
Smart Images

Figure CN120067000B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of digital integrated circuit technology, and particularly to a start signal processing circuit and a communication system. Background Art
[0002] I2C (Inter-Integrated Circuit) is a common serial communication protocol and also a two-wire communication protocol, which is simple and flexible and is mainly used to connect low-speed peripheral devices such as sensors, EEPROMs, real-time clocks (RTCs), LCD displays, etc.
[0003] In the I2C communication protocol, the start signal (START) is triggered by the SDA signal line changing from high level to low level during the high level of the SCL clock. However, during the I2C communication process, multiple START signals may continuously appear in the I2C-related communication link due to reasons such as level fluctuations and non-standard communication protocols.
[0004] In a conventional I2C start signal processing circuit, it is usually designed to start I2C communication when the SCL signal line outputs a high level and the SDA signal line outputs a falling edge. However, if a START signal is received again immediately at this time, the circuit may not be able to recognize it, resulting in the circuit being unable to restart I2C communication. Summary of the Invention
[0005] In view of this, embodiments of this application provide a start signal processing circuit and a communication system, mainly aiming to solve the technical problem that inaccurate recognition of the START signal leads to the inability to start I2C communication.
[0006] According to an aspect of the present application, a start signal processing circuit is provided, which is applied to a digital circuit using the I2C serial communication protocol. The start signal processing circuit includes a first signal recognition circuit, a second signal recognition circuit, a chip select circuit, and a signal output circuit. Wherein, the data input terminal of the first signal recognition circuit is connected to the inverted output terminal of the chip select circuit and the SCL signal line, the clock input terminal is connected to the SDA signal line, and the output terminal is connected to the first input terminal of the signal output circuit; the data input terminal of the second signal recognition circuit is connected to the forward output terminal of the chip select circuit and the SCL signal line, the clock input terminal is connected to the SDA signal line, and the output terminal is connected to the second input terminal of the signal output circuit; the data input terminal of the chip select circuit is connected to the SCL signal line, and the clock input terminal is connected to the SDA signal line; the output terminal of the signal output circuit is connected to at least one slave device to be communicated; wherein, when the chip select circuit outputs a first logic signal and the first signal recognition circuit outputs a second logic signal, or, when the chip select circuit outputs a second logic signal and the second signal recognition circuit outputs a second logic signal, the signal output circuit outputs a start signal to the slave device.
[0007] Optionally, the first signal recognition circuit includes a first signal acquisition module, a first signal synchronization module, and a first signal integration module; the data input terminal of the first signal acquisition module is connected to the inverted output terminal of the chip select circuit and the SCL signal line, and the clock input terminal is connected to the SDA signal line; the data input terminal of the first signal synchronization module is connected to the output terminal of the first signal acquisition module, and the clock input terminal is connected to the SCL signal line; the first input terminal of the first signal integration module is connected to the output terminal of the first signal acquisition module, the second input terminal is connected to the output terminal of the first signal synchronization module, and the output terminal is connected to the first input terminal of the signal output circuit.
[0008] Optionally, the first signal acquisition module includes a first D flip-flop, which is used to follow the logical AND operation signal of the inverted signal of the chip select signal output by the chip select circuit and the signal output by the SCL signal line when the SDA signal line outputs a falling edge, so as to output a first acquisition signal; the first signal synchronization module includes a second D flip-flop, which is used to follow the first acquisition signal when the SCL signal line outputs a rising edge, so as to output a first synchronization signal; the first signal output module includes a first NOT gate unit and a first AND gate unit, which are used to invert the first synchronization signal and perform a logical AND operation on the first acquisition signal and the inverted signal of the first synchronization signal, so as to output a first start signal.
[0009] Optionally, the second signal recognition circuit includes a second signal acquisition module, a second signal synchronization module, and a second signal integration module; the data input terminal of the second signal acquisition module is connected to the positive output terminal of the chip selection circuit and the SCL signal line, and the clock input terminal is connected to the SDA signal line; the data input terminal of the second signal synchronization module is connected to the output terminal of the second signal acquisition module, and the clock input terminal is connected to the SCL signal line; the first input terminal of the second signal integration module is connected to the output terminal of the second signal acquisition module, the second input terminal is connected to the output terminal of the second signal synchronization module, and the output terminal is connected to the second input terminal of the signal output circuit.
[0010] Optionally, the second signal acquisition module includes a third D flip-flop, which is used to follow the logical AND operation signal of the chip selection signal output by the chip selection circuit and the signal output by the SCL signal line when the SDA signal line outputs a falling edge, so as to output a second acquisition signal; the second signal synchronization module includes a fourth D flip-flop, which is used to follow the second acquisition signal when the SCL signal line outputs a rising edge, so as to output a second synchronization signal; the second signal output module includes a second NOT gate unit and a second AND gate unit, which are used to invert the second synchronization signal and perform a logical AND operation on the second acquisition signal and the inverted signal of the second synchronization signal, so as to output a second start signal.
[0011] Optionally, the chip selection circuit includes a third signal acquisition module, a positive output module, and a negative output module; the data input terminal of the third signal acquisition module is connected to the SCL signal line, and the clock input terminal is connected to the SDA signal line; the first input terminal of the negative output module is connected to the output terminal of the third signal acquisition module, the second input terminal is connected to the SCL signal line, and the output terminal is connected to the data input terminal of the first signal recognition circuit; the first input terminal of the positive output module is connected to the output terminal of the third signal acquisition module, the second input terminal is connected to the SCL signal line, and the output terminal is connected to the data input terminal of the second signal recognition circuit.
[0012] Optionally, the third signal acquisition module includes a fifth flip-flop, which is used to follow the signal output by the SCL signal line when the SDA signal line outputs a falling edge, so as to output a chip selection signal; the negative output module includes a third NOT gate unit and a third AND gate unit, which are used to invert the chip selection signal and input the logical AND operation signal of the inverted signal of the chip selection signal and the signal output by the SCL signal line into the data input terminal of the first signal recognition circuit; the positive output module includes a fourth AND gate unit, which is used to input the logical AND operation signal of the chip selection signal and the signal output by the SCL signal line into the data input terminal of the second signal recognition circuit.
[0013] Optionally, the reverse output module further includes a fourth NOT gate unit and a fifth AND gate unit, configured to invert the chip select signal, and input the inverted signal of the chip select signal and the logical AND operation signal of the first start signal output by the first signal recognition circuit into the first input end of the signal output circuit; the forward output module further includes a sixth AND gate unit, configured to input the logical AND operation signal of the chip select signal and the second start signal output by the second signal recognition circuit into the second input end of the signal output circuit.
[0014] Optionally, the signal output circuit includes an exclusive OR unit, wherein a first input end of the exclusive OR unit is connected to an output end of the first signal recognition circuit, a second input end is connected to an output end of the second signal recognition circuit, and an output end is connected to the slave device; alternatively, the first input end of the exclusive OR unit is connected to the output end of the first signal recognition circuit and the reverse output end of the chip select circuit, the second input end is connected to the output end of the second signal recognition circuit and the forward output end of the chip select circuit, and the output end is connected to the slave device.
[0015] According to another aspect of the present application, there is provided a communication system, including a master device, at least one slave device, and the start signal processing circuit as described in any one of the above, wherein the start signal processing circuit is connected between the master device and the at least one slave device.
[0016] By means of the above technical solution, the start signal processing circuit and the communication system provided by the embodiments of the present application can solve the problem of communication interruption caused by the repeated continuous appearance of START signals (start signals) in traditional I2C communication by setting two signal recognition circuits and using the polling switching mechanism of the chip select circuit. In the present application, the two signal recognition circuits can work independently in two states where the chip select signal is the first logic signal (such as low level) or the second logic signal (such as high level). When a valid START signal is detected, regardless of the current chip select state, the start signal output can be triggered and the I2C communication can be restarted. Based on this, when multiple START signals are continuously generated in the I2C communication link, the dynamic switching mechanism of the chip select circuit enables the two signal recognition circuits to alternately obtain the detection priority. Therefore, each START event can be independently recognized and trigger the communication reset. This circuit design method enables the bus state machine to have self-recovery ability. Even if the previous communication is not completed, the new START signal can still force the bus back to the known initial state and restart the I2C communication, thereby ensuring the reliability and robustness of the I2C communication.
[0017] The above description is only an overview of the technical solution of the present application. In order to understand the technical means of the present application more clearly, it can be implemented according to the content of the specification. And in order to make the above and other objects, features and advantages of the present application more obvious and understandable, the specific embodiments of the present application are specifically exemplified below. Description of the Drawings
[0018] The drawings described herein are used to provide a further understanding of the present application and form a part of the present application. The schematic embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation to the present application. In the drawings:
[0019] Figure 1 A circuit schematic diagram of a start signal processing circuit provided by the prior art is shown;
[0020] Figure 2 A waveform diagram of a start signal processing circuit provided by the prior art when encountering two consecutive start signals is shown;
[0021] Figure 3 A waveform diagram of a start signal processing circuit provided by the prior art when encountering three consecutive start signals is shown;
[0022] Figure 4 A structural schematic diagram of a start signal processing circuit provided by an embodiment of the present application is shown;
[0023] Figure 5 A structural schematic diagram of another start signal processing circuit provided by an embodiment of the present application is shown;
[0024] Figure 6 A circuit schematic diagram of a start signal processing circuit provided by an embodiment of the present application is shown;
[0025] Figure 7 A waveform diagram of a start signal processing circuit provided by an embodiment of the present application when encountering two consecutive start signals is shown;
[0026] Figure 8 A waveform diagram of a start signal processing circuit provided by an embodiment of the present application when encountering three consecutive start signals is shown. Detailed Embodiments
[0027] The present application will be described in detail below with reference to the drawings and in conjunction with the embodiments. It should be noted that, without conflict, the embodiments in the present application and the features in the embodiments can be combined with each other.
[0028] In the I2C serial communication protocol, the start signal (START signal) needs to meet the condition that the SDA signal transitions from high to low during the high level of SCL. However, the level fluctuations of the SCL and SDA communication links when the MCU is powered on, as well as consecutive START / STOP signals, may cause the state machine to fail due to timing conflicts or incorrect reset, thus preventing the restart of I2C communication.
[0029] For example, a traditional START signal recognition circuit is as follows Figure 1 shown. In this circuit, the falling edge of SDA is used as the sampling clock. When the SCL signal is high during sampling, the start_1 signal is set to 1; otherwise, the start_1 signal is set to 0. Then, the rising edge of SCL is used as the synchronization clock to synchronize the start_1 signal by one beat, generating the start_1_dl0 signal. In this scenario, when the start_1 signal is high and the start_1_dl0 signal is low (the start_1 signal has not been synchronized), the start_bit signal is set to high to initiate an I2C communication. At this time, the slave device can detect the start signal on the bus, start listening for the slave address sent on the bus, and prepare for data interaction with the master device.
[0030] However, during I2C communication, multiple START signals may appear consecutively. For example, when the I2C slave device is already powered on normally and the MCU connected to the peripheral device is powered on, the I2C-related communication link may generate level fluctuations, resulting in special waveforms similar to START signals. Or, the I2C master device may also send a START signal again without sending an end signal (STOP signal) and initiate a new data transmission. In this scenario, two or three START signals may be generated consecutively on the I2C communication link. At this time, the waveform diagrams of this circuit are as follows Figure 2 and Figure 3 shown. As shown in the waveforms in the figure, in the traditional I2C circuit design, an I2C communication can be initiated when SCL is high and SDA is at the falling edge. However, if a START signal is received again at this time, the circuit cannot effectively recognize it, thus preventing the restart of I2C communication and causing the I2C communication to fail.
[0031] To address the above problems, in one embodiment, as follows Figure 4As shown, a start signal processing circuit is provided. The above circuit can be applied to digital circuits using the I2C serial communication protocol. The circuit includes a first signal recognition circuit 10, a second signal recognition circuit 20, a chip select circuit 30, and a signal output circuit 40. Among them, the data input terminal of the first signal recognition circuit 10 is connected to the inverted output terminal of the chip select circuit 30 and the SCL signal line, the clock input terminal is connected to the SDA signal line, and the output terminal is connected to the first input terminal of the signal output circuit 40; the data input terminal of the second signal recognition circuit 20 is connected to the forward output terminal of the chip select circuit 30 and the SCL signal line, the clock input terminal is connected to the SDA signal line, and the output terminal is connected to the second input terminal of the signal output circuit 40; the data input terminal of the chip select circuit 30 is connected to the SCL signal line, the clock input terminal is connected to the SDA signal line; the output terminal of the signal output circuit 40 is connected to at least one slave device to be communicated. Among them, when the chip select circuit 30 outputs a first logic signal and the first signal recognition circuit 10 outputs a second logic signal, or when the chip select circuit 30 outputs a second logic signal and the second signal recognition circuit 20 outputs a second logic signal, the signal output circuit outputs a start signal to the slave device.
[0032] In this embodiment, the chip select circuit 30 can generate a chip select signal (SEL) according to the timing relationship between the SCL signal and the SDA signal. Specifically, when the chip select signal is a first logic signal (such as a low level), the first signal recognition circuit 10 is activated. At this time, the first signal recognition circuit 10 can use the falling edge of the SDA as a clock trigger to detect whether the SCL signal is high at the falling edge moment, so as to judge whether the signal on the I2C communication link is a valid START signal; conversely, when the chip select signal switches to a second logic signal (such as a high level), the second signal recognition circuit 20 is activated and performs the same detection logic. Based on this, the two signal recognition circuits can work alternately through the chip select signal, so as to ensure that the START signal can be independently recognized in different chip select states. Further, when the chip select circuit 30 outputs a first logic signal and the first recognition circuit 10 detects a valid START signal, or when the chip select circuit 30 outputs a second logic signal and the second recognition circuit 20 detects a valid START signal, the signal output circuit 40 can output a start signal to the slave device. In this embodiment, this time-division multiplexing mechanism enables the circuit to continuously recognize the START signal multiple times, and the state machine can be reset by switching through the chip select circuit after each recognition, so as to avoid the state machine entering an unknown state due to multiple consecutive START signals.
[0033] In a traditional start signal processing circuit, when START signals continuously appear multiple times in an I2C communication link, the state machine may enter a deadlock state due to timing conflicts or signal omissions, resulting in subsequent communication failures. The start signal processing circuit proposed in this embodiment can solve this problem through a triple mechanism: First, the above circuit uses two recognition circuits to work in parallel, which can cover two states of the chip select signal, thus eliminating the detection blind spot; Second, using the falling edge of SDA as the detection clock to synchronously sample the SCL level can ensure that the detection process complies with the physical layer specifications of the I2C protocol; Finally, through the forced restart mechanism, the I2C communication can be triggered immediately after detecting a valid START signal, thereby blocking the accumulation of error states. In this embodiment, the two signal recognition circuits can work independently under two logic signals of the chip select signal. When a valid START signal is detected, regardless of the current chip select state, the start signal output can be triggered to restart the I2C communication. Since the recognition of each START signal is accompanied by chip select switching and the reset of the state machine, even if START signals are triggered continuously multiple times, the system can ensure that the state machine starts from a known initial state after each START by alternately using two recognition channels, thus avoiding communication blockage. Therefore, the above circuit design can achieve continuous recognition of START signals of any number and communication recovery through time-division multiplexing and forced reset mechanisms, thereby improving the reliability and robustness of I2C communication.
[0034] In this embodiment, by setting two signal recognition circuits and using the polling switching mechanism of the chip select circuit, the problem of communication interruption caused by multiple consecutive START signals (start signals) in traditional I2C communication can be solved. In this application, the two signal recognition circuits can work independently in two states where the chip select signal is the first logic signal (such as low level) or the second logic signal (such as high level). When a valid START signal is detected, regardless of the current chip select state, the start signal output can be triggered and the I2C communication can be restarted. Based on this, when multiple START signals are continuously generated in the I2C communication link, the dynamic switching mechanism of the chip select circuit enables the two signal recognition circuits to alternately obtain the detection priority. Therefore, each START event can be independently recognized and trigger communication reset. This circuit design method enables the bus state machine to have self-recovery ability. Even if the previous communication is not completed, the new START signal can still force the bus back to a known initial state and restart the I2C communication, thus ensuring the reliability and robustness of I2C communication.
[0035] In one embodiment, the first signal recognition circuit includes a first signal acquisition module, a first signal synchronization module, and a first signal integration module. Among them, the data input terminal of the first signal acquisition module is connected to the inverted output terminal of the chip select circuit and the SCL signal line, and the clock input terminal is connected to the SDA signal line; the data input terminal of the first signal synchronization module is connected to the output terminal of the first signal acquisition module, and the clock input terminal is connected to the SCL signal line; the first input terminal of the first signal integration module is connected to the output terminal of the first signal acquisition module, the second input terminal is connected to the output terminal of the first signal synchronization module, and the output terminal is connected to the first input terminal of the signal output circuit.
[0036] Specifically, the first signal recognition circuit can accurately recognize the START signal through the first signal acquisition module, the first signal synchronization module, and the first signal integration module. Among them, the first signal acquisition module can perform a logical AND operation on the inverted signal of the chip select signal output by the chip select circuit and the SCL signal, and only when the chip select circuit outputs the first logic signal (such as a low-level signal), allows the SCL signal to pass, and uses the falling edge of the SDA as the trigger condition to capture the falling edge of the SDA during the high level of the SCL (i.e., the feature of the START signal). Further, the first signal synchronization module can synchronize the acquired signal using the rising edge of the SCL to eliminate timing deviation. Finally, the first signal integration module can compare the acquired signal and the synchronized signal, and use a logical AND operation to determine whether the falling edge of the SDA meets the condition of "SCL is at a high level", thereby outputting a valid first start signal.
[0037] The first signal recognition circuit proposed in this embodiment can improve the reliability of START signal recognition. Even under the interference of continuous START / STOP signals, it can ensure that each detection starts from a known timing starting point through chip select switching and state reset, thereby preventing the I2C state machine from entering an unknown state due to timing errors.
[0038] In one embodiment, such as Figure 6As shown in the figure, the first signal acquisition module includes a first D flip-flop D1 triggered by a falling edge. The first D flip-flop D1 can be used to follow the logical AND operation signal of the inverted signal of the chip select signal Sel output by the chip select circuit 30 and the signal output by the SCL signal line when a falling edge appears on the SDA signal line, so as to output a first acquisition signal Start_1; the first signal synchronization module includes a second D flip-flop D2 triggered by a rising edge. The second D flip-flop D2 can be used to follow the first acquisition signal Start_1 when a rising edge appears on the SCL signal line, so as to output a first synchronization signal Start_1_d10; the first signal output module includes a first NOT gate unit N1 and a first AND gate unit A1. The first NOT gate unit N1 can be used to invert the first synchronization signal Start_1_d10, and the first AND gate unit A1 can be used to perform a logical AND operation on the first acquisition signal Start_1 and the inverted signal of the first synchronization signal Start_1_d10, so as to output a first start signal.
[0039] Specifically, the first signal acquisition module can use a D flip-flop D1 triggered by a falling edge. When a falling edge appears on the SDA, D1 can latch the logical AND result of the inverted signal of the chip select signal and the SCL, and generate a first acquisition signal Start_1; the first signal synchronization module can use a D flip-flop D2 triggered by a rising edge to sample Start_1 when a rising edge appears on the SCL and output a synchronization signal Start_1_d10, so as to ensure timing alignment; the first signal integration module can invert Start_1_d10 through the first NOT gate N1 and then perform a logical AND operation with Start_1. In this scenario, only when Start_1 is high (indicating that the SDA falling edge is valid) and Start_1_d10 is low (indicating that the synchronization signal has not been triggered), the first start signal is output. This logical combination verifies the condition that "the SDA falling edge occurs during the SCL high level", so that the output START signal conforms to the legal start signal defined by the I2C protocol.
[0040] During the I2C communication process, there may be situations where multiple START signals appear continuously. All situations can be divided into two cases: an even number of consecutive START signals and an odd number of consecutive START signals. The following combines two examples to analyze the above two cases separately.
[0041] Example 1, such as Figure 7As shown, when the MCU connected to the peripheral device is powered on, there are voltage fluctuations on the SCL / SDA lines, generating a START signal. At this time, SCL outputs a high level, SDA is pulled down, the chip select signal Sel is at a low level, START_bit is pulled high, and a start signal is output. After that, SCL is normally pulled high. After the signals are synchronized, START_bit is pulled low, and the signal returns to the initial state. After that, I2C communicates normally. SCL outputs a high level, SDA is pulled down, and a START signal is generated again. At this time, the chip select signal Sel is at a high level, START_bit is pulled high again, and a start signal is output. After that, SCL is pulled high, the signals are synchronized, and START_bit is pulled low, returning to the initial state again. It can be seen that although an incorrect START signal is generated before normal I2C communication, the subsequent I2C communication is still normal.
[0042] Example 2, as Figure 8 As shown, when the MCU connected to the peripheral device is powered on, there are voltage fluctuations on the SCL / SDA lines, generating two START signals. At this time, SCL outputs a high level, SDA is pulled down, generating the first START signal. The chip select signal Sel is at a low level, START_bit is pulled high, and a start signal is output. After that, SCL is pulled up. After the signals are synchronized, START_bit is pulled low, returning to the initial state. After that, SCL outputs a high level, SDA is pulled down, generating the second START signal. The chip select signal Sel is at a high level, START_bit is pulled high again, and a start signal is output. After that, SCL is pulled up. After the signals are synchronized, START_bit is pulled low, returning to the initial state again. After that, I2C starts to communicate normally. SCL outputs a high level, SDA is pulled down, generating the third START signal. At this time, the chip select signal Sel is at a low level, START_bit is pulled high again, and a start signal is output. After that, I2C continues to communicate normally. SCL is pulled up. After the signals are synchronized, START_bit is pulled low, returning to the initial state. It can be seen that although two incorrect START signals are generated before normal I2C communication, the subsequent I2C communication is still normal.
[0043] By analogy, it can be deduced that: after any number of START signals are generated, the subsequent I2C communication can still communicate normally. It should be noted that for the convenience of waveform description, Figure 7 and Figure 8 The waveforms shown are not consistent with Figure 6 the waveforms actually generated by the circuit. In Figure 6 the actually generated waveforms, in the first cycle of the initial power-on stage, the chip select signal Sel should be at a high level. Therefore, Figure 7 and Figure 8The waveform shown is the result after delaying the waveform output by the chip select circuit by one cycle. It can be understood that this waveform description method does not conflict with the actual working principle of the circuit, and the actual working principle remains the same.
[0044] Through precise trigger edge control and logical operations, the above embodiment can achieve hardware-level low-latency detection of the START signal. In addition, through the switching of the chip select signal, the above circuit can support independent detection of the START signal multiple times in a row. After each detection, the state can be reset to avoid state machine blocking, thus solving the problem of communication interruption caused by multiple START / STOP signals in traditional I2C communication.
[0045] In one embodiment, the second signal recognition circuit includes a second signal acquisition module, a second signal synchronization module, and a second signal integration module. Among them, the data input terminal of the second signal acquisition module is connected to the positive output terminal of the chip select circuit and the SCL signal line, and the clock input terminal is connected to the SDA signal line; the data input terminal of the second signal synchronization module is connected to the output terminal of the second signal acquisition module, and the clock input terminal is connected to the SCL signal line; the first input terminal of the second signal integration module is connected to the output terminal of the second signal acquisition module, the second input terminal is connected to the output terminal of the second signal synchronization module, and the output terminal is connected to the second input terminal of the signal output circuit.
[0046] Specifically, the second signal recognition circuit can independently detect the START signal when the chip select circuit outputs the chip select signal through the second signal acquisition module, the second signal synchronization module, and the second signal integration module. Among them, the second signal acquisition module can perform a logical AND operation on the chip select signal and the SCL signal, and only when the chip select signal is valid, use the falling edge of the SDA as the trigger condition to capture the falling edge of the SDA when the SCL is at a high level; the second signal synchronization module can synchronize the signal output by the second signal acquisition module using the rising edge of the SCL; the second signal integration module can verify the timing consistency of the falling edge of the SDA and the high level of the SCL by comparing the original acquisition signal and the synchronized signal, and finally output the second start signal.
[0047] By setting the second signal recognition circuit that complements the division of labor with the first signal recognition circuit, the above embodiment can achieve dual-channel alternating detection of the START signal. This detection mechanism combining dual channels and chip select switching enables the circuit to continuously detect the START signal multiple times. That is, when the first channel enters an unknown state due to continuous signals, the chip select circuit can switch to the second channel and restart communication through the detection path of the second channel, thus solving the blocking problem of the traditional I2C state machine caused by multiple START / STOP signals.
[0048] In one embodiment, asFigure 6 As shown in Figure 6 , the second signal acquisition module includes a third D flip-flop D3, which can be used to follow the logical AND operation signal of the chip select signal Sel output by the chip select circuit 30 and the SCL signal when the SDA signal line outputs a falling edge, so as to output a second acquisition signal Start_2; the second signal synchronization module includes a fourth D flip-flop D4, which can be used to follow the second acquisition signal Start_2 when the SCL signal line outputs a rising edge, so as to output a second synchronization signal Start_2_d10; the second signal output module includes a second NOT gate unit N2 and a second AND gate unit A2. The second NOT gate unit N2 can be used to invert the second synchronization signal Start_2_d10, and the second AND gate unit A2 can be used to perform a logical AND operation on the second acquisition signal Start_2 and the inverted signal of the second synchronization signal Start_2_d10, so as to output a second start signal.
[0049] Specifically, the second signal acquisition module can use the third D flip-flop D3. When a falling edge appears on the SDA, D3 can latch the logical AND result of the chip select signal SEL and the SCL signal, and generate a second acquisition signal Start_2; the second signal synchronization module can be implemented by the fourth D flip-flop D4, sampling the rising edge of Start_2 during the high level of the SCL, and outputting a synchronization signal Start_2_d10; the second signal integration module can use the second NOT gate N2 to invert Start_2_d10, and then perform a logical AND operation on Start_2 and the inverted signal of Start_2_d10 through the second AND gate A2. In this scenario, only when Start_2 is high (the SDA falling edge is valid) and Start_2_d10 is low (the synchronization signal has not been triggered), the circuit can output a second start signal. This logical combination can accurately reproduce the START signal condition of "SDA falls during the high level of SCL" in the I2C protocol. It can be understood that the working principle of the above circuit can be viewed in the examples of the first signal recognition circuit related embodiments, which will not be elaborated here.
[0050] In this embodiment, through precise trigger edge control and logical operations, the symmetry and complementarity between the second signal recognition circuit and the first circuit can be ensured. Moreover, through the switching of the chip select signal, the above circuit can form a redundant detection path with the first signal recognition circuit, and the state machine can be reset by switching channels each time the START signal is triggered, thus avoiding the timing accumulation error caused by continuous communication, supporting any number of START signals, and not affecting the reliability of subsequent communications.
[0051] In one embodiment, the chip select circuit includes a third signal acquisition module, a forward output module, and a reverse output module. The data input terminal of the third signal acquisition module is connected to the SCL signal line, and the clock input terminal is connected to the SDA signal line; the first input terminal of the reverse output module is connected to the output terminal of the third signal acquisition module, the second input terminal is connected to the SCL signal line, and the output terminal is connected to the data input terminal of the first signal recognition circuit; the first input terminal of the forward output module is connected to the output terminal of the third signal acquisition module, the second input terminal is connected to the SCL signal line, and the output terminal is connected to the data input terminal of the second signal recognition circuit.
[0052] Specifically, the chip select circuit can be composed of a third signal acquisition module, a forward output module, and a reverse output module. This circuit can control the first signal recognition circuit and the second signal recognition circuit to work alternately by generating a chip select signal. Among them, the third signal acquisition module uses the falling edge of SDA as the clock trigger condition, and follows the SCL signal to generate a chip select signal (Sel), which can reflect the current bus state. The forward output module can perform a logical AND operation on Sel and SCL, and output a forward chip select signal to the second signal recognition circuit; the reverse output module can perform a logical AND operation on the inverted signal of Sel and SCL, and output a reverse chip select signal to the first signal recognition circuit. Through the positive and negative switching of the chip select signal, the above circuit enables the two signal recognition circuits to work independently in different chip select states and realizes time division multiplexing.
[0053] The above embodiment can provide mutually exclusive detection windows for the two recognition circuits by dynamically switching the chip select signal. This mutual exclusion mechanism can ensure that the two channels do not detect the START signal at the same time, thus avoiding the problem of timing conflicts. At the same time, the logical AND operation of the chip select signal and SCL can ensure that the output takes effect only when SCL is valid (high level), preventing false triggering caused by the low level of SCL. By alternately enabling the two channels in this embodiment, the START signal can be continuously detected multiple times, and the state machine is reset each time a switch is made, thereby solving the communication blocking problem caused by multiple START / STOP signals in traditional I2C.
[0054] In one embodiment, as Figure 6As shown, the third signal acquisition module includes a fifth flip-flop D5. The fifth flip-flop D5 can be used to follow the signal output on the SCL signal line when a falling edge signal is output on the SDA signal line, so as to output a chip select signal Sel; the reverse output module includes a third NOT gate unit N3 and a third AND gate unit A3. The third NOT gate unit N3 can be used to invert the chip select signal Sel, and input the logical AND operation signal of the inverted signal of the chip select signal Sel and the signal output on the SCL signal line into the data input terminal of the first signal recognition circuit 10; the forward output module includes a fourth AND gate unit A4. The fourth AND gate unit A4 can be used to input the logical AND operation signal of the chip select signal Sel and the signal output on the SCL signal line into the data input terminal of the second signal recognition circuit 20.
[0055] Specifically, the third signal acquisition module can use a fifth flip-flop D5. When a falling edge is output on the SDA, D5 can latch the SCL signal and output it as the chip select signal Sel. For example, if the falling edge of the SDA triggers D5, the Sel output by D5 will follow the current level of the SCL. In addition, the reverse output module can invert Sel through the third NOT gate N3, and then perform a logical AND operation with the SCL to generate an inverted chip select signal and input it into the first signal recognition circuit; the forward output module can perform a logical AND operation on Sel and the SCL through the fourth AND gate A4, and generate a forward chip select signal and input it into the second signal recognition circuit.
[0056] Through the combination of flip-flops and gate circuits in the above embodiments, it can be ensured that the generation and switching of the chip select signal completely depend on the timing relationship of the bus signals (SCL and SDA). In addition, through hardware-level timing control in this embodiment, low-delay and highly reliable generation of the chip select signal can be achieved, thereby providing stable switching conditions for dual-channel detection, so as to ensure the continuity and anti-interference ability of the START signal detection.
[0057] In one embodiment, as Figure 5 and Figure 6 shown, the reverse output module further includes a fourth NOT gate unit N4 and a fifth AND gate unit A5. The fourth NOT gate unit N4 is used to invert the chip select signal Sel, and input the logical AND operation signal of the inverted signal of the chip select signal Sel and the first start signal output by the first signal recognition circuit 10 into the first input terminal of the signal output circuit 40; the forward output module further includes a sixth AND gate unit A6. The sixth AND gate unit A6 is used to input the logical AND operation signal of the chip select signal Sel and the second start signal output by the second signal recognition circuit 20 into the second input terminal of the signal output circuit 40.
[0058] Specifically, in the reverse output module, a fourth NOT gate unit N4 can be added to invert the chip select signal Sel, and after performing a logical AND operation with the first start signal output by the first signal recognition circuit, it is input into the first input terminal of the signal output circuit; in the forward output module, a sixth AND gate unit A6 can be added to perform a logical AND operation on the chip select signal Sel and the second start signal output by the second signal recognition circuit and then input it into the second input terminal of the signal output circuit. In this embodiment, by adding the fourth NOT gate unit N4, the fifth AND gate unit A5, and the sixth AND gate unit A6, the chip select signal can be combined with the detection results of the corresponding recognition circuit, and only when the chip select signal is valid and the START signal is detected, the signal output circuit is triggered to output the start signal, thereby further improving the reliability of I2C communication.
[0059] Through the double logical AND operation in the above embodiment, a double verification mechanism for chip select state matching and START signal detection can be achieved. This design ensures that the signal output circuit is triggered only when the chip select state is consistent with the detection result, thereby eliminating the error output caused by reasons such as chip select switching delay or misjudgment of the recognition circuit.
[0060] In one embodiment, as Figure 5 and Figure 6 shown, the signal output circuit includes an exclusive OR unit X1. Among them, the first input terminal of the exclusive OR unit X1 is connected to the output terminal of the first signal recognition circuit 10, the second input terminal is connected to the output terminal of the second signal recognition circuit 20, and the output terminal is connected to the slave device to be communicated; alternatively, the first input terminal of the exclusive OR unit X1 is connected to the output terminal of the first signal recognition circuit 10 and the reverse output terminal of the chip select circuit 30, the second input terminal is connected to the output terminal of the second signal recognition circuit 20 and the forward output terminal of the chip select circuit 30, and the output terminal is connected to the slave device to be communicated.
[0061] Specifically, the above signal output circuit can be implemented by the exclusive OR unit X1. Among them, the exclusive OR unit X1 can be used to compare the output signals of the first signal recognition circuit and the second signal recognition circuit. When and only when one of the recognition circuits detects a valid START signal (output is high level) while the other does not detect (output is low level), the exclusive OR unit X1 can output a high level, thereby triggering the start signal to the slave device. For example, if the first signal recognition circuit detects the START signal while the second circuit does not detect the START signal, the exclusive OR result is 1, and vice versa. The above connection method can implement a mutually exclusive and valid judgment mechanism through exclusive OR logic, so as to ensure that the start signal is triggered only when a single recognition circuit detects the START signal, thereby avoiding the problem of simultaneous mis-triggering of the dual channels.
[0062] Furthermore, the signal output circuit can also combine the chip select signal and the output of the identification circuit through the XOR unit X1, thereby realizing dual verification of the chip select state and the detection result. Specifically, the first input end of the signal output circuit can AND the output signal of the first signal identification circuit with the reverse output of the chip select circuit. Only when the chip select signal is in the reverse state and the first signal identification circuit detects the START signal, the path outputs a high level; the second input end of the signal output circuit can AND the output of the second signal identification circuit with the positive output (SEL) of the chip select circuit. Only when the chip select is in the positive state and the second signal identification circuit detects the START signal, the path outputs a high level. Subsequently, the XOR unit X1 can perform an XOR operation on the logical AND results of the two input ends, and finally output a high-level start signal.
[0063] The above embodiment can solve the potential missed detection or false detection problem by binding the chip select signal and the detection result. The above connection method can ensure that only the detection result of the currently activated identification circuit can be included in the final judgment. Therefore, even if the two identification circuits output high levels at the same time due to timing deviation, only the channel matching the current chip select state will be adopted, thereby avoiding the problem of logic conflict.
[0064] In one embodiment, a communication system is provided, which includes a master device, at least one slave device, and a start signal processing circuit as described in any of the above embodiments, wherein the start signal processing circuit can be connected between the master device and the at least one slave device.
[0065] Specifically, the above communication system may be composed of a master device (such as a microcontroller, etc.), at least one slave device (such as a memory, a temperature sensor, an expander, etc.), and the start signal processing circuit described in any of the above embodiments. The above start signal processing circuit may be arranged on the SCL and SDA signal lines between the master device and the slave device, and its core module (chip select circuit, dual signal recognition circuit, signal output circuit) may manage the I2C communication process through a time-division multiplexing mechanism, thereby realizing continuous recognition and communication recovery of any number of START signals, thereby improving the reliability of I2C communication in the communication system.
[0066] The above-mentioned communication system can realize accurate control of the START signal of the I2C protocol by setting up a start signal processing circuit with hardware-level timing management and time-division multiplexing mechanism, thereby solving the communication blocking and anti-interference problems in traditional circuits, making the above-mentioned communication system suitable for high-reliability scenarios such as industrial control and embedded sensing.
[0067] The technical features of the above embodiments can be combined arbitrarily. For the sake of concise description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered as the scope described in this specification.
[0068] The above-described embodiments merely represent several implementation manners of the present application. The description is relatively specific and detailed, but it should not be construed as a limitation on the scope of the patent of the present application. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present application, several modifications and improvements can still be made, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the appended claims.
Claims
1. A start signal processing circuit, which is applied to a digital circuit using the I2C serial communication protocol, is characterized in that, The starting signal processing circuit includes a first signal recognition circuit, a second signal recognition circuit, a chip selection circuit, and a signal output circuit, where the data input terminal of the first signal recognition circuit is connected to the reverse output terminal of the chip selection circuit and the SCL signal line, the clock input terminal is connected to the SDA signal line, and the output terminal is connected to the first input terminal of the signal output circuit; the data input terminal of the second signal recognition circuit is connected to the forward output terminal of the chip selection circuit and the SCL signal line, the clock input terminal is connected to the SDA signal line, and the output terminal is connected to the second input terminal of the signal output circuit; the data input terminal of the chip selection circuit is connected to the SCL signal line, the clock input terminal is connected to the SDA signal line; the output terminal of the signal output circuit is connected to at least one slave device to be communicated with; the chip selection circuit includes a third signal acquisition module, a forward output module, and a reverse output module; the data input terminal of the third signal acquisition module is connected to the SCL signal line, the clock input terminal is connected to the SDA signal line; the first input terminal of the reverse output module is connected to the output terminal of the third signal acquisition module, the second input terminal is connected to the SCL signal line, and the output terminal is connected to the data input terminal of the first signal recognition circuit; the first input terminal of the forward output module is connected to the output terminal of the third signal acquisition module, the second input terminal is connected to the SCL signal line, and the output terminal is connected to the data input terminal of the second signal recognition circuit; wherein, when the chip selection circuit outputs a first logic signal and the first signal recognition circuit outputs a second logic signal, or when the chip selection circuit outputs a second logic signal and the second signal recognition circuit outputs a second logic signal, the signal output circuit outputs a starting signal to the slave device.
2. The starting signal processing circuit according to claim 1, wherein The first signal recognition circuit includes a first signal acquisition module, a first signal synchronization module, and a first signal integration module; the data input terminal of the first signal acquisition module is connected to the reverse output terminal of the chip selection circuit and the SCL signal line, the clock input terminal is connected to the SDA signal line; the data input terminal of the first signal synchronization module is connected to the output terminal of the first signal acquisition module, the clock input terminal is connected to the SCL signal line; the first input terminal of the first signal integration module is connected to the output terminal of the first signal acquisition module, the second input terminal is connected to the output terminal of the first signal synchronization module, and the output terminal is connected to the first input terminal of the signal output circuit.
3. The starting signal processing circuit according to claim 2, wherein the first signal acquisition module includes a first D flip-flop, which is used to follow the logical AND operation signal of the reverse signal of the chip selection signal output by the chip selection circuit and the signal output by the SCL signal line when the SDA signal line outputs a falling edge, so as to output a first acquisition signal; the first signal synchronization module includes a second D flip-flop, which is used to follow the first acquisition signal when the SCL signal line outputs a rising edge, so as to output a first synchronization signal; The first signal output module includes a first NOT gate unit and a first AND gate unit, and is used for inverting the first synchronization signal and performing a logical AND operation on the first acquisition signal and the inverted signal of the first synchronization signal to output a first start signal.
4. The starting signal processing circuit according to claim 1, wherein The second signal recognition circuit includes a second signal acquisition module, a second signal synchronization module, and a second signal integration module; The data input end of the second signal acquisition module is connected to the positive output end of the chip select circuit and the SCL signal line, and the clock input end is connected to the SDA signal line; The data input end of the second signal synchronization module is connected to the output end of the second signal acquisition module, and the clock input end is connected to the SCL signal line; The first input end of the second signal integration module is connected to the output end of the second signal acquisition module, the second input end is connected to the output end of the second signal synchronization module, and the output end is connected to the second input end of the signal output circuit.
5. The start signal processing circuit according to claim 4, wherein The second signal acquisition module includes a third D flip-flop, and is used for following the logical AND operation signal of the chip select signal output by the chip select circuit and the signal output by the SCL signal line when the SDA signal line outputs a falling edge, so as to output a second acquisition signal; The second signal synchronization module includes a fourth D flip-flop, and is used for following the second acquisition signal when the SCL signal line outputs a rising edge, so as to output a second synchronization signal; The second signal output module includes a second NOT gate unit and a second AND gate unit, and is used for inverting the second synchronization signal and performing a logical AND operation on the second acquisition signal and the inverted signal of the second synchronization signal to output a second start signal.
6. The start signal processing circuit according to claim 1, wherein The third signal acquisition module includes a fifth flip-flop, and is used for following the signal output by the SCL signal line when the SDA signal line outputs a falling edge, so as to output a chip select signal; The reverse output module includes a third NOT gate unit and a third AND gate unit, and is used for inverting the chip select signal and inputting the logical AND operation signal of the inverted signal of the chip select signal and the signal output by the SCL signal line into the data input end of the first signal recognition circuit; The forward output module includes a fourth AND gate unit, and is used for inputting the logical AND operation signal of the chip select signal and the signal output by the SCL signal line into the data input end of the second signal recognition circuit.
7. The start signal processing circuit according to claim 6, wherein The reverse output module further includes a fourth NOT gate unit and a fifth AND gate unit, and is used for inverting the chip select signal and inputting the logical AND operation signal of the inverted signal of the chip select signal and the first start signal output by the first signal recognition circuit into the first input end of the signal output circuit; The positive output module further includes a sixth AND gate unit, configured to input a logical AND operation signal of the chip select signal and a second start signal output by the second signal recognition circuit into a second input end of the signal output circuit.
8. The starting signal processing circuit according to claim 1, wherein The signal output circuit includes an exclusive-OR unit, wherein, a first input end of the exclusive-OR unit is connected to an output end of the first signal recognition circuit, a second input end is connected to an output end of the second signal recognition circuit, and an output end is connected to the slave device; or, a first input end of the exclusive-OR unit is connected to an output end of the first signal recognition circuit and a reverse output end of the chip select circuit, a second input end is connected to an output end of the second signal recognition circuit and a forward output end of the chip select circuit, and an output end is connected to the slave device.
9. A communication system, characterized in that, The communication system includes a master device, at least one slave device, and a start signal processing circuit according to any one of claims 1 to 8, wherein the start signal processing circuit is connected between the master device and the at least one slave device.
Citation Information
Patent Citations
I2C / SMBus start-stop detecting circuit that reduces the likelihood of stalling the bus due to glitches on the data line
US6530029B1