A hardware implementation method and device for triggering topology automatic update of IO hot plug

By using programmable logic device hardware to capture edges in real time during the hot-plugging of IO modules, autonomous updates of topology scanning and address mapping are achieved, solving the problems of topology awareness blind spots and CPU resource consumption in existing technologies, and improving the real-time performance and security of the system.

CN123178180APending Publication Date: 2026-11-27NANJING SHIDIAN ELECTRONIC TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

Existing technologies have topology awareness blind spots during hot-swapping of IO modules, resulting in slow response speeds, high CPU resource consumption on the main station, and an inability to meet real-time control requirements. Furthermore, the intermediate states of batch operations fluctuate significantly, failing to meet the requirements of safe operating procedures that require manual confirmation.

Method used

The device employs programmable logic devices to capture the hot-plug edges of I/O modules in real time. It autonomously completes topology scanning and address mapping updates through a hardware topology state machine, including change capture, autonomous hardware scanning, mapping table reconstruction, and completion notification. It supports real-time triggering, batch debouncing, and manual DIP confirmation modes to ensure the timeliness and security of topology updates.

Benefits of technology

This reduces the topology update response time from milliseconds to microseconds, eliminates blind spots in perception, frees up the main station's CPU resources, avoids intermediate state jitter in batch operations, meets the safety operating procedures that require manual confirmation before taking effect, and improves the system's robustness and real-time performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123178180A_ABST
    Figure CN123178180A_ABST
Patent Text Reader

Abstract

The application relates to the technical field of industrial automation distributed IO, and discloses a hardware implementation method and device for automatically updating an IO hot plug trigger topology. In view of the problems of the existing software periodic polling mode, such as a hot plug sensing blind area, high CPU resource occupation and intermediate state jitter caused by batch plug-in, the application captures the jump edge of each slot in-place signal through an edge trigger logic unit in a hardware topology state machine in a programmable logic device, initiates a backplane bus scanning, reconstructs an address mapping table and notifies a host station through an interruption; supports a manual dial code confirmation mode, detects a plug-in and sets a to-be-updated flag, maintains old topology operation and returns default response data to a pulled-out module, and uniformly refreshes after manual confirmation; an independent scanning watchdog is further arranged to forcibly terminate and roll back to the last stable topology when scanning is overtime. The application realizes microsecond-level topology response, zero CPU load, batch operation without jitter and high reliability of manual confirmation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of distributed input / output technology in industrial automation control systems. In particular, it relates to a method and apparatus for managing system topology and updating address mapping when hot-swapping I / O modules is performed during equipment operation. Background Technology

[0002] In existing industrial automation systems, to support hot-swapping of modules and detect changes in the system's physical topology, the industry commonly employs a topology discovery mechanism based on periodic polling by the master controller software. This involves the master CPU sequentially querying the module status of each slot on the backplane bus according to a fixed scan cycle and updating the address mapping table accordingly. This mechanism suffers from blind spots in hot-swapping response. Topology awareness relies on the master CPU's scan cycle; after a module is removed or inserted, it often takes tens of milliseconds to be detected in the next scan. During this period, the master station cannot respond promptly to accesses of removed modules, easily triggering bus watchdog timeout faults and causing module or even station outages. Furthermore, the master CPU needs to perform query and diagnostic operations on all slots in each scan cycle, consuming computing resources intended for real-time control tasks and limiting the system's real-time control capabilities. Simultaneously, during the replacement of multiple modules in a row, each insertion or removal triggers an independent software scan and topology update. The master station repeatedly receives intermediate topology statuses before all modules are fully installed, generating redundant alarms and causing repeated jumps in process data mapping, reducing system robustness.

[0003] To address the above issues and reduce the CPU load on the main station, existing technologies include solutions that move module identification and address allocation functions to the field-programmable gate array (FPGA) within the coupler. For example, the invention disclosed in CN121326814B, "FPGA-based I / O module hot-plugging method, apparatus, device, and storage medium," uses the FPGA in the coupler to send detection messages to the serially connected I / O module group to obtain the physical ID and quantity information of each module. It then assigns virtual IDs to each module and generates and reassembles periodic data messages, thus enabling hot-plugging without PLC reconfiguration when the number of modules changes. However, this invention still has the following technical problems: First, this invention still cannot achieve real-time topology awareness. It determines insertion / removal events by detecting station-by-station transmission and reception of messages and comparing changes in the number of modules in the returned messages, rather than by performing real-time hardware-level capture of the electrical transitions in in-situ signals caused by the insertion / removal action itself. Its response speed is limited by the message transmission / reception cycle and data frame reassembly delay, making microsecond-level topology response impossible. Furthermore, during the continuous insertion / removal of multiple modules, each change in the number of modules triggers the FPGA to reissue detection, allocate virtual IDs, and reassemble data messages. Multiple insertions and removals result in repeated message reassembly and ID allocation, causing the process data image to repeatedly change before the topology stabilizes.

[0004] Furthermore, this invention automatically reassembles messages and takes effect immediately upon detecting a change in the number of modules, with the timing of topology updates entirely determined by hardware events. In reality, in scenarios such as planned maintenance, contact jitter or temporary plugging and unplugging before the operator has completed all operations can trigger unexpected topology reconfiguration. This fails to meet the safety operating procedure of requiring operators to confirm the completion of operations before uniformly refreshing the topology, demonstrating that this invention is practically unapplicable in real-world scenarios.

[0005] Therefore, a hardware solution is needed that does not rely on main station CPU software polling, can be instantly detected by hardware and complete topology updates at the moment of module insertion and removal, can avoid intermediate state jitter during batch operations, and can support manual confirmation of effectiveness. Summary of the Invention

[0006] To address the shortcomings of existing technologies, this invention provides a method and apparatus for real-time capture of the hot-plug edge of an I / O module by a programmable logic device and autonomous completion of topology scanning and address mapping updates. This eliminates the perception blind spots and CPU resource consumption present in existing software polling and message polling mechanisms, while avoiding intermediate state jitter during batch plugging and unplugging and supporting manual confirmation of effectiveness.

