A probe insertion and extraction recognition method and device based on IIC line level disturbance

By reusing the data and clock lines of the IIC bus for passive level monitoring and three-level closed-loop verification, the problem of interface resource occupation and power consumption when the identification probe is plugged in and unplugged in embedded devices is solved, and accurate identification and low power consumption identification are achieved in complex environments.

CN123178328APending Publication Date: 2026-11-27QINGPING TECH BEIJING CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611688947.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Priority Date
2026-08-05
Filing Date
2026-10-29
Publication Date
2026-11-27

AI Technical Summary

Technical Problem

In existing technologies, embedded devices require additional detection pins and detection circuits when identifying probe insertion and removal, which leads to increased interface resource consumption and power consumption, failing to meet the requirements of low-power devices for longer battery life and simplified interfaces.

Method used

The original IIC bus data line and clock line of the embedded device are reused as the detection channel. The insertion and removal disturbances are identified by passive level monitoring, interrupt signals are generated in real time, bus reset, initialization configuration and probe identity query are performed, three-level closed-loop verification is carried out, and the probe type is determined by matching algorithm and the judgment threshold is adaptively adjusted.

Benefits of technology

With zero hardware redundancy and extremely low power consumption, it accurately identifies probe insertion and removal, improving the reliability of the device in complex environments and extending its battery life, while avoiding false triggering caused by electromagnetic noise and bus fluctuations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123178328A_ABST
    Figure CN123178328A_ABST
Patent Text Reader

Abstract

The application discloses a kind of probe plug identification method and device based on IIC line level disturbance, the method multiplexing equipment original IIC bus SDA, SCL line as detection channel, zero additional hardware pin, its steps include: full working condition passive level monitoring;Real-time according to preset jump number, amplitude and energy feature identification effective disturbance, determine after generating interrupt signal and pause regular communication;After triggering identification process, three-stage closed loop verification of bus reset, probe initialization configuration and identity query in turn are executed, and access state is determined according to each stage response;After verification, accurately match unique identification to determine probe type, and restore regular communication.Passive monitoring is maintained only under normal conditions, and it returns to this normal state after communication is restored.In addition, disturbance determination threshold is bidirectionally self-adapting adjusted according to historical identification result.The application does not need hardware redundancy, and can effectively filter electromagnetic interference.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of embedded device communication technology, and in particular to a probe insertion and removal identification method and device based on IIC line level disturbance. Background Technology

[0002] In the field of embedded device external probe application technology, device manufacturers typically rely on multi-pin interfaces to monitor the sensor's connection status. In existing technologies, to ensure the identification of the probe's physical connection, it is generally necessary to set up dedicated detection pins and corresponding detection circuits. External pull-up or pull-down resistors are used to determine changes in the pin level, thereby identifying probe insertion or removal. Specifically, in traditional interface designs, two additional pins are often needed specifically for detecting probe connection. However, this approach relying on additional detection pins not only consumes scarce interface resources in embedded devices and increases PCB layout complexity, but also generates fixed standby power consumption due to leakage current or voltage division losses in the hardware detection circuit, failing to meet the stringent requirements of low-power embedded devices for extended battery life and simplified interfaces. Summary of the Invention

[0003] This specification provides a probe insertion / removal identification method and apparatus based on IIC line level disturbance to solve at least one of the technical problems mentioned above.

[0004] To solve the above-mentioned technical problems, the embodiments in this specification are implemented as follows: According to a first aspect of the embodiments of this specification, a probe insertion / removal identification method based on IIC line level disturbance is provided, applied to an embedded device, which reuses the data lines and clock lines of the original IIC bus of the embedded device as detection channels, and includes the following steps: Passive level monitoring is performed on the data lines and clock lines under all operating conditions of the embedded device; Based on preset insertion and removal disturbance characteristics, the system identifies the detected level changes in real time. When a valid probe insertion and removal disturbance is determined, an interrupt signal is generated to trigger the identification process and the normal communication of the IIC bus is suspended. In the identification process, bus reset, probe initialization configuration and probe identity query are executed sequentially, and closed-loop verification is performed based on the response of each stage command; The probe access status is determined based on the closed-loop verification result, and the probe type is determined by a matching algorithm after the probe is successfully accessed, and the normal communication of the IIC bus is restored. In the normal state where the identification process is not triggered, only the passive level monitoring is maintained, and this state is returned to normal after regular communication is restored; and Based on the historical judgment results of the identification process, the judgment threshold in the preset insertion and removal disturbance feature is adaptively adjusted.

[0005] In some optional implementations, the sequential execution of bus reset, probe initialization configuration, and probe identity query, followed by closed-loop verification based on the responses to commands at each stage, includes: Send a bus reset command to clear residual data and abnormal level states on the bus, and wait for the preset hardware reset time; Send probe initialization configuration command to activate the probe and match the working mode; After receiving the initialization success response, a device type query command is sent to read the probe's unique identification information; If the bus reset command, probe initialization configuration command, and device type query command all receive standard response data, and the unique identification information is valid, then the probe is determined to have been successfully connected, and the probe type is determined based on the unique identification information. If any instruction times out without response, returns garbled data, or has abnormal parameters, the current recognition process will be terminated and determined to be a false trigger.

[0006] In some optional implementations, the passive level monitoring of the data lines and clock lines under all operating conditions of the embedded device includes: With preset sampling period Voltage value of the data line and the voltage value of the clock line Synchronous sampling is performed to obtain discrete voltage sequences. and ,in The sampling sequence number; Real-time calculation of the absolute value of the voltage difference between adjacent sampling points on each line: In each length of Within a sliding detection window of sampling points, the disturbance intensity characteristic of the window is calculated cumulatively based on the absolute value of the voltage difference.

[0007] In some optional implementations, the step of identifying the detected level changes based on preset insertion / removal disturbance characteristics, and generating an interrupt signal to trigger the identification process when a valid probe insertion / removal disturbance is determined, includes: Within the sliding detection window, statistics satisfy Number of sampling points and satisfy Number of sampling points ,in This is the preset voltage jump threshold; Calculate the total number of level transitions within the sliding detection window. ; Calculate the disturbance energy within the sliding detection window. ; A probe insertion / removal disturbance is considered valid when all of the following conditions are met: And there exists at least one sampling point such that or And the disturbance energy ; in, The preset threshold number of transitions, greater than The amplitude difference threshold, The energy threshold is determined based on the statistical distribution of bus noise energy in the probe-free access state.

[0008] In some alternative implementations, the energy threshold Determined dynamically in the following ways: During idle periods when the embedded device has no probe connected and is in normal communication mode, continuous data collection is performed. A length of The disturbance energy values ​​of the sliding detection window constitute the noise energy sample set. ; Calculate the mean of the noise energy sample set. and standard deviation ; Set the energy threshold ,in It is a preset constant factor, and ; The energy threshold The embedded device initializes upon each power-on or updates at preset intervals to adapt to changes in environmental electromagnetic noise.

