Device failure diagnosis apparatus, method, storage medium, and electronic device
Patent Information
- Application Number
- CN202611307925.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2026-07-21
- Filing Date
- 2026-08-26
- Publication Date
- 2026-10-16
AI Technical Summary
诊断功能与外部设备绑定紧密,如果子系统新增外部设备则需重新开发其对应的诊断功能,通用性较差
[0011]Based on the fault diagnosis apparatus, method, storage medium, and electronic device provided in the above embodiments of this disclosure, it is possible to determine the diagnostic nodes corresponding to various diagnostic methods pre-registered by the driver program of the target device. For any first diagnostic method among the various diagnostic methods, based on the diagnostic reference information in the diagnostic node corresponding to the first diagnostic method, the first diagnostic method is adopted to determine the first diagnostic sub-result of the target device. Then, based on the first diagnostic sub-result of the target device under each diagnostic method, the first fault diagnosis result of the target device is determined. It can be seen that the solution provided by the embodiments of this disclosure, by registering diagnostic nodes for various diagnostic methods by the driver program, can determine the diagnostic sub-result of the target device under the corresponding diagnostic method based on the diagnostic reference information in different diagnostic nodes when diagnosing a fault in the target device. This enables the subsystem where the target device resides to support fault diagnosis of multiple diagnostic methods, thereby meeting the fault diagnosis needs of devices in different subsystems. Furthermore, by abstracting the device's diagnostic reference information into diagnostic nodes, it is convenient for the subsystem to expand to new devices, thereby improving the flexibility and versatility of device fault diagnosis.
Smart Images