[0007] In this regard, the first aspect of the present invention relates to a hardware implementation method for hot-plug-triggered automatic topology updates, applied to a distributed I / O system including a master controller, a backplane bus, and several I / O module slots, wherein a hardware topology state machine implemented by a programmable logic device executes the following steps: S1. Change capture: The presence signal is obtained by the module presence detection circuit set in each IO module slot, and the edge triggering logic unit integrated inside the programmable logic device captures the transition edge of the presence signal and generates a trigger indication signal. S2. Hardware autonomous scanning: After receiving the trigger indication signal, the hardware topology state machine autonomously initiates a backplane bus scan without relying on the main station controller software intervention, and reads the current in-situ status and module type code of each slot. S3. Mapping table reconstruction: The hardware topology state machine reconstructs the topology mapping table according to the scan results and writes the updated mapping relationship into the dynamic address mapping register; S4. Completion Notification: The hardware topology state machine sends an interrupt request to the master station controller. After responding to the interrupt, the master station controller reads the dynamic address mapping register to obtain the latest topology. The generation of the trigger indication signal supports a manual dial-up confirmation mode: when the edge-triggered logic unit captures a transition edge, the hardware topology state machine sets the pending-update flag and maintains the current topology mapping relationship. During the period when the pending-update flag is set, access requests for unplugged modules are automatically returned with preset default response data to prevent the master station controller from triggering the watchdog due to communication timeout. When the hardware topology state machine detects a manual trigger signal generated by the manual triggering device and the pending-update flag is valid, steps S2 to S4 are executed, and the pending-update flag is cleared after the update is completed.

[0008] This approach, through the instantaneous capture of the transition edges of in-situ signals by edge-triggered logic units, allows the hardware topology state machine to autonomously complete backplane scanning and address mapping table reconstruction. This reduces the topology update response time from milliseconds (software polling) to microseconds, fundamentally eliminating blind spots and freeing up the master station's CPU resources. Especially in manual DIP switch confirmation mode, the hardware does not immediately take effect after detecting a plug-in / plug-out. Instead, it sets a pending update flag, maintains the current topology mapping, and automatically returns default response data for accesses to unplugged modules during the confirmation period. This avoids accidental topology reconstruction caused by contact jitter before the operator has completed all operations, meeting the safety operating procedures of process industries where manual confirmation is required for effective operation. It also prevents the master station from accessing faulty modules during the confirmation period, thus preventing bus watchdog timeouts and achieving a balance between high real-time performance and operational safety.

[0009] Furthermore, the generation of the trigger indication signal also supports one or both of the instantaneous trigger mode and the batch debouncing processing mode: In the instantaneous trigger mode, the edge triggering logic unit immediately sends an interrupt pulse to the hardware topology state machine to trigger steps S2 to S4 after capturing the transition edge; In the batch debouncing processing mode, the first transition edge starts the debouncing timer, and if another transition edge is captured during the timing period, the debouncing timer is reset. A trigger indication signal is generated and steps S2 to S4 are executed only when the debouncing timer overflows.

[0010] The instant trigger mode starts scanning immediately upon detecting a transition edge, suitable for rapid single-module replacement, achieving near-zero latency topology awareness. The batch debouncing mode uses a configurable timer to time and merge consecutive insertion / removal events, performing a scan only after the stabilization window times out following the last transition. Suitable for scenarios involving replacing entire rows of modules, it effectively shields against multiple invalid scans and repeated address table erasures during the intermediate process, preventing repeated transitions in the process data image before topology stabilization. Both modes can be selected as needed, adapting to typical operating conditions such as rapid replacement and batch maintenance.

[0011] Furthermore, the instant trigger mode, batch debouncing processing mode, and manual DIP confirmation mode can be selectively enabled via configuration registers, and when enabled simultaneously, they are arbitrated according to the following priority: manual DIP confirmation mode has the highest priority, followed by batch debouncing processing mode, and instant trigger mode has the lowest priority; when manual DIP confirmation mode is enabled, the automatic scanning behavior of the instant trigger mode and batch debouncing processing mode is suppressed, and the transition edge is only used to set the update flag; when batch debouncing processing mode is enabled, the edge triggering of the instant trigger mode is suppressed and used as the start or reset signal of the debouncing timer; during scan execution, new trigger signals are masked until the scan is completed.

[0012] By prioritizing arbitration across different modes, the operator's explicit intent takes precedence over automatic hardware judgment, ensuring the supreme authority of human confirmation in high-security scenarios. Mutual exclusion logic, such as suppressing automatic scanning when manual mode is enabled, absorbing immediate triggers when debouncing mode is enabled, and blocking new triggers during scan execution, avoids duplicate scanning, state conflicts, and race conditions caused by multi-mode concurrency. This ensures that the hardware state machine behaves predictably and deterministically under any configuration combination and trigger sequence.

[0013] Furthermore, the module presence detection circuit adopts a long and short pin connector structure, with the presence detection pin being the shortest and establishing the electrical connection last after the module is fully inserted, and disconnecting first when the module is removed. The presence signals of each slot are connected to the input pins of the programmable logic device via pull-up resistors; the edge-triggered logic unit captures the falling edge when the module is inserted or the rising edge when the module is removed.

[0014] The system employs a short-pin connector structure with the shortest possible in-situ detection pins. This ensures that the in-situ signal is only established after the module is fully inserted and all other electrical connections are reliably established, and is disconnected first upon removal. This physical timing guarantees the determinism of the in-situ detection signal and avoids false triggering in partially inserted or angled insertion states. Pull-up resistors provide a definite default level for each slot when no module is present, keeping the input pins in a stable state. The edge-triggered logic unit reliably captures the falling edge of insertion and the rising edge of removal, providing a clean and reliable electrical foundation for instantaneous hardware triggering.

[0015] Furthermore, the hardware topology state machine described in step S2 performs hardware-level classification processing for scanning anomalies of each slot: if no response is received within a preset timeout period after a query is initiated to the slot, the slot is automatically retried a preset number of times. If the timeout still occurs, the slot is marked as a communication failure and the corresponding mapping table entry is set to invalid. If a response is received but the verification fails, the slot is automatically reread a preset number of times. If the failure still occurs, the slot is marked as a data error and is not included in the valid address mapping table. If the communication is normal but the read module type code is not in the preset legal ID whitelist, the slot is marked as an illegal module and its address allocation is skipped. If the module type code is legal but does not match the preset allowed module type of the slot, the slot is marked as a mixed insertion failure and the output channel of the module is kept in a high impedance state or a safe state. Within a scanning cycle, a single slot is sequentially excluded according to the priority order of communication timeout, verification error, illegal module ID, and mixed insertion failure. Once a high-priority anomaly is confirmed, the subsequent detection of the slot is stopped.

[0016] The hardware topology state machine leverages the parallelism of programmable logic devices to automatically complete retries within a single scan cycle. It precisely distinguishes the cause of anomalies into four levels: communication timeout, verification error, illegal module, and mixed insertion fault, overcoming the crude approach of existing technologies that uniformly label all anomalies as module offline. A sequential elimination method is used to determine anomalies layer by layer according to priority. Once a high-priority anomaly is confirmed, subsequent detection stops, ensuring that only one anomaly type is marked for each slot within a scan cycle, resulting in a unique diagnostic result. In the event of a mixed insertion fault, the output channel is forced into a high-impedance state or a safe state, preventing erroneous signals from being output to field devices and improving the system's fault diagnosis accuracy and intrinsic safety level.