[0009] In some optional implementations, if any instruction times out without response, returns garbled data, or has abnormal parameters, the current identification process is terminated, including: Set corresponding response timeout thresholds for the bus reset command, probe initialization configuration command, and device type query command, respectively. , , ; A timer is started after each instruction is sent. If no start response signal is received from the probe within the corresponding response timeout threshold, the instruction is deemed to have timed out and there is no response. For the received response data, perform cyclic redundancy check. If the check fails, the returned data is considered to be garbled. For the unique identification information, it is matched with a preset legal device code library. If the device function code or hardware version number in the unique identification information is not in the legal device code library, it is determined to be a parameter abnormality. If any of the following occurs: no response after timeout, garbled returned data, or abnormal parameters, the current recognition process shall be terminated immediately.

[0010] In some optional implementations, the step of adaptively adjusting the judgment threshold in the preset insertion / removal disturbance features based on the historical judgment results of the identification process includes: Record the disturbance characteristic parameters corresponding to each valid probe insertion / removal disturbance, including the total number of level transitions. and disturbance energy ; When continuous If all subsequent identification processes are determined to be false triggers, the threshold for the number of jumps is automatically increased based on the median or mean of the most recently recorded perturbation feature parameters. and / or the amplitude difference threshold ; When continuous If each identification process determines that the probe access is valid, the threshold for the number of jumps is automatically lowered based on the median or mean of the most recently recorded disturbance characteristic parameters. and / or the amplitude difference threshold Furthermore, the lowered threshold is not lower than the initial preset value of the threshold when the device is powered on and initialized; in, and All are preset positive integers.

[0011] In some optional implementations, determining the probe type using a matching algorithm includes: After completing the probe identity query and receiving the unique identification information, the unique identification information is precisely matched with the pre-stored legitimate probe code library; If a match is successful, the type of probe matched is determined. If a match fails, the probe will be marked as an unknown type, the original device configuration will be maintained, and the unknown device access event will be recorded.

[0012] In some optional implementations, the generation of an interrupt signal to trigger the identification process and suspend normal communication on the IIC bus includes: When a valid probe insertion / removal disturbance is detected, a high-priority interrupt signal is generated. In response to the high-priority interrupt signal, the microcontroller of the embedded device wakes up from low-power sleep mode and performs the following operations: Detect the current communication status of the IIC bus. If the bus is in the process of data transmission, wait for the current byte transmission to complete before sending a stop condition, or save the context of the unfinished communication task to the buffer. If the IIC bus data line is continuously pulled low by the slave device, a preset number of clock pulses are continuously sent through the clock line until the data line is released to release the bus deadlock state. Set the identification process status flag to prevent the initiation of new regular communication tasks; When resuming normal IIC bus communication, the identification process status flag is cleared, and the communication task context is restored from the buffer to continue executing the suspended communication task.

[0013] According to a second aspect of the embodiments of this specification, a probe insertion / removal identification device based on IIC line level disturbance is provided, applied to an embedded device, which reuses the original IIC bus data line and clock line of the embedded device as a detection channel, including: A passive level monitoring module is used to passively monitor the level of the data line and clock line under all operating conditions of the embedded device. The disturbance identification and interruption triggering module is used to identify the monitored level changes in real time based on the preset insertion and removal disturbance characteristics. When it is determined to be a valid probe insertion and removal disturbance, an interrupt signal is generated to trigger the identification process and the normal communication of the IIC bus is suspended. The hierarchical identification and closed-loop verification module is used to sequentially execute bus reset, probe initialization configuration and probe identity query in the identification process, and perform closed-loop verification based on the response of each stage instruction; The access determination and type identification module is used to determine the probe access status based on the closed-loop verification result, and after determining that the probe has been successfully accessed, to determine the probe type through a matching algorithm and to restore the normal communication of the IIC bus. A low-power state management module is used to maintain only the passive level monitoring under normal conditions when the identification process is not triggered, and to return to this normal state after normal communication is restored; and The threshold adaptive adjustment module is used to adaptively adjust the judgment threshold in the preset insertion and removal disturbance features based on the historical judgment results of the recognition process.

[0014] One embodiment of this specification can achieve at least the following beneficial effects: In the technical solution of this application, after the embedded device performs passive level monitoring of the IIC bus in real time and identifies waveform characteristics, it first filters out various electromagnetic interferences based on preset multi-dimensional physical characteristics such as the number of transitions, amplitude changes, and sliding window energy. An interrupt signal is generated only when specific insertion and removal disturbance characteristics are met. Then, the embedded device is required to suspend normal communication and sequentially perform a three-level progressive closed-loop verification of bus reset, initialization configuration, and unique identifier query. At the same time, the system is limited to maintaining passive monitoring with extremely low power consumption under normal conditions and waking up the identification process only when a valid disturbance is triggered. The judgment threshold of disturbance characteristics is adjusted bidirectionally and adaptively through historical judgment results. Since this method fully reuses the original IIC bus data and clock lines of the device without the need for additional pins, it avoids the inherent static power consumption and interface complexity of traditional hardware detection. Furthermore, the three-step closed-loop verification and adaptive threshold mechanism can effectively isolate the electromagnetic environment from misleading the identification logic. This solution can ensure that the embedded device can accurately identify probe insertion and removal under the premise of zero hardware redundancy and extremely low power consumption. This is equivalent to limiting any electromagnetic noise or instantaneous bus fluctuations to prevent probe state switching. Only when the bus load change caused by physical insertion and removal is locked by multi-dimensional features and confirmed by three strict verifications can the probe access status be updated. This can, to a certain extent, ensure that the device's probe identification results are highly consistent with the actual physical access situation, improve the device's working reliability in complex environments, and effectively extend the battery life. Attached Figure Description

[0015] To more clearly illustrate the technical solutions in the embodiments or prior art of this specification, the drawings used in the description of the embodiments or prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0016] Figure 1 A flowchart illustrating a probe insertion / removal identification method based on IIC line level perturbation, provided as an embodiment of this specification; Figure 2 This diagram illustrates the determination of the real-time sampling waveform of the SDA bus and the absolute value of the voltage difference and the amplitude threshold in a probe insertion and removal identification method based on IIC line level disturbance provided in the embodiments of this specification. Figure 3 A schematic diagram comparing bus voltage waveforms under three operating conditions—normal IIC communication, electromagnetic interference, and probe insertion / removal—in a probe insertion / removal identification method based on IIC line level disturbance provided in the embodiments of this specification. Figure 4A timing diagram illustrating the real-time IIC timing compliance disturbance filtering mechanism under all operating conditions in a probe insertion and removal identification method based on IIC line level disturbance provided in the embodiments of this specification; Figure 5 A timing diagram illustrating the IIC bus deadlock recovery mechanism in a probe insertion / removal identification method based on IIC line level disturbance provided in the embodiments of this specification; Figure 6 A timing diagram illustrating the insertion / removal interrupt triggering and communication context saving in a probe insertion / removal identification method based on IIC line level perturbation provided in the embodiments of this specification; Figure 7 A scatter plot illustrating the feature value distribution of different disturbance types in a probe insertion / removal identification method based on IIC line-level disturbances provided in the embodiments of this specification; Figure 8 A schematic diagram of the balance between identification performance and power consumption under different sampling periods in a probe insertion and removal identification method based on IIC line level perturbation provided in the embodiments of this specification; Figure 9 The embodiments provided in this specification correspond to Figure 1 A schematic diagram of a probe insertion / removal identification device based on IIC line level perturbation. Detailed Implementation

