Self-diagnosis and self-recovery method for KNX firmware upgrade exception
By building a fault knowledge base and a hierarchical self-healing recovery strategy, the self-diagnostic engine identifies KNX firmware upgrade anomalies and performs targeted recovery actions, solving the problem of insufficient fault diagnosis during KNX firmware upgrades and improving the device's self-healing and self-maintenance capabilities.
Patent Information
- Application Number
- CN202611203411.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-10
- Publication Date
- 2026-11-24
AI Technical Summary
The existing KNX firmware upgrade process lacks a precise diagnosis and differentiated handling mechanism for fault characteristics, which makes it impossible for the system to perform targeted recovery based on the specific fault cause. This leads to upgrade failures requiring manual intervention and limits the device's self-maintenance and self-healing capabilities.
By building a fault knowledge base and a hierarchical self-healing recovery strategy, the self-diagnosis engine identifies anomalies and outputs diagnostic results. The hierarchical self-healing recovery strategy executor calls corresponding recovery actions according to the fault level, including application-level, hardware-level, and system-level recovery, and generates a structured fault report which is uploaded to the cloud.
It enables automatic execution of targeted recovery actions based on the fault level, reduces manual intervention, enhances the self-healing capability of the equipment, resolves firmware damage and communication failure faults, eliminates the need for factory repairs, and ensures data collaborative repair requests in network outage environments.
Smart Images

