Communication exception handling method, apparatus, device, and storage medium

By sampling and generating a second clock signal that conforms to timing characteristics in I2C communication, the problem of low efficiency in I2C communication anomaly handling is solved, and reliable data transmission recovery under abnormal conditions is achieved.

CN123178153APending Publication Date: 2026-11-27HANGZHOU HUAFENG JIXIN ELECTRONICS CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611676145.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-10-28
Publication Date
2026-11-27

AI Technical Summary

Technical Problem

In existing technologies, I2C communication anomaly handling is inefficient, especially when the clock signal stops output due to a master device failure, which can easily lead to bus deadlock. Existing methods rely on master device reset and reinitialization, which results in uncontrollable recovery time and low efficiency.

Method used

After successful address matching, the first clock signal driven by the second device is sampled to obtain timing parameters. When an anomaly is detected, a second clock signal that conforms to the timing characteristics is generated. The data signal is controlled by the second clock signal to avoid misjudgment and waiting for the master device to reset, and the anomaly is directly recovered.

Benefits of technology

It improves the reliability and efficiency of communication anomaly recovery, reduces reliance on master equipment intervention, and ensures that data transmission continues under abnormal conditions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123178153A_ABST
    Figure CN123178153A_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a communication exception processing method, device and equipment and a storage medium. The method comprises: in response to a state of address matching with a second device, performing parameter sampling on a first clock signal driven by the second device to obtain a timing parameter corresponding to the first clock signal; in the case of successful address matching, if the first clock signal is abnormal and the current situation is that the second device performs a read operation on the first device, generating a second clock signal according to the timing parameter, and regulating the data signal sent to the second device based on the second clock signal, wherein the timing parameter comprises at least one of a signal period, a first level duration, a second level duration, a duty cycle, a sampling phase, a data setup time, a data hold time and a jitter tolerance. The method is used to improve the efficiency of exception processing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of communications, and more particularly to a method, apparatus, device, and storage medium for handling communication anomalies. Background Technology

[0002] Inter-Integrated Circuit (I2C) communication protocol is widely used in embedded systems, IoT devices, and consumer electronics. In the I2C communication process, the master device sends a clock signal via the Serial Clock Line (SCL) and transmits interactive data signals via the Serial Data Line (SDA). The timing of the data signal's high and low levels is related to the clock signal's high and low levels. However, if the master device malfunctions, the clock signal may stop outputting. If the slave device is in a data transmission state and its data signal is low, this could lead to a bus deadlock.

[0003] In related technologies, the methods for handling this type of communication anomaly usually require resetting the master device, such as resetting the master device's I2C controller through software. After the reset, the master device resends a clock signal to release the data signal.

[0004] Therefore, communication anomaly handling methods in related technologies suffer from low processing efficiency. Summary of the Invention

[0005] This application provides a communication anomaly handling method, apparatus, device, and storage medium to improve the efficiency of communication anomaly handling.

[0006] In a first aspect, embodiments of this application provide a communication anomaly handling method, including:

[0007] In response to the state of address matching with the second device, the first clock signal driven by the second device is sampled to obtain the timing parameters corresponding to the first clock signal. The timing parameters include at least one of the following: signal period, first level duration, second level duration, duty cycle, sampling phase, data setup time, data hold time, and jitter tolerance.

[0008] If the address match is successful, and if the first clock signal is abnormal, and the current situation is that the second device is performing a read operation on the first device, a second clock signal is generated according to the timing parameters.

[0009] The data signal sent to the second device is controlled by the second clock signal.

[0010] In one possible embodiment, the first clock signal driven by the second device is sampled to obtain timing parameters corresponding to the first clock signal, including:

[0011] The first clock signal is sampled according to the sampling frequency corresponding to the sampling clock to obtain the original timing parameters corresponding to at least one signal period of the first clock signal.

[0012] The original timing parameters corresponding to each signal period are statistically processed to obtain the timing parameters. The statistical processing includes at least one of the following: average value calculation, median value calculation, maximum value filtering, minimum value filtering, and filtering.

[0013] In one possible embodiment, the method further includes:

[0014] Continuously acquire the level status of the first clock signal;

[0015] If the first clock signal remains at the first level for a period of time exceeding the first time threshold, or if the first clock signal remains at the second level for a period of time exceeding the second time threshold, it is determined that the first clock signal exhibits abnormal level behavior.

[0016] An anomaly was detected in the first clock signal.

[0017] In one possible embodiment, the method further includes:

[0018] A first time threshold is determined based on the duration of the first level and the first configuration value;

[0019] A second time threshold is determined based on the duration of the second level and the second configuration value. The second time threshold is greater than the maximum allowable clock stretch duration. The maximum allowable clock stretch duration represents the maximum duration during which the first clock signal is allowed to remain at the second level when the first clock signal is pulled low based on the clock stretch mechanism.

[0020] In one possible embodiment, before determining that there is an anomaly in the first clock signal, the method further includes:

[0021] If the first clock signal remains at the first level for a period of time exceeding the first time threshold, or if the first clock signal remains at the second level for a period of time exceeding the second time threshold, the number of abnormal level behaviors is accumulated.

[0022] If the number of abnormal level behaviors reaches the threshold, it is determined that there is an abnormality in the first clock signal.

[0023] In one possible embodiment, the data signal transmitted to the second device is modulated based on a second clock signal, including:

[0024] The read operation is completed by adjusting the data signal according to the second clock signal;

[0025] Release the transmission bus that transmits data signals.

[0026] In one possible embodiment, the method further includes:

[0027] Update the data in the timing parameter storage address based on the timing parameters.

[0028] Secondly, embodiments of this application provide a communication anomaly handling apparatus, applied to a first device, the apparatus comprising:

[0029] The sampling module is used to sample the parameters of the first clock signal driven by the second device in response to the address matching state with the second device, and obtain the timing parameters corresponding to the first clock signal. The timing parameters include at least one of the following: signal period, first level duration, second level duration, duty cycle, sampling phase, data setup time, data hold time, and jitter tolerance.