[0017] To make the objectives, technical solutions, and advantages of one or more embodiments of this specification clearer, the technical solutions of one or more embodiments of this specification will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this specification, and not all of them. Based on the embodiments in this specification, all other embodiments obtained by those skilled in the art without creative effort are within the protection scope of one or more embodiments of this specification.

[0018] The technical solution of this application will be described in detail below with reference to the accompanying drawings, such as... Figure 1 As shown, the probe insertion / removal identification method based on IIC line level perturbation of the present invention may include the following steps: Step 102: Perform passive level monitoring on the data line and clock line under all operating conditions of the embedded device.

[0019] In the embodiments described in this specification, passive level monitoring is performed under all operating conditions of the embedded device. This can be understood as the embedded device performing passive level monitoring at a preset sampling period. The voltage values ​​of the SDA and SCL lines on the IIC bus are continuously and uninterruptedly acquired. The monitoring in this application does not depend on whether the bus is idle; rather, it spans all states of the embedded device, including standby, regular data communication, and low-power sleep. The monitored physical quantity is the real-time analog voltage signal on the bus. In the embodiments of this specification, the embedded device can refer to a hardware device that measures and controls external physical quantities and has communication capabilities through a microcontroller (MCU) and various interfaces. This application's solution is applicable to low-power IoT terminals that are battery-powered, have strict power consumption requirements, and require the connection of various types of external sensor probes. For embedded devices, accurately identifying whether external probes have been physically plugged in or unplugged is a prerequisite for ensuring accurate data acquisition and normal device operation during long-term unattended operation in complex electromagnetic environments. In practical applications, from a hardware perspective, traditional identification schemes require additional dedicated detection pins on the device interface, along with external voltage divider circuits or pull-up / pull-down resistors to achieve high or low level detection. This not only occupies the scarce general-purpose input / output (GPIO) resources of the MCU but also causes continuous standby power consumption in the standby state due to pin bias current. To address the above issues, this application proposes to fully reuse the SDA and SCL signal lines of the original IIC communication bus of the device as the detection channel. Since the embedded device inevitably needs to interact with the probe during manufacturing or daily operation, the physical connection of the IIC bus already exists, adding no hardware cost and achieving an architecture with zero additional hardware pins and zero additional circuitry. To meet low power consumption requirements, this monitoring mode can be set to purely passive listening. The embedded device only performs ADC sampling and data recording, without actively sending any communication signals to the bus or preempting bus resources. Therefore, this monitoring behavior itself will not interfere with the device's normal communication operations, nor will it generate additional power consumption due to bus polling. Figure 2 As shown in part (a), the embedded device uses a preset sampling period. The SDA bus voltage is sampled in real time. Figure (b) shows the calculated absolute value of the voltage difference between adjacent sampling points. Absolute difference The magnitude of the amplitude directly reflects the degree of drastic change in bus level between adjacent sampling times, providing a basic physical quantity for subsequent sliding window statistics and amplitude comparison. The differential peak value exceeding the 0.5V threshold in Figure (b) is a typical characteristic of load mutation caused by physical plugging and unplugging.

[0020] Step 104: In real time, identify the detected level changes based on the preset insertion and removal disturbance characteristics. When a valid probe insertion and removal disturbance is determined, an interrupt signal is generated to trigger the identification process and the normal communication of the IIC bus is suspended.

[0021] In the embodiments described in this specification, identification is performed in real time based on preset insertion / removal disturbance characteristics, which can be understood according to the physical state in the actual scenario. In practical applications, when the probe is in the insertion state, it is connected to the bus as a slave load on the IIC bus. When a physical insertion / removal action occurs, the transient contact resistance of the contact point undergoes a drastic nonlinear change. This impedance change directly causes the SDA or SCL levels on the IIC bus to oscillate violently and randomly, with amplitude and frequency significantly different from the regular timing pulses during normal communication, as well as the occasional narrow pulses caused by electrostatic or electromagnetic environments. Figure 3 As shown, (a) is a normal IIC communication waveform, whose timing transitions are strictly synchronized with the clock line and have stable amplitude; (b) is a normal electromagnetic interference, which is manifested as a narrow pulse with small amplitude and extremely short duration; (c) is a level disturbance caused by actual probe insertion and removal. Figure 3 Part (c) illustrates the violent oscillations in the bus voltage caused by drastic changes in contact resistance during probe insertion and removal. These oscillations are high-frequency and irregular, with amplitudes exceeding one-third of the bus power supply voltage, and typically last for several milliseconds. This is significantly different from the regular square wave of normal communication in (a) and the occasional spike pulses lasting only microseconds in (b). This application's technical solution filters out valid insertion and removal signals from chaotic voltage fluctuations by setting multiple physical constraints such as "transition frequency threshold" and "amplitude threshold." Simultaneously, to filter out data transitions conforming to the IIC protocol during normal communication, this application also designs a real-time IIC timing compliance disturbance filtering mechanism. For example... Figure 4 As shown, when the SDA data line transitions during the SCL low level (i.e., the green line on the left side of the figure), this is a legal data change allowed by the IIC protocol. This change will be filtered in real time and will not be included in the transition statistics. However, once a plugging / unplugging disturbance is detected (i.e., the red line in the figure), it will be immediately determined to be valid. Figure 4 This illustrates the timing compliance filtering mechanism of this application. The "compliant communication transition" marked by the green line on the left occurs during the SCL low level, conforming to the timing specifications for data line switching in the IIC protocol, and is therefore filtered out and not included in the disturbance statistics. The "abnormal insertion / removal transition" marked by the red line on the right occurs in the SCL high level range. At this time, the large fluctuations on the SDA line are abnormal level changes that do not conform to the protocol specifications, and are captured in real time and counted in the transition count within the sliding window. In the statistics, the communication itself can be accurately distinguished from the plug-in / plug-out event.

[0022] Step 106: In the identification process, bus reset, probe initialization configuration and probe identity query are executed sequentially, and closed-loop verification is performed based on the response of each stage command.

[0023] In the embodiments described in this specification, once the embedded device detects a valid plug-in / plug-out disturbance event that meets the above-mentioned characteristics, it will immediately generate a high-priority interrupt signal and suspend normal communication. This is because plug-in / plug-out disturbances and communication often occur simultaneously. If a reset command is forcibly inserted while the bus is transmitting service data, it can easily lead to bus logic chaos. Subsequently, the embedded device performs a three-level step-by-step closed-loop verification, including bus reset, initialization configuration, and device type query. These three steps are progressive, verifying whether the probe is truly connected through hardware handshake and logic confirmation at the protocol level. The embedded device performs closed-loop verification based on the response data of the commands at each stage. If there is no response or an abnormal response at any step, the current process is terminated. It is through the layer-by-layer verification of the response data that this application can achieve multi-level verification logic in a strong interference environment, including cleaning up residual interference at the source, verifying the authenticity of access from the hardware level, and confirming the legitimacy of identity from the data level.