Figure CN123157494A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing technology, specifically to a self-diagnosis and self-healing method for KNX firmware upgrade anomalies. Background Technology
[0002] In actual operation, the KNX central control screen requires firmware upgrades to update functions or perform system maintenance. The firmware upgrade process is typically initiated by the host processor, which transmits the firmware data packet to the KNX coprocessor via a communication interface. The KNX coprocessor then performs the erasure and data writing of the underlying memory. The firmware upgrade process involves network data acquisition, underlying interface data transmission, firmware verification, and hardware memory burning operations.
[0003] In existing firmware upgrade solutions for KNX and related embedded devices, a fixed retry mechanism and dual-partition backup logic are typically pre-set. When the upgrade program detects a communication interruption or data write failure, the system automatically performs a fixed number of retries according to the preset configuration. If the retry operation ends and the upgrade program fails to execute successfully, the system generates an upgrade failure log record, reports the log to the cloud server through a remote operation and maintenance channel, and the device retains the original firmware partition to continue running.
[0004] Existing technologies lack precise diagnostic and differentiated handling mechanisms for firmware upgrade anomalies. When faced with different types of anomalies, such as packet verification errors, communication timeouts, or signature verification failures, the system employs a single, fixed retry strategy. This indiscriminate approach prevents the system from performing targeted recovery actions based on the specific cause of the fault. Consequently, many faults that could have been self-healed by changing communication parameters or altering the system execution path ultimately result in upgrade failures. The system passively relies on manual on-site intervention, limiting the device's self-maintenance and self-healing capabilities. Summary of the Invention
[0005] To address the shortcomings of existing technologies, this invention provides a self-diagnosis and self-healing method for KNX firmware upgrade anomalies, thus resolving the problems mentioned in the background section.
[0006] To achieve the above objectives, the present invention provides the following technical solution: This invention provides a self-diagnostic and self-healing method for KNX firmware upgrade anomalies. The purpose of this invention is to solve the technical problem that the system cannot automatically perform targeted recovery when upgrades fail due to communication anomalies, verification failures, or memory write anomalies during the KNX coprocessor firmware upgrade process.
[0007] The self-diagnosis and self-healing recovery method for KNX firmware upgrade anomalies of the present invention includes the following steps: initiating a KNX firmware upgrade task; executing upgrade steps and monitoring for anomalies; a self-diagnosis engine identifying anomalies and outputting system diagnostic results; a hierarchical self-healing recovery strategy executor querying the fault knowledge base and retrieving the corresponding fault level based on the system diagnostic results; when the fault level is determined to be L1, the hierarchical self-healing recovery strategy executor calling application-layer recovery actions; when the fault level is determined to be L2, or under the condition of transitioning from L1 to L2, the hierarchical self-healing recovery strategy executor calling hardware-level recovery actions; when the fault level is determined to be L3, the hierarchical self-healing recovery strategy executor executing a system-level hardware fault isolation procedure; and a structured fault report generator summarizing the status data of the firmware upgrade task and generating a structured fault report.
[0008] In this invention, the self-diagnostic engine is in a listening state during firmware download, firmware transmission, firmware burning, and firmware verification operation nodes. When it detects a coprocessor Flash write timeout, serial interface communication ACK packet loss, BootROM firmware signature verification failure, or version number inconsistency, the system enters the diagnostic analysis phase. The self-diagnostic engine extracts the error status bytes returned by the serial interface, the current system operation stage identifier, and reads the system timer's timeout flag or the interrupt controller's status register as abnormal phenomenon feature parameters. Using the extracted error status bytes, the current system operation stage identifier, and the abnormal phenomenon feature parameters as input variables, the self-diagnostic engine performs multi-dimensional parameter condition judgments in the fault knowledge base through built-in diagnostic mapping logic to match the corresponding standard fault code. Based on the standard fault code, the self-diagnostic engine generates an upgrade status context containing the occurrence time and the number of retries, and passes the upgrade status context to the hierarchical self-healing recovery strategy executor.
[0009] In this invention, the fault knowledge base contains multiple fault record sets. Any fault record in a fault record set is defined as a five-element data structure. Specifically, the five-element data structure includes: a standard fault code serving as the primary key for the self-diagnostic engine to retrieve and match; a fault level mapped to automatically recoverable faults, faults requiring assisted intervention, and faults requiring manual intervention; a list of recovery actions containing a sequence of system instruction calls arranged chronologically; a maximum number of automatic retries constraining the system's retry execution limit; and a timeout threshold constraining the allowed waiting time for a single recovery operation.
[0010] In this invention, when the fault level is determined to be L1, the application layer recovery action includes retransmitting the data block where the error occurred or reducing the communication baud rate of the serial interface. The system cyclically executes the application layer recovery action within the maximum automatic retry limit. Internally, the system runs retry state transition logic. The judgment condition for the retry state transition logic is as follows: when the cumulative number of retries performed by the system for the standard fault code is less than the maximum number of automatic retries defined in the fault knowledge base, the system calls the operation instruction to execute the recovery action list; when the cumulative number of retries is greater than or equal to the maximum number of automatic retries, the system triggers the fault level transition operation instruction, transitioning the current processing level from L1 to L2.
[0011] In this invention, when the fault level is determined to be L2, or when a jump from L1 to L2 occurs, the hardware-level recovery action includes a cross-interface switching intervention and a physical boot intervention. The cross-interface switching intervention switches the primary communication UART interface to a backup SPI interface by calling the hardware abstraction layer, and establishes a communication connection using the backup SPI interface. The physical boot intervention pulls the BOOT0 pin of the KNX coprocessor high and maintains it at that level by sending a level control command, then injects a hardware reset pulse into the RESET pin of the KNX coprocessor. After the hardware reset pulse ends, the BOOT0 pin level is released, forcing the KNX coprocessor into Bootloader mode, and writing the recovery firmware image through the backup communication channel. If the hardware-level recovery action fails, the fault level jumps from L2 to L3.
[0012] In this invention, when the fault level is determined to be L3, the hierarchical self-healing recovery strategy executor writes a node status file in the private data directory of the Android system, marking the current target device as being in maintenance mode and stopping the issuance of automated upgrade control commands to the KNX coprocessor. The Android WorkManager asynchronous work service packages the target device serial number, standard fault code, and firmware version number into a maintenance request data packet. In the event of an external network disconnection, the Android WorkManager asynchronous work service writes the maintenance request data packet to a local SQLite database for offline caching. Upon receiving a network recovery status broadcast, it automatically reads the offline cache and retransmits the maintenance request data packet to the external cloud-based operations and maintenance platform.
[0013] In this invention, a structured fault report generator aggregates unique IDs, target firmware versions, standard fault codes of the operating node, historical recovery action call sequences, and execution results, converting the aggregated data into a JSON document. The data structure of the structured fault report includes a unique ID, device serial number, start timestamp, end timestamp, target firmware version, final execution result, and a set of fault events recording standard fault codes, fault occurrence timestamps, historical recovery action call sequences, and single recovery results. The system writes the JSON document to the local system storage log directory and then uses an HTTPS application programming interface to upload the JSON document to an external cloud-based operations and maintenance platform for data analysis.
[0014] This invention provides a self-diagnosis and self-healing method for KNX firmware upgrade anomalies. It has the following beneficial effects: 1. This invention constructs a fault knowledge base and hierarchical self-healing recovery strategy execution logic. It extracts error status bytes, operation stage identifiers, and abnormal feature parameters for mapping and matching to determine the fault level and invoke the corresponding recovery action. When the maximum number of retries is reached and the fault is not eliminated, the system triggers a fault level transition instruction to execute a higher-level recovery control. This mechanism of matching specific fault causes and sequentially transitioning processing levels reduces reliance on manual intervention and improves the equipment's self-healing capability.
[0015] 2. This invention addresses firmware corruption and communication failures by implementing hardware-level intervention. When hardware-level recovery is deemed necessary, the system controls the underlying hardware abstraction layer to switch the primary serial interface to a backup communication interface to rebuild the connection; or, by controlling the physical pins to output high levels and reset pulses, it forces the coprocessor into boot mode and uses the backup channel to write the recovery firmware image. This cross-interface switching and physical boot control logic resolves the underlying failure of firmware to boot, eliminating the need for factory repairs.
[0016] 3. This invention, by setting up a hardware fault isolation program and fault report generation logic, marks the equipment as being under maintenance when an unrecoverable physical fault is detected, and intercepts upgrade commands to isolate the fault. The system extracts the equipment serial number and standard fault code to assemble a maintenance request message. When the network is disconnected, the message is stored in a local database for offline caching, and automatically retransmitted after the network is detected to be restored. The offline caching and automatic retransmission mechanism ensures data collaboration in the offline environment and realizes proactive maintenance request dispatch. Attached Figure Description
[0017] Figure 1 This is a flowchart of a self-diagnosis and self-healing recovery method for KNX firmware upgrade anomalies provided in an embodiment of the present invention. Detailed Implementation
[0018] The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0019] Example: Please see the appendix Figure 1 This invention provides a self-diagnosis and self-healing recovery method for KNX firmware upgrade anomalies, including an Android host processor and a KNX coprocessor. A communication link and a physical control link are established between the Android host processor and the KNX coprocessor. The primary communication link uses a serial interface UART. The backup communication link uses a synchronous serial peripheral interface SPI or an internal integrated circuit bus I2C. The Android host processor establishes a physical level control connection with the KNX coprocessor through general-purpose input / output (GPIO) pins. The physical control connection includes a RESET pin for controlling the reset state of the KNX coprocessor and a BOOT0 pin for controlling the boot mode configuration. The Android host processor internally runs a Hardware Abstraction Layer (HAL). The HAL encapsulates the protocol switching logic of the bus interface and the level driving logic of the GPIO pins, and provides a calling interface for the Hierarchical Self-Healing Recovery Strategy Executor (RSE). For the hardware implementation of the KNX underlying bus protocol's data packet encapsulation and encoding / decoding, those skilled in the art can use existing KNX transceiver chips combined with a standard protocol stack. The establishment of the relevant underlying communication links is well-known in the art and will not be elaborated further here.
[0020] Based on the system application environment and hardware / software architecture deployment, the workflow of the KNX firmware upgrade anomaly self-diagnosis and self-healing recovery method includes the following steps: S100 initiates a KNX firmware upgrade task. The Android host processor obtains the target KNX firmware package through the external network, parses the target KNX firmware package, divides the firmware data into multiple fixed-size data blocks, and prepares to send them to the KNX coprocessor via the serial interface UART.
[0021] S200 executes the upgrade steps and monitors for anomalies. The self-diagnostic engine (FDE) is in a monitoring state during firmware download, firmware transmission, firmware burning, and firmware verification operation nodes. Under normal firmware transmission conditions, the system continuously sends data blocks until the firmware upgrade is complete, triggering the structured fault report generator to generate an upgrade success report. If any operation node detects a coprocessor Flash write timeout, serial interface communication ACK packet loss, BootROM firmware signature verification failure, or version number readback inconsistency, the system enters the diagnostic analysis phase.
[0022] In the S300, the self-diagnostic engine (FDE) identifies anomalies and outputs diagnostic results. The FDE extracts the error status bytes returned by the serial interface UART, the current system operation stage identifier, and reads the timeout flag of the system timer or the status register of the interrupt controller as anomaly characteristic parameters. The FDE combines these three extracted parameters to search the Fault Knowledge Base (FKB) and matches the corresponding four-byte standard fault code (fault_code). Based on the fault code (fault_code), the FDE generates an upgrade status context (UpgradeContext) containing the occurrence time and the number of retries, and passes the UpgradeContext to the graded self-healing recovery strategy executor (RSE).
[0023] In S400, the graded self-healing recovery strategy executor (RSE) queries the fault knowledge base (FKB) and obtains the graded self-healing strategy. The RSE uses the standard fault code (fault_code) as the query index to retrieve the corresponding fault level (fault_level), recovery action list (recovery_actions), and maximum automatic retries (max_retry_count) from the FKB, and then enters the corresponding recovery control branch based on the retrieved fault level (fault_level).
[0024] In the S500, when the fault level is determined to be L1, the graded self-healing recovery strategy executor (RSE) invokes application-layer recovery actions. These actions include retransmitting the data block where the error occurred or reducing the communication baud rate of the serial interface UART. The system executes these application-layer recovery actions in a loop within the maximum automatic retries limit (max_retry_count). After a successful application-layer recovery action, the system resumes the interrupted firmware upgrade process. If the retries are exhausted and the system state is abnormal, the system modifies the level parameter in the upgrade state context (UpgradeContext), transitioning the current processing level from L1 to L2.
[0025] In the S600 system, when the fault level is determined to be L2, or when it transitions from L1 to L2, the graded self-healing recovery strategy executor (RSE) invokes a hardware-level recovery action. This hardware-level recovery action includes a cross-interface switching intervention and a physical boot intervention. The cross-interface switching intervention specifically involves calling the Hardware Abstraction Layer (HAL) to switch the primary UART interface to a backup SPI interface, establishing a communication connection using the backup SPI interface. The physical boot intervention specifically involves sending a level control command to pull the BOOT0 pin of the KNX coprocessor high and maintain that level. Then, a hardware reset pulse is injected into the RESET pin of the KNX coprocessor. After the reset pulse ends, the BOOT0 pin level is released, forcing the KNX coprocessor into Bootloader mode, and writing the recovery firmware image through the backup communication channel. If the hardware-level recovery action fails, the system modifies the level parameter in the Upgrade Context, transitioning the fault level from L2 to L3.
[0026] In the S700, when the fault level is determined to be L3, the Hierarchical Self-Healing Recovery Strategy Executor (RSE) executes a system-level hardware fault isolation procedure. The RSE writes a node status file to the Android system's private data directory, marking the target device as being in the DEVICE_MAINTENANCE_REQUIRED maintenance state, and the underlying system services stop issuing automated upgrade control commands to the KNX coprocessor. The internal AndroidWorkManager asynchronous service packages the target device serial number (device_sn), standard fault code (fault_code), and firmware version number into a repair request data packet, which is then sent to the external cloud-based operations and maintenance platform.
[0027] The S800 structured fault report generator aggregates upgrade status data and generates structured fault reports. Regardless of whether the firmware upgrade process is successfully restored or terminated by a system-level hardware fault isolation procedure, the structured fault report generator collects unique IDs related to the firmware upgrade, the target firmware version, standard fault codes for each operation node, historical recovery action call sequences, and system execution results. The generator converts the collected data into a JSON document, writes the JSON document to the local system storage log directory, and then uses an HTTPS application programming interface to upload the JSON document to an external cloud-based operations and maintenance platform for data analysis.
[0028] Combining the system diagnostic results output by the self-diagnostic engine FDE and the steps of the hierarchical self-healing recovery strategy executor RSE invoking strategies in the overall workflow, the decision basis for the hierarchical self-healing recovery strategy executor RSE to invoke recovery actions comes from the KNX upgrade fault knowledge base FKB. This section details the construction process and internal data structure definition of the KNX upgrade fault knowledge base FKB. The KNX upgrade fault knowledge base FKB uses structured data configuration files for storage. For the parsing and loading operations of structured data configuration files, those skilled in the art can use existing JSON data parsing libraries to complete the task. The file system read / write and external storage disk writing operations of its configuration files are well-known technologies in the field and will not be elaborated here.
[0029] S201 involves allocating a separate storage path within the non-volatile storage area of the Android host processor to build and write the KNX upgrade fault knowledge base (FKB). The specific independent storage path is the Android system's ` / system / etc / knx / fault_kb.json` system configuration file. The KNX upgrade fault knowledge base (FKB) contains multiple fault record sets. For the fault record set Any fault record in , record any fault Formal definition: 5-tuple structure
[0030] In the quintuple structure Defined as a standard fault code. Standard fault codes The fault record set is represented by a 4-byte hexadecimal value and is retrieved by the self-diagnostic engine FDE. The unique matching primary key. Defined as a fault level. Fault Level The value range is set to a set .gather These are respectively mapped to L1 level faults that can be automatically recovered, L2 level faults that require assisted intervention, and L3 level hardware faults that require manual intervention. Defined as a standard fault code List of bound recovery actions. It contains a sequence of system instruction calls arranged in chronological order of execution. Defined as the maximum number of automatic retries. Maximum number of automatic retries The constraint system is at a specific fault level The maximum number of times to retry execution. Defined as a timeout threshold. Timeout threshold Constraint Recovery Action List Allowable waiting time for a single recovery operation. The Hierarchical Self-Healing Recovery Strategy Executor (RSE) executes a list of recovery actions. During internal operations, a system internal hardware timer is started synchronously. The system internal hardware timer will continue operating until its value reaches the timeout threshold. If so, the single recovery operation is deemed a failure. Additionally, fault logs are recorded. It contains the fault name string "fault_name" used for human-computer interaction and the trigger condition description text "trigger_condition".
[0031] S202, based on the five-tuple structure definition, upgrades the KNX fault knowledge base (FKB) by writing L1-level fault mapping rules. L1-level fault mapping rules cover communication anomalies and packet verification anomalies. When the trigger condition description text `trigger_condition` indicates a data block CRC16 check failure, a standard fault code is mapped. The fault level is 0x0101. The corresponding recovery action list is configured as 1. Configured to retransmit data blocks that have failed verification to the KNX coprocessor. Maps a standard fault code when the trigger_condition description text indicates a timeout for the serial interface communication ACK packet wait. The fault level is 0x0102. The corresponding recovery action list is configured as 1. Configured to reduce the communication link baud rate. Reducing the communication link baud rate specifically includes: calling the system's underlying driver to lower the baud rate of the primary serial interface UART from the default value to 38400 bps, or lowering the communication clock frequency of the backup synchronous serial peripheral interface SPI to 500kHz. When the trigger condition description text `trigger_condition` indicates a differential packet checksum error, a standard fault code is mapped. For 0x0103, the corresponding recovery action list Configured to re-download the complete differential package from the external server. When the trigger condition description text `trigger_condition` indicates that the KNX coprocessor response latency exceeds a normal threshold, a standard fault code is mapped. The corresponding recovery action list is 0x0104. Configure it to add a fixed-duration timeout wait logic before re-initiating the read command.
[0032] S203, based on the five-tuple structure definition, writes L2-level fault mapping rules into the KNX upgrade fault knowledge base (FKB). The L2-level fault mapping rules cover firmware verification exceptions and memory erase / write logic exceptions. When the trigger condition description text `trigger_condition` indicates that the signature verification of the target KNX firmware package by the KNX coprocessor's internal BootROM has failed, a standard fault code is mapped. The fault level is 0x0201. The configuration is set to 2, and the corresponding list of recovery actions is as follows. The system is configured to download a backup recovery firmware package from the Android host processor's local pre-installed storage partition or from an external server, load the backup recovery firmware package into the Android host processor's memory, and call the Hardware Abstraction Layer (HAL) to boot the KNX coprocessor into Bootloader mode via the backup serial interface to rewrite the backup recovery firmware package. When the trigger condition description text `trigger_condition` indicates a failure to write a page erase operation to the KNX coprocessor's internal Flash memory, a standard fault code is mapped. For 0x0202, the corresponding recovery action list Configured to address and erase another blank spare memory block inside the Flash memory, forcing the KNX coprocessor to enter Bootloader mode for firmware rewriting. When the trigger condition description text `trigger_condition` indicates a communication interface physical layer communication failure, a standard fault code is mapped. For 0x0203, the corresponding recovery action list Configured to switch the communication link to the backup synchronous serial peripheral interface (SPI) and retry establishing the communication connection. When the trigger condition description text `trigger_condition` indicates a version number readback data after a Flash memory write is complete, which is inconsistent with the target version number, a standard fault code is mapped. The corresponding recovery action list is 0x0204. Configured to issue a full read command to the KNX coprocessor to perform a full data readback and verification operation from the Flash memory.
[0033] S204, based on the five-tuple structure definition, adds L3-level fault mapping rules to the KNX upgrade fault knowledge base (FKB). L3-level fault mapping rules cover hardware failure scenarios. When the trigger condition description text `trigger_condition` indicates that the number of bad blocks in the KNX coprocessor's internal Flash memory physical blocks exceeds the safety tolerance limit, a standard fault code is mapped. The fault level is 0x0301. The configuration is set to 3, and the corresponding list of recovery actions is as follows. Configured internally to mark the target device as being in a maintenance state, rejecting any subsequent firmware upgrade commands. When the trigger condition description text `trigger_condition` indicates a hardware electrical failure in the serial interface transceiver, it maps to a standard fault code. For 0x0302, the corresponding recovery action list Configured to mark the target device as being in maintenance status and generate a hardware maintenance dispatch request containing hardware pin information. When the trigger condition description text `trigger_condition` indicates that the number of times the system has not responded after the KNX coprocessor has resumed from L2 bootloader mode and retried, exceeding the maximum number of automatic retries. At that time, map standard fault codes For 0x0303, the corresponding recovery action list Configured to collect current error status register data and notify the external production line management system via MQTT or HTTPS protocol to generate a maintenance work order containing complete error status.
[0034] In the macro-upgrade workflow, the system enters the self-diagnostic analysis phase when it detects an upgrade anomaly. Combining the data structure of the Fault Knowledge Base (FKB), the self-diagnostic engine (FDE) is responsible for extracting anomaly feature parameters at the lower level and comparing these parameters with the mapping rules within the FKB. The feature extraction and diagnostic logic of the FDE includes the following operation nodes and execution mechanisms.
[0035] S301 deploys software hook functions and interrupt service routines as exception handling nodes between the Hardware Abstraction Layer (HAL) inside the Android host processor and the system kernel space. These exception handling nodes specifically include a bus interrupt listener, a hardware timer interrupt, and a data verification callback function. During the firmware download phase, the system calls the data verification callback function to calculate the hash value of the downloaded file and listen for file integrity errors. During the firmware transmission and flashing phases, the system intercepts receive interrupt requests from the UART serial interface through the bus interrupt listener, and the system synchronously starts a hardware timer, using the interrupt service routine triggered by the hardware timer overflow to listen for transmit / receive timeout states. During the firmware verification phase, the system reads the memory-mapped data returned by the KNX coprocessor and calls the data verification callback function to perform data verification.
[0036] S302, when an exception capture node triggers an exception event, the self-diagnostic engine FDE extracts three dimensions of exception feature parameters in the current system operating environment and constructs an exception feature vector input. The three-dimensional anomaly characteristic parameters include error status bytes. Current operation stage identifier and abnormal phenomenon characteristic parameters Error status byte This refers to the error code status returned by the underlying serial interface UART hardware register. It also indicates the current operation stage. Extracted from the system firmware upgrade state machine, this record shows anomalies occurring at download, transmission, flashing, or verification operation nodes. Anomaly characteristic parameters. The anomaly flag is obtained by reading the timer's timeout flag or the interrupt controller's status flag from the system kernel. The self-diagnostic engine (FDE) combines the extracted three-dimensional anomaly feature parameters into an anomaly feature vector as input.
[0037] S303, the self-diagnostic engine FDE calls the built-in diagnostic mapping function. Input the abnormal feature vector With the fault record collection in the Fault Knowledge Base (FKB) Data comparison is performed. The self-diagnostic engine FDE retrieves the fault knowledge base FKB, analyzes the preset state enumeration values and numerical threshold ranges of each fault record in the fault knowledge base FKB, and inputs the abnormal feature vectors. The system performs logical condition checks against the parameter values and preset state enumeration values and value threshold ranges. If the logical condition check is successful, the self-diagnostic engine (FDE) outputs a unique standard fault code. The diagnostic mapping logic of the self-diagnostic engine FDE satisfies the following mathematical expression:
[0038] In the above mathematical expression, For diagnostic mapping functions, This refers to the standard fault code obtained by the diagnostic mapping function from the Fault Knowledge Base (FKB) through addressing a 4-byte hexadecimal value. For the code implementation of JSON node traversal and comparison, those skilled in the art can use standard conditional branching or table lookup algorithms; the design of the traversal and comparison program is well-known in the field and will not be elaborated upon here.
[0039] S304, Self-diagnostic engine FDE according to standard fault codes. Instantiate the current upgrade state context. The upgrade state context is used to isolate and temporarily store system state data at the time of an exception. Define the upgrade state context as... Upgrade state context The following data structure must be satisfied:
[0040] In the data structure of the upgrade state context These are standard fault codes output by the self-diagnostic engine FDE; The absolute timestamp of the exception occurrence is obtained by the self-diagnostic engine FDE calling the system real-time clock RTC; This indicates the current operational stage at the time of the exception. For the system to respond to standard fault codes The cumulative number of retries already performed. This is the initial upgrade state context generated by the self-diagnostic engine FDE. At that time, the self-diagnostic engine FDE will increment the number of retries already performed. Initialize the value to 0. The self-diagnostic engine FDE completes the upgrade state context. The parameter encapsulation will upgrade the state context. Write it to the system memory buffer queue for the Hierarchical Self-Healing Recovery Strategy Executor (RSE) to read and invoke recovery instructions.
[0041] The graded self-healing recovery strategy executor (RSE) reads the upgrade state context written by the self-diagnostic engine (FDE) from the system memory buffer queue. The graded self-healing recovery strategy executor (RSE) parses the upgrade state context. Standard fault codes Accumulated with the number of retries already performed Combined with the fault level retrieved from the fault knowledge base FKB List of recovery actions and the maximum number of automatic retries The self-healing recovery control procedure is executed. The execution mechanism of the hierarchical self-healing recovery strategy executor (RSE) includes the following steps.
[0042] S501, when the graded self-healing recovery strategy executor RSE determines the fault level When the value equals 1, the Graded Self-Healing Recovery Strategy Executor (RSE) executes the list of recovery actions. The application layer recovery action. The hierarchical self-healing recovery strategy executor (RSE) internally runs a retry state transition function. Retry state transition function The control system at the maximum number of automatic retries The inner loop executes application-layer recovery actions. It then retryes the state transition function. The following conditional expression is satisfied:
[0043] In the above conditional expression, This represents the retry state transition function; This represents the cumulative number of retries that the system has performed for the standard fault code. This represents the maximum number of automatic retries defined in the Fault Knowledge Base (FKB). List of system interfaces invoked to perform recovery actions Operation instructions; This represents the operation command that triggers a fault level transition. After successful execution, the system resumes the firmware upgrade process. The number of retries is incremented. Reaching the maximum number of automatic retries Furthermore, if the system state is abnormal, retry the state transition function. trigger The operation command will upgrade the state context. The fault level parameter has been changed from L1 to L2.
[0044] S601, when the graded self-healing recovery strategy executor (RSE) determines the fault level... When the value equals 2, or when the system transitions from L1 to L2, the Hierarchical Self-Healing Recovery Strategy Executor (RSE) performs a cross-interface switching intervention or a physical boot intervention. The cross-interface switching intervention steps include: the RSE sending a bus switching command to the Android host's Hardware Abstraction Layer (HAL) via the Java Native Interface (JNI). The HAL responds to the bus switching command by modifying the system's underlying pin multiplexing registers, disabling the transmit / receive channels of the current primary serial interface (UART), and initializing the control registers of the backup synchronous serial peripheral interface (SPI). The HAL allocates the communication clock frequency and data frame format for the backup SPI, establishing a backup communication link between the Android host and the KNX coprocessor. After the backup communication link is established, the RSE resends firmware data blocks via the backup SPI.
[0045] S602, the physical boot intervention operation execution steps include: The Hierarchical Self-Healing Recovery Strategy Executor (RSE) calls the General Purpose Input / Output (GPIO) driver interface of the Hardware Abstraction Layer (HAL) through the Java Native Interface (JNI). The GPIO driver interface outputs a high-level signal to the BOOT0 pin of the KNX coprocessor and maintains it at a high level. After outputting the high-level signal, the GPIO driver interface outputs a reset pulse to the RESET pin of the KNX coprocessor. The reset pulse undergoes a level transition process from high to low and then from low to high. At the end of the rising edge transition of the reset pulse, the KNX coprocessor samples the high-level state of the BOOT0 pin, forcing the hardware system to enter the Bootloader boot mode. After entering the Bootloader boot mode, the GPIO driver interface releases the level control of the BOOT0 pin. The Hierarchical Self-Healing Recovery Strategy Executor (RSE) loads the backup recovery firmware package from the local preset storage partition of the Android host processor, and writes the backup recovery firmware package into the Flash memory of the KNX coprocessor through the backup serial interface using a proprietary burning protocol, completing the firmware recovery. In the event of a firmware recovery failure, the Hierarchical Self-Healing Recovery Strategy Executor (RSE) will upgrade the state context. The fault level parameter has been changed from L2 to L3.
[0046] S701, when the graded self-healing recovery strategy executor RSE determines the fault level When the value equals 3, or when the system transitions from L2 to L3, the Hierarchical Self-Healing Recovery Strategy Executor (RSE) executes a system-level hardware fault isolation procedure. The system-level hardware fault isolation procedure includes the following steps: the RSE generates a JSON state object containing the device's current state identifier, writes the JSON state object to the Android system's private state file ` / data / knx / device_state.json`, and marks the target node's state as `DEVICE_MAINTENANCE_REQUIRED`. The underlying system scheduling service continuously monitors the ` / data / knx / device_state.json` private state file, intercepting and blocking automatic upgrade data packets sent from the Android host to the KNX coprocessor.
[0047] S702, while intercepting upgrade data packets, instantiates the Hierarchical Self-Healing Recovery Strategy Executor (RSE) of the Android system's internal WorkManager asynchronous task. The WorkManager asynchronous task extracts the target device's device serial number (device_sn), the standard fault code (fault_code) for the exception, the current firmware version, and the KNX coprocessor hardware model, assembling the extracted hardware attribute parameters into a repair request data packet. The WorkManager asynchronous task calls the network request service to send the repair request data packet to the cloud-based operations and maintenance platform. In the event of an external network outage, the WorkManager asynchronous task writes the repair request data packet to a local SQLite database for offline caching. Upon receiving a network recovery status broadcast, it automatically reads the offline cache and retransmits the repair request data packet to the cloud-based operations and maintenance platform. The packet assembly and transmission process for the network request service can be accomplished by those skilled in the art using existing HTTP client network communication libraries; the relevant network data transmission mechanisms are well-known in the field and will not be elaborated upon here.
[0048] After the firmware upgrade process is successfully resumed or terminated by the system-level hardware fault isolation program, the system enters the data aggregation and uploading phase. The structured fault report generator is responsible for collecting the status data during the firmware upgrade process, storing the collected status data in a structured format on disk, and synchronizing it to the external cloud-based operations and maintenance platform. The execution mechanism of the structured fault report generator includes the following steps.
[0049] S801, the structured fault report generator instantiates a structured fault report in memory. The structured fault report is defined as... The structured fault report generator assembles structured fault reports according to the following data structure. :
[0050] In the data structure of structured fault reports, A globally unique identifier representing the assignment of this firmware upgrade task; The device serial number representing the target KNX coprocessor; The timestamp representing the start of the firmware upgrade task; The termination timestamp represents the end of the firmware upgrade task; This represents the target firmware version number of the target KNX firmware package. This represents the final execution result of the firmware upgrade task. The value range of the final execution result includes success status enumeration values and failure status enumeration values. This represents the set of failure events that occur during the firmware upgrade process. It contains multiple fault event records arranged in chronological order. Any fault event record The following data structure must be satisfied:
[0051] In the data structure of fault event records This represents the standard fault code output by the self-diagnostic engine (FDE) at the point where the fault occurs. The timestamp representing the time the failure occurred; This represents the sequence of recovery actions initiated by the graded self-healing recovery strategy executor (RSE) in response to standard fault code calls. This represents the result of a single recovery operation after the system executes the recovery action sequence.
[0052] S802, Structured Fault Report Generator for Structured Fault Reports Perform data serialization processing. The structured fault report generator calls the JSON serialization component to convert the structured fault report... The tuple parameter mapping transformation generates a JSON-formatted log document. The structured fault report generator calls the Android system's log output interface to print the JSON-formatted log document to the Logcat system log buffer. Simultaneously, the structured fault report generator calls the operating system's file write stream to write the JSON-formatted log document as a separate file to the Android host processor's ` / data / knx / upgrade_log / ` private log directory, completing the local physical disk write operation of the fault status data.
[0053] S803, the structured fault report generator calls the system's internal network request module to upload JSON-formatted log documents from the private log directory to the external cloud-based operations and maintenance platform. The network request module initiates an encrypted network connection via an HTTPS application programming interface (API) to push log data to the external cloud-based operations and maintenance platform. In the event of a network connection failure or external network disconnection, the network request module marks the push task as suspended and marks the physical files in the ` / data / knx / upgrade_log / ` private log directory as offline cached data. The Android host's background network listening service registers a network status callback interface with the operating system and continuously receives network connection status broadcasts from the operating system. After receiving a system broadcast message indicating network connection recovery, the background network listening service wakes up the suspended push task, reads the offline cached data, and re-invokes the HTTPS API to perform data retransmission, completing the data collaboration between local upgrade status data and the cloud-based operations and maintenance platform. For the network packet encapsulation and encrypted handshake process of the HTTPS API, those skilled in the art can use a standard TLS / SSL encryption protocol stack. The relevant network data encryption and transmission mechanisms are well-known technologies in the field and will not be elaborated upon here.
[0054] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.
Claims
1. A self-diagnosis and self-healing method for KNX firmware upgrade anomalies, characterized in that, Includes the following steps: S100 initiates a KNX firmware upgrade task; S200, executes upgrade procedures and listens for abnormal situations; S300, the self-diagnostic engine FDE identifies the abnormal situation and outputs the system diagnostic results; S400, the graded self-healing recovery strategy executor RSE queries the fault knowledge base FKB and retrieves the corresponding fault level fault_level based on the system diagnostic results; S500, when the fault level is determined to be L1, the graded self-healing recovery strategy executor RSE calls the application layer recovery action; S600, when the fault level is determined to be L2, or when it jumps from L1 to L2, the graded self-healing recovery strategy executor RSE calls the hardware-level recovery action. S700, when the fault level is determined to be L3, the graded self-healing recovery strategy executor RSE executes the system-level hardware fault isolation procedure. The S800 structured fault report generator summarizes the status data of firmware upgrade tasks and generates structured fault reports.
2. The self-diagnosis and self-healing recovery method for KNX firmware upgrade anomalies according to claim 1, characterized in that, The specific steps for performing the upgrade and monitoring for abnormal situations are as follows: The self-diagnostic engine FDE is in a listening state during firmware download, firmware transmission, firmware burning and firmware verification operation nodes. Under the condition that no abnormality occurs during firmware transmission, data blocks are continuously sent until the firmware upgrade is completed, triggering the structured fault report generator to generate an upgrade success report; When any of the aforementioned operating nodes detects a coprocessor Flash write timeout, serial interface communication ACK packet loss, BootROM firmware signature verification failure, or version number readback inconsistency, the diagnostic analysis phase begins.
3. The self-diagnosis and self-healing recovery method for KNX firmware upgrade anomalies according to claim 1, characterized in that, The self-diagnostic engine FDE identifies the abnormal situation and outputs the system diagnostic results, specifically: The self-diagnostic engine FDE extracts the error status byte and the current system operation stage identifier returned by the serial interface UART, and reads the timeout flag of the system timer or the status register of the interrupt controller as abnormal phenomenon characteristic parameters. The self-diagnostic engine FDE combines the extracted error status bytes, the current system operation stage identifier, and the abnormal phenomenon feature parameters to search the fault knowledge base FKB and match the corresponding standard fault code fault_code. The self-diagnostic engine FDE generates an upgrade status context UpgradeContext containing the occurrence time and the number of retries based on the standard fault code fault_code, and passes the upgrade status context UpgradeContext to the hierarchical self-healing recovery strategy executor RSE.
4. The self-diagnosis and self-healing recovery method for KNX firmware upgrade anomalies according to claim 1, characterized in that, The fault knowledge base (FKB) contains multiple fault record sets. For any fault record in any of the fault record sets, the fault record is defined as a quintuple structure, which includes: Standard fault codes, which serve as unique matching primary keys for the self-diagnostic engine FDE to retrieve the set of fault records; Fault level, the value range of the fault level is set as a set, the set is mapped to automatically recoverable faults, faults requiring auxiliary intervention, and hardware faults requiring manual intervention; A recovery action list, which contains a sequence of system instruction calls arranged in chronological order of execution. The maximum number of automatic retries, which constrains the upper limit of retry execution when the system is in a specific fault level; A timeout threshold, which constrains the allowed waiting time for a single recovery operation in the recovery action list.
5. The self-diagnosis and self-healing recovery method for KNX firmware upgrade anomalies according to claim 4, characterized in that, When the fault level is determined to be L1, the graded self-healing recovery strategy executor (RSE) invokes the application-layer recovery action, specifically: The application layer recovery action includes retransmitting the data block that has now malfunctioned, or reducing the communication baud rate of the serial interface UART. The system continuously executes the application-layer recovery action within the maximum automatic retry limit; After the application layer recovery action is successfully executed, the system resumes the interrupted firmware upgrade process; When the maximum number of automatic retries is exhausted and the state is in the abnormal condition, the current processing level is transitioned from level L1 to level L2.
6. The self-diagnosis and self-healing recovery method for KNX firmware upgrade anomalies according to claim 1, characterized in that, When the fault level is determined to be L2, or when a transition occurs from L1 to L2, the graded self-healing recovery strategy executor (RSE) invokes a hardware-level recovery action, specifically: The hardware-level recovery action includes cross-interface switching intervention and physical guidance intervention; The cross-interface switching intervention operation is specifically as follows: calling the hardware abstraction layer (HAL) to switch the primary communication UART interface to the backup SPI interface, and using the backup SPI interface to establish a communication connection. The physical boot intervention operation is specifically as follows: a level control command is sent to pull the BOOT0 pin of the KNX coprocessor high and maintain the level state, then a hardware reset pulse is injected into the RESET pin of the KNX coprocessor, and after the hardware reset pulse ends, the level of the BOOT0 pin is released, forcing the KNX coprocessor to enter the Bootloader boot mode, and writing the recovery firmware image through the backup communication channel. If the hardware-level recovery action fails, the fault level will be transitioned from L2 to L3.
7. The self-diagnosis and self-healing recovery method for KNX firmware upgrade anomalies according to claim 1, characterized in that, When the fault level is determined to be L3, the graded self-healing recovery strategy executor (RSE) executes a system-level hardware fault isolation procedure, specifically as follows: The hierarchical self-healing recovery strategy executor RSE writes a node status file in the private data directory of the Android system, marking the current target device as being in maintenance state and stopping the issuance of automated upgrade control commands to the KNX coprocessor. The Android WorkManager asynchronous work service packages the target device serial number (device_sn), standard fault code (fault_code), and firmware version number into a repair request data message, and sends the repair request data message to an external cloud-based operations and maintenance platform.
8. The self-diagnosis and self-healing recovery method for KNX firmware upgrade anomalies according to claim 7, characterized in that, The Android WorkManager asynchronous work service packages the target device serial number (device_sn), standard fault code (fault_code), and firmware version number into a repair request data message, and sends the repair request data message to the external cloud operation and maintenance platform. Specifically, it includes: In the event of an external network outage, the Android WorkManager asynchronous work service writes the repair request data message to a local SQLite database for offline caching. After receiving a network recovery status broadcast, the Android WorkManager asynchronous work service automatically reads the offline cache and resends the maintenance request data message to the external cloud operation and maintenance platform.
9. The self-diagnosis and self-healing recovery method for KNX firmware upgrade anomalies according to claim 1, characterized in that, The structured fault report generator summarizes the status data of the firmware upgrade task and generates a structured fault report, specifically: The structured fault report generator gathers a unique ID, target firmware version, standard fault code of the operating node, historical recovery action call sequence, and execution result; The structured fault report generator converts the collected data into a JSON document, writes the JSON document into the local system storage log directory, and calls the HTTPS application programming interface to upload the JSON document to an external cloud operation and maintenance platform for data analysis.
10. The self-diagnosis and self-healing recovery method for KNX firmware upgrade anomalies according to claim 9, characterized in that, The structured fault report generator aggregates the unique ID, the target firmware version, the standard fault code of the operating node, the historical recovery action call sequence, and the execution result, specifically including: The structured fault report data structure includes the unique ID, the device serial number of the target KNX coprocessor, the start timestamp of the firmware upgrade task, the end timestamp of the firmware upgrade task, the target firmware version, the final execution result of the firmware upgrade task, and the set of fault events that occurred during the firmware upgrade process. The fault event set contains multiple fault event records arranged in chronological order. Each fault event record includes the standard fault code of the operation node, the timestamp of the fault occurrence, the historical recovery action call sequence, and the single recovery result.