[0017] Furthermore, the hardware topology state machine also has a scanning watchdog timer independent of the master station controller system watchdog. If the backplane bus scan is not completed within a preset time, the scanning watchdog timer overflows and forcibly terminates the scan. The hardware topology state machine restores the previously successfully updated stable topology mapping table stored in the internal backup register to the dynamic address mapping register. Moreover, the access to the dynamic address mapping register adopts a hardware-priority mutual exclusion arbitration mechanism: the hardware topology state machine sets the busy flag bit of the mapping table before updating the mapping table and disables the master station side read / write enable. After the update is completed, the busy flag bit is cleared and the interrupt request is sent. When the master station controller actively reads the table, if it detects that the busy flag bit is valid, it inserts a waiting state by hardware until the busy flag bit is cleared. The time from setting the busy flag bit to clearing the busy flag bit during the mapping table update operation does not exceed a preset maximum value to avoid master station controller watchdog timeout.

[0018] Independent of the master system's watchdog timer, the scanning watchdog timer forcibly terminates the current scan and automatically restores the previous stable topology from the backup register when it times out due to continuous bus conflicts, clock loss, or state machine anomalies during the scanning process. This achieves fault isolation at the scan level. A failed scan only results in the abandonment of the current update; the system continues to run according to the old topology, without affecting the normal communication of any online modules. This avoids the temporary loss of control of all modules caused by the reliance on a complete system reset in existing technologies. The MAP_BUSY hardware mutual exclusion mechanism ensures that the master station will not read fragmented data that is neither fully new nor fully old by exclusively using the busy flag bit on the mapping table bus interface. When the master station is busy, the hardware inserts a waiting state instead of an access failure, and the update duration is limited to a preset maximum value. This ensures that even if the master station is waiting, it will not trigger its own watchdog timeout, achieving safe coexistence between autonomous hardware updates and concurrent master access.

[0019] Furthermore, in step S4, after all slots are scanned, the hardware topology state machine summarizes all the exception flags temporarily stored during the scan and writes them into the status register. After a scan process is completed, it sends only one interrupt request to the master controller. The master controller obtains all the exception information of this scan and its corresponding slot number through a single read operation. Moreover, only when the topology update is successfully completed and there are no exceptions, the hardware topology state machine writes the complete mapping table in the dynamic address mapping register along with the checksum into the non-volatile storage area. After the system is powered on and reset, it automatically performs a backplane bus scan and reads the historical mapping table in the non-volatile storage area. If the verification is successful and the current scan result is consistent with the historical mapping table, the historical mapping table is directly restored. If they are inconsistent, the mapping table is reconstructed with the current scan result and the non-volatile storage area is updated.

[0020] After all slots are scanned, exception flags are aggregated and only one interrupt is sent. The master station can obtain all exceptions and their slot numbers from this scan with a single register read. Regardless of how many slots are involved in the batch insertion / removal, the master station CPU is only interrupted once, significantly reducing the interruption frequency of exception handling to real-time control tasks and eliminating system jitter during batch operations. Non-volatile memory is written only when the topology update is successful and there are no exceptions, avoiding contamination of the storage area by failures or intermediate states. After power-on, it automatically scans and compares with the historical mapping table. If no modules are replaced during a power outage, the topology can be restored in microseconds without waiting for the master station CPU to start, greatly shortening the power-on recovery time.

[0021] Furthermore, each entry in the topology mapping table includes a physical slot number field, a module type code field, a logical address offset field, a valid bit field, and a fault type code field; when the hardware topology state machine reconstructs the mapping table, it scans incrementally by slot number, skips slots with a valid bit of zero, and continuously allocates logical address offsets only to valid modules.

[0022] Each table entry includes fields for physical slot number, module type, logical address offset, valid bit, and fault type. The master station can determine module accessibility using the valid bit and directly determine the cause of failure using the fault type field without additional diagnostic queries. When reconstructing the mapping table, empty slots, offline slots, and abnormal slots with a valid bit of zero are automatically skipped. Logical address offsets are allocated only to valid modules in a continuous and compact manner, ensuring a seamless process data mapping, high address space utilization, and allowing the master station to directly address any module using the base address plus slot offset without traversing the entire table, resulting in high access efficiency.

[0023] The second aspect of this invention includes a hardware implementation device for hot-pluggable triggered automatic topology updates, applied to a distributed I / O system including a master station controller and a backplane bus. It includes a hardware topology state machine and an edge-triggered logic unit implemented by a programmable logic device, a dynamic address mapping register, a module presence detection circuit connecting each I / O module slot, and a manual triggering device connected to a dedicated trigger pin of the programmable logic device. The module presence detection circuit adopts a long-short pin connector structure and outputs a presence signal to the edge-triggered logic unit via a pull-up resistor. The edge-triggered logic unit captures the transition edge of the presence signal and generates a trigger indication signal. After receiving the trigger indication signal, the topology state machine autonomously initiates a backplane bus scan and reconstructs the topology mapping table without relying on the master station controller software intervention, and writes the updated mapping table into the dynamic address mapping register. The hardware topology state machine sets the pending update flag after capturing the transition edge and maintains the current topology mapping relationship. During the period when the pending update flag is set, it returns preset default response data for access requests to unplugged modules to prevent the master station controller watchdog from timeout. It only performs scanning and mapping table update when it detects the manual trigger signal of the manual trigger device and the pending update flag is valid. After the update is completed, it sends an interrupt request to the master station controller.

[0024] This device integrates a hardware topology state machine, edge-triggered logic unit, dynamic address mapping register, long and short pin presence detection circuit, and manual triggering device into a programmable logic device and its peripheral circuits. It fully realizes all functions of plug-in / plug-out instantaneous sensing, autonomous scanning mapping, maintaining the old topology with the pending update flag, default response to prevent watchdog timer, and refresh after manual confirmation with pure hardware logic. It can replace the original polling mechanism without modifying the master station controller software, and has the comprehensive advantages of microsecond-level response, zero CPU load, and high reliability with manual confirmation. The device can be directly embedded into the backplane control circuit of PLC, remote I / O station, or bus coupler. It has low hardware cost, strong portability, and is suitable for large-scale application in industrial automation distributed I / O products.

[0025] Furthermore, it also includes at least one of the following: a debouncing and batch processing timer set inside the programmable logic device, used to time and merge consecutive transition edges in batch debouncing processing mode; a scan watchdog timer and backup register set inside the hardware topology state machine, used to forcibly terminate the scan and restore the previous stable topology when the scan times out; a mapping table access arbitrator, used to control the read wait of the master station controller through the mapping table busy flag; and a non-volatile storage area set inside or outside the programmable logic device, used to save the mapping table after the topology update is successful and provide comparison and recovery upon power-up.