[0024] Step 108: Determine the probe access status based on the closed-loop verification result, and determine the probe type through a matching algorithm after determining that the probe has been successfully accessed, and restore the normal communication of the IIC bus.

[0025] In the embodiments described in this specification, the probe access status is determined based on the closed-loop verification result, which can be specifically manifested as a veto-response verification of the three-level response result. The embedded device reads the unique identification information such as hardware version, function code, and serial number stored internally by the probe, determines the probe type through a matching algorithm (e.g., distinguishing between temperature probes, humidity probes, pressure probes, etc.), and resumes normal IIC communication. If any link in the three-level verification fails, the embedded device determines that it is a false trigger caused by environmental electromagnetic interference, terminates the identification process, and avoids abnormal device configuration caused by misoperation. The matching algorithm used in this application focuses on the accurate identification of hardware codes, enabling the embedded device to accurately obtain the specific model and version of the probe, thereby loading the correct driver and acquisition parameters.

[0026] Step 110: In the normal state where the identification process is not triggered, only the passive level monitoring is maintained, and the state is returned to normal after normal communication is restored; and the judgment threshold in the preset plugging and unplugging disturbance features is adaptively adjusted according to the historical judgment results of the identification process.

[0027] In practical applications, different electromagnetic environments, varying IIC bus load quantities, and even different PCB layouts can all cause deviations in the baseline level of bus noise floor. Using a rigid, fixed initial threshold for an extended period can easily lead to frequent false triggers in extremely noisy environments or missed detections of actual insertions and removals in low-noise environments. This application records the characteristic parameters of historical false triggers and successful identifications, and implements a bidirectional adjustment logic on the judgment threshold: "increasing for false triggers and decreasing for correct identifications, but not falling below the initial value." This allows the sensitivity and specificity of the entire identification scheme to self-optimize with environmental changes, consistently maintaining optimal performance. Based on the preset bidirectional adaptive adjustment logic of the insertion / removal disturbance judgment threshold, after each trigger of the identification process and completion of closed-loop verification, the embedded device dynamically records the disturbance characteristics (number of jumps, disturbance energy) of each trigger and adjusts subsequent threshold parameters in real time based on the judgment result (continuous false triggers or continuous correct identifications), thereby ensuring that the device operates at optimal recognition accuracy over the long term.

[0028] In the technical solution of this application, after the embedded device performs passive level monitoring of the IIC bus in real time and identifies waveform characteristics, it first filters out various electromagnetic interferences based on preset multi-dimensional physical characteristics such as the number of transitions, amplitude changes, and sliding window energy. An interrupt signal is generated only when specific insertion and removal disturbance characteristics are met. Then, the embedded device is required to pause normal communication and sequentially perform a three-level progressive closed-loop verification of bus reset, initialization configuration, and unique identifier query. At the same time, this solution is limited to maintaining extremely low power passive monitoring under normal conditions and waking up the identification process only when a valid disturbance is triggered. The judgment threshold of disturbance characteristics is adjusted bidirectionally and adaptively through historical judgment results. Since this method fully reuses the original IIC bus data and clock lines of the device without the need for additional pins, it avoids the inherent static power consumption and interface complexity of traditional hardware detection. Furthermore, the three-step closed-loop verification and adaptive threshold mechanism can effectively isolate the electromagnetic environment from misleading the identification logic. This solution can ensure that the embedded device can accurately identify probe insertion and removal under the premise of zero hardware redundancy and extremely low power consumption. This is equivalent to limiting any electromagnetic noise or instantaneous bus fluctuations to prevent probe state switching. Only when the bus load change caused by physical insertion and removal is locked by multi-dimensional features and confirmed by three strict verifications can the probe access status be updated. This can, to a certain extent, ensure that the device's probe identification results are highly consistent with the actual physical access situation, improve the device's working reliability in complex environments, and effectively extend the battery life.

[0029] Based on the technical solutions described above, this specification also provides some specific implementation schemes, which are described below.

[0030] In an optional embodiment, the sequential execution of bus reset, probe initialization configuration, and probe identity query, along with closed-loop verification based on the responses to commands at each stage, may include: sending a bus reset command to clear residual bus data and abnormal level states, and waiting for a preset hardware reset time; sending a probe initialization configuration command to activate the probe and match the working mode; after receiving a successful initialization response, sending a device type query command to read the probe's unique identification information; if the bus reset command, probe initialization configuration command, and device type query command all receive standard response data, and the unique identification information is valid, then the probe is determined to have successfully connected, and the probe type is determined based on the unique identification information; if any command times out without response, returns garbled data, or has abnormal parameters, then the current identification process is terminated and determined to be a false trigger.

[0031] This embodiment defines a three-level closed-loop verification process and details the "one-vote veto" judgment rules. The first step, a forced bus reset, is a crucial "zeroing" operation. Its purpose is to clear residual error frames or abnormal level states caused by previous communication anomalies, eliminating interference from historical communication on the current identification process. Waiting for a preset hardware reset time (e.g., 5ms) provides sufficient charging and logic level stabilization period for the hardware circuitry after the probe is powered on, allowing the probe's internal MCU and communication interface to complete power-on reset and ensure it is in an initial state addressable by the host. The second step, probe initialization configuration, is the true "handshake" verification. This instruction is not just a communication Q&A but also includes power supply parameter matching, operating mode configuration, and internal sampling reference calibration. It is a verification step to determine "whether a physical entity is connected," because if no actual probe is connected or the probe is damaged, the embedded device will not receive a compliant response frame. The third step, device type query, is the final closed loop of "identity confirmation." By reading the unique ID embedded within the probe, it is possible not only to determine the legality of the hardware but also to distinguish between different types and batches of probes. It is through these three interconnected verification steps, and the strict determination that the process will terminate if any step fails, that this application's solution can achieve the following in a strong interference environment: cleaning up residual interference at the source, verifying the authenticity of access from a hardware perspective, and confirming the legitimacy of identity from a data perspective, thus building multiple anti-interference barriers.

[0032] In an optional embodiment, the passive level monitoring of the data line and clock line under all operating conditions of the embedded device may include: using a preset sampling period. Voltage value of the data line and the voltage value of the clock line Synchronous sampling is performed to obtain discrete voltage sequences. and ,in This refers to the sampling sequence number; the absolute value of the voltage difference between adjacent sampling points on each line is calculated in real time. , ; in each length of Within a sliding detection window of sampling points, the disturbance intensity characteristic of the window is calculated cumulatively based on the absolute value of the voltage difference.

