A coprocessor-based multi-lane i2c parallel access and fault isolation method

By providing multiple independent channels and a unified register interface through the coprocessor, the communication latency and fault recovery issues when the main processor accesses multiple types of sensors in embedded systems are resolved. This enables efficient multi-channel parallel access and channel-level fault isolation, improving the real-time performance and reliability of the system.

CN123157643APending Publication Date: 2026-11-24HUNAN GUOKE HAIPHONG INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611659597.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-10-26
Publication Date
2026-11-24

AI Technical Summary

Technical Problem

In embedded systems, when the main processor accesses multiple types of sensors via the I2C bus, there are problems such as long communication timing delay, limited number of hardware controllers, mutual constraints on the access rates of multiple sensors, and complex bus fault recovery, making it difficult to achieve multi-channel parallel access and fault isolation.

Method used

The system employs a coprocessor to provide N independent communication master control channels. Each channel has an independent communication controller and pin resources, and a unified register interface is defined. The master processor accesses the channels through bus address mapping. The coprocessor generates communication timing and independently maintains timeouts and status, enabling channel-level fault isolation and online recovery.

Benefits of technology

It reduces the main processor access time from milliseconds to microseconds, enables multi-channel parallel access, channel-level fault isolation, ensures that a single sensor deadlock does not affect the entire system, and allows for rapid fault recovery without requiring a system restart, significantly improving sensor access efficiency and reliability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123157643A_ABST
    Figure CN123157643A_ABST
Patent Text Reader

Abstract

This invention discloses a method for multi-channel I2C parallel access and fault isolation based on a coprocessor. The method includes: a coprocessor providing N independent communication master control channels, each with its own communication controller and communication pin resources; each communication master control channel presenting a unified three-register interface; the main processor reading and writing registers via bus address mapping to complete sensor access; the communication timing is generated and executed by the coprocessor, and the main processor does not participate in bit timing; the coprocessor independently maintains the timeout and status information of each communication master control channel; in the event of a single communication master control channel failure, independent soft reset recovery is achieved simply by writing to the reset register of that communication master control channel. This invention achieves timing offloading, multi-channel parallel access, fault isolation, and independent recovery, significantly improving the real-time performance, reliability, and maintainability of multi-sensor systems.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of embedded system sensor interface technology, specifically to a coprocessor-based method for multi-channel I2C parallel access and fault isolation, applicable to sensor interface design of multi-sensor integrated devices such as underwater acoustic monitoring, industrial control, and unmanned platforms. Background Technology

[0002] In embedded systems, the main processor typically needs to access various types of sensors via the I2C bus, such as environmental sensors, power monitoring sensors, attitude and inertial navigation sensors, and I / O expansion chips. These sensors differ significantly in access timing, update rate, and communication reliability, posing the following engineering challenges to system design: (1) The main processor software simulates I2C timing and requires microsecond-level delay. During communication, the CPU is fully occupied, and the high-frequency access of multiple sensors severely squeezes the business processing capacity. (2) The main processor hardware I2C controller has a limited number of channels (usually 2-3 channels). Multiple types of sensors connected to the same bus need to be addressed in a time-division manner, and the speeds are mutually constrained. Furthermore, a single device deadlock will lock up the entire bus. (3) In a single-bus multi-device architecture, slow sensor long transmission blocks fast sensor acquisition, and data timeliness cannot be guaranteed; (4) Bus fault recovery relies on whole machine reset, which is costly and not suitable for long-term unattended equipment.

[0003] Therefore, there is an urgent need for a technical solution that can offload bus timing from the main processor, enable multi-channel parallel access, and have channel-level fault isolation and online recovery capabilities. Summary of the Invention

[0004] The purpose of this invention is to provide a method for multi-channel I2C parallel access and fault isolation based on a coprocessor, so as to solve the technical problems existing in the prior art.