[0030] The generation module is used to generate a second clock signal based on timing parameters if the first clock signal is abnormal and the current situation is that the second device is performing a read operation on the first device, provided that the address match is successful.

[0031] The control module is used to control the data signal sent to the second device based on the second clock signal.

[0032] Thirdly, embodiments of this application provide an electronic device, including: a memory and a processor;

[0033] The memory stores the instructions that the computer executes;

[0034] The processor executes computer execution instructions stored in memory, causing the processor to perform the methods provided above.

[0035] Fourthly, embodiments of this application provide a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the methods provided above.

[0036] This application provides a communication anomaly handling method, apparatus, device, and storage medium. The method includes: in response to an address matching state with a second device, sampling parameters of a first clock signal driven by the second device to obtain timing parameters corresponding to the first clock signal; if the first clock signal is abnormal when the address matching is successful, and the current state is when the second device is performing a read operation on the first device, generating a second clock signal according to the timing parameters, and controlling the data signal sent to the second device based on the second clock signal. The timing parameters include at least one of signal period, first level duration, second level duration, duty cycle, sampling phase, data setup time, data hold time, and jitter tolerance. In this way, when the addresses of the first and second devices match, the first clock signal driven by the second device is sampled to obtain at least one timing parameter, including signal period, duration of different levels, duty cycle, sampling phase, data setup time, data hold time, and jitter tolerance. This timing parameter is only used when the address match is successful, the first clock signal is determined to be abnormal, and the second device performs a read operation on the first device, i.e., the first device is in a data transmission state. This avoids the clock stretching mechanism being mistakenly judged as a communication abnormality, thus improving the reliability of abnormality recovery. In the case of a communication abnormality, the first device can generate a second clock signal that conforms to the timing characteristics of the first clock signal without waiting for the second device to reset, and use the second clock signal to regulate the data signal, reducing the dependence on the master device's intervention and improving the efficiency of abnormality handling. Attached Figure Description

[0037] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0038] Figure 1 This application provides a timing diagram illustrating an I2C deadlock communication anomaly.

[0039] Figure 2 A flowchart illustrating a communication anomaly handling method provided in this application embodiment. Figure 1 ;

[0040] Figure 3 A sampling timing diagram provided for an embodiment of this application;

[0041] Figure 4 A flowchart illustrating a communication anomaly handling method provided in this application embodiment. Figure 2 ;

[0042] Figure 5 A flowchart illustrating a communication anomaly handling method provided in this application embodiment. Figure 3;

[0043] Figure 6 This is a schematic diagram of the internal structure of a first device provided in an embodiment of this application;

[0044] Figure 7 A schematic diagram of the communication anomaly handling device provided in this application;

[0045] Figure 8 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application.

[0046] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation

[0047] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.

[0048] The I2C communication protocol is widely used in embedded systems, IoT devices, and consumer electronics. The communication process based on the I2C protocol requires the participation of at least two devices. The master device sends a clock signal through SCL and sends interactive data signals through SDA. During the interaction, the timing of the high and low level changes of the data signal is related to the high and low level of the clock signal.

[0049] However, when the master device malfunctions, the clock signal may stop outputting. If the slave device is in the data transmission state and the data signal is low, this may cause a bus deadlock.

[0050] Figure 1 This is a timing diagram of an I2C deadlock communication exception provided in an embodiment of this application. The left side is the I2C master device, the right side is the I2C slave device, and two bus signal lines, SCL clock line and SDA data line, connect the master and slave ends.

[0051] Understandably, during normal transmission, the front-end SCL outputs a continuous standard square wave clock signal, and SDA synchronously follows with the output data signal, allowing for normal bit transmission between master and slave devices. However, when the master device malfunctions, it stops continuously outputting the SCL clock signal, resulting in a lost clock signal. The SCL output signal remains low for a period of time, ceasing to generate transition clocks, thus interrupting the bus clock signal. When SCL is lost, the slave device is in the data transmission phase, and its output data signal is low. Due to the lack of a clock signal, the SDA output signal remains low, preventing signal transitions and preventing the next bit of data from being sent to the master device, causing a master line deadlock. When the master device recovers, it releases / re-drives SCL, returning it to a high-level idle state. However, SDA is still continuously pulled low by the slave device, and the bus remains locked, preventing further communication. Therefore, even if the master device resets, communication failures may not be automatically resolved.

[0052] In related technologies, the methods for handling this type of communication anomaly typically include: resending several SCL clock pulses after the master device recovers; resetting the I2C controller via master device software; resetting the slave device via an external watchdog or power switch; or performing bus cleanup during system startup.

[0053] However, the common feature of the above solutions is that they mainly rely on the master device or system-level software to participate in the recovery. The recovery process requires waiting for the master device to complete the reset and reinitialize the peripherals before the clock can be resent. The recovery time is uncontrollable. Furthermore, if the master device software fails to restore the bus, or if the I2C controller cannot work immediately after the reset, deadlock may persist for a long time, resulting in low processing efficiency.

[0054] In view of this, this application provides a communication anomaly handling method, apparatus, device, and storage medium. The method includes: in response to an address matching state with a second device, sampling parameters of a first clock signal driven by the second device to obtain timing parameters corresponding to the first clock signal; if the first clock signal is abnormal when the address matching is successful, and the current state is when the second device is performing a read operation on the first device, generating a second clock signal according to the timing parameters, and controlling the data signal sent to the second device based on the second clock signal. The timing parameters include at least one of signal period, first level duration, second level duration, duty cycle, sampling phase, data setup time, data hold time, and jitter tolerance. In this way, when the addresses of the first and second devices match, the first clock signal driven by the second device is sampled to obtain at least one timing parameter, including signal period, duration of different levels, duty cycle, sampling phase, data setup time, data hold time, and jitter tolerance. This timing parameter is only used when the address match is successful, the first clock signal is determined to be abnormal, and the second device performs a read operation on the first device, i.e., the first device is in a data transmission state. This avoids the clock stretching mechanism being mistakenly judged as a communication abnormality, thus improving the reliability of abnormality recovery. In the case of a communication abnormality, the first device can generate a second clock signal that conforms to the timing characteristics of the first clock signal without waiting for the second device to reset, and use the second clock signal to regulate the data signal, reducing the dependence on the master device's intervention and improving the efficiency of abnormality handling.