[0033] This embodiment specifically defines the physical execution process of passive level monitoring. First, the embedded device uses a preset sampling period... The voltage values ​​of the SDA and SCL lines are synchronously acquired to obtain discrete voltage sequences. The settings can be comprehensively configured based on device performance and power consumption requirements. This application experimentally tested the recognition accuracy and power consumption curves under different sampling periods. Figure 8 The performance-power balance curves shown depict the ADC sampling period (0 to 5 ms) on the horizontal axis, the recognition accuracy on the left vertical axis (blue), and the average standby current on the right vertical axis (red). The solid blue line illustrates the decreasing accuracy with increasing sampling period, while the dashed red line shows the rapid decreasing power consumption with increasing sampling period. A significant advantage point (green dashed line) is formed at 1 ms, where the accuracy remains as high as 98.7%, while the standby power consumption drops to only 12 μA, demonstrating excellent energy efficiency. Therefore, the "preset sampling period"... "In practical implementation, the configuration can be dynamically adjusted based on device resources and application scenarios. In real-world scenarios, it can be set to 1ms. The embedded device takes a voltage snapshot of the SDA and SCL lines every 1 millisecond, forming a discrete voltage sequence. Then, it calculates the absolute value of the voltage difference between two adjacent sampling points on each line in real time." This involves calculating the absolute value of the difference between the current sampling point voltage and the previous sampling point voltage. This absolute difference directly reflects the severity of voltage fluctuations on the bus. (The last sentence appears to be incomplete and possibly refers to a timeframe or time interval.) Within the sliding detection window of each sampling point, this The absolute values ​​of the voltage differences at each sampling point are accumulated for calculation. The sliding window design allows embedded devices to focus on changes in bus behavior over a continuous time period, rather than viewing transient voltages at a single moment in isolation, thus providing a data basis for subsequent statistics on "jump frequency" and "disturbance energy".

[0034] In an optional embodiment, the step of identifying the detected level changes based on preset insertion / removal disturbance characteristics, and generating an interrupt signal to trigger the identification process when a valid probe insertion / removal disturbance is determined, may include: within the sliding detection window, statistically analyzing data that satisfies… Number of sampling points and satisfy Number of sampling points ,in The preset voltage transition threshold is used; the total number of level transitions within the sliding detection window is calculated. ; Calculate the disturbance energy within the sliding detection window A probe insertion / removal disturbance is considered valid when all of the following conditions are met: And there exists at least one sampling point such that or And the disturbance energy ;in, The preset threshold number of transitions, greater than The amplitude difference threshold, The energy threshold is determined based on the statistical distribution of bus noise energy in the probe-free access state.

[0035] This embodiment further refines the specific calculations and multi-condition comprehensive judgment rules for disturbance feature identification. In practical applications, relying solely on the absolute value of the voltage difference is insufficient, as normal bus communication also generates voltage jumps. Therefore, the embedded device first sets a relatively low voltage jump threshold. (e.g., 0.1V) is used to filter out white noise and ADC quantization error, as long as the difference value exceeds... This means that a level transition has occurred, and the number of transitions on the SDA and SCL lines is counted separately. Meanwhile, the embedded device calculates the "disturbance energy" within the sliding window. This parameter sums the squared absolute values ​​of the voltage difference, which is equivalent to weighted amplification of the transition amplitude. This means that multiple small transitions generate less energy than several large transitions. Determining a disturbance as valid includes three stringent constraints: firstly, the total number of transitions within the window... The number of transitions must exceed the threshold. This ensures that the disturbance has a certain degree of "persistence," eliminating sporadic signal interference. Secondly, there must be at least one voltage jump amplitude exceeding [a certain value] within the window. A sampling point of 0.5V (e.g., 0.5V) ensures that the trigger source is a sudden level change caused by physical mechanical contact, rather than a normal logic jump in communication data (logic jumps are usually between 0V and 3.3V, but with steep edges, while insertion and removal often involve large fluctuations across these ranges). Thirdly, the total disturbance energy within the window. Exceeding the energy threshold This further eliminates the possibility of minor noise accumulation from the perspective of "overall destructive power." For example... Figure 7The scatter plot showing the distribution of disturbance type feature values ​​indicates that the horizontal axis represents the total number of level transitions counted within the sliding detection window. The vertical axis represents the calculated window perturbation energy. The figure uses different colored dots to classify and label normal bus noise, electrostatic / electromagnetic interference, and actual probe insertion / removal events. Blue dots represent normal bus noise, which is mainly concentrated in the low transition number and low energy region; yellow dots represent electrostatic or electromagnetic interference, which, although its transition number or energy is slightly increased, is mostly still distributed below the threshold; red dots represent actual probe insertion / removal events. Figure 7 The preset threshold number of transitions is indicated by red vertical dashed lines and blue horizontal dashed lines, respectively. and dynamically determined energy threshold Two dashed lines divide the two-dimensional plane into the upper right corner, defining the effective perturbation detection area (red shaded area). From... Figure 7 As can be seen, the actual probe insertion and removal events are concentrated within the effective disturbance judgment area, that is, simultaneously satisfying the condition... and The two-dimensional conditions naturally separate it from normal bus noise and occasional electromagnetic interference. This visualized feature distribution can verify the rationality of the multi-condition parallel judgment rule proposed in this application, that is, only when the frequency and energy intensity of bus fluctuations simultaneously exceed the threshold will an interrupt response be triggered, while normal background noise and impulse interference are blocked outside the effective judgment area.

[0036] In an optional embodiment, the energy threshold The following method can be used to dynamically determine: during idle periods when the embedded device has no probe connected and is in normal communication, continuous data collection is performed. A length of The disturbance energy values ​​of the sliding detection window constitute the noise energy sample set. ; Calculate the mean of the noise energy sample set. and standard deviation Set the energy threshold. ,in It is a preset constant factor, and The energy threshold The embedded device initializes upon each power-on or updates at preset intervals to adapt to changes in environmental electromagnetic noise.

[0037] This embodiment addresses the uncertainty of environmental background noise by providing an energy threshold. The proposed method employs a dynamic adaptive determination approach. During gaps in normal communication periods, although the IIC bus is idle, it may still generate weak noise voltages due to power supply ripple, PCB antenna effects, or high-frequency electromagnetic radiation from the surrounding environment. These noises can create small disturbances within the sliding detection window. Setting a fixed threshold for these noise levels can easily trigger false identifications when noise levels are high. Therefore, this solution collects data during the device's idle phase. The perturbation energy values ​​of the group window are used as background noise samples. According to the 3σ criterion in probability statistics, the energy values ​​of most normal background noise will be distributed around the mean. Add or subtract three standard deviations Within the range. The energy threshold. Set as And require A value ≥3 can statistically control the probability of normal background noise being misjudged as a valid disturbance to within 0.3%. This dynamic calibration mechanism makes embedded devices highly adaptable. Whether installed in a clean electromagnetic environment like a computer room or in a high-interference environment near a factory motor, the embedded device can self-calibrate to find the most suitable criterion threshold for the current environment at the moment of power-on or at regular intervals.

[0038] In an optional embodiment, terminating the identification process if any instruction times out without response, returns garbled data, or has abnormal parameters may include: setting corresponding response timeout thresholds for the bus reset instruction, probe initialization configuration instruction, and device type query instruction. , , After sending each instruction, a timer is started. If no initial response signal from the probe is received within the corresponding response timeout threshold, the instruction is deemed to have timed out and received no response. For the received response data, a cyclic redundancy check is performed. If the check fails, the returned data is deemed to be garbled. The unique identifier information is matched with a preset legitimate device code library. If the device function code or hardware version number in the unique identifier information is not in the legitimate device code library, the parameter is deemed abnormal. When any of the following occurs: no response timeout, garbled returned data, or abnormal parameters, the current identification process is immediately terminated.