[0005] To achieve the above-mentioned objectives, this invention provides a method for multi-channel I2C parallel access and fault isolation based on a coprocessor, the method comprising the following steps: S100: The coprocessor provides N independent communication master control channels, where N is an integer greater than or equal to 2. Each communication master control channel has an independent communication controller and independent communication pin resources, enabling each communication master control channel to communicate with its respective mounted sensor simultaneously, thus achieving multi-channel parallelism at the physical layer. S200. In the coprocessor, a unified register interface is defined for each communication master control channel. The master processor addresses the register interface uniformly according to the channel base address plus offset. The register interface includes at least a reset register, a command register, and a data register. Thus, the master processor's access to the sensor can be abstracted into register read and write operations. S300: The main processor performs register read and write operations on the register interfaces defined by each communication master control channel through bus address mapping to complete access to the target sensor. The communication timing of the target sensor is generated and executed by the coprocessor based on the content written or read by the register read and write operations. The main processor does not participate in the bit-level control of the communication timing, thus realizing timing offloading. The S400 and coprocessor independently maintain the timeout and status information of each communication master control channel. When any communication master control channel fails, the master processor writes reset information to the reset register corresponding to the faulty communication master control channel, so that the communication controller of the communication master control channel independently completes a soft reset and reinitializes, thereby realizing channel-level fault isolation and online recovery.

[0006] In this invention, the main processor only needs to read and write registers to access the sensor, reducing CPU usage per access from milliseconds to microseconds; N independent communication main control channels acquire data in parallel, decoupling the rates of slow and fast sensors; channel-level fault isolation prevents single sensor deadlock from spreading to the entire system; and independent soft reset of the communication main control channels enables online fault recovery without requiring a complete system restart.

[0007] As a further preferred embodiment, in step S100, the coprocessor is a programmable logic device, including at least one of FPGA and CPLD, the communication master control channel is an I2C master control channel, the communication controller is an I2C master controller, and the communication pin resources include SCL / SDA pins. The number of communication master control channels can be expanded as needed, and the communication master control channels are physically isolated from each other, with no shared resource contention.

[0008] As a further preferred embodiment, in step S100, the slow-update-rate sensor and the fast-update-rate sensor are respectively mounted on different communication master control channels. The master processor polls in parallel according to the cycle of each sensor. The rate decoupling is achieved through physical channel separation. The slow-speed sensor and the fast-speed sensor each occupy an independent channel. The master processor initiates access in parallel according to their respective cycles. This ensures that the long-time transmission of the slow channel does not drag down the fast channel.

[0009] As a further preferred embodiment, in step S100, the slow sensor includes an environmental quantity sensor, and the fast sensor includes a power monitoring sensor. The environmental quantity sensor (such as a temperature sensor, a barometric pressure sensor, etc.) updates at the second level, while the power monitoring sensor (such as a voltage sensor, a current sensor) acquires data at the millisecond level with high frequency. The two have a large difference in update rate, and the parallel advantages can be fully utilized by mounting them on separate channels, so that the timeliness of fast quantity data such as power monitoring is guaranteed, and the acquisition of environmental quantities is not affected.

[0010] As a further preferred embodiment, in step S200, the command register is used to distinguish between send / read operations, and the data register is used to carry read and write data. This register has a clear interface semantics, is simple to implement in the driver software, and has high access efficiency.

[0011] As a further preferred embodiment, in step S300, the communication timing includes at least one of start condition, stop condition, acknowledge bit, and clock stretching. These I2C bit-level timing details are all handled by the coprocessor hardware, eliminating the need for the main processor to worry about timing delays and significantly reducing CPU usage.

[0012] As a further preferred embodiment, in step S300, the main processor completes one access operation by writing a command to the command register and writing data to or reading data from the data register. This encapsulates a single sensor access into a bus operation sequence of writing a command and writing / reading data, with the subsequent timing automatically completed by the coprocessor hardware. In other words, the main processor operation is simplified to register read / write, reducing the single access time from milliseconds to microseconds.