[0055] Figure 2 A flowchart illustrating a communication anomaly handling method provided in this application embodiment. Figure 1 In this embodiment, the communication anomaly handling method is applied to a first device. The first node can be a slave device in the I2C communication process. This device can be a chip, terminal, server, or server cluster, or any other device capable of data interaction with other devices based on the I2C communication protocol. (Refer to...) Figure 2 The method may include:

[0056] S201, in response to the state of address matching with the second device, the first clock signal driven by the second device is sampled to obtain the timing parameters corresponding to the first clock signal.

[0057] The timing parameters include at least one of the following: signal period, duration of the first level, duration of the second level, duty cycle, sampling phase, data setup time, data hold time, and jitter tolerance.

[0058] Here, the second device is the master device that establishes I2C communication with the first device. It is responsible for driving the first clock signal on the bus and initiating addressing, read / write direction control, and data transmission.

[0059] The first clock signal corresponds to the clock line signal in the I2C bus. It is driven by the second device and received by the first device, serving as a reference basis for the current communication cycle.

[0060] It is understandable that the timing parameters are a set of time features extracted based on the first clock signal, used to characterize the actual timing state of the first clock signal. By collecting the timing parameters of the first clock signal, the first device can learn the timing characteristics of the first clock signal, thereby providing a data basis for subsequent anomaly handling.

[0061] Here, the timing parameters include at least one of the following: signal period, first level duration, second level duration, duty cycle, sampling phase, data setup time, data hold time, and jitter tolerance.

[0062] Wherein, signal period refers to the total duration of a single complete high and low level waveform of the first clock signal; first level can refer to high level, and the duration of the first level can refer to the duration of the high level of the first clock signal; second level can refer to low level, and the duration of the second level can refer to the duration of the low level of the first clock signal; duty cycle can refer to the proportion of the high level duration to the complete signal period; sampling phase can refer to the offset position of the sampling point inside the first device relative to the edge of the first clock signal; data setup time can refer to the interval from when the data signal stabilizes to the rising edge of the first clock signal; data hold time can refer to the interval from when the falling edge of the first data signal to when the data signal transitions; jitter tolerance can refer to the maximum allowable fluctuation deviation of the signal period of the first clock signal.

[0063] In this embodiment of the application, when the second device wants to interact with the first device, it first sends the device address of the second device to the device nodes in the cluster, and each node device will then match the address with the first device.

[0064] In this embodiment of the application, the first device can determine that it is currently in a state of address matching with the second device upon receiving the device address sent by the second device. At this time, timing parameters can be sampled.

[0065] Here, the address matching status can be obtained by comparing the received target address with the address information of the first device. Before receiving the complete address and confirming a successful match, the first device can start the parameter sampling process so as to obtain a real and valid timing reference before subsequent communication anomalies occur.

[0066] In one possible implementation of the sampling process, the first device can acquire the edge changes and corresponding time information of the first clock signal, and thereby obtain timing parameters such as the duration of the first level, the duration of the second level, and the signal period.

[0067] In another possible implementation, the process of step S201, "sampling the first clock signal driven by the second device to obtain the timing parameters corresponding to the first clock signal", may include: sampling the first clock signal according to the sampling frequency corresponding to the sampling clock to obtain the original timing parameters corresponding to at least one signal period of the first clock signal; performing statistical processing on the original timing parameters corresponding to each signal period to obtain the timing parameters, wherein the statistical processing includes at least one of average value calculation, median value calculation, maximum value filtering, minimum value filtering, and filtering processing.

[0068] Here, the sampling clock can refer to the high-frequency reference clock inside the first device, which provides a fixed timing scale for signal acquisition; the sampling frequency can be determined according to the fixed operating frequency of the sampling clock, and is used to determine the timing accuracy of timing acquisition.

[0069] For example, when the operating frequency of the sampling clock is 100MHz, the sampling frequency can also be 100MHz. In this way, if the frequency of the first clock signal is 100kHz, its period is about 10µs, and there are 1000 sampling clock cycles in one signal cycle.

[0070] Based on the sampling frequency, the first clock signal can be sampled. It can be understood that sampling can obtain the most original clock timing data, i.e., the original timing parameters, which are directly acquired in a single cycle without any processing.

[0071] Regarding the sampling process, in this embodiment, the real-time level of the first clock signal can be continuously sampled at a fixed sampling frequency of the internal sampling clock. The rising and falling edges of the clock are continuously captured, and the sampling count value corresponding to each transition is recorded. All raw timing data corresponding to at least one complete clock cycle is collected and saved to form single-cycle raw timing parameters. For example, the first device is configured with a 100MHz sampling clock, continuously sampling the SCL clock output by the master device with an accuracy of 0.01μs, capturing each high-low level transition of the first clock signal, and collecting three consecutive complete signal cycles to obtain three sets of unprocessed raw timing parameters.

[0072] It is understandable that the raw timing parameters of a single cycle are highly susceptible to electromagnetic interference, system jitter, and instantaneous glitches, resulting in random errors. Directly using the raw data of a single cycle to judge timing and correct the clock will lead to misjudgment and incorrect correction. Reliable indicators must be obtained through multi-cycle statistical noise reduction.

[0073] Therefore, in this embodiment of the application, after collecting the original timing parameters corresponding to multiple cycles, statistical processing can be performed on each original timing parameter to effectively filter out instantaneous interference and random jitter, eliminate abnormal outliers, greatly improve the accuracy and stability of timing parameters, and avoid subsequent clock anomaly misjudgment and adaptive clock error correction caused by single-point abnormal data.