[0039] This embodiment details how to effectively determine response anomalies during the three-level closed-loop verification process. Besides relying on traditional physical timeout mechanisms, this solution also incorporates software protocol verification and business logic validity checks into the identification framework. Specifically, the embedded device sets a corresponding independent timer for each instruction in the three-level identification process. This is because different probe hardware and internal Flash capacity can lead to variations in response time when performing reset, initialization, and type lookup. Using a uniform timeout threshold could easily cause some probes to terminate incorrectly due to slow response. By setting separate timeout thresholds... , , First, embedded devices can more accurately identify whether a probe is truly "out of contact." Second, for the received response data, the embedded device performs a complete Cyclic Redundancy Check (CRC). CRC is an important means in communication protocols to verify the integrity of data transmission. If the CRC check fails, it indicates that there may be glitches on the current IIC bus, causing data bits to be flipped. If subsequent judgment is forced with garbled data, it will inevitably produce incorrect results. Therefore, it is directly judged as garbled and the process is terminated. Finally, for the returned unique identification information, even if the CRC is correct and there is no timeout, the embedded device will also perform a business-level "legitimacy check," that is, strictly compare the "device function code" and "hardware version number" in the ID with the device's factory-built legitimate probe code library byte by byte. If the read code is not in the preset legitimate library, it means that the probe is either damaged, belongs to an illegal peripheral, or electromagnetic interference just randomly generated garbled code that happened to pass the CRC check. Through this three-fold rigorous closed-loop control, the risk of probe misjudgment caused by false disturbances under complex operating conditions can be eliminated.

[0040] In an optional embodiment, the adaptive adjustment of the judgment threshold in the preset insertion / removal disturbance features based on the historical judgment results of the identification process may include: recording the disturbance feature parameters corresponding to each valid probe insertion / removal disturbance, wherein the disturbance feature parameters include the total number of level transitions. and disturbance energy When continuous If all subsequent identification processes are determined to be false triggers, the threshold for the number of jumps is automatically increased based on the median or mean of the most recently recorded perturbation feature parameters. and / or the amplitude difference threshold When continuous If each identification process determines that the probe access is valid, the threshold for the number of jumps is automatically lowered based on the median or mean of the most recently recorded disturbance characteristic parameters. and / or the amplitude difference threshold Furthermore, the lowered threshold value is not lower than the initial preset value of the threshold when the device is powered on and initialized; where, and All are preset positive integers.

[0041] This embodiment defines a threshold self-iterative strategy for "preset insertion / removal disturbance characteristics". During the operation of the embedded device, the characteristic parameters of each disturbance event that is triggered and completes the three-level closed-loop verification are recorded in the historical buffer of the embedded device. When consecutive disturbance events occur... When a situation is identified as a false trigger, it indicates that the baseline noise level in the current environment may have increased (e.g., a new high-power inverter has been added near the device), or changes in the bus load capacitance have led to increased insertion and removal disturbances, rendering the original low threshold inadequate and frequently causing false positives. In this case, the embedded device will automatically adjust the threshold based on historical disturbance characteristic parameters, such as using the median as a reference. and The value is adjusted to filter out these new interferences. Conversely, when the embedded device continuously... When all identification processes successfully determine that the probe has been connected, it indicates that the ambient noise level is good, the device's anti-interference condition is stable, or the current threshold setting is too conservative and may be missing some weak but real insertion / removal events. In this case, the embedded device initiates a threshold reduction optimization program to lower the threshold to ensure identification sensitivity. However, to ensure that the initial settings of the embedded device at the factory or during power-on initialization are not completely destroyed, this solution specifically emphasizes that "the lowered threshold should not be lower than the initial preset value of the threshold during device power-on initialization." This allows the embedded device to maintain basic noise immunity under the initial baseline even after multiple rounds of environmental changes, preventing the threshold from dropping too low and causing an extremely high false alarm rate for normal noise. This two-way closed-loop adjustment mechanism gives this solution both high environmental adaptability and safety baseline protection.

[0042] In an optional embodiment, determining the probe type through a matching algorithm may include: after completing the probe identity query and receiving the unique identifier information, performing a precise match between the unique identifier information and a pre-stored legitimate probe code library; if the match is successful, determining the matched probe type; if the match fails, marking the probe as an unknown type, maintaining the original device configuration, and recording the unknown device access event.

[0043] This embodiment of the technical solution specifically clarifies the identification and matching strategy for probe types. Unlike the commonly used "similarity" matching in artificial intelligence or deep learning, this application focuses on low-power, low-cost embedded application scenarios, and therefore adopts a "precise matching" matching algorithm. This is because the unique identification information embedded inside the probe (e.g., device function code 0x01 represents a temperature probe, 0x02 represents a humidity probe; hardware version V1.0, V2.0, etc.) is stored in EEPROM or Flash in standard bit-based digital form. For this type of fixed digital identifier, fuzzy recognition is not required; efficient hash lookup or direct byte-by-byte memory comparison is sufficient to determine whether the probe is legitimate and accurately obtain the probe's specific model and version. Once a legitimate probe is confirmed, the embedded device will immediately and automatically load the corresponding driver parameters and calibration coefficients to complete the adaptation of the new probe. If precise matching fails, the embedded device will not force configuration but will mark the probe as an unknown type, maintaining the normal operation of the original device. At the same time, the embedded device will record the "unknown device access event" of this matching failure in the log. This design ensures that only compliant and certified probes can be used normally, preventing unauthorized peripherals from causing equipment malfunctions. Furthermore, in engineering practice, it facilitates after-sales personnel in checking equipment logs to determine if users have connected third-party probes from brands other than their own, thus aiding in rapid fault diagnosis.

[0044] In an optional embodiment, the step of generating an interrupt signal to trigger the identification process and suspend the normal communication of the IIC bus may include: generating a high-priority interrupt signal when a valid probe insertion / removal disturbance is determined; in response to the high-priority interrupt signal, the microcontroller of the embedded device wakes up from a low-power sleep mode and performs the following operations: detecting the current communication status of the IIC bus; if the bus is transmitting data, waiting for the current byte transmission to complete before sending a stop condition, or saving the unfinished communication task context to a buffer; if it is detected that the IIC bus data line is continuously pulled low by the slave device, continuously sending a preset number of clock pulses through the clock line until the data line is released to release the bus deadlock state; setting an identification process status flag to prevent the start of new normal communication tasks; when resuming normal IIC bus communication, clearing the identification process status flag and restoring the communication task context from the buffer to continue executing the suspended communication task.