[0013] As a further preferred embodiment, in step S300, the bus includes at least one of EMIF / AXI / AHB / PCIe. That is, the address mapping between the main processor and the coprocessor is compatible with multiple mainstream buses, has a wide range of applications, and is easy to integrate.

[0014] As a further preferred embodiment, in step S400, the coprocessor independently maintains the timeout counter for each communication master control channel. When the operation of a certain communication master control channel exceeds a preset timeout value, it is determined that the communication master control channel has failed and the corresponding status information is set. The master processor learns about the faulty channel by reading the status information. The preset timeout value is configured by the master processor or automatically set by the coprocessor according to the sensor type. This allows for accurate location of the faulty channel, highly targeted fault isolation, and precise recovery operations.

[0015] As a further optimization, the faults include at least one of sensor deadlock, bus hang, and no response. For common I2C bus fault types (deadlock, hang, no response), the coprocessor can detect and set the status through a timeout mechanism, achieving coverage of the main fault scenarios and significantly improving system robustness.

[0016] Compared with existing technologies, the method provided by this invention requires only register read and write operations for the main processor to access the sensor, reducing CPU usage per access from milliseconds to microseconds, significantly releasing business processing capabilities. At the same time, parallel acquisition through N independent communication main control channels decouples the rates of slow and fast sensors, ensuring the timeliness of fast data acquisition. Channel-level fault isolation prevents single-sensor deadlock from spreading to the entire system. Independent soft reset of a single communication main control channel enables online fault recovery without requiring a system restart, meeting the requirements for long-term unattended operation. Furthermore, the unified register interface decouples the sensor driver software from the physical channel implementation, and adding a new sensor only requires allocating a channel base address, resulting in low expansion costs. Attached Figure Description

[0017] Various other advantages and benefits will become apparent to those skilled in the art upon reading the detailed description of the embodiments described below. The accompanying drawings are for illustrative purposes only and are not intended to limit the invention. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings: Figure 1 This is a flowchart of the coprocessor-based multi-channel I2C parallel access and fault isolation method in this invention. Detailed Implementation

[0018] The technical solution of the present invention will be described in detail below with reference to the accompanying drawings and specific embodiments. The following embodiments are only used to illustrate the present invention and should not be regarded as limiting the scope of the present invention.

[0019] like Figure 1 As shown, the present invention specifically provides a method for multi-channel I2C parallel access and fault isolation based on a coprocessor, the method comprising the following steps: S100: The coprocessor provides N independent communication master control channels, where N is an integer greater than or equal to 2. Each communication master control channel has an independent communication controller and independent communication pin resources, enabling each communication master control channel to communicate with its respective mounted sensor simultaneously. S200. In the coprocessor, a unified register interface is defined for each communication master control channel. The master processor performs unified addressing of the register interface according to the channel base address plus offset. The register interface includes at least a reset register, a command register, and a data register. S300: The main processor performs register read and write operations on the register interfaces defined by each communication master control channel through bus address mapping to complete access to the target sensor. The communication timing of the target sensor is generated and executed by the coprocessor based on the content written or read by the register read and write operations. The main processor does not participate in the bit-level control of the communication timing. The S400 coprocessor independently maintains the timeout and status information of each communication master control channel. When any communication master control channel fails, the master processor writes reset information to the reset register corresponding to the failed communication master control channel, enabling the communication controller of that communication master control channel to independently complete a soft reset and reinitialize.

[0020] In this invention, based on steps S100-S400, the coprocessor provides N independent channels at the physical level to achieve parallel communication, abstracts sensor access into register read and write through a unified three-register interface at the interface level, generates and executes communication timing at the timing level so that the main processor does not participate in bit-level control, and independently maintains timeout and status at the fault handling level by writing to the reset register to achieve independent soft reset of the channel, thereby forming a complete mechanism of timing offloading, multi-channel parallelism, fault isolation and independent recovery.