[0074] In the embodiments of this application, the statistical processing of each original time series parameter may include at least one of the following: average calculation, median calculation, maximum value filtering, minimum value filtering, and filtering. When average calculation is used, the arithmetic mean of the original time series parameters of the same type in multiple periods can be calculated to obtain the time series parameters that reflect the overall time series level. When median calculation is used, the original time series parameters of each period can be sorted according to their numerical values ​​and the median value can be taken to reduce the influence of outlier sampling points. When maximum or minimum value filtering is used, representative boundary values ​​can be extracted from the original time series parameters of multiple periods. When filtering is used, the sequence of original time series parameters can be smoothed based on moving average filtering, weighted filtering, or threshold smoothing.

[0075] In this embodiment of the application, the timing parameters after statistical processing can be written to a preset storage location, which can be located in a cache, in memory, or written to a timing register as the basis for subsequent data processing.

[0076] Figure 3 This is a sampling timing diagram provided in an embodiment of the present application, wherein the upper part is the first clock signal transmitted by the serial clock line, and the lower part is the data signal transmitted by the serial data line.

[0077] During sampling, the first device continuously acquires the real-time level of the first clock signal at a fixed sampling frequency. Here, the 30% / 70% voltage line can be used as the threshold for signal transition. During sampling, the count values ​​of the rising and falling edges of the first clock signal are captured, and the count values ​​of signal transition points are recorded. The difference between the transition point count value and the count values ​​of the rising and falling edges is calculated to obtain the timing parameters within a single cycle, where T... low This refers to the duration of the low level of the first clock signal (the duration of the second level; T) high This refers to the duration for which the first clock signal remains high (the first level duration); T scl This refers to the complete signal period, and its value can be T. high +T low ;T setup_data This refers to the data setup time, which is the interval between the stable completion of the data signal level transition and the rising edge of the first clock signal; T hold_dataThis refers to the data hold time, which is the interval between the falling edge of the first clock signal and the data signal's allowed switching level.

[0078] In this way, waveforms of at least one complete signal cycle can be continuously acquired, thereby storing multiple sets of raw timing data for a single cycle.

[0079] The above processing method enables the first device to form stable timing parameters based on sampling results from multiple signal cycles, rather than directly using a single sample value. By statistically summarizing the original timing parameters, the first device can reduce the impact of software analog clock jitter, bus transient interference, and sampling glitches on parameter judgment, making the obtained timing parameters closer to the characteristics of the actual clock. Using this method, the first device can still obtain representative timing parameters even when the clock driven by the second device fluctuates, thus providing a stable basis for subsequent clock reconstruction and data signal modulation, and making bus recovery control under abnormal conditions more accurate.

[0080] S202, if the address matching is successful, and if the first clock signal is abnormal, and the current situation is that the second device is performing a read operation on the first device, a second clock signal is generated according to the timing parameters.

[0081] In this embodiment of the application, a successful address match indicates that the first device has confirmed that it is about to interact with the second device. Therefore, the signal status of the first clock signal on the serial clock line and the data signal on the serial data line can be monitored.

[0082] In this embodiment of the application, the first clock signal can be periodically or in real time monitored to see if it is in an abnormal state. Here, when the level of the first clock signal remains at the second level for a long time, it can be determined that the first clock signal is abnormal.

[0083] It is understandable that the prolonged low level of the first clock signal could be due to a clock stretching mechanism. That is, the I2C communication protocol allows slave devices to legally extend the low level of the first clock signal through a clock stretching mechanism, waiting for data to be processed internally. In some cases, the bus may contain master or slave devices simulated via General Purpose Input Output (GPIO), timers, or software loops. The duration of the high and low levels of the clock signals of such software-simulated master / slave devices is affected by software scheduling, interrupt responses, GPIO toggle delays, and operating system task switching, and their duration may be significantly longer than the standard timing generated by the hardware I2C controller. When the second device performs a write operation on the first device, the data signal is sent from the second device to the first device. Even if the first clock signal output by the second device is abnormal, the second device can synchronize with its internal timing, and the data signal output will still follow the timing parameters of the first clock signal, preventing communication failure.

[0084] In this embodiment of the application, when an abnormality is detected in the first clock signal, in order to avoid misjudgment, it is also detected whether the second device is performing a read operation on the first device. In this case, the second device will send data to the first device, and the abnormality of the first clock signal will directly cause the bus to lock up. Therefore, performing abnormality handling in this case can effectively reduce the false triggering of abnormality handling.

[0085] When the first clock signal is abnormal, and the second device performs a read operation on the first device, a bus deadlock can be determined. A second clock signal matching the rhythm of the first clock signal is then generated based on the timing parameters of the first clock signal acquired in the preceding steps. Here, the second clock signal can refer to a clock signal regenerated by the first device based on the timing parameters of the first clock signal under normal conditions learned during the previous address matching phase, used to replace the abnormal first clock signal.

[0086] Regarding the generation process, in one possible implementation, the first device can generate a second clock signal based on the sampled timing parameters through internal circuitry, so that the generated second clock signal corresponds to the communication beat before the anomaly.

[0087] S203, based on the second clock signal, regulates the data signal sent to the second device.

[0088] In this embodiment, the data signal is the data line output content sent by the first device to the second device during the read operation phase, corresponding to the serial data bits in the I2C bus, including the data bits to be sent, the acknowledgment related bits, and the data line release status during the communication end phase.

[0089] When the first clock signal is abnormal and the second clock signal is in the state of transmitting data signals, the bus deadlock occurs, causing the data signal of this read operation to be unable to continue to be transmitted to the second device. Therefore, in this embodiment, the data signal can be adjusted based on the second clock signal, indicating that after the first clock signal is abnormal, the first device no longer waits for the second device to continue to provide a stable clock, but uses the locally generated second clock signal as the transmission beat to control the output time, stabilization time and release time of each bit of data, so that the current read operation can continue to advance until the remaining bits are transmitted or to a bus state where it can be safely exited.

[0090] In this embodiment, after generating the second clock signal, the first device can send the signal to the transmission control process as a bit-level timing reference. The transmission control process can continue to control the output of data signals according to the edge order of the second clock signal, based on the current number of bits transmitted and the remaining bits in the buffer to be transmitted.