[0045] This embodiment discloses the specific details of the interrupt triggering mechanism and the bus preemption process. For example... Figure 6The timing diagram shown illustrates the complete timing sequence for interrupt triggering and communication context saving, illustrating the interrupt triggering and bus preemption. The diagram depicts four evolutionary stages—normal IIC communication, disturbance interrupt triggering, context saving and probe identification, and communication recovery—using the SCL clock line, SDA data line, high-priority interrupt signals, and communication task status signals. For low-power embedded devices, the MCU is normally in deep sleep mode, only enabling the edge-triggered external interrupt (EXTI) function of the IIC interface. Once a valid insertion / removal disturbance is detected, Figure 6 A high-priority interrupt signal is pulled high to wake up the MCU and switch the communication task status to "paused," followed by context saving, bus reset, and three-level verification. After the identification process is completed, the interrupt signal returns to low level, and the communication task resumes from the buffer, achieving a low-power operating mode of "no disturbance when not needed, instant wake-up when needed." After waking up, the MCU does not immediately take over the bus but first checks the current bus status. If the bus is busy, it waits for the currently transmitted byte to complete and sends the STOP condition specified by the IIC protocol at an appropriate time to terminate the current service, or saves the context of the unfinished communication task (such as the current register pointer and counter value) to the SRAM buffer. To prevent abnormal deadlocks that may occur on the bus during probe insertion and removal (i.e., the probe pulls the SDA line low at the moment of removal and remains stuck at a low level forever), this method also includes features such as... Figure 5 The deadlock recovery mechanism shown is as follows: Figure 5 The specific timing of the IIC bus deadlock recovery mechanism is shown. Figure 5 The diagram shows the master continuously outputting nine clock pulses via the SCL line, forcing the slave (probe) whose SDA line was abnormally pulled low to release the bus. Figure 5 As can be seen, the SDA line returns to a high level after 9 pulse cycles, indicating that the bus has successfully recovered from a deadlock state to an idle state. The MCU will actively send a preset number of clock pulses (such as the 9 clock pulses commonly used in the IIC protocol standard) continuously through the SCL line to force the abnormal slave device on the bus to release the SDA line, restoring the bus to an idle state. Subsequently, the MCU will initiate the three-level verification identification process. After the identification process is completed, the MCU will promptly clear the interrupt status flag and restore the previously saved communication context from the buffer, allowing suspended communication tasks to continue execution, thereby ensuring the continuity of device communication and avoiding packet loss or data interruption caused by plugging and unplugging identification.

[0046] In an optional embodiment, determining the probe access status based on the closed-loop verification result may further include secondary verification based on the consistency between the unique identifier information and historical access records: after determining successful probe access and reading the unique identifier information through closed-loop verification, the unique identifier information is compared with the historical probe access records stored internally by the embedded device; if the unique identifier information is consistent with the identifier of the most recently successfully accessed probe, and the time interval between the last disconnection event and the current access event is less than a preset first time threshold, then the probe working status is restored using a first set of initialization parameters, where the first set of initialization parameters is a cached copy of the configuration parameters used during the last successful access; if the unique identifier information is inconsistent with any probe identifier in the historical access records, or the historical access records are empty, then a complete initialization configuration process is executed, and the unique identifier information and corresponding configuration parameters are updated to the historical access records; if the unique identifier information is consistent with a probe identifier in the historical access records, but the time interval is greater than or equal to the first time threshold, then a complete verification process is executed, and the corresponding configuration parameters in the historical access records are calibrated.

[0047] This embodiment constructs a secondary verification and rapid recovery mechanism based on probe "identity memory." In practical applications, many embedded devices are fixedly installed, and probes of the same model or from the same batch and manufacturer are typically replaced periodically. Forcing a complete three-level step-by-step verification (including all power supply configurations and baud rate calibration) every time a probe is plugged in or out would increase unnecessary execution time and power consumption. This solution allocates a dedicated storage area in the device's internal Flash memory as a "historical access record," specifically recording the unique identifier ID of the probe that was successfully connected last time, along with a cached copy of its matching initialization configuration parameters. Once the embedded device completes the "physical verification" of hardware and identity, it immediately performs a rapid comparison. If the current probe ID is found to be completely identical to the previous connection, and the time interval between the last disconnection and this connection is very short (less than a preset first time threshold, such as 5 minutes), it is highly likely that the user has re-plugged in the same probe (e.g., accidentally unplugged and immediately plugged it back in). In this case, the embedded device skips the time-consuming initialization steps and uses the cached configuration copy to restore its working state. This mechanism is extremely user-friendly for scenarios involving frequent plugging and unplugging (such as probe replacement and maintenance in industrial settings), allowing the probe to be put back into working condition in a very short time. However, if the user connects a probe with a different ID, or if the same probe is reconnected after several weeks, the embedded device will still rigorously execute the entire initialization process and calibrate and update the parameters in the history record to prevent old parameters from becoming invalid due to aging of the probe's internal components, thus ensuring the absolute accuracy of measurement and control.

[0048] Based on the foregoing technical solutions, this invention also provides a probe insertion / removal identification device based on IIC line level disturbance, applied to embedded devices, which reuses the original IIC bus data lines and clock lines of the embedded device as detection channels, such as... Figure 9 As shown, the device, from a macroscopic perspective, may include the following modules: The passive level monitoring module 902 is used to passively monitor the level of the data line and clock line under all operating conditions of the embedded device. The disturbance identification and interrupt triggering module 904 is used to identify the monitored level changes in real time based on the preset insertion and removal disturbance characteristics. When it is determined to be a valid probe insertion and removal disturbance, an interrupt signal is generated to trigger the identification process and the normal communication of the IIC bus is suspended. The hierarchical identification and closed-loop verification module 906 is used to sequentially execute bus reset, probe initialization configuration and probe identity query in the identification process, and perform closed-loop verification based on the response of each stage instruction. The access determination and type identification module 908 is used to determine the probe access status based on the closed-loop verification result, and after determining that the probe has been successfully accessed, to determine the probe type through a matching algorithm and to restore the normal communication of the IIC bus. The low-power state management module 910 is used to maintain only the passive level monitoring under normal conditions where the identification process is not triggered, and to return to this normal state after resuming normal communication; and The threshold adaptive adjustment module 912 is used to adaptively adjust the judgment threshold in the preset insertion and removal disturbance features based on the historical judgment results of the recognition process. Those skilled in the art will understand that the modules in the device described in the foregoing embodiments can be distributed in the device of the embodiments as described, or they can be located in one or more devices different from this embodiment with corresponding changes.

[0049] The modules in the above embodiments can be merged into one module, or they can be further divided into multiple sub-modules. That is, the modules can be flexibly divided to implement the method embodiments described above.

[0050] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A probe insertion / removal identification method based on IIC line level perturbation, characterized in that, Applied to embedded devices, this invention reuses the data and clock lines of the original IIC bus of the embedded device as detection channels, and includes the following steps: Passive level monitoring is performed on the data lines and clock lines under all operating conditions of the embedded device; Based on preset insertion and removal disturbance characteristics, the system identifies the detected level changes in real time. When a valid probe insertion and removal disturbance is determined, an interrupt signal is generated to trigger the identification process and the normal communication of the IIC bus is suspended. In the identification process, bus reset, probe initialization configuration and probe identity query are executed sequentially, and closed-loop verification is performed based on the response of each stage command; The probe access status is determined based on the closed-loop verification result, and the probe type is determined by a matching algorithm after the probe is successfully accessed, and the normal communication of the IIC bus is restored. In the normal state where the identification process is not triggered, only the passive level monitoring is maintained, and this state is returned to normal after regular communication is restored; and Based on the historical judgment results of the identification process, the judgment threshold in the preset insertion and removal disturbance feature is adaptively adjusted.

