I2C data transmission event detection method and device, equipment and storage medium
By using a low-power analog Schmitt comparator to obtain the start and end transition signals of I2C data transmission events as trigger signals and hardware interrupts, the problem of wasted central processing unit resources is solved, efficient I2C data transmission event detection is achieved, and system power consumption is reduced.
Patent Information
- Application Number
- CN202510915165.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-02
- Publication Date
- 2025-11-14
AI Technical Summary
In existing technologies, the detection methods for I2C data transmission events waste the resources of the central processing unit.
A low-power analog Schmitt comparator is used to acquire start and end transition signals via the I2C serial port, which serve as trigger signals for data transmission events and hardware interrupt signals, thus avoiding cyclic detection by the central processing unit.
It saves resources of the central processing unit, improves the efficiency of I2C data transmission event detection and device flexibility, and reduces system power consumption.
Smart Images

Figure CN120950232A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of communication technology, and in particular to an I2C data transmission event detection method, apparatus, device, and storage medium. Background Technology
[0002] The I2C (Inter-Integrated Circuit) bus protocol is a standard half-duplex, synchronous communication bus protocol suitable for high-speed data transmission. The master device communicates with the slave device via two signal lines: SCL (serial clock) and SDA (serial data). SCL is used for unidirectional data transmission from the master to the slave, while SDA is used for time-division bidirectional data transmission between the master and slave. After receiving an I2C data transmission event from the master device, the slave device needs to continuously poll the central processing unit (CPU) and microcontroller unit (MCU) controlling the slave device to detect whether it has received an I2C data transmission event from the master device. In existing technology, slave device connections typically involve the CPU continuously detecting I2C data transmission events from the master device when I2C data transmission begins or when a specified FIFO (First-In-First-Out) depth is reached. If an event is detected, the CPU initiates I2C data transmission and processes it. This method is relatively wasteful of CPU resources. Summary of the Invention
[0003] The purpose of this invention is to provide an I2C data transmission event detection method, apparatus, device, and storage medium to solve the technical problem that the detection of I2C data transmission events in the prior art is wasteful of central processing unit resources.
[0004] The technical solution of the present invention is as follows: a method for detecting I2C data transmission events is provided, comprising:
[0005] A low-power analog Schmitt comparator is used to obtain the start transition signal of the current communication from the master device via the I2C serial port;
[0006] The start transition signal of the current communication is used as the trigger signal for the data transmission event. Based on the trigger signal, the slave device is allocated storage space and a starting address, and the I2C data is stored according to the storage space and the starting address.
[0007] A low-power analog Schmitt comparator is used to obtain the end-of-communication transition signal from the master device through the I2C serial port. The end-of-communication transition signal is used as a hardware interrupt signal to enable the slave device to process the data transmission event.
[0008] Furthermore, the method of obtaining the start transition signal of the current communication from the master device via the I2C serial port using a low-power analog Schmitt comparator includes: generating the start transition signal of the current communication based on the SDA signal level and the SCL signal level using the low-power analog Schmitt comparator, and obtaining the start transition signal of the current communication from the master device via the I2C serial port.
[0009] Furthermore, a low-power analog Schmitt comparator is used to generate a communication start-transition signal based on the SDA and SCL signal levels, including:
[0010] A low-power analog Schmitt comparator is used to continuously acquire the SDA and SCL signal levels, and continuously acquire the difference between the SCL and SDA signal levels. When the difference changes from being equal to a preset threshold to being greater than a preset threshold, a pulse signal is generated. The pulse signals are counted, and the total number of current pulse signals is counted. If the total number of current pulse signals is odd, the generated pulse signal is used as the starting transition signal for the current communication.
[0011] Further, obtaining the communication termination transition signal from the master device via the I2C serial port includes:
[0012] A low-power analog Schmitt comparator is used to continuously acquire the SDA and SCL signal levels, and continuously acquire the difference between the SCL and SDA signal levels. When the difference changes from being equal to a preset threshold to being greater than the preset threshold, a pulse signal is generated. The pulse signals are counted, and the total number of current pulse signals is counted. If the total number of current pulse signals is even, the generated pulse signal is used as the end transition signal of the current communication. The end transition signal of the communication is obtained from the master device through the I2C serial port.
[0013] Furthermore, using a low-power analog Schmitt comparator, the end-of-communication transition signal is obtained from the master device via the I2C serial port, including:
[0014] After obtaining the start transition signal of the current communication from the master device via the I2C serial port using a low-power analog Schmitt comparator, the number of cycles on the SCL clock is counted. After the number of cycles reaches a preset value, the low-power analog Schmitt comparator continuously obtains the SDA signal level and the SCL signal level, and continuously obtains the difference between the SCL signal level and the SDA signal level. When the difference changes from being equal to a preset threshold to being greater than the preset threshold, a pulse signal is generated. The pulse signal is used as the end transition signal of the current communication. The low-power analog Schmitt comparator obtains the end transition signal of the current communication from the master device via the I2C serial port.
[0015] Furthermore, the 2C data transmission event handling method further includes:
[0016] When the difference changes from being greater than a preset threshold to being equal to the preset threshold, it is determined that the I2C start transition state terminates or the I2C end transition state terminates.
[0017] Furthermore, the 2C data transmission event handling method further includes:
[0018] The end transition signal of the previous communication is used as the trigger signal for the data transmission event. Based on the trigger signal, the slave device is allocated storage space and a starting address, so that the I2C data is stored according to the storage space and the starting address.
[0019] Another technical solution of the present invention is as follows: an I2C data transmission event detection device is provided, including a signal acquisition module, a storage module and an event processing module;
[0020] The signal acquisition module is used to acquire the start transition signal of the current communication from the master device through the I2C serial port using a low-power analog Schmitt comparator.
[0021] The storage module is configured to use the start transition signal of the current communication as a trigger signal for a data transmission event, and according to the trigger signal, to allocate storage space and a starting address to the slave device, and to store I2C data according to the storage space and the starting address.
[0022] The event processing module is used to obtain the end transition signal of the current communication from the master device through the I2C serial port using a low-power analog Schmitt comparator, and use the end transition signal of the current communication as a hardware interrupt signal to enable the slave device to process the data transmission event.
[0023] Another technical solution of the present invention is as follows: an electronic device is provided, including a memory and a processor. The memory stores a computer program that can be executed by the processor. When the processor executes the computer program, it implements the I2C data transmission event detection method as described in any of the above technical solutions.
[0024] Another technical solution of the present invention is as follows: a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, and the computer program, when executed by a processor, implements the I2C data transmission event detection method as described in any of the above technical solutions.
[0025] The beneficial effects of this invention are as follows: A low-power analog Schmitt comparator is used to obtain the start transition signal of the current communication from the master device via the I2C serial port; the start transition signal of the current communication is used as a trigger signal for a data transmission event, and the slave device is allocated storage space and a starting address according to the trigger signal, and I2C data is stored according to the storage space and the starting address; the low-power analog Schmitt comparator is used to obtain the end transition signal of the current communication from the master device via the I2C serial port, and the end transition signal of the current communication is used as a hardware interrupt signal, causing the slave device to process the data transmission event; through the above technical solution, a low-power analog Schmitt comparator can be used to detect I2C data transmission events, avoiding the central processing unit's cyclic detection of I2C data transmission events issued by the master device, thus saving central processing unit resources. Attached Figure Description
[0026] Figure 1 A flowchart illustrating the I2C data transmission event detection method provided in an embodiment of the present invention;
[0027] Figure 2 This is a schematic diagram of the structure of the I2C data transmission event detection device provided in an embodiment of the present invention;
[0028] Figure 3 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0029] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of them. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present invention.
[0030] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of the invention. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0031] Figure 1 This is a flowchart illustrating the I2C data transmission event detection method according to an embodiment of the present invention. It should be noted that if substantially the same result is obtained, the I2C data transmission event detection method of the present invention does not necessarily require further explanation. Figure 1 The illustrated process sequence is limited. For example... Figure 1As shown, this I2C data transmission event detection method mainly includes the following steps:
[0032] S101 uses a low-power analog Schmitt comparator to obtain the start transition signal of the current communication from the master device through the I2C serial port;
[0033] In some embodiments, a low-power analog Schmitt comparator is used to obtain the start transition signal of the current communication from the master device via an I2C serial port, including: using a low-power analog Schmitt comparator to generate the start transition signal of the current communication based on the SDA signal level and the SCL signal level, and obtaining the start transition signal of the current communication from the master device via an I2C serial port.
[0034] In this embodiment of the invention, a low-power analog Schmitt comparator is used to generate a start transition signal for the current communication based on the SDA signal level and the SCL signal level. The start transition signal for the current communication is obtained from the master device through the I2C serial port, which can improve the robustness of SDA signal level and SCL signal level detection, thereby improving the robustness of generating the start transition signal.
[0035] In some embodiments, a low-power analog Schmitt comparator is used to generate a communication start-transition signal based on the SDA signal level and the SCL signal level, including:
[0036] A low-power analog Schmitt comparator is used to continuously acquire the SDA and SCL signal levels, and continuously acquire the difference between the SCL and SDA signal levels. When the difference changes from being equal to a preset threshold to being greater than a preset threshold, a pulse signal is generated. The pulse signals are counted, and the total number of current pulse signals is counted. If the total number of current pulse signals is odd, the generated pulse signal is used as the starting transition signal for the current communication.
[0037] In one specific embodiment, the preset threshold can be 200mV. When the difference changes from equal to 200mV to greater than 200mV, a pulse signal is generated, the pulse signals are counted, and the total number of current pulse signals is counted. If the total number of current pulse signals is odd, the generated pulse signal is used as the starting transition signal for the current communication.
[0038] S102, using the start transition signal of the current communication as the trigger signal for the data transmission event, the slave device is allocated storage space and a starting address according to the trigger signal, and the I2C data is stored according to the storage space and the starting address;
[0039] In some embodiments, the 2C data transmission event handling method further includes:
[0040] The end transition signal of the previous communication is used as the trigger signal for the data transmission event. Based on the trigger signal, the slave device is allocated storage space and a starting address, so that the I2C data is stored according to the storage space and the starting address.
[0041] In one specific embodiment, the start transition signal of the current communication can be used as the trigger signal for the data transmission event, or the end transition signal of the previous communication can be used as the trigger signal for the data transmission event, so as to allocate storage space and starting address in advance, and store I2C data according to the storage space and starting address.
[0042] S103, using a low-power analog Schmitt comparator, the end-of-communication transition signal is obtained from the master device through the I2C serial port, and the end-of-communication transition signal is used as a hardware interrupt signal to enable the slave device to process the data transmission event.
[0043] In some embodiments, obtaining the end-of-communication transition signal from the master device via the I2C serial port includes:
[0044] A low-power analog Schmitt comparator is used to continuously acquire the SDA and SCL signal levels, and continuously acquire the difference between the SCL and SDA signal levels. When the difference changes from being equal to a preset threshold to being greater than the preset threshold, a pulse signal is generated. The pulse signals are counted, and the total number of current pulse signals is counted. If the total number of current pulse signals is even, the generated pulse signal is used as the end transition signal of the current communication. The end transition signal of the communication is obtained from the master device through the I2C serial port.
[0045] In one specific embodiment, a low-power analog Schmitt comparator continuously acquires the SDA and SCL signal levels, and continuously acquires the difference between the SCL and SDA signal levels. When the difference first changes from being equal to a preset threshold to being greater than the preset threshold, a pulse signal is generated. This pulse signal is the first pulse signal, which serves as the start transition signal for the current communication, indicating that a data transmission event has occurred. When the difference changes from being equal to the preset threshold to being greater than the preset threshold for the second time, a pulse signal is generated. This pulse signal is the second pulse signal, which serves as the end transition signal for the current communication, indicating that the data transmission event has terminated. This process is repeated to determine the category of all pulse signals.
[0046] In some embodiments, a low-power analog Schmitt comparator is used to obtain the end-of-communication transition signal from the master device via the I2C serial port, including:
[0047] After obtaining the start transition signal of the current communication from the master device via the I2C serial port using a low-power analog Schmitt comparator, the number of cycles on the SCL clock is counted. After the number of cycles reaches a preset value, the low-power analog Schmitt comparator continuously obtains the SDA signal level and the SCL signal level, and continuously obtains the difference between the SCL signal level and the SDA signal level. When the difference changes from being equal to a preset threshold to being greater than the preset threshold, a pulse signal is generated. The pulse signal is used as the end transition signal of the current communication. The low-power analog Schmitt comparator obtains the end transition signal of the current communication from the master device via the I2C serial port.
[0048] In one specific embodiment, an internal digital counter can be used to count the number of cycles on the SCL clock. After the number of cycles reaches a preset cycle value, a low-power analog Schmitt comparator is used to continuously acquire the SDA signal level and the SCL signal level, and continuously acquire the difference between the SCL signal level and the SDA signal level. When the difference changes from being equal to a preset threshold to being greater than the preset threshold, a pulse signal is generated. The preset cycle value can be set according to actual conditions.
[0049] In some embodiments, the 2C data transmission event handling method further includes:
[0050] When the difference changes from being greater than a preset threshold to being equal to the preset threshold, it is determined that the I2C start transition state terminates or the I2C end transition state terminates.
[0051] In one specific embodiment, the data transmission event begins when the I2C start transition state ends and ends when the I2C end transition state ends.
[0052] This invention discloses an I2C data transmission event detection method. It utilizes a low-power analog Schmitt comparator to acquire the start transition signal of the current communication from the master device via the I2C serial port. This start transition signal serves as a trigger signal for the data transmission event. Based on the trigger signal, the slave device allocates storage space and a starting address, and I2C data is stored according to the allocated storage space and the starting address. The low-power analog Schmitt comparator also acquires the end transition signal of the current communication from the master device via the I2C serial port. This end transition signal serves as a hardware interrupt signal, causing the slave device to process the data transmission event. This method utilizes a low-power analog Schmitt comparator to detect I2C data transmission events, avoiding the need for the central processing unit (CPU) to continuously detect I2C data transmission events issued by the master device, thus saving CPU resources.
[0053] This invention discloses an I2C data transmission event detection method. It uses an analog low-power comparator to acquire the I2C start and end transition signals initiated by the master device. The method then uses these signals to determine if an I2C data transmission event exists (the specific I2C data transmission event is configured during system initialization). Upon completion of the I2C data transmission event, a hardware interrupt is initiated, and the processing unit in the slave device is notified to handle the event. This method not only monitors the I2C data transmission time but also saves power consumption during processing in the slave device, improving the overall flexibility of the device and meeting the needs of different I2C protocols. The Schmitt trigger analog comparator generates the I2C start and end transition signals, allocating storage space to prepare for receiving I2C data, thus avoiding situations where I2C protocol data cannot be received normally. Simultaneously, the automatic hardware storage allocation reduces the power consumption of the slave device's central processing unit in initiating storage allocation, lowering the overall system power consumption and improving performance.
[0054] Based on the above-described I2C data transmission event detection method, this embodiment of the invention provides an I2C data transmission event detection device, the structural schematic of which is shown below. Figure 2 As shown, the I2C data transmission event detection device 20 includes a signal acquisition module 21, a storage module 22, and an event processing module 23;
[0055] The signal acquisition module 21 is used to acquire the start transition signal of the current communication from the master device through the I2C serial port using a low-power analog Schmitt comparator.
[0056] The storage module 22 is used to use the start transition signal of the current communication as the trigger signal for the data transmission event, and according to the trigger signal, to allocate storage space and a starting address to the slave device, and to store I2C data according to the storage space and the starting address;
[0057] The event processing module 23 is used to obtain the end transition signal of the current communication from the master device through the I2C serial port using a low-power analog Schmitt comparator, and use the end transition signal of the current communication as a hardware interrupt signal to enable the slave device to process the data transmission event.
[0058] For other details regarding the implementation of the above technical solution by each module in the above I2C data transmission event detection device, please refer to the description in the I2C data transmission event detection method provided in the above embodiments of the invention, which will not be repeated here.
[0059] Based on the above-described I2C data transmission event detection method, this embodiment of the invention provides an electronic device, the structural schematic of which is shown below. Figure 3 As shown, the electronic device 30 includes a processor 31 and a memory 32 coupled to the processor 31. The memory 32 stores a computer program, which, when executed by the processor 31, causes the processor 31 to perform the steps of the I2C transmission event detection method in the above embodiments.
[0060] For other details regarding the implementation of the above technical solution by the processor 31 in the above electronic device 30, please refer to the description in the I2C transmission event detection method provided in the above embodiments of the invention, which will not be repeated here.
[0061] This invention provides a computer-readable storage medium storing a readable computer program. The computer program can be stored in the storage medium as a software product and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute all or part of the steps of the methods described in 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, magnetic disks or optical disks, ROM (Read-Only Memory), RAM (Random Access Memory), or terminal devices such as computers, servers, mobile phones, and tablets.
[0062] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules 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 through some interfaces; the indirect coupling or communication connection between apparatuses or modules may be electrical, mechanical, or other forms.
[0063] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical modules; that is, they may be located in one place or distributed across multiple network modules. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0064] Furthermore, the functional modules in the various embodiments of this application can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The integrated module can be implemented in hardware or as a software functional module. If the integrated module is implemented as a software functional module and sold or used as an independent product, it can be stored in a computer-readable storage medium.
[0065] In the above embodiments, the implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, in the form of a computer program product.
[0066] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a server or data center that integrates one or more available media. The available medium may be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state disk (SSD)).
[0067] The technical solutions provided in this application have been described in detail above. Specific examples have been used in this application to illustrate the principles and implementation methods of this application. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
[0068] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0069] This application is described with reference to flowchart illustrations and / or block diagrams of the methods, apparatus, and computer program products according to this application. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0070] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0071] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0072] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.
Claims
1. A method for detecting I2C data transmission events, characterized in that, include: A low-power analog Schmitt comparator is used to obtain the start transition signal of the current communication from the master device via the I2C serial port; The start transition signal of the current communication is used as the trigger signal for the data transmission event. Based on the trigger signal, the slave device is allocated storage space and a starting address, and the I2C data is stored according to the storage space and the starting address. A low-power analog Schmitt comparator is used to obtain the end-of-communication transition signal from the master device through the I2C serial port. The end-of-communication transition signal is used as a hardware interrupt signal to enable the slave device to process the data transmission event.
2. The I2C data transmission event detection method according to claim 1, characterized in that, The method of obtaining the start transition signal of the current communication from the master device through the I2C serial port using a low-power analog Schmitt comparator includes: generating the start transition signal of the current communication based on the SDA signal level and the SCL signal level using the low-power analog Schmitt comparator, and obtaining the start transition signal of the current communication from the master device through the I2C serial port.
3. The I2C data transmission event detection method according to claim 2, characterized in that, A low-power analog Schmitt comparator is used to generate a communication start-transition signal based on the SDA and SCL signal levels, including: A low-power analog Schmitt comparator is used to continuously acquire the SDA and SCL signal levels, and continuously acquire the difference between the SCL and SDA signal levels. When the difference changes from being equal to a preset threshold to being greater than a preset threshold, a pulse signal is generated. The pulse signals are counted, and the total number of current pulse signals is counted. If the total number of current pulse signals is odd, the generated pulse signal is used as the starting transition signal for the current communication.
4. The I2C data transmission event detection method according to claim 3, characterized in that, Obtaining the end-of-communication transition signal from the master device via the I2C serial port includes: A low-power analog Schmitt comparator is used to continuously acquire the SDA and SCL signal levels, and continuously acquire the difference between the SCL and SDA signal levels. When the difference changes from being equal to a preset threshold to being greater than the preset threshold, a pulse signal is generated. The pulse signals are counted, and the total number of current pulse signals is counted. If the total number of current pulse signals is even, the generated pulse signal is used as the end transition signal of the current communication. The end transition signal of the communication is obtained from the master device through the I2C serial port.
5. The I2C data transmission event detection method according to claim 1, characterized in that, Using a low-power analog Schmitt comparator, the end-of-communication transition signal is obtained from the master device via the I2C serial port, including: After obtaining the start transition signal of the current communication from the master device via the I2C serial port using a low-power analog Schmitt comparator, the number of cycles on the SCL clock is counted. After the number of cycles reaches a preset value, the low-power analog Schmitt comparator continuously obtains the SDA signal level and the SCL signal level, and continuously obtains the difference between the SCL signal level and the SDA signal level. When the difference changes from being equal to a preset threshold to being greater than the preset threshold, a pulse signal is generated. The pulse signal is used as the end transition signal of the current communication. The low-power analog Schmitt comparator obtains the end transition signal of the current communication from the master device via the I2C serial port.
6. The I2C data transmission event detection method according to claim 5, characterized in that, The 2C data transmission event handling method further includes: When the difference changes from being greater than a preset threshold to being equal to the preset threshold, it is determined that the I2C start transition state terminates or the I2C end transition state terminates.
7. The I2C data transmission event detection method according to claim 1, characterized in that, The 2C data transmission event handling method further includes: The end transition signal of the previous communication is used as the trigger signal for the data transmission event. Based on the trigger signal, the slave device is allocated storage space and a starting address, so that the I2C data is stored according to the storage space and the starting address.
8. An I2C data transmission event detection device, characterized in that, It includes a signal acquisition module, a storage module, and an event processing module; The signal acquisition module is used to acquire the start transition signal of the current communication from the master device through the I2C serial port using a low-power analog Schmitt comparator. The storage module is configured to use the start transition signal of the current communication as a trigger signal for a data transmission event, and according to the trigger signal, to allocate storage space and a starting address to the slave device, and to store I2C data according to the storage space and the starting address. The event processing module is used to obtain the end transition signal of the current communication from the master device through the I2C serial port using a low-power analog Schmitt comparator, and use the end transition signal of the current communication as a hardware interrupt signal to enable the slave device to process the data transmission event.
9. An electronic device, comprising a memory and a processor, wherein the memory stores a computer program executable by the processor, characterized in that, When the processor executes the computer program, it implements the I2C data transmission event detection method as described in any one of claims 1 to 7.
10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the I2C data transmission event detection method as described in any one of claims 1 to 7.