[0091] In one possible implementation, the first device can switch the line level of the next data bit at the corresponding timing position of the second clock signal and maintain the bit stability in subsequent clock phases. If the data signal is driven by an open-drain output stage, the first device actively pulls the data line low when the output logic is "0", and releases the data line and forms the first level by a pull-up resistor when the output logic is "1". In this way, even if the original clock source (first clock signal) malfunctions, as long as it inputs the pre-learned timing parameters, the first device can still maintain the subsequent data bits according to the second clock signal.

[0092] In some implementations, if there are still remaining data bits that have not been sent, the first device continues to output data bit by bit according to the second clock signal until the current transmission process is completed.

[0093] In some implementations, when the current communication process is nearing its end, the first device may use the second clock signal to complete the transmission of the remaining bits and the line state preparation before stopping, and then stop the output of the second clock signal and release the data signal.

[0094] Based on the above analysis, it can be seen that the second clock signal is not only used to supplement the clock pulse, but also serves as a timing reference for the first device to continue outputting data signals. By coordinating the data signal switching time with the second clock signal, the first device can continue to drive the data signal for bit transmission even after an anomaly occurs, until the serial data line is released, thereby allowing the bus to transition from a continuously occupied state to a state where it can be taken over again.

[0095] In the above embodiments, when the addresses of the first device and the second device are matched, the first clock signal driven by the second device is sampled to obtain at least one timing parameter including signal period, duration of different levels, duty cycle, sampling phase, data setup time, data hold time, and jitter tolerance. This timing parameter is only performed when the address matching is successful, the first clock signal is determined to be abnormal, and the second device performs a read operation on the first device, i.e., the first device is in a data transmission state. This avoids misjudging the clock stretching mechanism as a communication abnormality, thus improving the reliability of abnormal recovery. In the case of a communication abnormality, the first device can generate a second clock signal that conforms to the timing characteristics of the first clock signal without waiting for the second device to reset, and regulate the data signal through the second clock signal, reducing the dependence on the master device's intervention and improving the efficiency of abnormal handling.

[0096] Figure 4 A flowchart illustrating a communication anomaly handling method provided in this application embodiment. Figure 2 . Reference Figure 4 The process of detecting an anomaly in the first clock signal may include:

[0097] S401 continuously acquires the level status of the first clock signal.

[0098] Understandably, the abnormalities of the first clock signal (level timeout, clock stretching exceeding limits, software delay exceeding limits) are all manifested by the level not changing for a long time. Therefore, only continuous sampling can capture the feature of "level maintenance for too long" and identify the feature of level maintenance timeout, so as to determine the abnormality of the first clock signal.

[0099] Regarding the acquisition process, in this embodiment of the application, the first device can continuously acquire the real-time level of the first clock signal based on a fixed sampling frequency and refresh the current level status in real time, thereby continuously monitoring the high and low level switching process of the first clock signal throughout the entire process and not missing any level maintenance status for any duration.

[0100] S402, when the first clock signal is continuously at the first level for a period of time exceeding the first time threshold, or when the first clock signal is continuously at the second level for a period of time exceeding the second time threshold, it is determined that the first clock signal has abnormal level behavior.

[0101] After receiving the continuous acquisition results, the first device can accumulate the duration of the first clock signal at the first level and the second level respectively, and compare the duration with the corresponding threshold to determine whether the signal is abnormal.

[0102] Here, the first time threshold can be the maximum allowed duration of the first level configured in the protocol or register (high level timeout threshold); the second time threshold can be the maximum allowed duration of the second level configured in the protocol or register (including the maximum allowed clock stretch duration); abnormal level behavior can refer to timing violations where the duration of the high and low levels of the first clock signal exceeds the compliant allowable range.

[0103] In one possible implementation, the first time threshold and the second time threshold can be determined based on the maximum allowable duration of the first level and the maximum allowable duration of the second level permitted in the communication protocol.

[0104] In another possible implementation, the configuration method for the first time threshold and the second time threshold may include: determining the first time threshold based on the duration of the first level and a first configuration value; determining the second time threshold based on the duration of the second level and a second configuration value, wherein the second time threshold is greater than the maximum allowable clock stretching duration, and the maximum allowable clock stretching duration characterizes the maximum duration during which the first clock signal is allowed to remain at the second level when the first clock signal is pulled low based on the clock stretching mechanism.

[0105] Here, the first configuration value and the second configuration value can be parameters pre-stored in the configuration, or they can be parameters calculated based on the mapping between the first level duration and the second level duration. The first configuration value is used to perform compensation calculation with the first level duration to obtain the first time threshold, and the second configuration value is used to perform compensation calculation with the second level duration to obtain the second time threshold.

[0106] In the embodiments of this application, the compensation calculation can be a numerical operation, such as multiplication, division, addition, and subtraction of the ratio.

[0107] Taking multiplication by a factor as an example, the duration of the second level is T. low The second configuration value is K. low The second time threshold is T low_timeout Therefore, the formula for calculating the second time threshold can be referred to as Formula 1 below:

[0108] T low_timeout =T low ×K low Formula 1

[0109] The calculation process for the first time threshold can refer to the reference process for the second time threshold, and will not be repeated here.

[0110] It is understood that the I2C communication protocol allows the slave device to legally extend the time of the first clock signal low through the clock stretching mechanism to wait for the data to be processed internally. In order to avoid misjudgment, the second time threshold needs to be greater than the clock stretching duration. Therefore, in the embodiments of this application, the size of the second configuration value can be configured according to the clock stretching duration specified in the protocol.

[0111] Here, clock stretch duration can refer to the length of time that the slave device is allowed to legally pull down the first clock signal level in the I2C communication protocol.