2. The probe insertion / removal identification method based on IIC line level perturbation according to claim 1, characterized in that, The process sequentially executes bus reset, probe initialization configuration, and probe identity query, and performs closed-loop verification based on the responses to commands at each stage, including: Send a bus reset command to clear residual data and abnormal level states on the bus, and wait for the preset hardware reset time; Send probe initialization configuration command to activate the probe and match the working mode; After receiving the initialization success response, a device type query command is sent to read the probe's unique identification information; If the bus reset command, probe initialization configuration command, and device type query command all receive standard response data, and the unique identification information is valid, then the probe is determined to have been successfully connected, and the probe type is determined based on the unique identification information. If any instruction times out without response, returns garbled data, or has abnormal parameters, the current recognition process will be terminated and determined to be a false trigger.

3. The probe insertion / removal identification method based on IIC line level perturbation according to claim 1, characterized in that, The passive level monitoring of the data lines and clock lines under all operating conditions of the embedded device includes: With preset sampling period Voltage value of the data line and the voltage value of the clock line Synchronous sampling is performed to obtain discrete voltage sequences. and ,in The sampling sequence number; Real-time calculation of the absolute value of the voltage difference between adjacent sampling points on each line: In each length of Within a sliding detection window of sampling points, the disturbance intensity characteristic of the window is calculated cumulatively based on the absolute value of the voltage difference.

4. The probe insertion / removal identification method based on IIC line level perturbation according to claim 3, characterized in that, The process involves identifying detected level changes based on preset insertion / removal disturbance characteristics. When a valid probe insertion / removal disturbance is detected, an interrupt signal is generated to trigger the identification process, including: Within the sliding detection window, statistics satisfy Number of sampling points and satisfy Number of sampling points ,in This is the preset voltage jump threshold; Calculate the total number of level transitions within the sliding detection window. ; Calculate the disturbance energy within the sliding detection window. ; A probe insertion / removal disturbance is considered valid when all of the following conditions are met: And there exists at least one sampling point such that or And the disturbance energy ; in, The preset threshold number of transitions, greater than The amplitude difference threshold, The energy threshold is determined based on the statistical distribution of bus noise energy in the probe-free access state.

5. The probe insertion / removal identification method based on IIC line level perturbation according to claim 4, characterized in that, The energy threshold Determined dynamically in the following ways: During idle periods when the embedded device has no probe connected and is in normal communication mode, continuous data collection is performed. A length of The disturbance energy values ​​of the sliding detection window constitute the noise energy sample set. ; Calculate the mean of the noise energy sample set. and standard deviation ; Set the energy threshold ,in It is a preset constant factor, and ; The energy threshold The embedded device initializes upon each power-on or updates at preset intervals to adapt to changes in environmental electromagnetic noise.

6. The probe insertion / removal identification method based on IIC line level perturbation according to claim 2, characterized in that, If any instruction times out without response, returns garbled data, or has abnormal parameters, the current recognition process will be terminated, including: Set corresponding response timeout thresholds for the bus reset command, probe initialization configuration command, and device type query command, respectively. , , ; A timer is started after each instruction is sent. If no start response signal is received from the probe within the corresponding response timeout threshold, the instruction is deemed to have timed out and there is no response. For the received response data, perform cyclic redundancy check. If the check fails, the returned data is considered to be garbled. For the unique identification information, it is matched with a preset legal device code library. If the device function code or hardware version number in the unique identification information is not in the legal device code library, it is determined to be a parameter abnormality. If any of the following occurs: no response after timeout, garbled returned data, or abnormal parameters, the current recognition process shall be terminated immediately.

7. The probe insertion / removal identification method based on IIC line level perturbation according to claim 1, characterized in that, The step of adaptively adjusting the judgment threshold in the preset insertion / removal disturbance features based on the historical judgment results of the recognition process includes: Record the disturbance characteristic parameters corresponding to each valid probe insertion / removal disturbance, including the total number of level transitions. and disturbance energy ; When continuous If all subsequent identification processes are determined to be false triggers, the threshold for the number of jumps is automatically increased based on the median or mean of the most recently recorded perturbation feature parameters. and / or the amplitude difference threshold ; When continuous If each identification process determines that the probe access is valid, the threshold for the number of jumps is automatically lowered based on the median or mean of the most recently recorded disturbance characteristic parameters. and / or the amplitude difference threshold Furthermore, the lowered threshold is not lower than the initial preset value of the threshold when the device is powered on and initialized; in, and All are preset positive integers.

8. The probe insertion / removal identification method based on IIC line level perturbation according to claim 1, characterized in that, The process of determining the probe type using a matching algorithm includes: After completing the probe identity query and receiving the unique identification information, the unique identification information is precisely matched with the pre-stored legitimate probe code library; If a match is successful, the type of probe matched is determined. If a match fails, the probe will be marked as an unknown type, the original device configuration will be maintained, and the unknown device access event will be recorded.

9. The probe insertion / removal identification method based on IIC line level perturbation according to claim 1, characterized in that, The generation of an interrupt signal to trigger the identification process and suspend normal communication on the IIC bus includes: When a valid probe insertion / removal disturbance is detected, a high-priority interrupt signal is generated. In response to the high-priority interrupt signal, the microcontroller of the embedded device wakes up from low-power sleep mode and performs the following operations: Detect the current communication status of the IIC bus. If the bus is in the process of data transmission, wait for the current byte transmission to complete before sending a stop condition, or save the context of the unfinished communication task to the buffer. If the IIC bus data line is continuously pulled low by the slave device, a preset number of clock pulses are continuously sent through the clock line until the data line is released to release the bus deadlock state. Set the identification process status flag to prevent the initiation of new regular communication tasks; When resuming normal IIC bus communication, the identification process status flag is cleared, and the communication task context is restored from the buffer to continue executing the suspended communication task.

10. A probe insertion / removal identification device based on IIC line level perturbation, characterized in that, Applied to embedded devices, it reuses the data lines and clock lines of the original IIC bus of the embedded device as detection channels, including: A passive level monitoring module is used to passively monitor the level of the data line and clock line under all operating conditions of the embedded device. The disturbance identification and interruption triggering module is used to identify the monitored level changes in real time based on the preset insertion and removal disturbance characteristics. When it is determined to be a valid probe insertion and removal disturbance, an interrupt signal is generated to trigger the identification process and the normal communication of the IIC bus is suspended. The hierarchical identification and closed-loop verification module is used to sequentially execute bus reset, probe initialization configuration and probe identity query in the identification process, and perform closed-loop verification based on the response of each stage instruction; The access determination and type identification module is used to determine the probe access status based on the closed-loop verification result, and after determining that the probe has been successfully accessed, to determine the probe type through a matching algorithm and to restore the normal communication of the IIC bus. A low-power state management module is used to maintain only the passive level monitoring under normal conditions when the identification process is not triggered, and to return to this normal state after normal communication is restored; and The threshold adaptive adjustment module is used to adaptively adjust the judgment threshold in the preset insertion and removal disturbance features based on the historical judgment results of the recognition process.