[0021] Example 1 This embodiment describes a certain type of underwater acoustic signal monitoring device, which includes a main processor (DSP), a coprocessor (FPGA), and three sets of sensors. The coprocessor (FPGA) provides three independent I2C master control communication channels. The main control communication channel 0 is equipped with a temperature and pressure sensor (polling at the second level). The main control communication channel 1 is equipped with a multi-channel power monitoring chip (millisecond-level high-frequency voltage and current acquisition). The main control communication channel 2 is equipped with an IO expansion chip (status acquisition).

[0022] Each master communication channel presents three registers: a channel reset register (writing to it resets the I2C controller of that master communication channel), a command register (distinguishing between send and read operations), and a data register (carrying read and write data). The main processor DSP accesses these three registers via the EMIF bus according to the channel base address. A single sensor access is encapsulated as a bus operation of writing to the command register and writing / reading the data register. The timing details such as I2C start / stop / acknowledgment / clock stretching are all handled by the FPGA hardware. The DSP does not participate in the I2C bit timing at all, and there is no waiting or blocking.

[0023] Comparative Example 1 Compared with Example 1, the difference in Comparative Example 1 is that: the hardware I2C controller (2 channels) of the main processor DSP is used to connect all three types of sensors, and the temperature and pressure sensors and the power monitoring chip are connected to the same bus for time-division addressing.

[0024] Under the same test conditions (main processor DSP clock frequency 600MHz, EMIF bus clock 100MHz, three sets of sensors working simultaneously), Example 1 and Comparative Example 1 were compared and tested, and the results are shown in Table 1.

[0025]

[0026] As shown in Table 1, Example 1, through its technical features of multiple independent channels, timing hardware offloading, and slow-fast channel mounting, reduces the CPU usage time of the main processor during a single access from 850μs in Comparative Example 1 to 12μs, a reduction of approximately 98.6%; the CPU utilization rate during multi-sensor polling decreases from 42% to 6%; the maximum data acquisition interval for power monitoring is shortened from 120ms to 10ms, a reduction of approximately 91.7%, significantly improving the timeliness of rapid data acquisition; when the IO expansion chip fails, Comparative Example 1 experiences a 2200ms interruption in other channels due to the entire bus being suspended, requiring a complete system reset, while in Example 1, access to other channels is completely unaffected, and the faulty channel recovers immediately after a 3ms single-channel soft reset, reducing recovery time by approximately 99.8%. This fully demonstrates that the present invention represents a significant and verifiable technological advancement over existing technologies in terms of real-time performance, reliability, and maintainability.

[0027] Example 2 This embodiment targets industrial control equipment, which includes a main processor (MCU), a coprocessor (CPLD), and four sets of sensors. The CPLD provides four independent I2C master control channels, each connected to a temperature sensor, humidity sensor, voltage monitoring chip, and current monitoring chip, respectively. The main processor (MCU) accesses the three-register interface of each channel via the AHB bus according to the channel base address. When a sensor on a certain channel experiences a no-response fault, the independent timeout counter maintained by the coprocessor for that channel overflows, setting the corresponding status information. The main processor then reads the status information and writes reset information to the reset register of that channel, achieving online recovery of the faulty channel.

[0028] Comparative Example 2 Compared with Example 2, the difference of Comparative Example 2 is that it adopts the 3-way hardware I2C controller built into the main processor MCU, and the MCU directly handles I2C interrupts and timing.

[0029] Under the same test conditions (main processor MCU clock frequency 200MHz, AHB bus clock 50MHz, four sets of sensors working simultaneously), Example 2 and Comparative Example 2 were compared and tested, and the results are shown in Table 2.

[0030]