[0112] In this way, when calculating the first and second time thresholds, the level duration information of the first clock signal is first obtained, and then the threshold calculation is completed based on the preset first and second configuration values. Subsequently, the first and second time thresholds are used for subsequent anomaly detection. Since the second time threshold is set to be greater than the maximum allowable clock stretching duration, when the second device legally pulls the first clock signal low through the clock stretching mechanism, it will not prematurely trigger anomaly detection due to a short-term continuous state at the second level. With this implementation, the threshold can be adaptively determined according to the level duration and configuration value, and the second time threshold maintains a boundary relationship with the maximum allowable clock stretching duration, thereby making the distinction between anomaly detection and legal stretching clearer, improving the consistency of level anomaly behavior identification and the reliability of bus recovery processing.

[0113] S403, it has been determined that there is an anomaly in the first clock signal.

[0114] In one possible implementation, when it is determined that the first clock signal has abnormal behavior, the abnormality of the first clock signal can be immediately determined and subsequent abnormality handling can be performed.

[0115] In another possible implementation, to avoid errors in signal anomaly determination due to a single abnormal behavior, a fault-tolerance mechanism can be added in this embodiment. Therefore, the communication anomaly handling method provided in this embodiment may further include, before determining that the first clock signal is abnormal: when the first clock signal is continuously at a first level for a period exceeding a first time threshold, or when the first clock signal is continuously at a second level for a period exceeding a second time threshold, accumulating the number of abnormal level behaviors; if the number of abnormal level behaviors reaches a threshold, determining that the first clock signal is abnormal.

[0116] In this embodiment of the application, the first device continuously collects the level state of the first clock signal and counts the duration of the continuous holding at the same level; when it is detected that the holding time of the first clock signal at the first level exceeds the first time threshold, or the holding time at the second level exceeds the second time threshold, it can be determined that an abnormal level behavior has occurred, and the cumulative count value is incremented by one.

[0117] Here, the count value is used to count the number of times abnormal behavior of the first clock signal level occurs. It can be stored in a register, cache or software variable and updated each time a new abnormal behavior is detected.

[0118] In this embodiment of the application, in order to avoid triggering the abnormal judgment by a single interference, the number of times threshold can be set to an integer greater than one, and can be configured according to different bus speeds, slave device response capabilities and system fault tolerance requirements.

[0119] When the accumulated number of abnormal behavior events is compared with the threshold, if the count reaches the threshold, the system outputs a judgment result indicating that the first clock signal is abnormal. Based on this judgment result, the generation of the second clock signal is triggered. This judgment method enables the system to confirm the clock state based on the accumulated results of multiple abnormalities, rather than directly judging based on a single timeout. This allows subsequent abnormality handling to be based on a more stable judgment.

[0120] In this way, by accumulating the number of timeout level states and confirming the anomaly using a threshold method, it is possible to distinguish between occasional level fluctuations and persistent clock anomalies, making the anomaly identification results more stable and providing a reliable trigger condition for generating a second clock signal in subsequent read operation scenarios, thereby improving the accuracy of bus anomaly handling and the reliability of recovery.

[0121] In the above embodiments, by continuously monitoring the duration of the two voltage levels and setting separate thresholds, anomalies can be promptly identified when the clock signal remains at a single level for an extended period. This abnormal voltage behavior is directly mapped to an abnormal state of the first clock signal, providing a reliable basis for subsequent clock reconstruction and data signal modulation. This implementation method enables anomaly identification even when the clock line exhibits a sustained high or low voltage level, reducing reliance on the immediate recovery capabilities of the master device. It provides clearer timing criteria for anomaly determination and subsequent processing, thereby improving the stability of communication anomaly handling and the reliability of bus recovery.

[0122] Based on the aforementioned embodiments, the aforementioned step S203, "regulating the data signal sent to the second device based on the second clock signal," may further include: regulating the data signal according to the second clock signal to complete the read operation; and releasing the transmission bus for transmitting the data signal.

[0123] It is understandable that when there is an anomaly in the first clock signal and the first device is sending data to the second device, it indicates that the bus may be deadlocked. In this case, the data signal line can be controlled and driven according to the beat of the second clock signal when necessary, so as to complete the read operation of the second device on the first device.

[0124] In one possible implementation, the process can use the generated second clock signal as a timing reference, match the rising and falling edges of the second clock to control the level switching of the data signal, strictly follow the standard data setup time and data hold time to output each bit of data, and transmit data to the second device bit by bit to complete the read interaction.

[0125] Only by releasing the bus after the transmission is completed can the bus's normal multiplexing capability be restored. Therefore, after completing the read operation, the first device can release the transmission bus. For example, after detecting that all data transmission of the read operation has been completed, the first device can turn off the internal drive transistor of the serial data line, thereby releasing the level clamp on the bus, so that the data signal on the bus enters a high-impedance release state, and the bus returns to an idle level.

[0126] In the above embodiments, the second clock signal serves as a data signal modulation reference, directly constraining the data cycle time during the read operation to ensure that the second device can continue to receive complete data content under abnormal conditions. Releasing the transmission bus after the data signal transmission is complete allows the transmission bus to quickly exit the occupied state and enter an idle recovery state, thereby completing the current communication interaction and reserving conditions for subsequent bus recovery. In this way, the data signal can complete the read operation under the control of the second clock signal, and the transmission bus is released promptly after transmission, allowing the communication process to conclude normally and reducing the risk of congestion caused by continuous bus occupation.

[0127] In one possible implementation, after a successful address match, the process also includes updating the data in the timing parameter storage address based on the timing parameters.

[0128] In this embodiment of the application, after the first device completes the parameter sampling of the first clock signal and obtains the timing parameters, and the address of the first device and the second device are successfully matched, it can be determined that the first device is about to communicate with the second device. At this time, the timing parameters can be written into the preset timing parameter storage address to replace or supplement the original data, so that the parameters stored in the timing parameter storage address are consistent with the current sampling result.

[0129] In one possible implementation, when a difference is detected between the new sampling result and the old parameters, the update process can directly overwrite the old data with the new time-series parameters.

[0130] In another possible implementation, when it is necessary to preserve the change trajectory, the previous parameters can be preserved and the corresponding time identifier can be attached while writing the new parameters.

[0131] In this way, the criteria used for anomaly detection and the timing basis used when generating the second clock signal can be kept up-to-date.