[0026] Through this technical solution, the debouncing timer supports the timing merging of batch plug-in / plug-out events; the scan watchdog and backup register enable forced termination of scan timeout and stable topology rollback; the mapping table access arbitrator controls the master station's read waiting through the busy flag to ensure concurrent consistency; and the non-volatile storage area supports power-down mapping table saving and power-on comparison recovery.

[0027] By employing the aforementioned technical solution, this invention instantly captures the transition edge output of the long and short pin presence detection circuit through the edge-triggered logic unit in the programmable logic device. The hardware topology state machine autonomously completes the backplane bus scan and address mapping table reconstruction and notifies the master station via interrupt. This reduces the topology update response time from milliseconds of software polling to microseconds, fundamentally eliminating the blind spot of hot-plug detection and the potential timeout of the bus watchdog, without consuming the master station's CPU resources. Furthermore, through three modes—instant triggering, batch debouncing, and manual DIP confirmation—it can be configured as needed or arbitrated according to priority. These modes respectively achieve zero-latency response for rapid replacement of single modules, single-scan merging without intermediate jitter for continuous insertion and removal of multiple modules, and safe operations such as setting the pending update flag during planned maintenance, maintaining the old topology operation and returning default response data to removed modules, and uniformly refreshing after manual confirmation. The presence detection of long and short pins and pull-up resistors ensure the timing determinism of trigger signals. The four-level hardware anomaly classification and sequential elimination judgment enable fault location to be accurate to the slot and cause. The output channel is forced into a safe state during mixed insertion. The independent scanning watchdog, together with the backup register, enables automatic rollback in case of scan failure without affecting the operation of online modules. The hardware priority mutual exclusion arbitration of the busy flag bit of the mapping table avoids the master station reading half-new and half-old data and the waiting time is controllable. The single interrupt aggregation and reporting reduces the interference of anomaly handling on real-time control tasks. Non-volatile storage and power-on comparison recovery enable the topology to be rebuilt in microseconds after power failure. The logical address skipping invalid slots and continuous allocation ensures that the process data mapping is compact and efficient. The overall solution is integrated into the PLC, remote I / O station or bus coupler with pure hardware logic. It has the comprehensive advantages of microsecond response, zero CPU load, no jitter in batch operation, self-recovery of anomalies, fast recovery after power failure and high reliability with manual confirmation. It has low hardware cost and strong portability. Attached Figure Description

[0028] The accompanying drawings are provided to further illustrate the invention and form part of the specification. They are used in conjunction with embodiments of the invention to explain the invention and do not constitute a limitation thereof. In the drawings: Figure 1 This is a schematic diagram of the hardware system in the hardware implementation method and device for triggering automatic topology updates by IO hot-plugging according to the present invention.

[0029] Figure 2 This is an address mapping table in an embodiment of the hardware implementation method and device for triggering automatic topology updates via I / O hot-plugging according to the present invention. Detailed Implementation

[0030] The preferred embodiments of this application are described below with reference to the accompanying drawings. It should be understood that the preferred embodiments described herein are for illustration and explanation only and are not intended to limit this application.

[0031] Since this invention relates to some non-standard terminology, it is explained herein: Hardware topology state machine: This refers to a finite state machine implemented in pure hardware logic by a CPLD / FPGA, responsible for backplane scanning, address mapping table reconstruction, exception handling, and interrupt notification. The hardware topology state machine does not execute software programs via the CPU; instead, it consists of flip-flops and combinational logic. State transitions are driven by clock and edge signals, resulting in microsecond-level responses and no consumption of master station CPU resources.

[0032] Edge-triggered logic unit: A custom hardware unit in this invention, connected to the in-slot signals, specifically designed to capture the instantaneous transitions in signal levels, such as the falling edge during insertion and the rising edge during removal, and generate a trigger indication signal. Unlike existing technologies that rely on periodic polling or changes in message count for reactive insertion / removal, this unit provides real-time sensing of the insertion / removal action itself.

[0033] Dynamic Address Mapping Register: This invention allocates a register space within the programmable logic device to store, in the form of table entries, the physical slot number, module type code, logical address offset, valid bits, and fault type for each slot. It serves as the data interface between the hardware state machine and the master CPU. The master CPU obtains the latest topology by reading it, and its contents are reconstructed in real time during hot-swapping.

[0034] CHANGE_PENDING (Pending Update Flag): A 1-bit status flag defined in this invention. In manual DIP switch confirmation mode, the hardware does not immediately update the topology after detecting a plug-in or unplug, but only sets this flag and maintains the old mapping; the update is only performed and the flag is cleared after the operator confirms by toggling the DIP switch.

[0035] MAP_BUSY (Mapping Table Busy Flag): A custom concurrency mutual exclusion flag defined in this invention. It is set to 1 before the hardware update of the mapping table, at which point the master station's read operation is blocked or enters a waiting state; it is cleared after the update is complete before an interrupt is sent to notify the master station to read. This is used to prevent the master station from reading inconsistent data during the update process.

[0036] Scan Watchdog Timer: This invention features a dedicated watchdog timer independently configured within the hardware state machine. It has a preset upper limit for the total scan duration and is independent of the main station CPU's system watchdog. If a timeout occurs due to an anomaly in the scan process, it forcibly terminates the scan and rolls back to the previous stable topology, achieving scan-level fault isolation and preventing a complete system reset.

[0037] Debouncing and Batch Processing Timer: This invention uses a custom configurable hardware timer. When replacing modules in batches, the timer starts with the first insertion / removal, and resets with each new insertion / removal. Only after the last insertion / removal and a period of stabilization is a scan triggered, merging multiple insertions / removals into a single topology update to avoid intermediate state jitter.

[0038] Logical address offset: The address difference of a module relative to its base address in the master station's process data image. When reconstructing the mapping table, the hardware state machine automatically skips empty and faulty slots, allocating offsets only to valid modules in a continuous and compact manner to ensure that the master station's process data image is free of gaps.

[0039] Single-interrupt aggregation and reporting: This is the interrupt handling mechanism of this invention: during the scanning process, exceptions are not reported immediately, but the exception flags of all slots are temporarily stored. After all scanning is completed, the flags are aggregated and written into the status register, and only one interrupt is sent to the master station. The master station can learn about all exceptions with a single read, avoiding frequent interruptions to the master station during batch plugging and unplugging.

[0040] Mapping table access arbitrator: The custom hardware arbitration logic of this invention adopts an update-first strategy to resolve concurrent conflicts between hardware state machine updates and master station reading of the mapping table. With the MAP_BUSY flag and waiting state insertion, data consistency is guaranteed.