Figure CN122925100A_ABST
Abstract
Description
[0001] This disclosure claims priority to Chinese Patent Application No. CN202611089343.9, filed on July 21, 2026, with the State Intellectual Property Office of China, entitled "Fault Diagnosis Apparatus, Method, Storage Medium and Electronic Equipment", the entire contents of which are incorporated herein by reference. Technical Field
[0002] This disclosure relates to functional safety technology, and in particular to a fault diagnosis device, method, storage medium, and electronic device for a device. Background Technology
[0003] In-vehicle systems typically comprise multiple subsystems, such as camera subsystems, radar subsystems, autonomous driving subsystems, infotainment subsystems, and vehicle control subsystems. Some subsystems have high functional safety requirements. For example, the camera subsystem, radar subsystem, autonomous driving subsystem, and vehicle control subsystem are all closely related to vehicle driving safety. If the camera subsystem or radar subsystem malfunctions and cannot accurately perceive environmental conditions, the autonomous driving subsystem and vehicle control subsystem will struggle to perform accurate planning and control, easily affecting vehicle driving safety. Therefore, these subsystems have high functional safety requirements. Different subsystems may include different external devices. Effective fault diagnosis of the external devices of a subsystem is a key technology for ensuring the functional safety of the subsystem.
[0004] In related technologies, fault diagnosis of external devices in a subsystem typically relies on a single diagnostic method, such as interrupt-based or polling-based methods. The diagnostic function is tightly bound to the external device; if a new external device is added to the subsystem, its corresponding diagnostic function must be redeveloped, resulting in poor versatility. Summary of the Invention
[0005] The embodiments of this disclosure provide a device fault diagnosis apparatus, method, storage medium, and electronic device that can support fault diagnosis of external devices using multiple diagnostic methods, thereby meeting the fault diagnosis needs of external devices in different subsystems and facilitating the expansion of new external devices, effectively improving the flexibility and versatility of fault diagnosis for external devices.
[0006] A first aspect of this disclosure provides a device fault diagnosis apparatus, including a processor configured to: determine diagnostic nodes corresponding to various diagnostic methods pre-registered by a driver for a target device; the diagnostic nodes include diagnostic reference information for the target device; for any first diagnostic method among the various diagnostic methods, based on the diagnostic reference information in the diagnostic node corresponding to the first diagnostic method, using the first diagnostic method to determine a first diagnostic sub-result for the target device; and based on the first diagnostic sub-results of the target device under each of the diagnostic methods, determine a first fault diagnosis result for the target device.
[0007] A second aspect of this disclosure provides a method for diagnosing device faults, comprising: determining diagnostic nodes corresponding to various diagnostic methods pre-registered by a driver for a target device; the diagnostic nodes including diagnostic reference information of the target device; for any first diagnostic method among the various diagnostic methods, determining a first diagnostic sub-result of the target device based on the diagnostic reference information in the diagnostic node corresponding to the first diagnostic method; and determining a first fault diagnosis result of the target device based on the first diagnostic sub-result of the target device under each of the diagnostic methods.
[0008] A third aspect of this disclosure is to provide a computer-readable storage medium storing a computer program that is executed by a processor to perform a fault diagnosis method for a device according to any of the above embodiments of this disclosure.
[0009] A fourth aspect of this disclosure provides an electronic device, the electronic device comprising: a processor; a memory for storing executable instructions of the processor; the processor being configured to read the executable instructions from the memory, the processor executing the executable instructions to implement the fault diagnosis method of the device according to any of the above embodiments of this disclosure.
[0010] A fifth aspect of this disclosure provides a computer program product that, when instructions in the computer program product are executed by a processor, performs a fault diagnosis method for a device provided in any of the above embodiments of this disclosure.
[0011] Based on the fault diagnosis apparatus, method, storage medium, and electronic device provided in the above embodiments of this disclosure, it is possible to determine the diagnostic nodes corresponding to various diagnostic methods pre-registered by the driver program of the target device. For any first diagnostic method among the various diagnostic methods, based on the diagnostic reference information in the diagnostic node corresponding to the first diagnostic method, the first diagnostic method is adopted to determine the first diagnostic sub-result of the target device. Then, based on the first diagnostic sub-result of the target device under each diagnostic method, the first fault diagnosis result of the target device is determined. It can be seen that the solution provided by the embodiments of this disclosure, by registering diagnostic nodes for various diagnostic methods by the driver program, can determine the diagnostic sub-result of the target device under the corresponding diagnostic method based on the diagnostic reference information in different diagnostic nodes when diagnosing a fault in the target device. This enables the subsystem where the target device resides to support fault diagnosis of multiple diagnostic methods, thereby meeting the fault diagnosis needs of devices in different subsystems. Furthermore, by abstracting the device's diagnostic reference information into diagnostic nodes, it is convenient for the subsystem to expand to new devices, thereby improving the flexibility and versatility of device fault diagnosis. Attached Figure Description
[0012] Figure 1 This is an exemplary application scenario of the fault diagnosis device for the equipment provided in this disclosure; Figure 2 This is a schematic diagram of the structure of a fault diagnosis device for an apparatus provided in an exemplary embodiment of this disclosure; Figure 3 This is a structural block diagram of a fault diagnosis apparatus for a device provided in an exemplary embodiment of this disclosure; Figure 4 This is a schematic diagram of the data structure of a diagnostic node provided in an exemplary embodiment of this disclosure; Figure 5 This is a schematic flowchart of a fault diagnosis method for a device provided in an exemplary embodiment of this disclosure; Figure 6 This is a flowchart illustrating a fault diagnosis method for a device provided in another exemplary embodiment of this disclosure; Figure 7 This is a schematic flowchart of a fault diagnosis method for a device provided in yet another exemplary embodiment of this disclosure; Figure 8 This is a schematic flowchart of a fault diagnosis method for a device provided in yet another exemplary embodiment of this disclosure; Figure 9 This is a schematic flowchart of a fault diagnosis method for a device provided in yet another exemplary embodiment of this disclosure; Figure 10 This is a structural diagram of an electronic device provided in an embodiment of this disclosure. Detailed Implementation
[0013] To explain this disclosure, exemplary embodiments of the disclosure will now be described in detail with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the disclosure, and not all of them. It should be understood that the disclosure is not limited to exemplary embodiments.
[0014] It should be noted that, unless otherwise specifically stated, the relative arrangement, numerical expressions, and values of the components and steps set forth in these embodiments do not limit the scope of this disclosure.
[0015] This disclosure outlines In the process of developing this disclosure, the inventors discovered that in the fault diagnosis scenario of in-vehicle systems, some subsystems of the in-vehicle system have high requirements for functional safety. For example, the camera subsystem, radar subsystem, autonomous driving subsystem, and vehicle control subsystem are all closely related to vehicle driving safety. If the camera subsystem, radar subsystem, etc., malfunctions and cannot accurately perceive environmental conditions, the autonomous driving subsystem and vehicle control subsystem will struggle to perform accurate planning and control, easily affecting vehicle driving safety. Therefore, these subsystems have high requirements for functional safety. Different subsystems may include different external devices. Effective fault diagnosis of the external devices of a subsystem is a key technology to ensure the functional safety of the subsystem. For example, external devices (hereinafter referred to as peripherals or devices) of the camera subsystem, radar subsystem, etc., are prone to functional failure in complex environments due to hardware failures, signal interference, connection abnormalities, etc., failing to effectively acquire environmental images and environmental point clouds, which will affect the function of the autonomous driving subsystem that relies on environmental images and environmental point clouds. Different subsystems may include different external devices. For example, external devices for the camera subsystem may include image sensors, serializer-deserializers (SerDes), and power over coaxial (POC) devices. External devices for the radar subsystem may include radar-side hardware, intermediate transmission harness hardware, and domain controller-side hardware. Radar-side hardware includes, but is not limited to, radar-side processing chips, automotive Ethernet PHY (Physical Layer) chips, and transceivers. Intermediate transmission harness hardware includes, but is not limited to, shielded twisted-pair cables. Domain controller-side hardware includes, but is not limited to, automotive Ethernet PHY chips and Ethernet switches on the domain controller side.
[0016] In related technologies, fault diagnosis of external devices in a subsystem typically relies on a single diagnostic method, such as interrupt-based or polling-based methods. The diagnostic function is tightly bound to the external device; if a new external device is added to the subsystem, its corresponding diagnostic function must be redeveloped, resulting in poor versatility.
[0017] Exemplary Overview Figure 1 This is an exemplary application scenario of the fault diagnosis device for the equipment provided in this disclosure. For example... Figure 1 As shown, the vehicle system 10 may include multiple subsystems 11, and any subsystem 11 may include an external device 111 and a computing device 112. The external device 111 can be used to collect data, transmit data to the computing device 112, etc., and the computing device 112 can be used to perform calculations on the data transmitted by the external device to realize the response function of the subsystem 11. Taking the camera subsystem in the vehicle system as an example, the external device 111 of the camera subsystem includes, but is not limited to, an image sensor, a serializer / deserializer, and a coaxial power supply. Among them, the image sensor is used to perceive the environment around the vehicle system 10 and collect sensor data. The serializer (Ser) is used to convert the parallel data collected by the image sensor into serial data and transmit the serial data to the deserializer (Des). The deserializer is used to deserialize the serial data, restore the serial data to parallel data, and transmit the restored parallel data to the computing device 112. Coaxial power supply is a method where the host side (e.g., computing device 112) on the deserializer side supplies power to the serializer side via a coaxial cable, thereby providing power to the serializer and the image sensor. The computing device 112 includes, for example but not limited to, a processor or controller with certain computing resources in subsystem 11.
[0018] The fault diagnosis device of this disclosure is provided, for example, but not limited to, in the computing device 112. For any one of a plurality of external devices 111, that external device can be used as the target device, and the fault diagnosis device of this disclosure can be used to perform fault diagnosis on the target device to obtain a fault diagnosis result. Specifically, the fault diagnosis device of this disclosure may include a processor, which is configured to: determine the diagnostic nodes corresponding to various diagnostic methods pre-registered by the driver corresponding to the target device; the diagnostic nodes include diagnostic reference information of the target device; for any first diagnostic method among the various diagnostic methods, based on the diagnostic reference information included in the diagnostic node corresponding to the first diagnostic method, adopt the first diagnostic method to determine a first diagnostic sub-result of the target device; and based on the first diagnostic sub-results of the target device under each diagnostic method, determine a first fault diagnosis result of the target device.
[0019] The fault diagnosis device provided in this disclosure registers diagnostic nodes for multiple diagnostic methods through a driver program. When diagnosing a target device, it can determine the diagnostic sub-result of the target device under the corresponding diagnostic method based on the diagnostic reference information included in different diagnostic nodes. This enables the subsystem containing the target device to support fault diagnosis using multiple diagnostic methods. The same subsystem can include multiple identical or different external devices. By enabling sub-devices to support fault diagnosis using multiple diagnostic methods, the fault diagnosis needs of the subsystem for different external devices can be met. Furthermore, different subsystems can include identical or different external devices, and different subsystems may have identical or different diagnostic needs for the same external device. By enabling subsystems to support fault diagnosis using multiple diagnostic methods, the fault diagnosis needs of different subsystems for the same external device can be met. Moreover, by abstracting the diagnostic reference information of the target device into diagnostic nodes, it is easy for the subsystem to extend and associate with new external devices, thereby improving the flexibility and versatility of external device fault diagnosis.
[0020] Exemplary device Figure 2 This is a schematic diagram of the structure of a fault diagnosis device for a device provided in an exemplary embodiment of this disclosure. The fault diagnosis device for a device provided in this embodiment can be applied to electronic devices or systems-on-a-chip (SoCs). The electronic devices may include, but are not limited to, in-vehicle computing platforms (or in-vehicle terminals), intelligent agents, mobile phones, tablets, or wearable devices. The SoCs may include, but are not limited to, intelligent driving SoCs, intelligent cockpit SoCs, cockpit-driver integrated SoCs, or SoCs applied to electronic devices. Figure 2 As shown, the fault diagnosis device 20 of the device in this embodiment of the present disclosure may include a processor 21. Optionally, the fault diagnosis device 20 of the device may include one or more processors 21.
[0021] The processor 21 is configured to: determine the diagnostic nodes corresponding to various diagnostic methods pre-registered by the driver of the target device; the diagnostic nodes include diagnostic reference information of the target device; for any first diagnostic method among the various diagnostic methods, based on the diagnostic reference information in the diagnostic node corresponding to the first diagnostic method, adopt the first diagnostic method to determine the first diagnostic sub-result of the target device; and based on the first diagnostic sub-result of the target device under each diagnostic method, determine the first fault diagnosis result of the target device.
[0022] The processor 21 includes, for example but not limited to, one or more of a central processing unit, a coprocessor, or any other suitable processor.
[0023] The target device may include, but is not limited to, one or more external devices. For example, in the camera subsystem of an in-vehicle system, the target device may include one or more of an image sensor, serializer, deserializer, etc. The driver for the target device is the software interface that connects the operating system and the hardware of the target device. The driver's role is to enable the operating system to control and manage the hardware of the target device. The driver encapsulates the low-level hardware details of the target device, providing corresponding access interfaces for upper-layer applications.
[0024] Diagnostic methods refer to the approaches used to diagnose faults in target devices. Various diagnostic methods exist, including but not limited to register polling, general purpose input / output (GPIO) interrupt methods, and / or GPIO polling. Register polling determines whether the target device is faulty by polling the status register. Examples of register polling methods include I2C (Inter-Integrated Circuit) register polling. GPIO interrupt methods monitor the status changes of external devices by real-time detection of GPIO pin levels to determine if the device is faulty. GPIO polling checks the connection status of external devices or the corresponding hardware for abnormalities by periodically reading GPIO pin states.
[0025] A diagnostic node is an information node abstracted from the diagnostic functions of a target device. It includes diagnostic reference information for the target device. This diagnostic reference information describes whether the target device is faulty. It includes, but is not limited to, node identification information, sensor temperature reference information, voltage reference information, clock reference information, and data stream reference information. Optionally, the diagnostic reference information can be set according to the specific diagnostic objects of the target device. For example, the target device may include one or more diagnostic objects, which are the items to be diagnosed. Diagnostic objects include, but are not limited to, temperature, voltage, clock, and data stream. The diagnostic reference information for the target device may include diagnostic reference information corresponding to one or more diagnostic objects of the target device.
[0026] In one example, taking temperature as an example, the diagnostic reference information corresponding to the temperature (which can be called temperature reference information) may include temperature thresholds and judgment rules for determining whether the temperature of the target device is abnormal based on the temperature thresholds. Temperature thresholds may include one or more of an upper limit threshold and a lower limit threshold. Judgment rules, for example, include determining a high-temperature fault in the target device if the temperature exceeds the upper limit threshold, and determining a low-temperature fault in the target device if the temperature is below the lower limit threshold.
[0027] In another example, taking voltage as an example, the diagnostic reference information corresponding to the voltage may include, but is not limited to, voltage thresholds and judgment rules for determining that the target device's voltage is abnormal based on the voltage thresholds. Voltage thresholds may include, for example, at least one of a minimum voltage threshold and a maximum voltage threshold. Judgment rules may include, but are not limited to, determining that the target device's voltage is abnormal if the target device's current voltage is lower than the minimum voltage threshold or higher than the maximum voltage threshold.
[0028] In another example, taking a clock as an example, the diagnostic reference information corresponding to the clock (which may be called clock reference information) may include, but is not limited to, the reference state corresponding to the clock lock status register, and the judgment rules for determining whether the clock of the target device is abnormal based on the reference state. For example, the reference state is 0, and the judgment rules include, for example, if the current state of the clock lock status register of the target device is the same as the reference state, it is determined that the clock of the target device is faulty.
[0029] In another example, taking a data stream as an example, the diagnostic reference information corresponding to the data stream may include, but is not limited to, the judgment rules for determining data stream interruption, the reference frame number corresponding to the frame count register, and the judgment rules for determining data stream faults. For example, if the start or end synchronization flag of a data frame is detected to be lost on the target device, it is determined that the target device's data stream is interrupted. If the error between the number of valid frames output by the target device per unit time counted by the frame count register and the reference frame number is large, it is determined that the target device's data stream is faulty.
[0030] Optionally, each diagnostic node corresponds to a diagnostic method. A diagnostic node may correspond to a diagnostic object, or a diagnostic node may correspond to multiple diagnostic objects that need to use the same diagnostic method. That is, a diagnostic node may include diagnostic reference information corresponding to a diagnostic object, or a diagnostic node may include diagnostic reference information corresponding to multiple diagnostic objects that need to use the same diagnostic method.
[0031] During driver startup, the driver can register diagnostic nodes corresponding to various diagnostic methods for the target device. Optionally, the diagnostic nodes can be pre-registered in a preset memory or database. After the driver starts, the processor 21 executes a fault diagnosis program (or diagnostic management program) to perform fault diagnosis. Specifically, the processor 21 can retrieve the diagnostic nodes corresponding to the various diagnostic methods pre-registered by the driver from the preset memory or database, traverse each diagnostic method, take the currently traversed diagnostic method as the first diagnostic method, and determine the first diagnostic sub-result of the target device based on the diagnostic reference information included in the diagnostic node corresponding to the first diagnostic method, using the first diagnostic method.
[0032] In some optional embodiments, the first diagnostic method may correspond to one or more diagnostic nodes. For example, if at least two diagnostic nodes on the target device correspond to the same diagnostic method (e.g., the first diagnostic method), then both of the at least two diagnostic nodes are diagnostic nodes corresponding to the first diagnostic method, i.e., the first diagnostic method corresponds to at least two diagnostic nodes. If the target device has only one diagnostic object corresponding to the first diagnostic method, then the first diagnostic method corresponds to one diagnostic node.
[0033] For any diagnostic node corresponding to the first diagnostic method, the current status information of the diagnostic object in that diagnostic node can be obtained based on the first diagnostic method. Based on the current status information and the diagnostic reference information in that diagnostic node, the diagnostic sub-result of the diagnostic object corresponding to that diagnostic node can be determined. Combining the diagnostic sub-results corresponding to each diagnostic node of the first diagnostic method, the first diagnostic sub-result of the target device under the first diagnostic method is obtained. Based on this, multiple diagnostic methods corresponding to the target device can be used as the first diagnostic method respectively. Following the above operation process, the first diagnostic sub-results of the target device under multiple diagnostic methods can be obtained. Based on the first diagnostic sub-results of the target device under multiple diagnostic methods, the first fault diagnosis result of the target device can be determined.
[0034] The fault diagnosis device for a device provided in this disclosure can determine the diagnostic nodes corresponding to various diagnostic methods pre-registered by the driver program of the target device. For any first diagnostic method among the various diagnostic methods, based on the diagnostic reference information in the diagnostic node corresponding to the first diagnostic method, the first diagnostic method is adopted to determine the first diagnostic sub-result of the target device. Then, based on the first diagnostic sub-results of the target device under each diagnostic method, the first fault diagnosis result of the target device is determined. It can be seen that by registering diagnostic nodes for various diagnostic methods through the driver program, this disclosure can determine the diagnostic sub-result of the target device under the corresponding diagnostic method based on the diagnostic reference information in different diagnostic nodes when diagnosing a fault in the target device. This enables the subsystem containing the target device to support fault diagnosis using multiple diagnostic methods. The same subsystem may include multiple identical or different external devices. By enabling sub-devices to support fault diagnosis using multiple diagnostic methods, the fault diagnosis needs of the subsystem for different external devices can be met. In addition, different subsystems may include the same or different external devices, and different subsystems may have the same or different diagnostic requirements for the same external device. By enabling subsystems to support fault diagnosis using multiple diagnostic methods, the fault diagnosis requirements of different subsystems for the same external device can be met. Furthermore, by abstracting the diagnostic reference information of the target device into diagnostic nodes, it is easy for the subsystem to extend and associate with new external devices, thereby improving the flexibility and versatility of external device fault diagnosis.
[0035] In some alternative embodiments, based on any of the above embodiments, the processor 21 is further configured to: Obtain diagnostic information of the target device, which includes at least one diagnostic object of the target device and corresponding diagnostic reference information; based on the diagnostic information of the target device, generate a diagnostic node corresponding to the target device according to a preset data structure; based on the diagnostic node, generate a registration request for the diagnostic node; based on the registration request for the diagnostic node, determine the target diagnostic method corresponding to the diagnostic node; based on the target diagnostic method corresponding to the diagnostic node, register the diagnostic node to the diagnostic node linked list corresponding to the target diagnostic method.
[0036] The diagnostic information of the target device may be pre-configured and stored in a preset memory or register. The processor 21 can read the diagnostic information of the target device from the memory or register. The diagnostic information includes, but is not limited to, register labels, threshold values for the diagnostic faults corresponding to the diagnostic objects, and threshold values for the faults that have been recovered for the corresponding diagnostic objects. The diagnostic objects include, but are not limited to, temperature, humidity, voltage, current, and data streams corresponding to the target device. The diagnostic objects for different target devices may be the same or different. Optionally, the diagnostic information includes an object identifier corresponding to at least one diagnostic object of the target device and corresponding diagnostic reference information.
[0037] Register labels can be used to identify the registers corresponding to the diagnostic object. The processor 21 can obtain the register labels from the diagnostic nodes, read the current state of the diagnostic object from the register corresponding to the register label, and then determine whether the diagnostic object is abnormal or faulty based on the current state and the diagnostic reference information corresponding to the diagnostic object. The threshold for the diagnostic fault corresponding to the diagnostic object represents the threshold for judging whether the diagnostic object is faulty. For example, the temperature threshold and voltage threshold mentioned above. The threshold for the fault recovery corresponding to the diagnostic object represents the threshold for judging whether the diagnostic object has recovered from the fault state to the normal state.
[0038] The preset data structure is used to generate diagnostic nodes by generating the object identifier of the diagnostic object and its corresponding diagnostic reference information according to a preset data format. Optionally, the preset data structure may include multiple preset information fields, each used to record information about preset attributes. For example, the preset data structure may include fields for diagnostic object identifier information, diagnostic reference information, and / or other related information fields. The diagnostic object identifier field records the identifier of the diagnostic object, and the diagnostic reference information field records the diagnostic reference information corresponding to the diagnostic node. Optionally, the diagnostic reference information may include multiple types of sub-information, and the corresponding diagnostic reference information fields may include multiple sub-information fields, each used to record multiple types of sub-information. For example, multiple sub-information fields may include, but are not limited to, fields for the type of the target device to which the diagnostic object belongs (dev_type), fields for the type of the diagnostic object (sub_type), fields for the threshold of the diagnostic fault corresponding to the diagnostic object, and fields for the threshold of fault recovery corresponding to the diagnostic object. The specific content of the diagnostic reference information is set according to the specific diagnostic object. Optionally, based on the diagnostic information of the target device, the initial diagnostic node can be populated with information according to the preset data structure to generate the diagnostic node corresponding to the target device.
[0039] Optionally, the processor 21 generates a registration request for a diagnostic node by executing a driver. The registration request for the diagnostic node is used to request the diagnostic management program (or diagnostic management component) to register the diagnostic node. The diagnostic management program determines the target diagnostic method corresponding to the diagnostic node based on the registration request for the diagnostic node. Optionally, the registration request for the diagnostic node may carry the target diagnostic method corresponding to the diagnostic node, and the processor 21 can parse the target diagnostic method corresponding to the diagnostic node from the registration request for the diagnostic node.
[0040] A diagnostic node linked list is a linked list formed by recording diagnostic nodes in a linked list manner and stored in a pre-defined memory. Any diagnostic node in the linked list can point to the next diagnostic node through a pointer (or reference), allowing the diagnostic nodes to be traversed one by one in the linked list without needing to be stored contiguously in the pre-defined memory space. For example, for any diagnostic node A, the storage address of the next diagnostic node B can be recorded in the pointer field of diagnostic node A. Then, after traversing diagnostic node A, diagnostic node B can be traversed according to the storage address of diagnostic node B recorded in the pointer field of diagnostic node A; then diagnostic node C can be traversed according to the storage address of diagnostic node C recorded in the pointer field of diagnostic node B, and so on, thus achieving traversal of all diagnostic nodes in the linked list. Optionally, the pointing relationship between the pointers of each diagnostic node can be set according to the diagnostic requirements of the diagnostic object corresponding to each diagnostic node.
[0041] Optionally, each diagnostic method corresponds to a diagnostic node linked list, thereby managing the diagnostic nodes corresponding to different diagnostic methods through different diagnostic node linked lists.
[0042] Optionally, the processor 21 can generate a diagnostic node registration request by executing a diagnostic subroutine in the driver. That is, the diagnostic subroutine obtains diagnostic information of the target device, generates a diagnostic node corresponding to the target device based on the diagnostic information and according to a preset data structure, and then generates a diagnostic node registration request based on the diagnostic node. The processor 21 executes a diagnostic management program, responds to the diagnostic node registration request from the diagnostic subroutine, determines the target diagnostic method corresponding to the diagnostic node based on the registration request, and then registers the diagnostic node to the diagnostic node linked list corresponding to the target diagnostic method based on the target diagnostic method.
[0043] In the embodiments of this disclosure, diagnostic information of the target device is obtained, a diagnostic node corresponding to the target device is generated according to a preset data structure, and a registration request for the diagnostic node is generated. Based on the registration request, the diagnostic node is registered to the diagnostic node linked list corresponding to the target diagnostic method, thus realizing the effective registration of the diagnostic node and providing effective reference information for fault diagnosis of the target device using multiple diagnostic methods. Furthermore, by establishing the association relationship between diagnostic nodes belonging to the same diagnostic method through the diagnostic node linked list, the diagnostic nodes of the same diagnostic method are grouped in the same linked list, which facilitates the management of diagnostic nodes and allows for effective fault diagnosis of the target device according to the pointing relationship between the diagnostic nodes in the linked list.
[0044] In some alternative embodiments, processor 21 is specifically configured as follows: Based on the linked lists of diagnostic nodes corresponding to various diagnostic methods, the diagnostic nodes corresponding to each diagnostic method are determined.
[0045] For any given diagnostic method, this method is designated as the first diagnostic method. The diagnostic nodes in the linked list corresponding to the first diagnostic method can be identified as the diagnostic nodes corresponding to that method. Optionally, the first diagnostic sub-result of the target device can be determined by traversing the linked list according to the pointing relationships between the diagnostic nodes and using the diagnostic reference information within the diagnostic nodes, employing the first diagnostic method.
[0046] In the embodiments of this disclosure, when diagnostic nodes are registered based on a diagnostic node linked list, during fault diagnosis, the diagnostic nodes corresponding to each diagnostic method can be quickly determined based on the diagnostic node linked lists corresponding to different diagnostic methods. This provides effective reference information for implementing fault diagnosis for each diagnostic method. Furthermore, different diagnostic methods have their own corresponding diagnostic node linked lists, allowing the diagnostic node linked lists corresponding to different diagnostic methods to be independent of each other. This facilitates parallel processing of fault diagnosis for different diagnostic methods. For example, multiple processes or threads can execute fault diagnosis for each diagnostic method in parallel based on the diagnostic node linked lists corresponding to each diagnostic method, which helps improve the efficiency of fault diagnosis.
[0047] In some optional embodiments, after generating the diagnostic node corresponding to the target device, the processor 21 is further configured to: Write the diagnostic nodes into the diagnostic node set.
[0048] Based on the diagnostic nodes, a registration request for the diagnostic node is generated, which specifically includes: traversing each diagnostic node in the diagnostic node set, and for the current diagnostic node that is traversed, generating a registration request for the diagnostic node corresponding to the current diagnostic node.
[0049] The diagnostic node set includes at least one diagnostic node corresponding to the target device generated by the driver. That is, each time the driver generates a diagnostic node, it writes the generated diagnostic node into the diagnostic node set (or diagnostic node pool), which can be stored in a preset memory or cache. In one optional implementation, after all diagnostic nodes corresponding to the target device have been generated, each diagnostic node in the diagnostic node set is traversed, and for the currently traversed diagnostic node, a registration request for the corresponding diagnostic node is generated. In yet another optional implementation, the steps of writing diagnostic nodes into the diagnostic node set and traversing each diagnostic node in the diagnostic node set to generate a registration request for the diagnostic node can be performed in parallel.
[0050] In the embodiments of this disclosure, the generated diagnostic nodes are cached by writing them into a cached set of diagnostic nodes. This allows the generated diagnostic nodes to be retrieved from the cached set of diagnostic nodes when registering a diagnostic node, thus preventing the loss of generated diagnostic nodes and ensuring the security and effectiveness of the diagnostic nodes.
[0051] In some optional embodiments, based on any of the above embodiments, the target device includes at least one external device corresponding to a preset subsystem; before determining the diagnostic nodes corresponding to the various diagnostic methods pre-registered by the driver corresponding to the target device, the processor 21 is further configured to: In response to a request from the application to start the preset subsystem, start the preset subsystem; initialize each external device corresponding to the preset subsystem; and create diagnostic detection threads corresponding to the various diagnostic methods for each external device.
[0052] The processor 21 is specifically configured as follows: For the first diagnostic method among multiple diagnostic methods, the diagnostic node corresponding to the first diagnostic method is determined through the diagnostic detection thread corresponding to the first diagnostic method, and based on the diagnostic reference information in the diagnostic node corresponding to the first diagnostic method, the first diagnostic method is used to determine the first diagnostic sub-result of the target device. The target device can be any external device among the external devices corresponding to the preset subsystem.
[0053] The preset subsystem can be any subsystem within the vehicle system, including, but not limited to, one or more subsystems such as camera subsystem, radar subsystem, autonomous driving subsystem, infotainment subsystem, and vehicle control subsystem. The application program is, for example, but not limited to, a bootloader. The processor 21 executes this application, loads the image data of the preset subsystem, and initiates a request to start the preset subsystem based on the image data. For example, based on the image data, the executable code and related data information of the preset subsystem are stored in memory, an executable environment is constructed, and the execution jumps to the entry function of the executable code of the preset subsystem to begin executing the executable code. This initializes the external devices corresponding to the preset subsystem and creates diagnostic detection threads corresponding to various diagnostic methods for the external devices. It should be noted that different subsystems have their own corresponding external devices. When a preset subsystem starts up, each external device corresponding to that subsystem needs to be initialized so that the preset subsystem can access or manage its corresponding external devices. Initialization of external devices includes, but is not limited to, configuring the external device's registers, enabling the external device's hardware diagnostic functions, and opening the external device's hardware link transmission channel. This ensures that the external device can successfully connect to the preset subsystem and establish a stable and reliable data transmission link. Taking the camera subsystem as an example, initialization establishes the image acquisition link to ensure the coordinated operation of the image sensor, serializer / deserializer, and transmission medium, laying a reliable hardware foundation for the normal transmission and processing of subsequent image data streams.
[0054] A diagnostic detection thread is a thread used for fault diagnosis using certain diagnostic methods. After the processor 21 has initialized the external device, it can create diagnostic detection threads corresponding to each diagnostic method. Each diagnostic method can correspond to one or more diagnostic detection threads. These threads can execute diagnostic detection functions in parallel. Specifically, for any first diagnostic method among multiple diagnostic methods, the diagnostic detection thread corresponding to the first diagnostic method determines the diagnostic node corresponding to that method, and based on the diagnostic reference information in the diagnostic node, the first diagnostic method is used to determine the first diagnostic sub-result of the target device. The first diagnostic sub-result may include whether the diagnostic object corresponding to the diagnostic node of the target device has failed.
[0055] In this embodiment, during the startup process of the preset subsystem, the external devices corresponding to the preset subsystem are initialized to create a data transmission link between the external devices and the preset subsystem, laying the hardware foundation for fault diagnosis of the external devices. Furthermore, by creating diagnostic detection threads corresponding to various diagnostic methods, during fault diagnosis, fault diagnosis is performed based on the diagnostic reference information in the diagnostic nodes corresponding to each diagnostic method, using the diagnostic detection threads corresponding to each diagnostic method. This allows fault diagnosis of different diagnostic methods to be executed in parallel, thereby effectively improving fault diagnosis efficiency.
[0056] In some optional embodiments, the first diagnostic sub-result includes the diagnostic sub-result of at least one diagnostic object of the target device; the diagnostic sub-result of the diagnostic object includes one of the following: the diagnostic object remains normal, changes from normal to fault, changes from fault to normal, or remains faulty.
[0057] Processor 21 is also configured as follows: A diagnostic report thread is created; the diagnostic node corresponding to the first diagnostic sub-result that meets the preset reporting conditions is written into the diagnostic report linked list through the diagnostic detection thread; the preset reporting conditions include that the first diagnostic sub-result includes at least one diagnostic object that changes from normal to fault or from fault to normal; the diagnostic report thread generates a diagnostic report based on the diagnostic report linked list and reports the diagnostic report to the fault collection module, which is, for example, but not limited to, the fault collection circuit in the microcontroller unit (MCU).
[0058] The diagnostic sub-results of a diagnostic object are the results of whether the object has malfunctioned (or is abnormal). For example, whether a sensor's temperature or voltage is abnormal. "Maintaining a normal state" means the object's state was normal at a historical time and remains normal at the current time. "Changing from normal to faulty" means the object's state was normal at a historical time and becomes faulty at the current time. "Changing from faulty to normal" means the object's state was faulty at a historical time and becomes normal at the current time. "Maintaining a faulty state" means the object's state was faulty at a historical time and remains faulty at the current time. "Historical time" can be the time before the current time, or it can include multiple times before the current time.
[0059] The diagnostic report thread is used to generate diagnostic reports. Optionally, the processor 21 can create the diagnostic report thread during or after the startup of the preset subsystem. For example, after initializing the various external devices corresponding to the preset subsystem, diagnostic detection threads corresponding to different diagnostic methods can be created, and then a diagnostic report thread can be created.
[0060] The preset report conditions are used to determine whether a diagnostic report needs to be generated for the first diagnostic sub-result of the target device. These conditions can include a change in the state of the diagnostic object, meaning that at least one diagnostic object in the first diagnostic sub-result changes from normal to faulty, or from faulty to normal. After obtaining the first diagnostic sub-result of the target device, the diagnostic detection thread can write the diagnostic nodes corresponding to the first diagnostic sub-results that meet the preset report conditions into the diagnostic report linked list. The diagnostic report linked list manages the diagnostic nodes that need to generate diagnostic reports, establishing a pointing relationship between these nodes and providing a valid reference for the diagnostic report thread to generate the reports. The diagnostic report thread can traverse the diagnostic report linked list, generate diagnostic reports, and report them to the fault collection module. Taking a microcontroller as an example, the fault collection module can record, output, or perform other processing on the diagnostic reports. The specific processing method of the microcontroller for the diagnostic reports can be set according to actual needs, such as setting the microcontroller's processing method based on functional safety requirements.
[0061] Optionally, the diagnostic report thread can populate information into a preset diagnostic report template based on the diagnostic report linked list to generate a diagnostic report.
[0062] Optionally, the diagnostic node may also include a diagnostic result field, which records the diagnostic sub-results of the target device's diagnostic object. After obtaining the first diagnostic sub-result of the target device, the diagnostic detection thread updates the diagnostic result field in the diagnostic node based on the first diagnostic sub-result, and writes the updated diagnostic node corresponding to the first diagnostic sub-result that meets the preset reporting conditions into the diagnostic report linked list. The diagnostic report thread can generate a diagnostic report based on the content of the diagnostic result field in the diagnostic report linked list.
[0063] In the embodiments of this disclosure, by creating a diagnostic report thread, after the diagnostic detection thread obtains the first diagnostic sub-result of the target device, the diagnostic nodes corresponding to the first diagnostic sub-result that meet the preset reporting conditions can be written into the diagnostic report linked list. The diagnostic report thread can then retrieve the diagnostic nodes that need to generate diagnostic reports from the diagnostic report linked list, generate diagnostic reports based on the information recorded in the diagnostic nodes, and report the diagnostic reports to the fault collection module. This enables the preset subsystem to promptly detect the faults of the target device and facilitate timely fault resolution. Furthermore, the diagnostic report thread and the diagnostic detection thread are independent of each other, achieving decoupling between diagnostic detection and diagnostic report generation. This allows for flexible adaptation to different task requirements (e.g., development tasks, testing tasks). For example, for tasks that do not require the generation of diagnostic reports, the generation of diagnostic reports can be avoided by disabling the function of creating the diagnostic report thread or by directly removing the function of creating the diagnostic report thread.
[0064] In some optional embodiments, based on any of the above embodiments, the number of diagnostic nodes corresponding to the first diagnostic method is multiple, and each diagnostic node includes diagnostic reference information of at least one diagnostic object of the target device; the processor 21 is specifically configured as follows: For the first diagnostic method, each diagnostic node corresponding to the first diagnostic method is traversed. For the currently traversed diagnostic node, the current status information of each diagnostic object corresponding to the currently traversed diagnostic node is obtained using the first diagnostic method. Based on the diagnostic reference information and the current status information of each diagnostic object in the currently traversed diagnostic node, the diagnostic sub-results corresponding to each diagnostic object are determined. Based on the diagnostic sub-results corresponding to each diagnostic object, the first diagnostic sub-result of the target device is determined.
[0065] The current state information of the diagnostic object represents its performance status at the current moment. In one example, taking the temperature of a sensor as the diagnostic object, the current state information of the diagnostic object could include the current temperature value of the sensor. In another example, taking the voltage of a hardware component as the diagnostic object, the current state information of the diagnostic object could include the current voltage value of the hardware component.
[0066] Optionally, the current state information of the diagnostic object can be matched or compared with the diagnostic reference information of the diagnostic object in the diagnostic node to determine whether the current state of the diagnostic object is faulty or abnormal. Taking the temperature of a sensor as an example, the current temperature value of the diagnostic object can be compared with the first temperature threshold used to determine faults in the diagnostic reference information. If the current temperature value is higher than the first temperature threshold, it is determined that the current temperature value of the diagnostic object is abnormal, and the current diagnostic result of the diagnostic object can be determined as a fault. The current diagnostic result of the diagnostic object represents the instantaneous diagnostic result of the diagnostic object at the current moment, which can also be called the instantaneous state of the diagnostic object.
[0067] Optionally, diagnostic sub-results for a diagnostic object can be determined based on its current instantaneous diagnostic results and historical instantaneous diagnostic results. Historical instantaneous diagnostic results are the instantaneous diagnostic results at a historical moment. Instantaneous diagnostic results include whether the diagnostic object is in a faulty or normal state at a given moment. Diagnostic sub-results for a diagnostic object can represent the diagnostic results of the object's state changes over multiple consecutive moments. A diagnostic sub-result for a diagnostic object can include one of the following: the object remains normal, changes from fault to normal, changes from normal to fault, or remains faulty. After obtaining the diagnostic sub-results for each diagnostic object, a first diagnostic sub-result for the target device can be obtained based on these diagnostic sub-results.
[0068] Optionally, if diagnostic nodes are pre-registered to the diagnostic node linked list of the corresponding diagnostic method, for the first diagnostic method, based on the pointing relationships between the diagnostic nodes in the linked list corresponding to the first diagnostic method, each diagnostic node in the linked list can be traversed. For the currently traversed diagnostic node, the current status information of each diagnostic object corresponding to the currently traversed diagnostic node is obtained using the first diagnostic method. Optionally, starting from the initial diagnostic node in the linked list, the initial diagnostic node is taken as the currently traversed diagnostic node. After completing the fault diagnosis of the initial diagnostic node, the next diagnostic node is determined based on the diagnostic node identifier or storage address of the next diagnostic node pointed to by the pointer in the initial diagnostic node. This process continues until the last diagnostic node in the linked list is traversed, obtaining the diagnostic sub-results corresponding to each diagnostic object. Then, based on the diagnostic sub-results corresponding to each diagnostic object, the first diagnostic sub-result of the target device is determined.
[0069] In the embodiments of this disclosure, during the fault diagnosis process, for any first diagnostic method, when there are multiple diagnostic nodes corresponding to the first diagnostic method, it is possible to traverse each diagnostic node corresponding to the first diagnostic method. Each diagnostic node corresponds to one or more diagnostic objects. By traversing the diagnostic nodes, the diagnostic objects are traversed, and the diagnostic sub-results corresponding to each diagnostic object are obtained, ensuring full coverage of the diagnostic objects for fault diagnosis.
[0070] In some optional embodiments, after determining the diagnostic sub-results corresponding to each diagnostic object based on the diagnostic reference information and current status information of each diagnostic object in the currently traversed diagnostic node, the processor 21 is further configured to: In response to the diagnostic node currently traversed, which includes a first diagnostic sub-node identifier, the first diagnostic sub-node corresponding to the first diagnostic sub-node identifier is determined based on the first diagnostic sub-node identifier; the diagnostic method corresponding to the first diagnostic sub-node is used to determine the second diagnostic sub-result of the target device; and the first fault diagnosis result of the target device is determined based on the first diagnostic sub-result and the second diagnostic sub-result.
[0071] Here, the first diagnostic child node identifier is the identifier of the child node corresponding to the diagnostic node. The child nodes corresponding to the diagnostic node are other diagnostic nodes corresponding to other diagnostic objects associated with the diagnostic object corresponding to this diagnostic node. Optionally, the diagnostic node may include a field for child node information, which can be represented as `diag_list`, for example, to record the child nodes corresponding to the diagnostic node. The number of child nodes corresponding to a diagnostic node can be one or more. Optionally, the child nodes corresponding to the diagnostic object can be managed in the form of a linked list, which can be called a sub-linked list.
[0072] Optionally, the diagnostic method of the child node corresponding to a diagnostic node can be different from or the same as the diagnostic method of the diagnostic node itself. For example, the diagnostic method of diagnostic node A is GPIO interrupt, and the diagnostic method of diagnostic node B is register polling. During fault diagnosis, after determining the GPIO change corresponding to diagnostic node A, the registers corresponding to diagnostic node B are polled to determine whether the diagnostic object corresponding to diagnostic node B is faulty. In this case, the fault diagnosis of the diagnostic object corresponding to diagnostic node B depends on the diagnostic result of the diagnostic object corresponding to diagnostic node A. Therefore, diagnostic node B is treated as a child node corresponding to diagnostic node A. When registering the diagnostic node, the node identifier of diagnostic node B can be pre-written as the first diagnostic child node identifier into the field of the child node information of diagnostic node A. During fault diagnosis, after completing the fault diagnosis of diagnostic node A, the first diagnostic child node identifier can be determined based on the child node information field of diagnostic node A, and then the first diagnostic child node can be determined based on the first diagnostic child node identifier. For example, the first diagnostic child node can be determined from the sub-linked list where the first diagnostic child node is located. Based on the first diagnostic sub-node, the diagnostic method corresponding to the first diagnostic sub-node is used to determine the diagnostic sub-result of the diagnostic object corresponding to the first diagnostic sub-node. Based on the diagnostic sub-result of the diagnostic object corresponding to the first diagnostic sub-node, the second diagnostic sub-result of the target device is determined. Combining the first and second diagnostic sub-results of the target device, the first fault diagnosis result of the target device is obtained.
[0073] Optionally, if the currently traversed diagnostic node does not contain a diagnostic child node identifier, then the next diagnostic node is traversed. For example, if the child node information field in the currently traversed diagnostic node is empty or has a preset value, it means that the currently traversed diagnostic node does not have a corresponding child node, and then the next diagnostic node can be traversed.
[0074] In the embodiments of this disclosure, by supporting the inclusion of diagnostic child node identifiers in diagnostic nodes, fault diagnosis of related diagnostic objects is performed in a coordinated manner, thereby ensuring the accuracy and effectiveness of the diagnostic results of the target device.
[0075] In some alternative embodiments, based on any of the above embodiments, the processor 21 is specifically configured as follows: If the first diagnostic method is determined to be the register polling diagnostic method, for the currently traversed diagnostic node, in response to the fact that the currently traversed diagnostic node does not contain pre-registered diagnostic callback function information, the current status information of each diagnostic object in the currently traversed diagnostic node is obtained from the preset register corresponding to the currently traversed diagnostic node; or, in response to the fact that the currently traversed diagnostic node contains pre-registered diagnostic callback function information, the diagnostic callback function corresponding to the diagnostic callback function information is called based on the diagnostic callback function information to obtain the current status information of each diagnostic object in the currently traversed diagnostic node.
[0076] The diagnostic callback function is a function that can perform diagnostic functions. The diagnostic callback function information can be its identifier, such as, but not limited to, its function name. The diagnostic callback function can be implemented in the driver program. When registering a diagnostic node, the driver program can write the function name into the diagnostic node and register the diagnostic node with the diagnostic management program or the diagnostic node linked list. Thus, during fault diagnosis, the processor 21 can call the diagnostic callback function in the driver program based on the diagnostic callback function information to obtain the current status information of the diagnostic object.
[0077] Optionally, the diagnostic callback function can be a customized diagnostic function implementation function based on diagnostic requirements. If the currently traversed diagnostic node includes pre-registered diagnostic callback function information, it indicates that the diagnostic node needs to obtain the current status information of the corresponding diagnostic object based on the customized diagnostic callback function. If the currently traversed diagnostic node does not include diagnostic callback function information, it indicates that the diagnostic node obtains the current status information of the corresponding diagnostic object based on general register polling. The preset register stores the real-time performance status of the diagnostic object; register values can be read from the preset register and used as the current status information of the diagnostic object.
[0078] Optionally, the processor 21 can obtain the execution result by executing the diagnostic callback function, and determine the execution result as the current status information of the diagnostic object.
[0079] In the embodiments of this disclosure, it is possible to support the pre-registration of diagnostic callback function information. During fault diagnosis, the corresponding diagnostic callback function can be called based on the diagnostic callback function information. The current status information of the diagnostic object can be obtained through the customized functions of the diagnostic callback function. Based on traditional fault diagnosis methods such as register polling and GPIO interrupt, the customization of fault diagnosis function is realized to meet the different functional safety requirements of the subsystem and further improve the coverage and scalability of external device fault detection.
[0080] In some alternative embodiments, based on any of the above embodiments, the processor 21 is specifically configured as follows: If the first diagnostic method is determined to be the general input / output interface interrupt method, the current status information of each diagnostic object corresponding to the currently traversed diagnostic node is obtained using the general input / output interface interrupt method; or, If the first diagnostic method is determined to be the general input / output interface polling method, the current status information of each diagnostic object corresponding to the currently traversed diagnostic node is obtained by using the general input / output interface polling method.
[0081] The general purpose input / output interface (GPIO) interrupt method uses GPIO interrupts to obtain the voltage level (high or low) of the GPIO pins and determine the current status information of the diagnostic object. For example, an interrupt request to processor 21 can be triggered when the GPIO pin voltage changes. Processor 21 then determines the current status information of the diagnostic object based on the interrupt request. The specific interrupt triggering method can be set according to actual needs, such as triggering the interrupt request when the voltage level changes from high to low (falling edge), or from low to high (rising edge), or both rising and falling edges can trigger the interrupt request. The GPIO polling method can periodically poll the voltage level of the GPIO pins and then use the voltage level of the GPIO pins as the current status information of the diagnostic object.
[0082] In the embodiments of this disclosure, by using diagnostic nodes corresponding to different diagnostic methods, mixed fault diagnosis such as general input / output interface interrupt method and general input / output interface polling method can be supported. Compared with the fault diagnosis methods in related technologies that only support a single method, the embodiments of this disclosure help to improve the comprehensiveness of fault diagnosis and increase the fault diagnosis coverage.
[0083] In some alternative embodiments, based on any of the above embodiments, the processor 21 is further configured to: In response to the first diagnostic sub-result including at least one target diagnostic object's diagnostic sub-result changing from normal to fault, or from fault to normal, the currently traversed diagnostic node and the target diagnostic object's diagnostic sub-result are written into the diagnostic report linked list; wherein, the diagnostic object includes the target diagnostic object; based on the diagnostic report linked list, a diagnostic report is generated according to a preset mapping rule.
[0084] In this system, if the diagnostic sub-result of a diagnostic object changes from normal to fault, or from fault to normal, it indicates a change in the state of the diagnostic object. If it changes from normal to fault, the fault problem of the target device needs to be resolved to restore normal operation in a timely manner. If it changes from fault to normal, it indicates that the fault problem of the target device has been resolved and normal operation has been restored. By combining the diagnostic sub-results of all diagnostic objects of the target device, it can be determined whether the target device can be put into normal operation. To resolve the fault problem or put the restored external device into operation, the diagnostic object can be designated as the target diagnostic object. The diagnostic node and the diagnostic sub-results of the target diagnostic object are written into the diagnostic report linked list. Then, based on the diagnostic report linked list, a diagnostic report is generated according to a preset mapping rule. The preset mapping rule represents the rule for mapping the diagnostic nodes and the diagnostic sub-results of the target diagnostic object in the diagnostic report linked list to diagnostic results that meet the specific task requirements. Since the diagnostic node identifier is defined internally by the driver based on hardware information, it is unique and fixed, which is not conducive to on-demand integration in different tasks. Therefore, mapping rules can be designed to map the diagnostic sub-results corresponding to the diagnostic nodes to the desired diagnostic result representation according to the actual task requirements. Preset mapping rules include, but are not limited to, mapping rules for diagnostic node identifiers and diagnostic object identifiers, as well as mapping rules for diagnostic sub-results. For example, based on the node identifier of a diagnostic node, according to the preset mapping rules, the diagnostic sub-result of the target diagnostic object is mapped to a module identifier (module_id) that meets the task requirements and the corresponding event information (e.g., event_id). The module identifier is used to locate the hardware that has failed (i.e., changed from normal to failed) or recovered (i.e., changed from failed to normal), and the event information is used to locate the specific event that occurred, such as identifying what kind of hardware failure occurred or identifying that the hardware failure has been recovered.
[0085] In the embodiments of this disclosure, by writing the target diagnostic object whose state has changed and its diagnostic node into the diagnostic report chain, an effective reference basis is provided for generating a diagnostic report. The diagnostic report is generated according to a preset mapping rule, and the diagnostic sub-results can be mapped into a representation that meets the task requirements, thereby meeting the fault diagnosis requirements of different tasks and improving the versatility of the fault diagnosis device of this disclosure.
[0086] In some alternative embodiments, processor 21 is also configured to: In response to the first diagnostic sub-result including at least one target diagnostic object changing from normal to fault, based on the currently traversed diagnostic node, determine the fault clearing callback function information, wherein the diagnostic object includes the target diagnostic object; call the fault clearing callback function corresponding to the fault clearing callback function information to perform the fault clearing operation; in response to the completion of the fault clearing operation, generate the diagnostic sub-result corresponding to the currently traversed diagnostic node, indicating that the target diagnostic object has recovered from fault to normal.
[0087] The fault clearing callback function information can be the identifier of the fault clearing callback function, which may include, but is not limited to, the function name. This information is pre-registered with the diagnostic node, and the fault clearing callback function is used to clear faults occurring in the diagnosed object. Optionally, the fault clearing callback function can be implemented in the driver program. When registering a diagnostic node, the driver program can write the identifier of the fault clearing callback function into the diagnostic node and register the diagnostic node in the diagnostic node linked list. In other words, the diagnostic node can include a field for recording fault clearing callback function information. The driver program can write the fault clearing callback function information into this field when generating the diagnostic node.
[0088] Optionally, if it is determined that the first diagnostic sub-result includes a change in the diagnostic sub-result of at least one target diagnostic object from normal to fault, fault clearing callback function information can be obtained from the currently traversed diagnostic nodes. Based on the fault clearing callback function information, the fault clearing callback function corresponding to the fault clearing callback function information is called to perform the fault clearing operation. Optionally, a call request can be generated based on the fault clearing callback function information. The processor 21 executes the driver program, responds to the call request, and executes the fault clearing callback function to complete the fault clearing operation. If it is determined that the fault clearing operation has been completed, the processor 21 can generate a diagnostic sub-result corresponding to the currently traversed diagnostic node, which indicates that the target diagnostic object has changed from fault to normal.
[0089] Optionally, after fault clearance, in response to detecting that the target diagnostic object has changed from faulty to normal, the processor 21 can generate a corresponding diagnostic report, or can record the instantaneous diagnostic result (i.e., instantaneous state) of the diagnostic object as normal in real time. Optionally, the processor 21 can maintain the recording of the instantaneous diagnostic results of the diagnostic object at one or more recent moments. After obtaining a new instantaneous diagnostic result, based on the new instantaneous diagnostic result and one or more previously recorded instantaneous diagnostic results, the change in the state of the diagnostic object is determined, thereby obtaining the diagnostic sub-result of the diagnostic object. The recorded instantaneous diagnostic results can also be updated based on the new instantaneous diagnostic result, for example, by discarding the oldest instantaneous diagnostic result and recording the latest instantaneous diagnostic result. Optionally, the number of recorded instantaneous diagnostic results can be constrained by a sliding window or other means.
[0090] Optionally, the instantaneous diagnostic results of each diagnostic object at one or more moments can be maintained in real time through the status register, and the instantaneous diagnostic result of any diagnostic object at any moment can be normal or faulty.
[0091] In the embodiments of this disclosure, by pre-registering fault clearing callback function information, when a fault occurs, the fault clearing callback function corresponding to the fault clearing callback function information can be called in a timely manner to clear the fault in a timely manner, thereby enabling the target device to quickly return to normal and further improving the security of the target device.
[0092] In some optional embodiments, based on any of the above embodiments, the target device is an external device in a preset subsystem; the processor 21 is further configured to: In response to the termination of a preset subsystem, the diagnostic nodes corresponding to various diagnostic methods are deregistered; the preset subsystem is controlled to exit the working state.
[0093] The process of deregistering a diagnostic node can include removing the diagnostic node or its linked list from the corresponding memory to release storage resources. Taking the camera subsystem as an example, when the camera subsystem terminates its operation, all previously registered diagnostic nodes are deregistered, releasing the storage resources occupied by these nodes. Optionally, the diagnostic node identifier may contain the hardware interface information of the corresponding target device, allowing all diagnostic nodes related to the data transmission path of the target device to be deregistered based on this information. After deregistration, the preset subsystem exits its operational state, and once the entire preset subsystem has exited its operational state, it ceases all operation.
[0094] In the embodiments of this disclosure, after a subsystem finishes working, the diagnostic nodes for various diagnostic methods corresponding to the subsystem are promptly deregistered to release storage resources in a timely manner, so that the storage resources can be used for the functions of other subsystems.
[0095] In some alternative embodiments, based on any of the above embodiments, the processor 21 is further configured to: In response to receiving a fault injection request from the application, the system determines the target diagnostic node for which the fault to be injected based on the fault injection request; determines the pre-registered injection callback function information based on the target diagnostic node; calls the injection callback function corresponding to the injection callback function information to perform a fault injection operation on the device corresponding to the target diagnostic node; obtains the second fault diagnosis result of the device corresponding to the target diagnostic node under the fault injection operation; and determines the fault injection test result based on the second fault diagnosis result.
[0096] Among them, the fault injection request is used to request the injection of faults into external devices in order to test the fault diagnosis function of external devices.
[0097] Optionally, the fault injection request may include selection information of the diagnostic node identifier of the fault to be injected, and then the target diagnostic node of the fault to be injected may be determined based on the selection information included in the fault injection request.
[0098] In some alternative embodiments, the selection information may include information indicating that all diagnostic node identifiers are selected. In this case, it means that fault injection needs to be performed on all diagnostic nodes, and all diagnostic nodes can be used as target diagnostic nodes.
[0099] In some alternative embodiments, the selection information may include information specifying a portion of the diagnostic node identifiers. This indicates that fault injection is only needed on the diagnostic node corresponding to the specified diagnostic node identifier, and the specified diagnostic node can be used as the target diagnostic node. The selection information can be determined according to actual needs.
[0100] The injection callback function information can be the function identifier of the injection callback function; for example, it can be the function name of the injection callback function. The injection callback function is used to perform fault injection operations. The injection callback function can be implemented in the driver program. The driver program can write the injection callback function information to the diagnostic node when generating the diagnostic node and register the diagnostic node in memory or the diagnostic node linked list. During fault injection, the processor 21 can obtain the injection callback function information from the target diagnostic node, call the corresponding injection callback function based on the injection callback function information, and perform fault injection operations on the external device corresponding to the target diagnostic node by executing the injection callback function. Injection callback functions in different diagnostic nodes can correspond to the same or different fault injection operations; the specific injection callback function can be set according to the actual needs of the device.
[0101] When performing a fault injection operation on the external device corresponding to the target diagnostic node, the processor 21 can execute the aforementioned fault diagnosis function, obtain the second fault diagnosis result of the external device corresponding to the target diagnostic node under the fault injection operation, and determine the fault injection test result based on the second fault diagnosis result and the expected fault diagnosis result, so as to test whether the fault diagnosis function can effectively diagnose the injected fault.
[0102] In the embodiments of this disclosure, a fault injection request can be initiated by an application. The processor 21 can call the injection callback function based on the fault injection request to perform fault injection operation on the device corresponding to the target diagnostic node, so as to realize the testing of the fault diagnosis function, discover the defects in the fault diagnosis function in a timely manner, and provide an effective reference for the optimization of the fault diagnosis function.
[0103] In some alternative embodiments, processor 21 is specifically configured as follows: In response to a fault injection request instructing all diagnostic nodes to inject faults, all diagnostic nodes in the preset set of diagnostic nodes are selected as target diagnostic nodes; or, in response to a fault injection request including diagnostic node selection conditions, target diagnostic nodes that meet the diagnostic node selection conditions are determined from the set of diagnostic nodes based on the diagnostic node selection conditions.
[0104] Specifically, the application can set the diagnostic node selection information indicated by the fault injection request, and based on the diagnostic node selection information, determine whether to inject faults into all diagnostic nodes or inject faults into a subset of diagnostic nodes that meet the diagnostic node selection conditions.
[0105] Optionally, the diagnostic node selection criteria may include, but are not limited to, one or more of the following: the selected diagnostic node identifier, field attributes in the diagnostic node, etc. For example, the diagnostic node selection criteria may include the selected target device type. Then, based on the matching of the target device type with the content of the device type information field in the diagnostic node, all diagnostic nodes whose device type is the target device type are selected as target diagnostic nodes. In practical applications, the diagnostic node selection criteria are not limited to a single criterion; multiple selection criteria can be combined. For example, the diagnostic node selection criteria may include a combination of multiple selected information fields. This disclosure does not specifically limit this.
[0106] In the embodiments of this disclosure, fault injection is supported for all diagnostic nodes and for a specified subset of diagnostic nodes, thereby meeting different fault injection testing requirements.
[0107] In some alternative embodiments, Figure 3 This is a structural block diagram of a fault diagnosis apparatus for a device provided in an exemplary embodiment of this disclosure. Figure 3As shown, the processor 21 may include a fault diagnosis module 211 and a driver module 212. The fault diagnosis module 211 may include a diagnostic management component 2111, a detection component 2112, and a reporting component 2113. The diagnostic management component 2111 can be used to execute a diagnostic management program to start or manage the detection component 2112 and the reporting component 2113. The diagnostic management component 2111 may be referred to as a diagnostic management process. The detection component 2112 may be referred to as a detection thread or a diagnostic detection thread. The reporting component 2113 may be referred to as a diagnostic reporting thread. The driver module 212 includes diagnostic components and driver components (not shown) for each external device. The diagnostic components include, for example, […]. Figure 3 The diagnostic components 2121 for external device A, 2122 for external device B, and 2123 for external device C are included. The fault diagnosis module 211 works in conjunction with the driver module 212 to implement the fault diagnosis function of this embodiment. Specifically, the diagnostic management component 2111 can respond to an instruction from the application to start a preset subsystem, start the preset subsystem, initialize each external device corresponding to the preset subsystem, and start the detection component 2112 and the reporting component 2113. The diagnostic components in the driver module 212 can be used to obtain diagnostic information of the target device; based on the diagnostic information of the target device, according to a preset data structure, generate a diagnostic node corresponding to the target device; based on the diagnostic node, generate a registration request for the diagnostic node, and transmit the registration request to the diagnostic management component 2111. The diagnostic management component 2111 can be used to determine the target diagnostic method corresponding to the diagnostic node based on the registration request, and then register the diagnostic node to the diagnostic node linked list corresponding to the target diagnostic method based on the target diagnostic method. The detection component 2112 can be used to determine the diagnostic nodes corresponding to various diagnostic methods pre-registered by the driver for the target device. For any first diagnostic method among the various diagnostic methods, based on the diagnostic reference information in the diagnostic node corresponding to the first diagnostic method, the first diagnostic method is adopted to determine the first diagnostic sub-result of the target device; based on the first diagnostic sub-result of the target device under each diagnostic method, the first fault diagnosis result of the target device is determined. The detection component 2112 can also be used to write the diagnostic nodes corresponding to the first diagnostic sub-results that meet the preset reporting conditions into the diagnostic report linked list. The reporting component 2113 can be used to generate a diagnostic report based on the diagnostic report linked list and to report the diagnostic report to the microcontroller 30. Optionally, the diagnostic component in the driver module 212 can also be used to write the diagnostic nodes into the diagnostic node set after generating the diagnostic nodes, and then traverse each diagnostic node in the diagnostic node set. For the current diagnostic node that is traversed, a registration request for the diagnostic node corresponding to the current diagnostic node is generated, and the registration request for the diagnostic node is transmitted to the diagnostic management component 2111.
[0108] Optionally, the detection component 2112 can also be used to respond to the currently traversed diagnostic node including a first diagnostic sub-node identifier, determine the first diagnostic sub-node corresponding to the first diagnostic sub-node identifier based on the first diagnostic sub-node identifier; determine the second diagnostic sub-result of the target device by adopting the diagnostic method corresponding to the first diagnostic sub-node; and determine the first fault diagnosis result of the target device based on the first diagnostic sub-result and the second diagnostic sub-result.
[0109] Optionally, the diagnostic management component 2111 further includes an injection component 21111. During fault injection, the injection component 21111 can be used to: respond to a fault injection request from an application, determine the target diagnostic node to be injected based on the fault injection request; determine pre-registered injection callback function information based on the target diagnostic node; call the injection callback function corresponding to the injection callback function information to perform a fault injection operation on the device corresponding to the target diagnostic node; obtain a second fault diagnosis result of the device corresponding to the target diagnostic node under the fault injection operation; and determine the fault injection test result based on the second fault diagnosis result. The injection component 21111 can obtain the second fault diagnosis result of the device corresponding to the target diagnostic node under the fault injection operation through the detection component 2112.
[0110] Optionally, the diagnostic component in the driver module 212 can also be used to initiate a diagnostic node deregistration request to the diagnostic management component 2111 when the preset subsystem has finished working. The diagnostic management component 2111 can respond to the deregistration request, deregister the registered diagnostic node, and release the resources occupied by the diagnostic node.
[0111] In some alternative embodiments, Figure 4 This is a schematic diagram of the data structure of a diagnostic node provided in an exemplary embodiment of this disclosure. For example... Figure 4As shown, the diagnostic node can define all the diagnostic reference information required for fault diagnosis. This diagnostic reference information includes, but is not limited to, the diagnostic node identifier (e.g., but not limited to `diag_id`), device type (e.g., but not limited to `dev_type`), transmission path number (e.g., but not limited to `port / rx.link`), diagnostic object type (e.g., but not limited to `sub_type`), diagnostic object identifier (e.g., but not limited to `sub_id`), injection callback function name (e.g., but not limited to `test_fault_inject`), fault clearing callback function name (e.g., but not limited to `fault_clear`), diagnostic callback function name (e.g., but not limited to `diag_func`), child node list (e.g., but not limited to `diag_list`), and a pointer to the next diagnostic node information (e.g., but not limited to `diag_node_info`). Optionally, for GPIO interrupt or GPIO polling methods, the diagnostic node can also include the GPIO number and fault level. For register polling methods, the diagnostic node can also include the bus number, device address, register type, register address, minimum register value, and maximum register value of the register. The current status information of the corresponding diagnostic object can be read based on the diagnostic reference information included in the diagnostic node, and it can be determined whether the diagnostic object has malfunctioned. Figure 4 This is just one example of a data structure for a diagnostic node; in practice, the data structure is not limited to this example.
[0112] The fault diagnosis device provided in this disclosure improves the scalability of external devices by abstracting their diagnostic functions into diagnostic nodes and managing these nodes uniformly. Secondly, it supports multiple hybrid diagnostic methods, including GPIO interrupt, GPIO polling, and register polling, facilitating system load optimization and improving real-time fault diagnosis. Thirdly, it decouples fault diagnosis from diagnostic reports, allowing for flexible adaptation to different task requirements. Fourthly, it provides a standardized fault injection entry point through callback functions, accelerating functional safety verification of fault diagnosis functions and further improving their effectiveness and reliability. Fifthly, the fault diagnosis device decouples the fault diagnosis program from the driver program, reducing development complexity and increasing the iteration speed of both. Finally, it facilitates dynamic management of diagnostic nodes without requiring a system restart.
[0113] The embodiments described above can be implemented individually or in any combination without conflict. The specific implementation can be set according to actual needs, and this disclosure does not limit them.
[0114] Exemplary methods Figure 5 This is a schematic flowchart of a device fault diagnosis method provided in an exemplary embodiment of this disclosure. The device fault diagnosis method provided in this embodiment can be implemented by any of the device fault diagnosis devices provided in the above embodiments of this disclosure, such as... Figure 5 The fault diagnosis method for the device shown may include the following steps: Step 510: Determine the diagnostic nodes corresponding to the various diagnostic methods pre-registered by the driver for the target device.
[0115] The diagnostic node includes diagnostic reference information for the target device.
[0116] Step 520: For any first diagnostic method among multiple diagnostic methods, based on the diagnostic reference information in the diagnostic node corresponding to the first diagnostic method, the first diagnostic method is adopted to determine the first diagnostic sub-result of the target device.
[0117] Step 530: Based on the first diagnostic sub-results of the target device under each diagnostic method, determine the first fault diagnosis result of the target device.
[0118] Figure 6 This is a flowchart illustrating a fault diagnosis method for a device provided in another exemplary embodiment of this disclosure.
[0119] In some alternative embodiments, based on any of the above embodiments, such as Figure 6 As shown, prior to step 510, the method of this embodiment may further include: Step 610: Obtain diagnostic information of the target device. The diagnostic information includes at least one diagnostic object of the target device and diagnostic reference information corresponding to the diagnostic object.
[0120] Step 620: Based on the diagnostic information of the target device, generate the corresponding diagnostic node for the target device according to the preset data structure.
[0121] Step 630: Based on the diagnostic node, generate a registration request for the diagnostic node.
[0122] Step 640: Based on the registration request of the diagnostic node, determine the target diagnostic method corresponding to the diagnostic node.
[0123] Step 650: Based on the target diagnostic method corresponding to the diagnostic node, register the diagnostic node to the diagnostic node linked list corresponding to the target diagnostic method.
[0124] In some optional embodiments, step 510, which determines the diagnostic nodes corresponding to the various diagnostic methods pre-registered by the driver for the target device, may include: Based on the linked lists of diagnostic nodes corresponding to various diagnostic methods, the diagnostic nodes corresponding to each diagnostic method are determined.
[0125] In some optional embodiments, after generating the diagnostic node corresponding to the target device, the method further includes: writing the diagnostic node into the diagnostic node set.
[0126] Step 630 generates a registration request for the diagnostic node based on the diagnostic node, including: Iterate through each diagnostic node in the diagnostic node set, and for the current diagnostic node, generate a registration request for the corresponding diagnostic node.
[0127] Figure 7 This is a flowchart illustrating a fault diagnosis method for a device provided in another exemplary embodiment of this disclosure.
[0128] In some optional embodiments, based on any of the above embodiments, the target device includes at least one external device corresponding to a preset subsystem; such as... Figure 7 As shown, before determining the diagnostic nodes corresponding to the various diagnostic methods pre-registered by the driver for the target device in step 510, the process further includes: Step 7110: In response to receiving an instruction from the application to start the default subsystem, start the default subsystem.
[0129] Step 7120: Initialize each external device corresponding to the preset subsystem.
[0130] Step 7130: Create diagnostic detection threads corresponding to various diagnostic methods.
[0131] In step 520, for any first diagnostic method among multiple diagnostic methods, based on the diagnostic reference information in the diagnostic node corresponding to the first diagnostic method, the first diagnostic method is used to determine the first diagnostic sub-result of the target device, including: For the first diagnostic method among multiple diagnostic methods, the diagnostic node corresponding to the first diagnostic method is determined through the diagnostic detection thread corresponding to the first diagnostic method, and based on the diagnostic reference information in the diagnostic node corresponding to the first diagnostic method, the first diagnostic method is adopted to determine the first diagnostic sub-result of the target device.
[0132] In some optional embodiments, the first diagnostic sub-result includes the diagnostic sub-result of at least one diagnostic object of the target device; the diagnostic sub-result of the diagnostic object includes one of the following: remaining normal, changing from normal to faulty, changing from faulty to normal, and remaining faulty.
[0133] like Figure 7 As shown, the method in this embodiment of the disclosure may further include: Step 7140: Create a diagnostic report thread.
[0134] Step 7150: Through the diagnostic detection thread, write the diagnostic node corresponding to the first diagnostic sub-result that meets the preset reporting conditions into the diagnostic report linked list.
[0135] The preset reporting conditions include the presence of at least one diagnostic object that changes from normal to faulty or from faulty to normal in the first diagnostic sub-result.
[0136] Step 7160: Generate a diagnostic report based on the diagnostic report chain through the diagnostic report thread, and report the diagnostic report to the fault collection module.
[0137] Figure 8 This is a flowchart illustrating a fault diagnosis method for a device provided in yet another exemplary embodiment of this disclosure.
[0138] In some optional embodiments, based on any of the above embodiments, the number of diagnostic nodes corresponding to the first diagnostic method is multiple, and each diagnostic node includes diagnostic reference information of at least one diagnostic object of the target device.
[0139] like Figure 8 As shown, in step 520, for any first diagnostic method among multiple diagnostic methods, based on the diagnostic reference information in the diagnostic node corresponding to the first diagnostic method, the first diagnostic method is used to determine the first diagnostic sub-result of the target device, which may include: Step 5210: For the first diagnostic method, traverse each diagnostic node corresponding to the first diagnostic method. For the currently traversed diagnostic node, use the first diagnostic method to obtain the current status information of each diagnostic object corresponding to the currently traversed diagnostic node.
[0140] Step 5220: Based on the diagnostic reference information and current status information of each diagnostic object in the currently traversed diagnostic node, determine the diagnostic sub-result corresponding to each diagnostic object.
[0141] Step 5230: Based on the diagnostic sub-results corresponding to each diagnostic object, determine the first diagnostic sub-result of the target device.
[0142] In some optional embodiments, after determining the diagnostic sub-results corresponding to each diagnostic object based on the diagnostic reference information and current state information of each diagnostic object in the currently traversed diagnostic node, the method further includes: Step 7210: In response to the current traversed diagnostic node including the first diagnostic child node identifier, determine the first diagnostic child node corresponding to the first diagnostic child node identifier based on the first diagnostic child node identifier.
[0143] Step 7220: Using the diagnostic method corresponding to the first diagnostic sub-node, determine the second diagnostic sub-result of the target device.
[0144] Step 530 specifically includes: determining the first fault diagnosis result of the target device based on the first diagnostic sub-result and the second diagnostic sub-result.
[0145] In some optional embodiments, based on any of the above embodiments, in step 5210, for the first diagnostic method, each diagnostic node corresponding to the first diagnostic method is traversed. For the currently traversed diagnostic node, the current status information of each diagnostic object corresponding to the currently traversed diagnostic node is obtained using the first diagnostic method, including: If the first diagnostic method is determined to be the register polling diagnostic method, for the currently traversed diagnostic node, in response to the fact that the currently traversed diagnostic node does not contain pre-registered diagnostic callback function information, the current status information of each diagnostic object in the currently traversed diagnostic node is obtained from the preset register corresponding to the currently traversed diagnostic node; or, in response to the fact that the currently traversed diagnostic node contains pre-registered diagnostic callback function information, the diagnostic callback function corresponding to the diagnostic callback function information is called based on the diagnostic callback function information to obtain the current status information of each diagnostic object in the currently traversed diagnostic node.
[0146] In some optional embodiments, based on any of the above embodiments, in step 5210, for the first diagnostic method, each diagnostic node corresponding to the first diagnostic method is traversed. For the currently traversed diagnostic node, the current status information of each diagnostic object corresponding to the currently traversed diagnostic node is obtained using the first diagnostic method, including: If the first diagnostic method is determined to be the general input / output interface interrupt method, the current status information of each diagnostic object corresponding to the currently traversed diagnostic node is obtained using the general input / output interface interrupt method; or, if the first diagnostic method is determined to be the general input / output interface polling method, the current status information of each diagnostic object corresponding to the currently traversed diagnostic node is obtained using the general input / output interface polling method.
[0147] In some optional embodiments, based on any of the above embodiments, the method of this disclosure further includes: In response to the first diagnostic sub-result including at least one target diagnostic object's diagnostic sub-result changing from normal to fault, or from fault to normal, the currently traversed diagnostic node and the target diagnostic object's diagnostic sub-result are written into the diagnostic report linked list; wherein, the diagnostic object includes the target diagnostic object; based on the diagnostic report linked list, a diagnostic report is generated according to a preset mapping rule.
[0148] In some optional embodiments, based on any of the above embodiments, the following is also included: In response to the first diagnostic sub-result including at least one target diagnostic object changing from normal to fault, based on the currently traversed diagnostic node, determine the fault clearing callback function information, wherein the diagnostic object includes the target diagnostic object; call the fault clearing callback function corresponding to the fault clearing callback function information to perform the fault clearing operation; in response to the completion of the fault clearing operation, generate the diagnostic sub-result corresponding to the currently traversed diagnostic node, indicating that the target diagnostic object has recovered from fault to normal.
[0149] In some optional embodiments, based on any of the above embodiments, the target device is a device in a preset subsystem; the method of this disclosure embodiment further includes: In response to the termination of a preset subsystem, the diagnostic nodes corresponding to various diagnostic methods are deregistered; the preset subsystem is controlled to exit the working state.
[0150] Figure 9 This is a flowchart illustrating a fault diagnosis method for a device provided in another exemplary embodiment of this disclosure.
[0151] In some alternative embodiments, based on any of the above embodiments, such as Figure 9 As shown, the method in this embodiment of the disclosure further includes: Step 810: In response to receiving a fault injection request from the application, determine the target diagnostic node for the fault to be injected based on the fault injection request.
[0152] Step 820: Based on the target diagnostic node, determine the pre-registered injection callback function information.
[0153] Step 830: Invoke the injection callback function corresponding to the injection callback function information to perform fault injection operation on the device corresponding to the target diagnostic node.
[0154] Step 840: Obtain the second fault diagnosis result of the device corresponding to the target diagnostic node under the fault injection operation.
[0155] Step 850: Based on the second fault diagnosis result, determine the fault injection test result.
[0156] In some optional embodiments, step 810, based on the fault injection request, determines the target diagnostic node for which the fault to be injected, including: In response to a fault injection request instructing all diagnostic nodes to inject faults, all diagnostic nodes in the preset set of diagnostic nodes are selected as target diagnostic nodes; or, in response to a fault injection request including diagnostic node selection conditions, target diagnostic nodes that meet the diagnostic node selection conditions are determined from the set of diagnostic nodes based on the diagnostic node selection conditions.
[0157] The embodiments described above can be implemented individually or in any combination without conflict. The specific implementation can be set according to actual needs, and this disclosure does not limit them.
[0158] The beneficial technical effects corresponding to the exemplary embodiments of this method can be found in the corresponding beneficial technical effects of the exemplary device section above, and will not be repeated here.
[0159] The fault diagnosis method for any device provided in this disclosure can be executed by any suitable electronic device with data processing capabilities, including but not limited to: terminal devices and servers. Alternatively, the fault diagnosis method for any device provided in this disclosure can be executed by a processor, such as by a processor executing the fault diagnosis method for any device mentioned in this disclosure by calling corresponding instructions stored in memory. Further details will not be elaborated below.
[0160] Exemplary electronic devices Figure 10 This is a structural diagram of an electronic device provided in an embodiment of the present disclosure, including at least one processor 91 and a memory 92.
[0161] The processor 91 may be a central processing unit (CPU) or other form of processing unit with data processing capabilities and / or instruction execution capabilities, and may control other components in the electronic device 90 to perform desired functions.
[0162] The memory 92 may include one or more computer program products, which may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. Volatile memory may include, for example, random access memory (RAM) and / or cache memory. Non-volatile memory may include, for example, read-only memory (ROM), hard disk, flash memory, etc. One or more computer program instructions may be stored on the computer-readable storage medium, and the processor 91 may execute one or more computer program instructions to implement the fault diagnosis method and / or other desired functions of the devices of the various embodiments of this disclosure described above.
[0163] In one example, the electronic device 90 may also include an input device 93 and an output device 94, which are interconnected via a bus system and / or other forms of connection mechanism (not shown).
[0164] The input device 93 may also include, for example, a touch screen, a microphone, various sensors, etc.
[0165] The output device 94 can output various information to the outside, including, for example, a display, a speaker, a communication network and its connected remote output devices, etc.
[0166] Of course, for the sake of simplicity, Figure 10 Only some of the components of the electronic device 90 relevant to this disclosure are shown, omitting components such as buses, input / output interfaces, etc. In addition, the electronic device 90 may include any other suitable components depending on the specific application.
[0167] Exemplary computer program products and computer-readable storage media In addition to the methods and apparatus described above, embodiments of this disclosure may also provide a computer program product, including computer program instructions that, when executed by a processor, cause the processor to perform the steps in the fault diagnosis methods of the apparatuses of various embodiments of this disclosure described in the "Exemplary Methods" section above.
[0168] Computer program products can be written in any combination of one or more programming languages to perform the operations of embodiments of this disclosure. These programming languages include object-oriented programming languages such as Java and C++, as well as conventional procedural programming languages such as C or similar languages. The program code can be executed entirely on a user's computing device, partially on a user's computing device, as a standalone software package, partially on a user's computing device and partially on a remote computing device, or entirely on a remote computing device or server.
[0169] Furthermore, embodiments of this disclosure may also be computer-readable storage media storing computer program instructions thereon, which, when executed by a processor, cause the processor to perform the steps in the fault diagnosis methods of the devices of various embodiments of this disclosure described in the "Exemplary Methods" section above.
[0170] Computer-readable storage media may take the form of any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may include, but is not limited to, systems, apparatuses, or devices that are electrical, magnetic, optical, electromagnetic, infrared, or semiconductor, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: electrical connections having one or more wires, portable disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0171] The basic principles of this disclosure have been described above with reference to specific embodiments. However, the advantages, benefits, and effects mentioned in this disclosure are merely examples and not limitations, and should not be considered as essential features of each embodiment of this disclosure. Furthermore, the specific details disclosed above are for illustrative and facilitative purposes only, and are not limitations. These details do not limit the scope of this disclosure to the necessity of employing the aforementioned specific details for implementation.
[0172] Various modifications and variations can be made to this disclosure without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this disclosure and their equivalents, this disclosure is also intended to include such modifications and variations.
Claims
1. A fault diagnosis device for equipment, comprising a processor, the processor being configured to: The diagnostic nodes corresponding to the various diagnostic methods pre-registered by the driver for the target device are determined; the diagnostic nodes include diagnostic reference information for the target device. For any first diagnostic method among the multiple diagnostic methods, based on the diagnostic reference information in the diagnostic node corresponding to the first diagnostic method, the first diagnostic method is used to determine the first diagnostic sub-result of the target device; Based on the first diagnostic sub-result of the target device under each of the diagnostic methods, the first fault diagnosis result of the target device is determined.
2. The apparatus according to claim 1, wherein, The number of diagnostic nodes corresponding to the first diagnostic method is multiple, and each diagnostic node includes diagnostic reference information for at least one diagnostic object of the target device; the processor is specifically configured as follows: For the first diagnostic method, each diagnostic node corresponding to the first diagnostic method is traversed. For the currently traversed diagnostic node, the current status information of each diagnostic object corresponding to the currently traversed diagnostic node is obtained using the first diagnostic method. Based on the diagnostic reference information and the current status information of each diagnostic object in the currently traversed diagnostic node, determine the diagnostic sub-result corresponding to each diagnostic object; Based on the diagnostic sub-results corresponding to each of the diagnostic objects, the first diagnostic sub-result of the target device is determined.
3. The apparatus according to claim 2, wherein, After determining the diagnostic sub-results corresponding to each diagnostic object based on the diagnostic reference information and the current state information of each diagnostic object in the currently traversed diagnostic node, the processor is further configured to: In response to the fact that the currently traversed diagnostic node includes a first diagnostic child node identifier, the first diagnostic child node corresponding to the first diagnostic child node identifier is determined based on the first diagnostic child node identifier; The second diagnostic sub-result of the target device is determined using the diagnostic method corresponding to the first diagnostic sub-node; Based on the first diagnostic sub-result and the second diagnostic sub-result, the first fault diagnosis result of the target device is determined.
4. The apparatus according to claim 2, wherein, The processor is specifically configured as follows: When the first diagnostic method is determined to be the register polling diagnostic method, for the currently traversed diagnostic node, in response to the fact that the currently traversed diagnostic node does not contain pre-registered diagnostic callback function information, the current status information of each diagnostic object in the currently traversed diagnostic node is obtained from the preset register corresponding to the currently traversed diagnostic node. or, In response to the fact that the currently traversed diagnostic node includes pre-registered diagnostic callback function information, the diagnostic callback function corresponding to the diagnostic callback function information is called based on the diagnostic callback function information to obtain the current status information of each diagnostic object in the currently traversed diagnostic node.
5. The apparatus according to claim 2, wherein, The processor is also configured to: In response to the first diagnostic sub-result including at least one target diagnostic object, where the diagnostic sub-result changes from normal to fault or from fault to normal, the currently traversed diagnostic node and the diagnostic sub-result of the target diagnostic object are written into the diagnostic report linked list; wherein, the diagnostic object includes the target diagnostic object; Based on the diagnostic report chain, a diagnostic report is generated according to a preset mapping rule.
6. The apparatus according to claim 2, wherein, The processor is also configured to: In response to the first diagnostic sub-result including at least one target diagnostic object, the diagnostic sub-result changes from normal to faulty, based on the currently traversed diagnostic node, fault clearing callback function information is determined, wherein the diagnostic object includes the target diagnostic object; Call the fault clearing callback function corresponding to the fault clearing callback function information to perform the fault clearing operation; In response to the completion of the fault clearing operation, a diagnostic sub-result corresponding to the currently traversed diagnostic node is generated, indicating that the target diagnostic object has recovered from the fault to normal.
7. The apparatus according to claim 2, wherein, The processor is specifically configured as follows: If the first diagnostic method is determined to be a general input / output interface interrupt method, the current status information of each diagnostic object corresponding to the currently traversed diagnostic node is obtained using the general input / output interface interrupt method. or, If the first diagnostic method is determined to be a general input / output interface polling method, the current status information of each diagnostic object corresponding to the currently traversed diagnostic node is obtained using the general input / output interface polling method.
8. The apparatus according to claim 1, wherein, The processor is also configured to: Obtain diagnostic information of the target device, wherein the diagnostic information includes at least one diagnostic object of the target device and diagnostic reference information corresponding to the diagnostic object; Based on the diagnostic information of the target device, a diagnostic node corresponding to the target device is generated according to a preset data structure; Based on the diagnostic node, a registration request for the diagnostic node is generated; Based on the registration request of the diagnostic node, determine the target diagnostic method corresponding to the diagnostic node; Based on the target diagnostic method corresponding to the diagnostic node, the diagnostic node is registered to the diagnostic node linked list corresponding to the target diagnostic method.
9. The apparatus according to claim 8, wherein, The processor is specifically configured as follows: Based on the diagnostic node linked lists corresponding to the various diagnostic methods, the diagnostic nodes corresponding to each diagnostic method are determined.
10. The apparatus according to claim 8, wherein, After generating the diagnostic node corresponding to the target device, the processor is further configured to: Write the diagnostic node into the diagnostic node set; The step of generating a registration request for the diagnostic node based on the diagnostic node includes: Iterate through each diagnostic node in the diagnostic node set, and for the current diagnostic node encountered, generate a registration request for the diagnostic node corresponding to the current diagnostic node.
11. The apparatus according to claim 1, wherein, The target device includes at least one external device corresponding to a preset subsystem; before determining the diagnostic nodes corresponding to the various diagnostic methods pre-registered by the driver for the target device, the processor is further configured to: In response to a request from the application to start the preset subsystem, the preset subsystem is started; Initialize each of the external devices corresponding to the preset subsystem; Create diagnostic detection threads corresponding to the various diagnostic methods described above; The processor is specifically configured as follows: For the first diagnostic method among the various diagnostic methods, the diagnostic node corresponding to the first diagnostic method is determined by the diagnostic detection thread corresponding to the first diagnostic method, and based on the diagnostic reference information in the diagnostic node corresponding to the first diagnostic method, the first diagnostic sub-result of the target device is determined by using the first diagnostic method.
12. The apparatus according to claim 11, wherein, The first diagnostic sub-result includes the diagnostic sub-result of at least one diagnostic object of the target device; the diagnostic sub-result of the diagnostic object includes one of the following: the state of the diagnostic object remains normal, changes from normal to fault, changes from fault to normal, or remains faulty; The processor is also configured to: Create a diagnostic report thread; The diagnostic detection thread writes the diagnostic node corresponding to the first diagnostic sub-result that meets the preset reporting conditions into the diagnostic report linked list; the preset reporting conditions include that the first diagnostic sub-result includes at least one diagnostic object that changes from normal to fault or from fault to normal. The diagnostic report thread generates a diagnostic report based on the diagnostic report chain and reports the diagnostic report to the fault collection module.
13. The apparatus according to claim 1, wherein, The target device is a device in a preset subsystem; the processor is further configured to: In response to the termination of the preset subsystem, the diagnostic nodes corresponding to the various diagnostic methods are deregistered. Control the preset subsystem to exit the working state.
14. The apparatus according to any one of claims 1-13, wherein, The processor is also configured to: In response to receiving a fault injection request from the application, the target diagnostic node for the fault to be injected is determined based on the fault injection request. Based on the target diagnostic node, determine the pre-registered injection callback function information; Invoke the injection callback function corresponding to the injection callback function information to perform fault injection operation on the device corresponding to the target diagnostic node; Obtain the second fault diagnosis result of the device corresponding to the target diagnostic node under the fault injection operation; Based on the second fault diagnosis result, the fault injection test result is determined.
15. The apparatus according to claim 14, wherein, The processor is specifically configured as follows: In response to the fault injection request instructing all diagnostic nodes to inject faults, all diagnostic nodes in the preset set of diagnostic nodes are used as the target diagnostic nodes; or, In response to the fault injection request including diagnostic node selection criteria, a target diagnostic node that meets the diagnostic node selection criteria is determined from the set of diagnostic nodes based on the diagnostic node selection criteria.
16. A method for diagnosing equipment faults, comprising: The diagnostic nodes corresponding to the various diagnostic methods pre-registered by the driver for the target device are determined; the diagnostic nodes include diagnostic reference information for the target device. For any first diagnostic method among the multiple diagnostic methods, based on the diagnostic reference information in the diagnostic node corresponding to the first diagnostic method, the first diagnostic method is used to determine the first diagnostic sub-result of the target device; Based on the first diagnostic sub-result of the target device under each of the diagnostic methods, the first fault diagnosis result of the target device is determined.
17. The method according to claim 16, wherein, The number of diagnostic nodes corresponding to the first diagnostic method is multiple, and each diagnostic node includes diagnostic reference information of at least one diagnostic object of the target device; For any first diagnostic method among the multiple diagnostic methods, based on the diagnostic reference information in the diagnostic node corresponding to the first diagnostic method, the first diagnostic method is used to determine the first diagnostic sub-result of the target device, including: For the first diagnostic method, each diagnostic node corresponding to the first diagnostic method is traversed. For the currently traversed diagnostic node, the current status information of each diagnostic object corresponding to the currently traversed diagnostic node is obtained using the first diagnostic method. Based on the diagnostic reference information and the current status information of each diagnostic object in the currently traversed diagnostic node, determine the diagnostic sub-result corresponding to each diagnostic object; Based on the diagnostic sub-results corresponding to each of the diagnostic objects, the first diagnostic sub-result of the target device is determined.
18. The method according to claim 17, wherein, After determining the first diagnostic sub-result of the target device based on the diagnostic sub-results corresponding to each of the diagnostic objects, the method further includes: In response to the fact that the currently traversed diagnostic node includes a first diagnostic child node identifier, the first diagnostic child node corresponding to the first diagnostic child node identifier is determined based on the first diagnostic child node identifier; The second diagnostic sub-result of the target device is determined using the diagnostic method corresponding to the first diagnostic sub-node; Based on the first diagnostic sub-result and the second diagnostic sub-result, the first fault diagnosis result of the target device is determined.
19. The method of claim 16, wherein, Also includes: Obtain diagnostic information of the target device, wherein the diagnostic information includes at least one diagnostic object of the target device and diagnostic reference information corresponding to the diagnostic object; Based on the diagnostic information of the target device, a diagnostic node corresponding to the target device is generated according to a preset data structure; Based on the diagnostic node, a registration request for the diagnostic node is generated; Based on the registration request of the diagnostic node, determine the target diagnostic method corresponding to the diagnostic node; Based on the target diagnostic method corresponding to the diagnostic node, the diagnostic node is registered to the diagnostic node linked list corresponding to the target diagnostic method.
20. The method according to any one of claims 16-19, wherein, Also includes: In response to receiving a fault injection request from the application, the target diagnostic node for the fault to be injected is determined based on the fault injection request. Based on the target diagnostic node, determine the pre-registered injection callback function information; Invoke the injection callback function corresponding to the injection callback function information to perform fault injection operation on the device corresponding to the target diagnostic node; Obtain the second fault diagnosis result of the device corresponding to the target diagnostic node under the fault injection operation; Based on the second fault diagnosis result, the fault injection test result is determined.
21. A computer-readable storage medium storing a computer program that is executed by a processor to perform a fault diagnosis method for the device according to any one of claims 16-20.
22. An electronic device, the electronic device comprising: processor; Memory used to store the processor's executable instructions; The processor is configured to read the executable instructions from the memory, and execute the executable instructions to implement the fault diagnosis method of the device according to any one of claims 16-20.