[0132] In the above embodiments, the first device can promptly reflect the timing changes of the first clock signal during continuous operation and match the stored parameter data with the current bus state. Since subsequent anomaly identification and second clock signal generation can directly call the updated timing parameters, even when the first clock signal is affected by jitter, clock stretching, or period drift, processing can still be completed based on the latest parameters, thereby improving the consistency of subsequent control and the stability of bus recovery.

[0133] The following describes the application of the embodiments of this application in a real-world scenario.

[0134] Figure 5 A flowchart illustrating a communication anomaly handling method provided in this application embodiment. Figure 3 . Reference Figure 5 The process includes the following steps:

[0135] S501, the second device sends its address to all slave devices. At this time, the first device, acting as a slave device, will perform an address matching process with the second device.

[0136] S502, during the address matching process, the first device can sample and measure the first clock signal on the serial clock line and the data signal on the serial data line through the internal sampling clock to obtain the timing parameters of the first clock signal.

[0137] S503: If an address matching failure is detected, the detected timing parameters are discarded.

[0138] S504 If a successful address match is detected, the timing parameters are saved in the timing parameter storage address, and it is checked whether anomaly detection is enabled.

[0139] In this embodiment of the application, the communication exception handling method can be applied as an additional function in the I2C communication process. Therefore, the user can choose whether to enable this function. Only when it is enabled will subsequent communication exception handling be performed; otherwise, the first device will maintain normal communication with the second device.

[0140] If anomaly detection is detected, the first device can start monitoring whether there is an anomaly in the first clock signal sent by the second device. If the first clock signal remains normal, the first device will maintain normal communication with the second device. If there is an anomaly in the first clock signal, it is necessary to check whether to enter the anomaly maintenance mode.

[0141] It is understandable that the determination of a first clock signal abnormality and the continued existence of such an abnormality may include the second device performing a read operation on the first device, that is, the first device sending data to the second device. In this case, since the read operation has not yet been completed, the current byte or device response cycle has not ended normally, and the first device needs to continue driving or releasing the serial data line. In this embodiment of the application, a first clock signal abnormality indicates that the first clock signal is continuously at a low level or at a high level for more than the configured timeout threshold (first time threshold and second time threshold), and this continuous state does not belong to the allowed clock stretching threshold or other legal delays, and the number of abnormal level behaviors reaches the threshold configured in the register.

[0142] In this situation, it can be determined that the system has entered an abnormal maintenance mode.

[0143] If the S505 detects that an abnormal maintenance mode has been entered, it will terminate the current transmission and release the bus after completing the current read operation. If it does not enter the abnormal maintenance mode, it will maintain normal communication with the second device.

[0144] Figure 6 This is a schematic diagram of the internal structure of a first device provided in an embodiment of this application. (Refer to...) Figure 6 The first device includes: an I2C protocol control state machine, an address matching module, a shift and bit control module, an SDA / SCL synchronization and filtering module, an SCL clock extraction and storage module, an anomaly detection module, a local timing maintenance module, and a register control module.

[0145] The core modules of this invention are the SCL clock extraction and storage module, the bus anomaly detection module, and the local clock maintenance module. The SCL clock extraction and storage module measures the SCL timing output by the master device during the address phase. The anomaly detection module determines whether the current SCL state is abnormal based on the stored SCL parameters and the thresholds configured in the registers. The local timing maintenance module ensures that the slave device can normally send the remaining data in abnormal mode. The register control module configures the SCL low-level timeout threshold, the SCL high-level timeout threshold, and enables the abnormal maintenance mode.

[0146] Figure 7 This is a schematic diagram of the communication anomaly handling device provided in this application, which is used in a first device. Figure 7 As shown, the communication anomaly handling device 700 provided in this embodiment includes:

[0147] The sampling module 701 is used to sample the parameters of the first clock signal driven by the second device in response to the state of address matching with the second device, and obtain the timing parameters corresponding to the first clock signal. The timing parameters include at least one of the following: signal period, first level duration, second level duration, duty cycle, sampling phase, data setup time, data hold time, and jitter tolerance.

[0148] The generation module 702 is used to generate a second clock signal based on timing parameters if the first clock signal is abnormal and the current situation is that the second device is performing a read operation on the first device when the address matching is successful.

[0149] The control module 703 is used to control the data signal sent to the second device based on the second clock signal.

[0150] In some embodiments, the sampling module 701 includes:

[0151] The original sampling unit is used to sample the parameters of the first clock signal according to the sampling frequency corresponding to the sampling clock, and obtain the original timing parameters corresponding to at least one signal period of the first clock signal.

[0152] The statistical unit is used to perform statistical processing on the original timing parameters corresponding to each signal period to obtain timing parameters. The statistical processing includes at least one of the following: average value calculation, median value calculation, maximum value filtering, minimum value filtering, and filtering processing.

[0153] In some embodiments, the communication anomaly handling device 700 further includes:

[0154] The clock anomaly detection module is used to continuously collect the level status of the first clock signal; when the first clock signal is continuously at the first level for a period of time exceeding a first time threshold, or when the first clock signal is continuously at the second level for a period of time exceeding a second time threshold, it is determined that the first clock signal has an abnormal level behavior; it is determined that the first clock signal is abnormal.

[0155] In some embodiments, the communication anomaly handling device 700 further includes:

[0156] The threshold configuration module is used to determine a first time threshold based on the duration of the first level and a first configuration value; and to determine a second time threshold based on the duration of the second level and a second configuration value. The second time threshold is greater than the maximum allowable clock stretching duration. The maximum allowable clock stretching duration represents the maximum duration during which the first clock signal is allowed to remain at the second level when the first clock signal is pulled low based on the clock stretching mechanism.

[0157] In some embodiments, the communication anomaly handling device 700 further includes:

[0158] The counting module is used to accumulate the number of abnormal level behaviors when the first clock signal is continuously at a first level for a period of time exceeding a first time threshold, or when the first clock signal is continuously at a second level for a period of time exceeding a second time threshold; if the number of abnormal level behaviors reaches the count threshold, it is determined that there is an abnormality in the first clock signal.