[0041] Long and short pin presence detection: The presence detection mechanism is implemented by using different pin lengths of the connector: the presence detection pin is the shortest, and it is the last to be connected when inserted and the first to be disconnected when pulled out, ensuring that the presence signal is only effective after the module is fully inserted, thus avoiding false triggering due to partial insertion from a physical timing perspective.

[0042] FAULT_TYPE (Fault Type Encoding Field): This is a 3-bit fault encoding field in the mapping table entry, which accurately distinguishes anomalies into types such as communication timeout, CRC check error, illegal module, and mixed insertion fault. The main station can directly locate the cause of the fault by reading this field, which is different from the existing technology that uniformly marks all types of anomalies as offline.

[0043] like Figure 1 As shown, the distributed I / O system provided in this embodiment of the invention includes a master controller, a backplane bus, and several I / O module slots. The master controller is the CPU module of a programmable logic controller (PLC) or a bus coupler. The backplane bus is a parallel bus or a serial local bus such as I²C or SPI, located on the baseboard. The I / O module slots are arranged along the backplane bus, and the I / O modules are plugged into the slots via connectors. The bus coupler or master controller is equipped with a complex programmable logic device (CPLD) or a field-programmable gate array (FPGA), which internally implements a hardware topology state machine, edge-triggered logic units, dynamic address mapping registers, and debouncing and batch processing timers. The input pins of the programmable logic device are connected to the in-slot signals of each slot, the dedicated trigger pins are connected to the manual triggering device, and the interrupt pins are connected to the interrupt input of the master controller. The hardware topology state machine serves as the core of the backplane bus's main control logic. Internally, it includes scan control logic, a retry counter, verification logic, an exception flag register, a backup register, a scan watchdog timer, and a mapping table access arbitrator. The module presence detection circuit uses a long-short pin connector structure, with the presence detection pin being the shortest. The presence signal of each slot is connected to the input pin of the programmable logic device via pull-up resistors. The edge-triggered logic unit captures the falling and rising edges of the presence signal in real time. The dynamic address mapping register stores the correspondence between slot number, module type code, and logic address offset. The manual triggering device is a self-resetting DIP switch or a momentary button located on the panel. The system's general workflow consists of four steps: change capture S1, hardware autonomous scan S2, mapping table reconstruction S3, and completion notification S4. These are illustrated below through two examples. Example 1:

[0044] This embodiment provides an 8-slot remote I / O station based on CPLD, including a bus coupler and eight I / O module slots from Slot0 to Slot7.

[0045] In this embodiment, the CPLD on the bus coupler integrates a hardware topology state machine, an edge-triggered logic unit, and a dynamic address mapping register. Each slot is equipped with presence signals PRSNT0 to PRSNT7, each of which is pulled up to the CPLD's I / O interface power supply via a 10kΩ pull-up resistor and connected to the CPLD input pin. A self-resetting DIP switch is provided on the panel as a manual triggering device, and its output is connected to the CPLD's dedicated trigger pin. The aforementioned hardware topology state machine, edge-triggered logic unit, dynamic address mapping register, long and short pin presence detection circuit, and manual triggering device together constitute the hardware implementation device of this embodiment.

[0046] Regarding presence detection, in this embodiment, the PRSNT signal is pulled high when the slot is empty. When a module is inserted, the power pin and signal pin are turned on first, and the presence detection pin is turned on last. At the moment of connection, PRSNT changes from high to low, generating a falling edge. When the module is removed, the presence detection pin is turned off first, and PRSNT returns from low to high, generating a rising edge. The shortest structure of the presence detection pin ensures that the presence signal is only effective after the module is fully inserted and is the first to become invalid when it is removed, avoiding false triggering during partial insertion.

[0047] After the system is powered on, the CPLD first performs a complete backplane bus scan, reads the module type code Module_ID preset in the electronic data table of each slot module through the I²C local bus, allocates logical address offsets to the online modules, establishes an initial topology mapping table in the dynamic address mapping register, and sends a power-on ready interrupt to the master station.

[0048] During system operation, this embodiment employs a manual DIP switch confirmation mode. When an operator inserts a digital input module into Slot 3, PRSNT3 generates a falling edge. The edge-triggered logic unit captures this transition edge and generates a trigger indication signal, thus executing step S1. Upon receiving this signal, the hardware topology state machine does not immediately scan but instead sets an internal pending update flag named CHANGE_PENDING and drives the panel indicator light to flash to indicate pending confirmation, while maintaining the current topology mapping relationship and continuing operation. During the pending confirmation period, if the master station controller initiates access to the slot where the old module that has been removed is located, the hardware topology state machine automatically intercepts and returns a preset default response data of all 0x00, preventing the master station from triggering the bus watchdog due to timeout while waiting for a response. After the operator completes all module insertions and removals and manually toggles the self-reset DIP switch once, the hardware topology state machine detects the manual trigger signal and the CHANGE_PENDING flag is valid. It then autonomously initiates a backplane bus scan (step S2), sequentially reading the presence status and Module_ID of Slots 0 to 7. Within a single bus cycle, it reconstructs the mapping table and writes it to the dynamic address mapping register (step S3). Subsequently, it clears the CHANGE_PENDING flag, turns off the indicator lights, and sends an interrupt request to the master station (step S4). Upon responding to the interrupt, the master station directly reads the dynamic address mapping register to obtain the latest topology. The entire process requires no polling or scanning instructions from the master station CPU, with a response time in the microsecond range. The rising edge triggering process when a module is removed is symmetrical to the insertion process described above and will not be elaborated here. Example 2:

[0049] This embodiment further configures all three trigger modes and exception handling, mutual exclusion, and persistence mechanisms based on the 8-slot remote I / O station hardware of Embodiment 1.

[0050] Regarding the triggering mode, in this embodiment, the hardware topology state machine selects the triggering mode through the configuration register TRIG_MODE_CFG. This register is located at offset address 0x00 and has a width of 3 bits, where bit 0 is the immediate mode enable bit, bit 1 is the debouncing mode enable bit, and bit 2 is the manual mode enable bit. In the immediate triggering mode, the edge-triggered logic unit immediately sends an interrupt pulse to the hardware topology state machine after capturing the transition edge, immediately triggering steps S2 to S4, which is suitable for rapid replacement of a single module. In batch debouncing mode, the first transition edge triggers the debouncing and batch processing timer, the period of which is set by the DEBOUNCE_TIME register, which is located at offset address 0x01, has a bit width of 8 bits, and a timing unit of 100μs. In this embodiment, the debouncing time T is 5ms to 10ms. If any slot transition edge is captured again during the timing period, the timer is reset and the timing starts again. Only when the timer overflows, that is, when no new event has occurred after a full time T since the last transition, a trigger indication signal is generated and steps S2 to S4 are executed once, so that the multiple insertions and removals when replacing modules in the whole row are combined into one scan and one interrupt.