[0031] As shown in Table 2, Example 2, through its unified three-register interface, channel-level independent timeout maintenance, and channel-independent soft reset, reduces the CPU time occupied by the MCU during a single access from 620μs in Comparative Example 2 to 10μs, a reduction of approximately 98.4%; the number of MCU interrupt responses per unit time is reduced from approximately 4800 times / s to zero, the MCU does not need to respond to any I2C interrupts, and the CPU load rate is reduced from 38% to 5%; when a sensor in a certain communication control channel fails to respond, Comparative Example 2 needs to reset the MCU or reinitialize all I2C controllers, causing an interruption in data acquisition for other communication control channels for approximately 150 seconds. The recovery time is approximately 1200ms (re-initialization of all I2C controllers), while in Example 2, only the communication control channel fails due to a timeout, and access to other communication control channels is completely unaffected. The faulty channel recovers normally after a single-channel soft reset in about 2.5ms, reducing the recovery time by approximately 99.8%. Furthermore, because Example 2 uses a unified three-register interface, the workload for developing new sensor drivers is reduced from approximately 16 person-hours in Example 2 (requiring programming for different controllers) to approximately 4 person-hours (using only a unified three-register interface), a reduction of approximately 75%, significantly lowering expansion costs. This fully demonstrates that the present invention represents a significant and verifiable technological advancement over existing technologies in terms of CPU load, fault recovery granularity, inter-channel disturbances, and driver expansion costs.

[0032] Example 3 This embodiment targets an unmanned platform, which includes a main processor (CPU), a coprocessor (FPGA), and multiple sets of sensors. These sensors include attitude inertial navigation sensors (high-frequency acquisition), environmental quantity sensors (low-frequency acquisition), power monitoring sensors (high-frequency acquisition), and I / O expansion chips (low-frequency acquisition). The FPGA provides four independent I2C master control channels, with high-frequency and low-frequency sensors mounted on separate channels. The main processor polls these sensors in parallel according to their respective cycles, ensuring that the long-sequence transmission of slower channels does not hinder faster channels. If any channel experiences sensor deadlock or bus hang, only that channel's operation times out; access to other channels remains unaffected. The faulty channel recovers after an independent soft reset without requiring a restart of the main processor system.

[0033] Comparative Example 3 Compared with Example 3, the difference of Comparative Example 3 is that it adopts a traditional whole-system reset and recovery scheme. When any I2C bus fails, the entire system is reset by watchdog timer or manual intervention.

[0034] Under the same test conditions (main processor CPU frequency 1GHz, AXI bus clock 125MHz, multiple sensors working simultaneously, attitude inertial navigation and power monitoring are high-frequency acquisition, environmental quantities and IO extension are low-frequency acquisition), Example 3 and Comparative Example 3 were compared and tested, and the results are shown in Table 3.

[0035]

[0036] As can be seen from Table 3, Example 3, through its technical features of channel-level fault isolation, independent channel soft reset, and high-frequency and low-frequency parallel polling of different channels, reduces the CPU time occupied by the main processor for a single access from 780μs in Comparative Example 3 to 11μs, a reduction of approximately 98.6%. When any communication control channel experiences sensor deadlock or bus hangup, Comparative Example 3's whole-system reset scheme results in the interruption of all sensor acquisition, the loss of approximately 120 frames / packets (all communication control channels are interrupted), and a system recovery time of approximately 3500ms. In contrast, Example 3 only experiences timeout failure in that specific communication control channel, while other communication control channels... Access was completely unaffected, data loss was zero, and data continuity in other communication control channels reached 100%. Faulty channels recovered immediately after a 3ms single-channel soft reset, reducing recovery time by approximately 99.9%. Simultaneously, because Example 3 separates the high-frequency and low-frequency sensors and polls them in parallel according to their respective cycles, the maximum delay of attitude inertial navigation data was reduced from approximately 45ms (due to slow channel blockage) in Comparative Example 3 to approximately 8ms (in parallel processing), a reduction of approximately 82.2%. The environmental data acquisition cycle deviation decreased from ±15% to ±2%, significantly improving both the timeliness of fast data acquisition and the stability of slow data acquisition. This fully demonstrates that the present invention represents a significant and verifiable technological advancement over existing technologies in terms of recovery range, data continuity, recovery time, and parallel scheduling of multi-rate sensors.