[0159] In some embodiments, the control module 703 includes:

[0160] The transmitting unit is used to adjust the data signal according to the second clock signal to complete the read operation;

[0161] The release unit is used to release the transmission bus that transmits data signals.

[0162] In some embodiments, the communication anomaly handling device 700 further includes:

[0163] The parameter update module is used to update the data in the timing parameter storage address according to the timing parameters.

[0164] The communication anomaly handling device provided in this embodiment can execute the method provided in the above method embodiment. Its implementation principle and technical effect are similar, and will not be described in detail here.

[0165] Figure 8 The schematic diagram of the electronic device provided in the embodiments of this application illustrates that both the first device and the second device can be this electronic device. Figure 8 As shown, the electronic device 80 provided in this embodiment includes at least one processor 801 and a memory 802. Optionally, the device 80 further includes a communication component 803. The processor 801, memory 802, and communication component 803 are connected via a bus 804.

[0166] In a specific implementation, at least one processor 801 executes computer execution instructions stored in memory 802, causing at least one processor 801 to perform the above-described method.

[0167] The specific implementation process of processor 801 can be found in the above method embodiments, and its implementation principle and technical effect are similar. It will not be repeated here.

[0168] In the above embodiments, it should be understood that the processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), etc. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in this invention can be directly implemented by a hardware processor, or implemented by a combination of hardware and software modules within the processor.

[0169] The memory may include random access memory (RAM) and may also include non-volatile memory (NVM), such as at least one disk storage device.

[0170] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of illustration, the buses shown in the accompanying drawings are not limited to a single bus or a single type of bus.

[0171] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the above-described method.

[0172] This application also provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the above-described method.

[0173] The aforementioned readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The readable storage medium can be any available medium accessible to a general-purpose or special-purpose computer.

[0174] An exemplary readable storage medium is coupled to a processor, enabling the processor to read information from and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can reside in an Application Specific Integrated Circuit (ASIC). Alternatively, the processor and the readable storage medium can exist as discrete components in the device.

[0175] The division of units is merely a logical functional division; in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be indirect coupling or communication connection through some interfaces, devices, or units, and may be electrical, mechanical, or other forms.

[0176] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0177] In addition, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0178] If a function is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0179] Those skilled in the art will understand that all or part of the steps of the above-described method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method embodiments; and the aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.

[0180] Finally, it should be noted that other embodiments of the invention will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This invention is intended to cover any variations, uses, or adaptations of the invention that follow the general principles of the invention and include common knowledge or customary techniques in the art not disclosed herein, and is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of the invention is limited only by the appended claims.

Claims

1. A method for handling communication anomalies, characterized in that, Applied to a first device, the method includes: In response to the state of address matching with the second device, the first clock signal driven by the second device is sampled to obtain the timing parameters corresponding to the first clock signal. The timing parameters include at least one of the following: signal period, first level duration, second level duration, duty cycle, sampling phase, data setup time, data hold time, and jitter tolerance. If the address match is successful, and if the first clock signal is abnormal, and the current situation is that the second device is performing a read operation on the first device, a second clock signal is generated according to the timing parameters. The data signal sent to the second device is controlled based on the second clock signal.

2. The method according to claim 1, characterized in that, The step of sampling the first clock signal driven by the second device to obtain the timing parameters corresponding to the first clock signal includes: The first clock signal is sampled according to the sampling frequency corresponding to the sampling clock to obtain the original timing parameters corresponding to at least one signal period of the first clock signal. The original timing parameters corresponding to each signal period are statistically processed to obtain the timing parameters. The statistical processing includes at least one of the following: average value calculation, median value calculation, maximum value filtering, minimum value filtering, and filtering processing.

3. The method according to claim 1, characterized in that, The method further includes: Continuously acquire the level status of the first clock signal; If the first clock signal remains at a first level for a period of time exceeding a first time threshold, or if the first clock signal remains at a second level for a period of time exceeding a second time threshold, it is determined that the first clock signal exhibits abnormal level behavior. It was determined that the first clock signal was abnormal.

4. The method according to claim 3, characterized in that, The method further includes: The first time threshold is determined based on the duration of the first level and the first configuration value; The second time threshold is determined based on the duration of the second level and the second configuration value. The second time threshold is greater than the maximum allowable clock stretch duration. The maximum allowable clock stretch duration represents the maximum duration during which the first clock signal is allowed to remain at the second level when the first clock signal is pulled low based on the clock stretching mechanism.

5. The method according to claim 3, characterized in that, Before determining that the first clock signal is abnormal, the method further includes: If the first clock signal remains at the first level for a period of time exceeding the first time threshold, or if the first clock signal remains at the second level for a period of time exceeding the second time threshold, the number of abnormal level behaviors is accumulated. If the number of abnormal level behaviors reaches a threshold, it is determined that the first clock signal is abnormal.

6. The method according to claim 1, characterized in that, The data signal transmitted to the second device based on the second clock signal includes: The read operation is completed by adjusting the data signal according to the second clock signal; Release the transmission bus that transmits the data signal.

7. The method according to claim 1, characterized in that, After the address match is successful, the following is also included: The data in the timing parameter storage address is updated according to the timing parameters.

8. A communication anomaly handling device, characterized in that, Applied to a first device, the device includes: The sampling module is used to sample the parameters of the first clock signal driven by the second device in response to the state of address matching with the second device, and obtain the timing parameters corresponding to the first clock signal. The timing parameters include at least one of the following: signal period, first level duration, second level duration, duty cycle, sampling phase, data setup time, data hold time, and jitter tolerance. The generation module is used to generate a second clock signal based on the timing parameters if the first clock signal is abnormal and the second device is currently performing a read operation on the first device when the address match is successful. The control module is used to control the data signal sent to the second device based on the second clock signal.

9. An electronic device, characterized in that, include: Memory, processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory, causing the processor to perform the method as described in any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the method as described in any one of claims 1-7.