[0051] When all three modes are enabled simultaneously, priority arbitration is based on manual DIP confirmation, batch debouncing, and instant triggering. When the manual mode enable bit is 1, manual mode is in effect regardless of other bits, and the automatic scanning behavior of instant mode and debouncing mode is suppressed. The transition edge is only used to set the CHANGE_PENDING flag. When manual mode is not enabled and the debouncing mode enable bit is 1, the edge triggering of instant mode is suppressed and used as the start or reset signal of the debouncing timer. If a manual DIP trigger is received during the debouncing wait, the wait for immediate scanning is interrupted. Any new trigger signal during the scan execution is masked until the scan is completed and the busy flag of the mapping table is released. If none of the three modes are enabled, it is considered an illegal configuration, and the hardware reverts to instant triggering mode. The manual confirmation timeout is set by the MANUAL_TIMEOUT register, which is located at offset address 0x02, has a bit width of 8 bits, and is in ms. A value of 0 indicates infinite waiting. If no manual confirmation is received within the timeout period, the hardware state machine can maintain the wait according to the configuration or automatically perform a timeout update.

[0052] In terms of exception handling, the hardware topology state machine performs hardware-level classification for each slot in step S2. If no response is received within 50μs after initiating a query to the slot, the retry counter automatically retryes up to 3 times. If it still times out, it is marked as a communication failure and the SCAN_TIMEOUT_FLAG flag is set. The corresponding mapping table entry is set to invalid, and subsequent accesses return all 0x00. No overall rollback is performed; only the slot is marked individually. If the bus physical layer returns an idle level indicating no module, it is marked as an empty slot and the corresponding table entry is cleared. It does not occupy a logical address and is treated as normal topology shrinkage without reporting an exception. If a response is received but the CRC check or parity check fails, it is automatically reread up to 3 times. If it still fails, it is marked as a data error and the CRC_ERROR_FLAG flag is set. This module is not included in the valid mapping table, and its history is retained in the backup register but not automatically restored. If communication is normal but M If the module_ID is all 0xFF or not in the valid module ID whitelist MODULE_ID_WHITELIST, it is marked as an illegal module and the UNKNOWN_MODULE_FLAG flag is set. Its address allocation is skipped, and the address of subsequent modules is postponed. The whitelist is located at offset addresses 0x20 to 0x3F, and each ID occupies 16 bits. If the module_ID is valid but does not match the default type of the slot in the slot type constraint table SLOT_TYPE_TABLE, it is marked as a mixed insertion fault and the MISMATCH_MODULE_FLAG flag is set. The output channel of this module is forced to remain in a high-impedance state or a safe state. The slot type constraint table is located at offset addresses 0x10 to 0x1F, and each slot occupies 1 byte. Within a scan cycle, a single slot is excluded and judged according to the priority order of communication timeout, check error, illegal module ID, and mixed insertion fault. Once a high-priority fault is confirmed, the subsequent detection of the slot is stopped. Only one fault type is marked for a slot and written to the fault type field.

[0053] Regarding scanning fault isolation and concurrent access, the hardware topology state machine has a global scan watchdog timer independent of the master system watchdog. In this embodiment, the preset total scan duration is 500μs. The timer automatically starts from zero each time a scan is entered, and is reset to zero when the scan is completed normally. If the scan fails to complete within 500μs due to a continuous level conflict on the backplane bus, clock loss, or abnormal state machine logic, the watchdog overflows and forcibly terminates the scan, clears the temporary registers and intermediate states, reads the last successfully updated stable topology mapping table from the internal backup register and fully restores it to the dynamic address mapping register, and sets the SCAN_ABORT_FLAG flag. The system continues to run according to the old topology without affecting the online modules. Regarding mutual exclusion, the hardware topology state machine has a built-in mapping table access arbiter. Before updating, the busy flag MAP_BUSY of the mapping table is set to 1. This flag is located in control register 0x30 and is visible to the master station. After MAP_BUSY is set, the mapping table bus interface switches to hardware exclusive mode and disables read / write enable on the master station side. The hardware state machine writes the reconstructed mapping table entry by entry. After all entries are written, MAP_BUSY is cleared and access is restored to the master station before an interrupt is issued. When the master station actively reads, if MAP_BUSY is 1, the hardware inserts a wait state and pulls the READY signal low during its read cycle until MAP_BUSY is cleared. In this embodiment, the entire update time from setting MAP_BUSY to clearing it does not exceed 2μs, ensuring that the master station will not trigger its own watchdog timeout even if it waits.

[0054] Regarding interrupt reporting and power-down recovery, during the scanning process, the abnormal flags of each slot are only temporarily stored in an internal temporary register without being sent as notifications. After all slots are scanned, the hardware state machine summarizes the abnormal flags such as SCAN_TIMEOUT_FLAG, CRC_ERROR_FLAG, UNKNOWN_MODULE_FLAG, MISMATCH_MODULE_FLAG, and SCAN_ABORT_FLAG and writes them into the status register STATUS_REG, which is located at offset address 0x40 and has a bit width of 16 bits. Subsequently, the hardware state machine sends only one IRQ interrupt to the master station, and the master station can obtain all abnormalities and their corresponding slot numbers through a single read. For persistence, the hardware state machine writes the complete mapping table, along with the checksum and timestamp, to the non-volatile storage area only when the topology update is successful and SCAN_ABORT_FLAG is not set. This area is a user-reserved sector configured with Flash in the CPLD or FPGA, or an onboard SPI Flash chip. Intermediate processes and failed updates are not written. After power-on reset, the hardware state machine automatically performs a backplane bus scan and reads the historical mapping table and checksum in the non-volatile storage area. If the checksum is successful and consistent with the current scan result slot by slot, the historical mapping table is directly restored, and topology initialization is completed in microseconds. If inconsistent, the non-volatile storage area is rebuilt and updated with the current scan result. After completion, a power-on ready interrupt is sent to the master station. After hardware reset, the state machine enters the IDLE state, and the CHANGE_PENDING flag and the exception flag are cleared.