[0037] The foregoing has provided a detailed description of a coprocessor-based multi-channel I2C parallel access and fault isolation method provided by this invention. Specific examples have been used to illustrate the principles and implementation methods of this invention. The descriptions of the embodiments above are merely for the purpose of helping to understand the core ideas of this invention. It should be noted that those skilled in the art can make various improvements and modifications to this invention without departing from its principles, and these improvements and modifications also fall within the protection scope of the claims of this invention.

Claims

1. A method for multi-channel I2C parallel access and fault isolation based on a coprocessor, characterized in that, The method includes the following steps: S100: The coprocessor provides N independent communication master control channels, where N is an integer greater than or equal to 2. Each communication master control channel has an independent communication controller and independent communication pin resources, enabling each communication master control channel to communicate with its respective mounted sensor simultaneously. S200. In the coprocessor, a unified register interface is defined for each communication master control channel. The master processor performs unified addressing of the register interface according to the channel base address plus offset. The register interface includes at least a reset register, a command register, and a data register. S300: The main processor performs register read and write operations on the register interfaces defined by each communication master control channel through bus address mapping to complete access to the target sensor. The communication timing of the target sensor is generated and executed by the coprocessor based on the content written or read by the register read and write operations. The main processor does not participate in the bit-level control of the communication timing. The S400 coprocessor independently maintains the timeout and status information of each communication master control channel. When any communication master control channel fails, the master processor writes reset information to the reset register corresponding to the failed communication master control channel, enabling the communication controller of that communication master control channel to independently complete a soft reset and reinitialize.

2. The method for multi-channel I2C parallel access and fault isolation based on a coprocessor as described in claim 1, characterized in that, In step S100, the coprocessor is a programmable logic device, including at least one of FPGA and CPLD; the communication master control channel is an I2C master control channel, the communication controller is an I2C master controller, and the communication pin resources include SCL pin and SDA pin.

3. The method for multi-channel I2C parallel access and fault isolation based on a coprocessor as described in claim 1, characterized in that, In step S100, sensors with slow update rates and sensors with fast update rates are respectively mounted on different communication master control channels, and the main processor performs parallel polling of the corresponding communication master control channels according to the cycle of each sensor.

4. The method for multi-channel I2C parallel access and fault isolation based on a coprocessor as described in claim 3, characterized in that, The sensors with slow update rates include environmental quantity sensors, while the sensors with fast update rates include power monitoring sensors.

5. The method for multi-channel I2C parallel access and fault isolation based on a coprocessor as described in claim 1, characterized in that, In step S200, the command register is used to distinguish between send and read operations, and the data register is used to carry read and write data.

6. The method for multi-channel I2C parallel access and fault isolation based on a coprocessor as described in claim 5, characterized in that, In step S300, the communication timing includes at least one of start condition, stop condition, acknowledgment bit, and clock stretch.

7. The method for multi-channel I2C parallel access and fault isolation based on a coprocessor as described in claim 6, characterized in that, In step S300, the main processor completes the operation of accessing a target sensor by writing a command to the command register and writing data to or reading data from the data register.

8. The method for multi-channel I2C parallel access and fault isolation based on a coprocessor as described in claim 1, characterized in that, In step S300, the bus includes at least one of EMIF bus, AXI bus, AHB bus and PCIe bus.

9. The method for multi-channel I2C parallel access and fault isolation based on a coprocessor as described in claim 1, characterized in that, In step S400, the coprocessor independently maintains the timeout counter for each communication master control channel. When the operation of a certain communication master control channel exceeds the preset timeout value, it is determined that the communication master control channel has failed and the corresponding status information is set. The master processor learns about the faulty channel by reading the status information. The preset timeout value is configured by the master processor or automatically set by the coprocessor according to the sensor type.

10. The method for multi-channel I2C parallel access and fault isolation based on a coprocessor as described in claim 9, characterized in that, The fault includes at least one of sensor deadlock, bus hangup, and no response.