[0055] In terms of the mapping table structure, each entry in the dynamic address mapping register corresponds to one slot, with a total bit width of 48 bits, or 6 bytes. The first 6 bits (0-5) are the physical slot number (SLOT_ID), ranging from 0 to 63; the second 16 bits (6-21) are the module type code (MODULE_TYPE); the third 12 bits (22-33) are the logical address offset (LOGIC_ADDR_OFFSET); the fourth 1 bit (VALID) is the validity bit, where 1 indicates a valid module is online and the address is valid, and 0 indicates an empty slot, offline, or an error; the fifth 3 bits (35-37) are the fault type code (FAULT_TYPE), valid only when VALID is 0, where 000 indicates no error (empty slot), 001 indicates communication timeout (offline), 010 indicates a CRC check error, 011 indicates an illegal module ID, and 100 indicates a mixed insertion fault; the sixth 2 bits (38-39) are reserved bits (RESERVED) for future expansion; and the seventh 8 bits (40-47) are the timestamp (TIMESTAMP), which increments each time this entry is updated. In the 8-slot system, entries Slot0 to Slot7 are located sequentially at offsets 0x00 to 0x2F, each occupying 6 bytes. 0x30 is the mapping table control register. During address allocation, the scan starts from SLOT_ID 0 and increments, skipping empty slots, offline slots, or faulty slots with VALID 0. Logical address offsets are continuously allocated only to valid modules starting from offset 0. Taking a 256-byte address space per module as an example, Slot0 is effectively allocated at offset 0x000, Slot1 is skipped if it is empty, and Slot2 is effectively allocated at offset 0x100. This ensures that the process data mapping is compact and without gaps, allowing the master station to directly address any external module using the base address plus the slot offset.

[0056] like Figure 2As shown, at this moment, four modules—Slot0, Slot2, Slot3, and Slot6—are online and active. The hardware topology state machine starts scanning incrementally from slot 0, skipping the empty slot 1, the communication failure slot 4, and the illegal module slot 5. The logical address offsets of the four active modules are sequentially and continuously assigned as 0x000, 0x100, 0x200, and 0x300. Each module occupies 256 bytes of address space. The data areas of the active modules in the master station process data image are compactly arranged with no address holes. The RESERVED reserved bits in the table are all filled with 00; TIMESTAMP is the last update timestamp of the table entry. Assuming this is the 5th topology update, the timestamps of the slots involved in this scan are all incremented to 0x05, and the empty slots that have not changed remain at 0x00. Slot 4 was marked as a communication failure due to three timeouts, with FAULT_TYPE encoding 001. Slot 5 was marked as an illegal module because its Module_ID was 0xFFFF and it was not in the whitelist, with FAULT_TYPE encoding 011. Both modules have VALID of 0 and do not participate in address allocation. When the master station accesses their addresses, the hardware returns the default security value of all 0x00. All fields in the table are read-only. The master station determines accessibility by reading the VALID bit, obtains the cause of the failure by reading the FAULT_TYPE field, and calculates the access address by reading the LOGIC_ADDR_OFFSET field.

[0057] In a further configuration of the device, the programmable logic device of this embodiment also includes one or more of the following: a debouncing and batch processing timer set inside the device, used to merge the timing of consecutive transition edges in batch debouncing mode; a scan watchdog timer and backup register set inside the hardware topology state machine, used to force termination of scan timeout and restore the previous stable topology; a mapping table access arbitrator, used to control the master station's read wait through the MAP_BUSY flag; and a non-volatile memory area set inside or outside the programmable logic device, used to save the mapping table after successful update and provide comparison and recovery upon power-up.

[0058] The above description is merely a preferred embodiment of the present invention. Those skilled in the art can make several modifications and improvements without departing from the concept of the present invention: the programmable logic device can be a CPLD or FPGA; the non-volatile memory can be an internally configured Flash user sector or an external SPI Flash; the backplane bus can be a parallel bus or an I²C / SPI serial bus; the manual triggering device can be a DIP switch, a momentary button, or software triggering initiated by writing to the CTRL_REG register by the master station; parameters such as debouncing cycle, scan timeout, number of retries, global watchdog duration, and update duration upper limit can all be configured according to the system clock and application requirements; the triggering mode can be enabled individually or in combination according to priority. All these modifications and improvements should be covered within the protection scope of the present invention.

[0059] While this application discloses preferred embodiments as described above, it is not intended to limit the scope of this application. Any person skilled in the art can make modifications without departing from the scope of this application; all equivalent modifications made in accordance with this application should be covered by the scope of this application. In the description of this specification, references to terms such as "an embodiment / mode," "some embodiments / modes," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment / mode or example is included in at least one embodiment / mode or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment / mode or example. Moreover, the specific features, structures, materials, or characteristics described can be combined in a suitable manner in any one or more embodiments / modes or examples. Furthermore, without contradiction, those skilled in the art can combine and integrate different embodiments / modes or examples and features of different embodiments / modes or examples described in this specification.

[0060] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this application, "multiple" means at least two, such as two, three, etc., unless otherwise explicitly specified.

[0061] Those skilled in the art should understand that the above embodiments are merely for illustrating the present disclosure and are not intended to limit the scope of the disclosure. Those skilled in the art can make other changes or modifications based on the above disclosure, and these changes or modifications still fall within the scope of the present disclosure.

Claims

1. A hardware implementation method for triggering automatic topology updates via I / O hot-plugging, applied to a distributed I / O system including a master controller, a backplane bus, and several I / O module slots, characterized in that, The hardware topology state machine implemented by the programmable logic device executes the following steps: S1, Change capture: The presence signal is obtained by the module presence detection circuit set in each IO module slot. The edge triggering logic unit integrated inside the programmable logic device captures the transition edge of the presence signal and generates a trigger indication signal; S2, Hardware autonomous scan: After receiving the trigger indication signal, the hardware topology state machine autonomously initiates a backplane bus scan without relying on the main station controller software intervention to read the current presence status and module type code of each slot; S3. Mapping table reconstruction: The hardware topology state machine reconstructs the topology mapping table according to the scan results and writes the updated mapping relationship into the dynamic address mapping register. S4. Completion Notification: The hardware topology state machine sends an interrupt request to the master station controller. After responding to the interrupt, the master station controller reads the dynamic address mapping register to obtain the latest topology. The generation of the trigger indication signal supports a manual DIP confirmation mode: when the edge-triggered logic unit captures a transition edge, the hardware topology state machine sets the pending update flag and maintains the current topology mapping relationship. During the period when the pending update flag is set, access requests to unplugged modules automatically return preset default response data to prevent the master station controller from triggering the watchdog due to communication timeout. When the hardware topology state machine detects a manual trigger signal generated by the manual triggering device and the pending update flag is valid, steps S2 to S4 are executed, and the pending update flag is cleared after the update is completed.

2. The hardware implementation method for triggering automatic topology updates by I / O hot-plugging according to claim 1, characterized in that, The generation of the trigger indication signal also supports one or both of the following modes: instant trigger mode and batch debouncing mode. In instant trigger mode, the edge triggering logic unit immediately sends an interrupt pulse to the hardware topology state machine to trigger steps S2 to S4 after capturing a transition edge. In batch debouncing mode, the first transition edge starts the debouncing timer. If another transition edge is captured during the timer, the debouncing timer is reset. A trigger indication signal is generated and steps S2 to S4 are executed only when the debouncing timer overflows.

3. The hardware implementation method for triggering automatic topology updates by I / O hot-plugging according to claim 2, characterized in that, The instant trigger mode, batch debouncing processing mode, and manual DIP confirmation mode can be selectively enabled via configuration registers, and when enabled simultaneously, they are arbitrated according to the following priority: manual DIP confirmation mode has the highest priority, followed by batch debouncing processing mode, and instant trigger mode has the lowest priority; when manual DIP confirmation mode is enabled, the automatic scanning behavior of the instant trigger mode and batch debouncing processing mode is suppressed, and the transition edge is only used to set the update flag; when batch debouncing processing mode is enabled, the edge triggering of the instant trigger mode is suppressed and used as the start or reset signal of the debouncing timer; during the scan execution, new trigger signals are masked until the scan is completed.

4. The hardware implementation method for triggering automatic topology updates by I / O hot-plugging according to claim 1, characterized in that, The module presence detection circuit adopts a long and short pin connector structure. The presence detection pin is the shortest and is the last to establish electrical connection after the module is fully inserted and the first to disconnect when the module is pulled out. The presence signals of each slot are connected to the input pins of the programmable logic device via pull-up resistors. The edge-triggered logic unit captures the falling edge when the module is inserted or the rising edge when the module is pulled out.

5. The hardware implementation method for triggering automatic topology updates by I / O hot-plugging according to claim 1, characterized in that, In step S2, the hardware topology state machine performs hardware-level classification processing for scanning anomalies of each slot: if no response is received within a preset timeout period after a query is sent to the slot, the slot is automatically retried a preset number of times. If the timeout still occurs, the slot is marked as a communication failure and the corresponding mapping table entry is set to invalid. If a response is received but the verification fails, the slot is automatically reread a preset number of times. If the failure still occurs, the slot is marked as a data error and is not included in the valid address mapping table. If the communication is normal but the read module type code is not in the preset legal ID whitelist, the slot is marked as an illegal module and its address allocation is skipped. If the module type code is legal but does not match the preset allowed module type of the slot, the slot is marked as a mixed insertion failure and the output channel of the module is kept in a high impedance state or a safe state. Within a scanning cycle, a single slot is sequentially excluded according to the priority order of communication timeout, verification error, illegal module ID, and mixed insertion failure. Once a high-priority anomaly is confirmed, the subsequent detection of the slot is stopped.

6. The hardware implementation method for triggering automatic topology updates by I / O hot-plugging according to claim 1, characterized in that, The hardware topology state machine also has a scanning watchdog timer that is independent of the master station controller system watchdog. If the backplane bus scan is not completed within the preset time, the scanning watchdog timer overflows and forcibly terminates the scan. The hardware topology state machine restores the last successfully updated stable topology mapping table stored in the internal backup register to the dynamic address mapping register. Furthermore, the access to the dynamic address mapping register adopts a hardware-priority mutual exclusion arbitration mechanism: the hardware topology state machine sets the busy flag bit of the mapping table before updating the mapping table and disables the read / write enable on the master station side. After the update is completed, the busy flag bit is cleared and the interrupt request is sent. When the master station controller actively reads the table, if it detects that the busy flag bit is valid, the hardware inserts a waiting state until it is cleared. The time from setting the busy flag bit to clearing it during the mapping table update operation does not exceed a preset maximum value to avoid the master station controller watchdog timeout.

7. The hardware implementation method for triggering automatic topology updates by I / O hot-plugging according to claim 1, characterized in that, In step S4, after all slots are scanned, the hardware topology state machine summarizes all the exception flags temporarily stored during the scan and writes them into the status register. After a scan process is completed, it sends only one interrupt request to the master controller. The master controller obtains all the exception information of this scan and its corresponding slot number through a single read operation. Furthermore, only when the topology update is successfully completed and there are no exceptions, the hardware topology state machine writes the complete mapping table in the dynamic address mapping register along with the checksum into the non-volatile storage area. After the system is powered on and reset, it automatically performs a backplane bus scan and reads the historical mapping table in the non-volatile storage area. If the check passes and the current scan result is consistent with the historical mapping table, the historical mapping table is directly restored. If they are inconsistent, the mapping table is reconstructed with the current scan result and the non-volatile storage area is updated.

8. The hardware implementation method for triggering automatic topology updates by I / O hot-plugging according to claim 1, characterized in that, Each entry in the topology mapping table includes a physical slot number field, a module type code field, a logical address offset field, a valid bit field, and a fault type code field. When reconstructing the mapping table, the hardware topology state machine scans incrementally by slot number, skips slots with a valid bit of zero, and continuously allocates logical address offsets only to valid modules.

9. A hardware implementation device for hot-plug triggering automatic topology updates, applied to a distributed I / O system including a master controller and a backplane bus, characterized in that, It includes a hardware topology state machine and edge-triggered logic unit implemented by a programmable logic device, a dynamic address mapping register, a module presence detection circuit connecting each IO module slot, and a manual triggering device connected to the dedicated trigger pin of the programmable logic device; the module presence detection circuit adopts a long and short pin connector structure and outputs a presence signal to the edge-triggered logic unit through a pull-up resistor; the edge-triggered logic unit captures the transition edge of the presence signal and generates a trigger indication signal; After receiving the trigger indication signal, the hardware topology state machine autonomously initiates a backplane bus scan, reconstructs the topology mapping table, and writes the updated mapping table into the dynamic address mapping register without relying on the main station controller software intervention. The hardware topology state machine sets the pending update flag after capturing the transition edge and maintains the current topology mapping relationship. During the period when the pending update flag is set, it returns preset default response data to access requests for unplugged modules to prevent the master station controller watchdog from timeout. It only performs scanning and mapping table update when it detects the manual trigger signal of the manual trigger device and the pending update flag is valid. After the update is completed, it sends an interrupt request to the master station controller.

10. The hardware implementation device for hot-plug triggered automatic topology update according to claim 9, characterized in that, It also includes at least one of the following: a debouncing and batch processing timer set inside the programmable logic device, used to time and merge consecutive transition edges in batch debouncing processing mode; a scan watchdog timer and backup register set inside the hardware topology state machine, used to forcibly terminate the scan and restore the previous stable topology when the scan times out; a mapping table access arbitrator, used to control the read wait of the master station controller through the mapping table busy flag; and a non-volatile storage area set inside or outside the programmable logic device, used to save the mapping table after the topology update is successful and provide comparison and recovery upon power-up.

Citation Information

Patent Citations

  • FPGA-based IO module hot plug method, device and equipment and storage medium

    CN121326814B