Communication fault processing method and system, electronic equipment and storage medium

By monitoring the CAN communication link and executing the CAN transceiver reset operation by the MCU, the problem of BDC controller communication paralysis was solved, realizing online fault detection and self-recovery, and improving the reliability and safety of vehicle communication.

CN120979917APending Publication Date: 2025-11-18CHONGQING SELIS PHOENIX INTELLIGENT INNOVATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511184964.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-22
Publication Date
2025-11-18

AI Technical Summary

Technical Problem

The existing BDC controller's CAN transceiver automatically enters sleep mode when the power supply voltage drops briefly, causing communication failure. Existing solutions rely on manual restarting or disconnecting and reconnecting wiring harnesses, which cannot achieve online automated processing, posing safety hazards and high maintenance costs.

Method used

By monitoring the CAN communication link through the MCU, detecting abnormalities and setting fault flags, reading CAN transceiver status information, and performing a reset operation to restore normal working mode, including accurate diagnosis of mode and power supply status, online fault detection and self-recovery are achieved.

Benefits of technology

It enables online detection and self-recovery of CAN communication anomalies, avoiding manual intervention, significantly shortening fault handling time, reducing maintenance costs, and improving vehicle communication reliability and security.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120979917A_ABST
    Figure CN120979917A_ABST
Patent Text Reader

Abstract

The invention provides a communication fault processing method and system, electronic equipment and a storage medium, and relates to the technical field of communication security, the method monitors a CAN communication link in real time through an MCU, determines communication abnormity and sets a fault flag when an effective communication message is not monitored continuously, and then reads the state of a CAN transceiver to determine whether the state is abnormal or not, so as to determine whether the communication is abnormal or not. And if so, resetting to recover normal communication. According to the invention, the detection of CAN communication abnormity and the online recovery of the transceiver can be completed, and the fault processing depending on the modes of manual plugging, restarting and the like is avoided, so that the fault processing time is remarkably shortened, and the maintenance cost is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of communication security, and in particular to a communication fault processing method and system, an electronic device, and a storage medium. BACKGROUND

[0002] With the continuous development of automotive electronics and intelligent technology, BDC (Body Domain Controller) undertakes more and more key functions in the vehicle control architecture, including body control such as lighting, wiper, window, and communication coordination with other control domains. Among them, the communication mechanism based on CAN (Controller Area Network) is the core means for BDC and other electronic control units of the vehicle to interact data, and its reliability is directly related to the safety and usability of the vehicle.

[0003] However, in existing mass-produced vehicles, the CAN transceiver chip used by some BDC controllers has inherent design defects: when its supply voltage short-term drops below 4.5V, it will automatically enter sleep mode at the hardware level, and lacks autonomous wake-up capability. The MCU (Micro controller Unit) inside the BDC can still operate normally at 3.3V, resulting in a state of "MCU normal operation but CAN communication paralysis" after the voltage recovers. This abnormality will directly cause lighting, wiper failure, and other serious problems such as the vehicle being unable to power on and off.

[0004] To solve this problem, the current industry mainly relies on manual restart of BDC or disconnection of the controller wire harness to restore communication, which can resolve the fault in the short term, but has obvious limitations: on the one hand, manual intervention increases the fault handling time and maintenance cost, and may even cause safety hazards during vehicle driving; on the other hand, this type of recovery method cannot achieve online automatic processing, especially under the trend of distributed electronic architecture and autonomous driving, the long-term reliability of communication links is required to be higher.

[0005] Based on the above problems, there is an urgent need for a new communication fault processing method. SUMMARY

[0006] In view of the above problems, the embodiments of the present application provide a communication fault processing method, system, electronic device and storage medium to overcome the above problems or at least partially solve the above problems.

[0007] In a first aspect, the embodiments of the present application provide a communication fault processing method, which comprises: monitoring, by the MCU, the CAN communication link between the MCU and the CAN transceiver, and outputting a monitoring result; In a case where the monitoring result indicates that no valid communication packet is monitored within a preset time length, it is determined that a communication abnormality occurs and a communication fault flag is set; In response to the setting of the communication fault flag, state information of the CAN transceiver is read; According to the read state information, it is determined whether the CAN transceiver has an abnormality; In a case where the CAN transceiver has an abnormality, a reset operation is performed on the CAN transceiver so as to make the CAN transceiver return to a normal working mode.

[0008] Optionally, the MCU is configured with a communication timeout counter, which is configured to decrease from an initial value by a preset step length. The MCU monitors the CAN communication link between the MCU and the CAN transceiver, and outputs a monitoring result, which includes: The MCU collects communication packets on the CAN communication link between the MCU and the CAN transceiver, and monitors the collected communication packets; In a case where any valid communication packet is monitored before the communication timeout counter decreases to 0 from the initial value, the count value of the communication timeout counter is restored to the initial value, and a first monitoring result is output, which indicates that the collected communication packet is a valid communication packet; In a case where no valid communication packet is monitored before the communication timeout counter decreases to 0 from the initial value, a second monitoring result is output, which indicates that no valid communication packet is collected within a preset time length.

[0009] Optionally, the reading of the state information of the CAN transceiver includes: In response to a register reading instruction issued by the MCU, a target field of a register of the CAN transceiver is read, and the target field at least includes a mode bit field; The mode bit field is read to obtain current working mode state information of the CAN transceiver; The determination of whether the CAN transceiver has an abnormality according to the read state information includes: The current working mode state information is compared with preset normal working mode state information; In a case where the current working mode state information is inconsistent with the preset normal working mode state information, and the working mode represented by the current working mode state information is any one of a sleep mode, a standby mode or a bus-off mode, it is determined that the CAN transceiver has a working mode abnormality; In a case where the current working mode state information is consistent with the preset normal working mode state information, and the working mode represented by the current working mode state information is not any one of the sleep mode, the standby mode or the bus-off mode, it is determined that the CAN transceiver has a hardware exception.

[0010] Optionally, the reading of the state information of the CAN transceiver comprises: reading a target field of a register of the CAN transceiver in response to a register reading instruction issued by the MCU, the target field further comprising a power supply state field; reading the power supply state field to obtain power supply voltage state information of the CAN transceiver; The determination of whether the CAN transceiver has an exception according to the read state information comprises: comparing the power supply voltage state information with preset power supply voltage state information; In a case where the power supply voltage value represented by the power supply voltage state information is less than a preset power supply voltage value represented by the preset power supply voltage state information, and / or the fluctuation frequency of the power supply voltage represented by the power supply voltage state information is greater than a preset fluctuation frequency represented by the preset power supply voltage state information, it is determined that the CAN transceiver has a voltage exception, and a fault flag corresponding to the voltage exception is set.

[0011] Optionally, before the reset operation on the CAN transceiver is performed by the MCU, the method further comprises: obtaining a preset reset flag variable, the reset flag variable being used to identify a reset state of the CAN transceiver in a reset operation process; determining whether the reset flag variable has been set; In a case where the reset flag variable has not been set, the reset flag variable is set to identify that the reset operation on the CAN transceiver has been triggered, and the reset operation on the CAN transceiver is performed; In a case where the reset flag variable has been set, the request for the reset operation on the CAN transceiver is ignored, and the triggered reset operation is continued to be performed.

[0012] Optionally, the reset operation on the CAN transceiver by the MCU comprises: applying a low-level control signal to the CAN transceiver by the MCU to switch the CAN transceiver from a high-level state to a low-level state; switch the low-level control signal to a high-level control signal to switch the CAN transceiver from a low-level state to a high-level state, when a duration of the continuous application of the low-level control signal meets a preset reset duration; perform a reset operation on the CAN transceiver in response to the CAN transceiver being switched from a low-level state to a high-level state.

[0013] Optionally, after performing the reset operation on the CAN transceiver by the MCU, the method further comprises: performing a reestablishment operation on the CAN communication link, the reestablishment operation comprising: reconfiguring a communication parameter of the CAN transceiver and activating a communication transceiving function of the CAN transceiver; in response to activating the communication transceiving function of the CAN transceiver, reading state information of the CAN transceiver existing an abnormality and performing a clearing process on the state information existing the abnormality.

[0014] In a second aspect, the embodiment of the present application provides a communication fault processing system, the system comprising: a monitoring module configured to monitor a CAN communication link between the MCU and the CAN transceiver and output a monitoring result; a first determining module configured to determine a communication abnormality and set a communication fault flag in a case where the monitoring result represents that no valid communication message is monitored within a preset duration; a reading module configured to read state information of the CAN transceiver in response to the setting of the communication fault flag; a second determining module configured to determine whether the CAN transceiver exists an abnormality according to the read state information; a reset module configured to perform a reset operation on the CAN transceiver to make the CAN transceiver return to a normal working mode in a case where the CAN transceiver exists the abnormality.

[0015] Optionally, the MCU is configured with a communication timeout counter, the communication timeout counter is configured to decrease from an initial value by a preset step size, and the monitoring of the CAN communication link between the MCU and the CAN transceiver and the output of the monitoring result by the MCU comprises: a collecting sub-module configured to collect communication messages of the CAN communication link between the MCU and the CAN transceiver by the MCU and monitor the collected communication messages; The first output sub-module is configured to, in response to any valid communication packet being monitored before the communication timeout counter decreases from the initial value to 0, restore the count value of the communication timeout counter to the initial value, and output a first monitoring result, wherein the first monitoring result is used to represent that the collected communication packet is a valid communication packet. The second output sub-module is configured to, in response to no valid communication packet being monitored before the communication timeout counter decreases from the initial value to 0, output a second monitoring result, wherein the second monitoring result is used to represent that no valid communication packet is collected within a preset time length.

[0016] Optionally, the reading of the state information of the CAN transceiver comprises: The first reading sub-module is configured to read a target field of a register of the CAN transceiver in response to a register reading instruction issued by the MCU, wherein the target field at least comprises a mode bit field. The second reading sub-module is configured to read the mode bit field to obtain current working mode state information of the CAN transceiver. The second determination module configured to determine whether the CAN transceiver has an abnormality according to the read state information comprises: The first comparison sub-module is configured to compare the current working mode state information with preset normal working mode state information. The first determination sub-module is configured to, in response to the current working mode state information being inconsistent with the preset normal working mode state information and the working mode represented by the current working mode state information being any one of a sleep mode, a standby mode or a bus-off mode, determine that the CAN transceiver has a working mode abnormality. The second determination sub-module is configured to, in response to the current working mode state information being consistent with the preset normal working mode state information and the working mode represented by the current working mode state information not being any one of the sleep mode, the standby mode or the bus-off mode, determine that the CAN transceiver has a hardware abnormality.

[0017] Optionally, the reading of the state information of the CAN transceiver comprises: The third reading sub-module is configured to read a target field of a register of the CAN transceiver in response to a register reading instruction issued by the MCU, wherein the target field further comprises a power supply state field. The fourth reading sub-module is configured to read the power supply state field to obtain power supply voltage state information of the CAN transceiver. The second determination module configured to determine whether the CAN transceiver has an abnormality according to the read state information comprises: a second comparison submodule, configured to compare the power supply voltage state information with preset power supply voltage state information; a third determination submodule, configured to determine that the CAN transceiver has voltage abnormality in a case where a power supply voltage value represented by the power supply voltage state information is less than a preset power supply voltage value represented by the preset power supply voltage state information, and / or a fluctuation frequency of the power supply voltage represented by the power supply voltage state information is greater than a preset fluctuation frequency represented by the preset power supply voltage state information, and set a fault flag corresponding to the voltage abnormality.

[0018] Optionally, the system further comprises: an acquisition submodule, configured to acquire a preset reset flag variable, the reset flag variable being used to identify a reset state of the CAN transceiver in a reset operation process; a judgment submodule, configured to judge whether the reset flag variable has been set; a first execution submodule, configured to set the reset flag variable in a case where the reset flag variable has not been set, so as to identify that a reset operation on the CAN transceiver has been triggered, and execute the current reset operation on the CAN transceiver; a second execution submodule, configured to ignore a request of the current reset operation on the CAN transceiver in a case where the reset flag variable has been set, and continue to execute the reset operation which has been triggered.

[0019] Optionally, the reset operation on the CAN transceiver by the MCU comprises: an application submodule, configured to continuously apply a low-level control signal to the CAN transceiver by the MCU, so as to switch the CAN transceiver from a high-level state to a low-level state; a switching submodule, configured to switch the low-level control signal to a high-level control signal in a case where a continuous application time length of the low-level control signal satisfies a preset reset time length, so as to switch the CAN transceiver from the low-level state to the high-level state; a third execution submodule, configured to execute the reset operation on the CAN transceiver in response to the CAN transceiver being switched from the low-level state to the high-level state.

[0020] Optionally, the system further comprises: a reconstruction submodule, configured to perform a reconstruction operation on the CAN communication link, the reconstruction operation comprising: a configuration and activation submodule, configured to reconfigure a communication parameter of the CAN transceiver, and activate a communication and transceiving function of the CAN transceiver; The processing submodule is configured to read the abnormal state information of the CAN transceiver and perform clearing processing on the abnormal state information in response to activating the communication transceiving function of the CAN transceiver.

[0021] In a third aspect, an electronic device is provided, which includes a processor, a memory, and a program or instructions stored in the memory and executable on the processor, and the program or instructions, when executed by the processor, implement the steps of the communication fault processing method according to the first aspect.

[0022] In a fourth aspect, a readable storage medium is provided, which stores a program or instructions, and the program or instructions, when executed by a processor, implement the steps of the communication fault processing method according to the first aspect.

[0023] Advantages of the present application: The present application provides a communication fault processing method, which includes: monitoring, by an MCU, a CAN communication link between the MCU and a CAN transceiver, and outputting a monitoring result; determining a communication abnormality and setting a communication fault flag in a case where the monitoring result represents that no valid communication message is monitored within a preset time length; reading state information of the CAN transceiver in response to setting of the communication fault flag; determining, according to the read state information, whether the CAN transceiver is abnormal; and performing a reset operation on the CAN transceiver in a case where the CAN transceiver is abnormal, so as to make the CAN transceiver return to a normal working mode. The present application monitors a CAN communication link in real time through an MCU, determines a communication abnormality and sets a fault flag in a case where no valid communication message is continuously monitored, subsequently reads CAN transceiver state to determine whether it is abnormal, and performs a reset operation to restore normal communication in a case where it is abnormal. The present application can complete detection of CAN communication abnormality and online recovery of a transceiver, avoids relying on manual plugging, restarting and other methods to process faults, and thus significantly shortens fault processing time and reduces maintenance cost. BRIEF DESCRIPTION OF DRAWINGS

[0024] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the description of the embodiments of the present application. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can also be obtained by those skilled in the art without any creative effort on the basis of these drawings.

[0025] Figure 1 is a step flow diagram of a communication fault processing method provided by an embodiment of the present application; Figure 2 is a CAN transceiver hardware reset flow diagram provided by an embodiment of the present application; Figure 3 is a flowchart of a communication fault processing method provided by an embodiment of the present application; Figure 4 is a flowchart of a communication fault detection and self-recovery method provided by an embodiment of the present application; Figure 5 is a schematic diagram of a communication fault processing system provided by an embodiment of the present application; Figure 6 is a schematic diagram of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION

[0026] Exemplary embodiments of the present application will be described in detail with reference to the drawings, wherein the exemplary embodiments of the present application are shown. It should be understood that the present application can be implemented in various forms and should not be limited by the embodiments set forth herein. Rather, these embodiments are provided so that this application will be thorough and complete, and will fully convey the scope of the application to those skilled in the art.

[0027] In a first aspect, the present application provides a communication fault processing method, as shown in Figure 1 the method comprises the following steps: Step S101, monitoring, by an MCU, a CAN communication link between the MCU and a CAN transceiver, and outputting a monitoring result.

[0028] In this step, the MCU continuously monitors the CAN communication link established between the MCU and the CAN transceiver. The monitoring method can be implemented by setting a timing task or an interrupt service program in the MCU, which is used to detect whether an effective communication message is received from the CAN transceiver within a preset sampling period. The communication state information obtained by the monitoring is outputted as the monitoring result for use in the subsequent abnormality determination step.

[0029] Step S102, determining that a communication abnormality occurs and setting a communication fault flag in a case where the monitoring result indicates that no effective communication message is monitored within a preset time length.

[0030] In this step, in a case where the monitoring result indicates that no effective communication message is monitored within a preset time length, it is determined that the current CAN communication link is in an abnormal state, and the communication fault flag indicating the communication abnormality is set to form an abnormal state identifier for use in the subsequent diagnosis and recovery process. In the present application, the preset time length can be 500 milliseconds or other time threshold set according to requirements.

[0031] Step S103, reading state information of the CAN transceiver in response to the setting of the communication fault flag.

[0032] In this step, in response to the event trigger of the communication fault flag being set, a CAN transceiver state acquisition operation is performed, that is, the state information of the CAN transceiver is read through the hardware interface (for example, an SPI bus or other communication bus) between the MCU and the CAN transceiver. In some cases, the state information of the CAN transceiver includes at least one register field for characterizing the current working mode and power supply state of the CAN transceiver, so as to be used for subsequent abnormal mode judgment.

[0033] In step S104, whether the CAN transceiver has an abnormality is determined according to the read state information.

[0034] In this step, according to the state information of the CAN transceiver read in step S103, the current working state of the CAN transceiver is analyzed and judged to determine whether it has an abnormality. In some cases, if the CAN transceiver is in an abnormal mode, including but not limited to sleep mode, standby mode, bus-off mode and the like, it can be determined that it has an abnormality.

[0035] In step S105, in the case that the CAN transceiver has an abnormality, a reset operation is performed on the CAN transceiver to make the CAN transceiver return to a normal working mode.

[0036] In this step, in the case that the CAN transceiver has an abnormality as indicated by the judgment result of step S104, a reset signal meeting the timing requirements is output to the reset control pin of the CAN transceiver through the MCU, and a hardware reset operation is performed to make the CAN transceiver exit the abnormal mode and return to the normal working mode.

[0037] The application can detect CAN communication abnormalities and set the fault flag when no valid communication message is continuously monitored by the MCU. Then, the CAN transceiver state is read to determine whether it is abnormal. If it is abnormal, a reset is performed to restore normal communication. The application can detect CAN communication abnormalities and restore the transceiver online, avoiding the need for manual plugging, restarting and other methods to handle faults, thereby significantly reducing fault handling time and maintenance costs.

[0038] In one embodiment, a communication timeout counter is configured in the MCU, which is configured to decrease from an initial value by a preset step size. The CAN communication link between the MCU and the CAN transceiver is monitored, and the monitoring result is output, including: The CAN communication link between the MCU and the CAN transceiver is monitored, and the monitoring result is output, including: At any time before the communication timeout counter decreases from the initial value to 0, if any valid communication message is monitored, the count value of the communication timeout counter is restored to the initial value, and a first monitoring result is output, which is used to represent that the collected communication message is a valid communication message; If no valid communication message is monitored before the communication timeout counter decreases from the initial value to 0, a second monitoring result is output, which is used to represent that no valid communication message is collected within a preset time length.

[0039] In this embodiment, a communication timeout counter for communication state detection is pre-configured in the MCU, which is assigned with a fixed initial value at initialization and is set to decrease in a periodic task according to a predetermined step value. For example, in a 500 ms periodic task, the counter decreases by 100 ms each time, and when it decreases to 0, it means that the maximum communication waiting time length has been exceeded.

[0040] In actual operation, the MCU collects communication messages on the CAN communication link in real time through the hardware interface with the CAN transceiver, and determines the validity of each collected communication message. In some cases, the validity determination can be based on whether the communication message conforms to the communication protocol format, whether it comes from an expected node, and whether it meets the key data requirements defined by the application layer, and the like.

[0041] When the communication timeout counter starts to decrease from the initial value, at any time before it returns to 0, as long as any communication message that meets the validity determination condition is detected, it is considered that the communication link is in a normal working state. At this time, the MCU will immediately restore the value of the communication timeout counter to the initial value, thereby starting a new monitoring period, and output a first monitoring result. The first monitoring result is used to explicitly indicate that a valid communication message is collected in the current monitoring period, indicating that the CAN bus and the CAN transceiver are currently working normally.

[0042] On the contrary, if the communication timeout counter decreases from the initial value to 0, and no valid communication message is detected during the entire decreasing process, it is determined that there is no valid data interaction on the CAN communication link within the preset time length. In some cases, if the communication timeout counter decreases from the initial value to 0 without detecting any communication message, it is also determined that no valid communication message is detected during the entire decreasing process. At this time, the MCU outputs a second monitoring result, which indicates that no valid communication message is collected within the preset time length, i.e., the current CAN communication link is in an abnormal state.

[0043] The embodiment can realize online monitoring of the CAN communication link without relying on external diagnostic equipment, complete fault detection without disassembling hardware or interrupting vehicle operation, greatly shorten the problem discovery time. At the same time, based on the design of the communication timeout counter, the instantaneous interference or occasional packet loss can be effectively filtered out, reducing the probability of misjudgment, thereby providing a reliable basis for subsequent automated fault diagnosis and self-recovery processing. This not only improves the communication reliability of the vehicle, but also enhances the stability and safety of the vehicle in distributed electronic architecture and automatic driving scenarios with high real-time requirements.

[0044] In an embodiment, the reading of the state information of the CAN transceiver comprises: In response to the register read instruction issued by the MCU, the target field of the register of the CAN transceiver is read, and the target field at least includes a mode bit field; The mode bit field is read to obtain the current working mode state information of the CAN transceiver; The determination of whether the CAN transceiver has an abnormality according to the read state information comprises: Comparing the current working mode state information with the preset normal working mode state information; In the case that the current working mode state information is inconsistent with the preset normal working mode state information, and the working mode represented by the current working mode state information is any one of the sleep mode, the standby mode or the bus off mode, it is determined that the CAN transceiver has a working mode abnormality; In the case that the current working mode state information is consistent with the preset normal working mode state information, and the working mode represented by the current working mode state information is not any one of the sleep mode, the standby mode or the bus off mode, it is determined that the CAN transceiver has a hardware abnormality.

[0045] In the embodiment, first, after detecting that the communication fault flag bit is set, the MCU sends a register read instruction to the CAN transceiver to trigger the CAN transceiver to return the target field value of its internal register. The register read operation can be realized through the SPI bus, I²C bus or other available hardware communication interface, wherein the SPI read mode can access the real-time state data stored in the register by setting the read flag bit in the first byte of the instruction. The target field at least includes a mode bit field for representing the current working mode of the CAN transceiver, which is usually located in the low bit area of the register (such as bit0-bit2), and uses specific coding to represent normal mode, sleep mode, standby mode and bus off mode and other working states.

[0046] Then, the read mode bit field is parsed to obtain the current working mode state information of the CAN transceiver. For example, when the mode bit value is "000b", it indicates the normal working mode; when the mode bit value is "001b", it indicates the sleep mode; when the mode bit value is "010b", it indicates the standby mode; and when the mode bit value is "100b", it indicates the bus-off mode.

[0047] When it is determined according to the read state information whether the CAN transceiver has an abnormality, the current working mode state information is first compared with the preset normal working mode state information. If the two are inconsistent, and the mode represented by the current working mode state information belongs to any one of the sleep mode, the standby mode or the bus-off mode, it is determined that the CAN transceiver is in an abnormal working mode state. This means that the CAN transceiver enters a low-power or isolated state in an unexpected situation, causing the normal communication to be interrupted.

[0048] On the other hand, if the current working mode state information is consistent with the preset normal working mode state information, and the mode does not belong to the sleep mode, the standby mode or the bus-off mode, it is indicated that the mode bit judgment of the transceiver is normal, but the CAN communication link is still in an abnormal state. In this case, it can be further determined that there is an abnormality at the hardware level of the transceiver, such as a physical layer interface failure, internal circuit damage or power supply abnormality.

[0049] The embodiment can quickly and accurately distinguish between the two types of fault types, working mode abnormality and hardware abnormality, by actively reading the registers of the CAN transceiver by the MCU after fault detection, and parsing and comparing the mode bit field. On the one hand, it can avoid relying solely on communication interruption to make a rough judgment, reducing false positives and false negatives. On the other hand, in the case of mode abnormality, it can quickly trigger a targeted reset recovery process, and in the case of hardware abnormality, it can provide accurate root cause information for subsequent operation and maintenance or fault reporting. The embodiment can realize online automatic state diagnosis without manual disassembly and external diagnostic equipment, significantly shortening the fault handling time, reducing maintenance costs, and reducing safety hazards during vehicle driving.

[0050] In one embodiment, the reading of the state information of the CAN transceiver includes: In response to the register reading instruction issued by the MCU, the target field of the register of the CAN transceiver is read, and the target field further includes a power supply state field; The power supply state field is read to obtain the power supply voltage state information of the CAN transceiver; The determination of whether the CAN transceiver has an abnormality according to the read state information includes: The power supply voltage state information is compared with the preset power supply voltage state information; In the case that the supply voltage value represented by the supply voltage state information is less than the preset supply voltage value represented by the preset supply voltage state information, and / or the fluctuation frequency of the supply voltage represented by the supply voltage state information is greater than the preset fluctuation frequency represented by the preset supply voltage state information, it is determined that the CAN transceiver has a voltage abnormality, and the fault flag corresponding to the voltage abnormality is set.

[0051] In the embodiment, in the case that the communication fault flag is set, the MCU actively issues a register reading instruction to access the register inside the CAN transceiver and obtain the target field data therein. The target field includes not only a mode bit field representing the current working mode of the transceiver, but also a supply state field reflecting the supply condition of the transceiver. The supply state field can be composed of a specific bit area (e.g. bit3-bit4) of the register and represent the level, range or stability state of the current supply voltage in the form of binary code or specific value mapping.

[0052] After reading the supply state field, it is parsed to obtain the real-time supply voltage state information of the CAN transceiver. For example, the code value of the supply state field can correspond to different electrical characteristics such as normal voltage range, undervoltage state, overvoltage state or voltage fluctuation state, respectively.

[0053] In the process of determining whether the CAN transceiver has an abnormality according to the read state information, the MCU compares the parsed supply voltage state information with the preset supply voltage state information. The preset supply voltage state information can be determined based on the data manual of the transceiver chip, the design parameters of the vehicle electrical system or the calibration data obtained from long-term operation, and is used to represent the normal supply range and stability index of the system.

[0054] If the comparison result shows that the current supply voltage value is lower than the preset supply voltage value, or the fluctuation frequency of the current supply voltage exceeds the preset fluctuation frequency threshold, it is determined that the CAN transceiver has a voltage abnormality. Such abnormality can be caused by poor contact in the vehicle power supply circuit, wire harness loss, instantaneous large load impact or power module failure, etc. Once the voltage abnormality is detected, the MCU immediately sets the corresponding voltage abnormality fault flag, so as to trigger the subsequent fault handling logic, such as performing hardware reset, switching to a backup power supply path or reporting the fault information to the diagnostic system of the vehicle.

[0055] The embodiment can further introduce accurate diagnosis of the supply state on the basis of conventional communication monitoring, and realize multi-dimensional determination of the working abnormality of the CAN transceiver. By collecting and parsing the supply voltage value and its fluctuation characteristics in real time, not only can the communication fault caused by undervoltage, overvoltage or voltage fluctuation be identified at the first time, but also more accurate root cause information can be provided for subsequent self-recovery processing.

[0056] In an optional embodiment, when it is detected that the communication fault flag bit is set, the MCU performs a joint diagnosis operation on the CAN transceiver to simultaneously complete the detection of the working mode state and the power supply state.

[0057] Firstly, the MCU issues a register reading instruction through a hardware communication interface (such as an SPI bus), accesses the register of the CAN transceiver, and obtains the target field therein. The target field at least includes a mode bit field for representing the current working mode and a power supply state field for representing the power supply condition. Among them, the mode bit field can be encoded by the low bit area (such as bit0-bit2) of the register, indicating normal mode, sleep mode, standby mode, or bus-off mode, etc.; the power supply state field can be located in a specific bit area (such as bit3-bit4) of the register, indicating the level or state of the current power supply voltage.

[0058] In the mode bit diagnosis process, the MCU analyzes the mode bit field to obtain the current working mode state information of the CAN transceiver, and compares it with the preset normal working mode state information. If they are inconsistent and the current mode belongs to any of the sleep mode, standby mode or bus-off mode, it is determined that the CAN transceiver has a working mode abnormality; if the current mode is consistent with the preset normal mode, but the communication is still abnormal, it can be determined as a hardware layer abnormality.

[0059] In the power supply state diagnosis process, the MCU analyzes the power supply state field to obtain the current power supply voltage state information of the CAN transceiver, and compares it with the preset power supply voltage state information. If the current power supply voltage value is lower than the preset value, or the voltage fluctuation frequency exceeds the preset fluctuation frequency, it is determined that the CAN transceiver has a voltage abnormality, and the voltage abnormality fault flag bit is set.

[0060] Through the above joint diagnosis, the determination of the working mode and the power supply state of the CAN transceiver can be completed simultaneously in one register access, so as to quickly determine the specific type and root cause information of the communication fault, thereby realizing efficient and low-delay multi-dimensional fault determination, and improving the accuracy of fault positioning and the pertinence of processing.

[0061] In an embodiment, the resetting of the CAN transceiver by the MCU includes: applying a low-level control signal to the CAN transceiver by the MCU to switch the CAN transceiver from a high-level state to a low-level state; switching the low-level control signal to a high-level control signal to switch the CAN transceiver from a low-level state to a high-level state when the duration of the application of the low-level control signal meets a preset reset duration; In response to the CAN transceiver switching from a low level state to a high level state, a reset operation is performed on the CAN transceiver.

[0062] In this embodiment, first, the MCU establishes a connection with the reset end (nRST) of the CAN transceiver through its general input / output interface (GPIO) or a dedicated reset control pin. When it is determined that a reset needs to be performed, the MCU continuously outputs a low level control signal to the reset end to switch the pin state of the CAN transceiver from the original high level to a low level state. The low level control signal forces the CAN transceiver to enter a hardware reset preparation phase, clearing the running state of internal logic circuits and registers.

[0063] During the period when the low level control signal is continuously applied, the MCU counts according to a preset reset duration parameter (for example, 50 microseconds, 100 microseconds, or a specific duration determined according to the CAN transceiver chip manual). When the continuous application time of the low level control signal reaches or exceeds the preset reset duration, the MCU switches the output state to a high level control signal, causing the reset end of the CAN transceiver to recover from a low level state to a high level state.

[0064] When the CAN transceiver detects that the level of its reset end switches from a low level state to a high level state, it automatically performs an internal reset process, including reinitializing internal registers, restoring normal working mode, reestablishing physical layer communication with the CAN controller, and other operations. Through this process, the CAN transceiver can recover from an abnormal state (such as sleep mode, standby mode, or bus off mode) to a normal working state, ensuring the reestablishment of CAN bus communication functions.

[0065] This embodiment directly controls the level change of the CAN transceiver reset pin by the MCU, achieving hardware-level reset of the CAN transceiver. The reset process is simple, timing controllable, and does not depend on external dedicated equipment.

[0066] In one embodiment, the present application also provides a CAN transceiver hardware reset flowchart as shown in Figure 2 as shown in Figure 2 . S10, the reset signal is pulled low: the MCU outputs a low level signal to the reset pin (nRST) of the CAN transceiver through control, starting the hardware reset process of the transceiver.

[0067] S11, keep low: the low level signal is kept for about 50 microseconds to ensure that the reset signal is stable and effective.

[0068] S12, CAN transceiver internal reset trigger: during the low level holding period, the CAN transceiver sequentially completes the following internal reset actions: Trigger internal reset logic: clear internal logic state and start initialization procedure; State machine reset: restore internal state machine to initial state; Configuration register reset: restore configuration registers to default values; Error counter clear: clear communication error counter.

[0069] S13, reset signal release: the MCU switches the nRST pin level from low to high, indicating the end of the reset signal, and the transceiver starts entering the power-on initialization process.

[0070] S14, power-on initialization timing: in the high state, the transceiver performs three stages of power-on initialization: Reference voltage establishment (about 1.2 ms); Oscillator stabilization (about 2.5 ms); Register group default value loading (about 0.5 ms).

[0071] S15, initialization completion waiting: the MCU waits for a total of about 10 ms to ensure that the transceiver completes all power-on initialization actions.

[0072] S16, post-reset state reading: after initialization is completed, the MCU sends a register reading instruction (such as address 0 00) to the CAN transceiver through the SPI interface to verify the current state of the CAN transceiver and confirm that it has returned to normal working mode.

[0073] In one embodiment, after performing a reset operation on the CAN transceiver by the MCU, the method further comprises: performing a reestablishment operation on the CAN communication link, the reestablishment operation comprising: reconfiguring communication parameters of the CAN transceiver and activating communication transceiving functions of the CAN transceiver; in response to activating the communication transceiving functions of the CAN transceiver, reading abnormal state information of the CAN transceiver and performing clearing processing on the abnormal state information.

[0074] In this embodiment, first, the MCU reissues a communication configuration instruction to the CAN transceiver to initialize and configure its communication parameters. These communication parameters can include but are not limited to baud rate settings of the CAN bus, sampling point positions, synchronization segment lengths, transmission and reception filter configurations, message buffer allocations, and error handling strategies, etc. By reconfiguring these parameters, it can be ensured that the CAN transceiver maintains protocol consistency and communication compatibility with the vehicle CAN network after resuming work.

[0075] After the parameter configuration is completed, the MCU will activate the CAN transceiver's communication transceiver function, switching it to a working mode capable of sending and receiving CAN communication messages normally. At this time, the CAN transceiver should restore its physical layer and data link layer connections with the CAN controller and other nodes on the bus, thus enabling it to re-participate in network communication.

[0076] After the transceiver's communication function is activated, the MCU immediately reads the CAN transceiver's registers to check for any remaining abnormal status information. This abnormal status information may include communication error flags, bus off status flags, arbitration loss flags, frame error flags, undervoltage or overvoltage flags, etc. If these abnormal status information are detected, the MCU will clear these abnormal flag bits by writing clear instructions to the corresponding registers or executing an error reset procedure, ensuring that the transceiver's registers return to normal values, thereby preventing old error states from affecting subsequent communication monitoring and fault diagnosis.

[0077] In this embodiment, by performing a systematic reconstruction of the communication link after a hardware reset, it is possible to ensure that the CAN transceiver not only resumes operation at the physical level, but also fully restores to normal operating conditions in terms of communication parameters, function activation, and state clearing. This significantly reduces the risk of secondary failures caused by parameter mismatch, residual error flags, or uncleared states after a reset, ensuring that the CAN communication link resumes stable operation in the shortest possible time.

[0078] In one embodiment, a method such as Figure 3 The flowchart for handling communication faults shown is as follows: Figure 3 As shown: First, a communication timeout counter is configured inside the MCU to monitor the activity of the CAN communication link with the CAN transceiver. This timeout counter is assigned an initial value during system initialization and decrements periodically according to a preset step size. When a valid CAN communication message is detected at any time before the timeout counter reaches zero, the MCU restores the counter value to its initial value and outputs a first monitoring result, indicating that communication is currently normal. If no valid communication message is detected even after the timeout counter decrements to zero, a second monitoring result is output, indicating that there has been no valid communication within a preset time period, thus setting a communication fault flag.

[0079] When the communication fault flag is set, the MCU enters the fault diagnosis process. First, it sends a register read command to the CAN transceiver via the SPI interface or other hardware interface to obtain the target field data in the register, including the mode bit field and the power supply status field. The mode bit field is used to characterize the current operating mode, and possible values ​​include normal mode, sleep mode, standby mode, and bus off mode; the power supply status field is used to reflect the current power supply voltage level and stability of the CAN transceiver.

[0080] The MCU compares the read mode bit information with the preset normal working mode: if the modes are inconsistent and belong to any of the sleep, standby or bus-off modes, it is determined that the working mode is abnormal; if the state information is consistent but the communication is abnormal, it is determined that the hardware is abnormal. At the same time, the MCU analyzes the power supply state information and compares it with the preset power supply voltage state: if the current power supply voltage is lower than the preset value or the voltage fluctuation frequency exceeds the preset threshold, it is determined that the voltage is abnormal and the voltage abnormality flag bit is set.

[0081] When it is determined that the transceiver has a working mode abnormality or a voltage abnormality, the MCU outputs a low-level signal through the GPIO pin connected to the CAN transceiver reset end (nRST), so that the CAN transceiver is switched from a high-level state to a low-level state and remains for a preset reset duration. When the preset reset duration is reached, the MCU switches the output back to a high-level state, triggering the CAN transceiver to perform a hardware reset process, clearing the internal logic state and restoring to a normal mode.

[0082] After the hardware reset is completed, the MCU performs a communication link reconstruction operation: including reconfiguring the CAN transceiver communication parameters (such as baud rate, sampling point, filter, etc.), activating the CAN transceiver communication function, and reading the state register after the function is activated to check whether there is an abnormal flag bit; if there is, it performs a clearing operation to restore the register to a normal state, ensuring stable communication of the CAN bus.

[0083] In one embodiment, before the reset operation on the CAN transceiver is performed by the MCU, the method further comprises: obtaining a preset reset flag variable, the reset flag variable being used to identify the reset state of the CAN transceiver in the reset operation process; determining whether the reset flag variable has been set; in the case where the reset flag variable has not been set, setting the reset flag variable to identify that the reset operation on the CAN transceiver has been triggered, and performing the current reset operation on the CAN transceiver; in the case where the reset flag variable has been set, ignoring the request for the current reset operation on the CAN transceiver, and continuing to perform the triggered reset operation.

[0084] In this embodiment, the MCU obtains a pre-set reset flag variable, which is used to identify the execution state of the current CAN transceiver in the reset operation process. The reset flag variable can be stored in the global variable area or a specific control register of the MCU, and is cleared at initialization, indicating that it is not currently in the reset process.

[0085] Subsequently, the MCU judges the current value of the reset flag variable to determine whether a reset operation is in progress. If it is detected that the variable has not been set, it means that no reset task is currently being executed, and the MCU sets the reset flag variable to identify that a reset operation is about to be performed on the CAN transceiver, and immediately enters the reset flow. This setting operation can prevent the reset from being repeatedly triggered by other interrupt tasks or periodic tasks during the reset process, thereby avoiding reset signal conflicts or timing confusion.

[0086] On the contrary, if it is detected that the reset flag variable has been set, it means that a reset flow is in execution. At this time, the MCU ignores the current reset request and does not start a new reset flow, but continues to execute the previously triggered reset operation until it is completed. This can effectively prevent multiple reset operations from overlapping and avoid unnecessary repeated resets or state abnormalities of the CAN transceiver.

[0087] In one embodiment, the application also provides a communication fault detection and self-recovery flow diagram as shown in FIG. 1, which is shown in FIG. 2 as follows: Figure 4 Figure 4 First, the CAN communication link is monitored. When it is detected that no valid communication message has been received for 500 consecutive times, it is determined that there is a communication abnormality, and the subsequent diagnosis and recovery flow is entered. In the diagnosis phase, the MCU uses a register-based diagnosis method to read and analyze the register information of the CAN transceiver to distinguish different types of abnormalities:

[0088] If the mode bit information is inconsistent with the preset normal mode, it is determined to be a working mode abnormality; If the mode bit information is consistent with the preset but the communication is still abnormal, it is determined to be a hardware abnormality; If the mode bit information indicates that the CAN transceiver is in a normal mode and the communication is normal, it can be determined to be a physical layer fault, and the corresponding physical layer alarm flow is triggered. When the diagnosis result is a working mode abnormality or a hardware abnormality, the hardware reset flow is entered. The MCU first outputs a low-level control signal to the reset pin of the CAN transceiver and accurately maintains it for 50 microseconds, and then releases the low-level signal to switch to high level to trigger the internal reset process of the CAN transceiver.

[0089] After the reset is completed, the communication link is rebuilt, including reconfiguring the communication parameters, activating the CAN transceiver transceiver function, and performing the error flag clearing operation. When the communication link is rebuilt, the random delay avoidance principle is followed.

[0090]

[0091] ​​If the error clearing operation is successful, the communication function is restored, and the communication is normal; if the error clearing fails, the error information is reported to the upper computer or vehicle diagnostic system for further processing.

[0092] The application provides a communication fault processing method, which comprises the following steps: monitoring, by an MCU, a CAN communication link between the MCU and a CAN transceiver, and outputting a monitoring result; determining that a communication is abnormal and setting a communication fault flag bit, in a case where the monitoring result indicates that no valid communication message is monitored within a preset time length; reading state information of the CAN transceiver in response to the setting of the communication fault flag bit; determining whether the CAN transceiver is abnormal according to the read state information; and performing a reset operation on the CAN transceiver to restore the CAN transceiver to a normal working mode, in a case where the CAN transceiver is abnormal. The application can detect the CAN communication abnormality and restore the transceiver online, and can avoid relying on manual plugging, restarting and other methods to process faults, thereby significantly shortening the fault processing time and reducing the maintenance cost.

[0093] Based on the same inventive concept, a communication fault processing system is provided in the second aspect of the embodiments of the application, as shown in the accompanying drawings, which comprises: Figure 5 The system comprises: A monitoring module 201 is configured to monitor, by an MCU, a CAN communication link between the MCU and a CAN transceiver, and output a monitoring result. A first determining module 202 is configured to determine that a communication is abnormal and set a communication fault flag bit, in a case where the monitoring result indicates that no valid communication message is monitored within a preset time length. A reading module 203 is configured to read state information of the CAN transceiver in response to the setting of the communication fault flag bit. A second determining module 204 is configured to determine whether the CAN transceiver is abnormal according to the read state information. A reset module 205 is configured to perform a reset operation on the CAN transceiver to restore the CAN transceiver to a normal working mode, in a case where the CAN transceiver is abnormal.

[0094] Optionally, a communication timeout counter is configured in the MCU, the communication timeout counter is configured to decrease from an initial value by a preset step size, the monitoring, by an MCU, of a CAN communication link between the MCU and a CAN transceiver, and the output of a monitoring result, the monitoring module 201 comprises: The collection submodule is configured to collect communication messages on a CAN communication link between the MCU and the CAN transceiver, and monitor the collected communication messages; The first output submodule is configured to, in a case where any valid communication message is monitored before the communication timeout counter decreases from the initial value to 0, restore the count value of the communication timeout counter to the initial value, and output a first monitoring result, the first monitoring result being used to represent that the collected communication message is a valid communication message; The second output submodule is configured to, in a case where no valid communication message is monitored before the communication timeout counter decreases from the initial value to 0, output a second monitoring result, the second monitoring result being used to represent that no valid communication message is collected within a preset time length.

[0095] Optionally, the reading of the state information of the CAN transceiver comprises the reading module 203, which comprises: The first reading submodule is configured to read a target field of a register of the CAN transceiver in response to a register reading instruction issued by the MCU, the target field at least comprising a mode bit field; The second reading submodule is configured to read the mode bit field to obtain current working mode state information of the CAN transceiver; The determination of whether the CAN transceiver has an abnormality according to the read state information comprises the second determination module 204, which comprises: The first comparison submodule is configured to compare the current working mode state information with preset normal working mode state information; The first determination submodule is configured to, in a case where the current working mode state information is inconsistent with the preset normal working mode state information, and the working mode represented by the current working mode state information is any one of a sleep mode, a standby mode or a bus-off mode, determine that the CAN transceiver has a working mode abnormality; The second determination submodule is configured to, in a case where the current working mode state information is consistent with the preset normal working mode state information, and the working mode represented by the current working mode state information is not any one of the sleep mode, the standby mode or the bus-off mode, determine that the CAN transceiver has a hardware abnormality.

[0096] Optionally, the reading of the state information of the CAN transceiver comprises the reading module 203, which comprises: The third reading submodule is configured to read a target field of a register of the CAN transceiver in response to a register reading instruction issued by the MCU, the target field further comprising a power supply state field; a fourth reading submodule, configured to read the power supply state field to obtain power voltage state information of the CAN transceiver; the second determining module 204 is configured to determine whether the CAN transceiver has an abnormality according to the read state information, and the second determining module 204 includes: a second comparison submodule, configured to compare the power voltage state information with preset power voltage state information; a third determining submodule, configured to determine that the CAN transceiver has a voltage abnormality in a case where a power voltage value represented by the power voltage state information is less than a preset power voltage value represented by the preset power voltage state information, and / or a fluctuation frequency of the power voltage represented by the power voltage state information is greater than a preset fluctuation frequency represented by the preset power voltage state information, and set a fault flag corresponding to the voltage abnormality.

[0097] Optionally, the system further includes: an obtaining submodule, configured to obtain a preset reset flag variable, the reset flag variable being used to identify a reset state of the CAN transceiver in a reset operation process; a judging submodule, configured to judge whether the reset flag variable has been set; a first executing submodule, configured to set the reset flag variable in a case where the reset flag variable has not been set, to identify that a reset operation on the CAN transceiver has been triggered, and to execute a current reset operation on the CAN transceiver; a second executing submodule, configured to ignore a request for a current reset operation on the CAN transceiver in a case where the reset flag variable has been set, and to continue to execute a reset operation that has been triggered.

[0098] Optionally, the system further includes: an applying submodule, configured to continuously apply, by the MCU, a low-level control signal to the CAN transceiver, to switch the CAN transceiver from a high-level state to a low-level state; a switching submodule, configured to switch the low-level control signal to a high-level control signal in a case where a duration of continuous application of the low-level control signal satisfies a preset reset duration, to switch the CAN transceiver from the low-level state to the high-level state; a third executing submodule, configured to execute a reset operation on the CAN transceiver in response to the CAN transceiver being switched from the low-level state to the high-level state.

[0099] Optionally, the system further includes: The reconstruction submodule is configured to perform a reconstruction operation on the CAN communication link, and the reconstruction operation comprises: The configuration and activation submodule is configured to reconfigure communication parameters of the CAN transceiver and activate a communication transceiving function of the CAN transceiver. The processing submodule is configured to read abnormal state information of the CAN transceiver in response to activation of the communication transceiving function of the CAN transceiver, and perform a clearing process on the abnormal state information.

[0100] Based on the same inventive concept, a third aspect of the embodiments of the present application provides an electronic device 100 as shown in the accompanying drawings, which comprises a processor 120, a memory 110, and a program or instruction stored in the memory 110 and executable on the processor 120, and the program or instruction is executed by the processor 120 to implement the steps of the communication fault processing method according to the first aspect of the present application. Figure 6

[0101] A fourth aspect of the embodiments of the present application provides a readable storage medium, which stores a program or instruction, and the program or instruction is executed by a processor to implement the steps of the communication fault processing method according to the first aspect of the present application.

[0102] In the present specification, each embodiment focuses on the difference from other embodiments, and the same or similar parts between various embodiments can be referred to each other.

[0103] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, device, or computer program product. Therefore, the embodiments of the present application can be in the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the embodiments of the present application can be in the form of a computer program product implemented on one or more computer usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer usable program code.

[0104] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams according to the method, terminal device (system), and computer program product of the embodiments of the present application. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, and the combination of the flows and / or blocks in the flowcharts and / or block diagrams can be implemented by computer program instructions. These computer program instructions can be provided to a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to produce a machine, so that the instructions executed by the computer or other programmable data processing terminal device produce a device for implementing the functions specified in the flowcharts and / or block diagrams. Figure 1 Each flow or multiple flows and / or blocks Figure 1 ​means for performing the function specified by the block or blocks.

[0105] These computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture including instructions which implement the flow Figure 1 one or more flow diagrams and / or blocks Figure 1 means for performing the function specified by the block or blocks.

[0106] These computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the flow Figure 1 one or more flow diagrams and / or blocks Figure 1 means for performing the function specified by the block or blocks.

[0107] While preferred embodiments of the application have been described, those skilled in the art will appreciate that other modifications than those specifically described can be made within the scope of the application. Accordingly, all changes coming within the meaning and equivalency range of the application are intended to be embraced in the claim.

[0108] Finally, it should be noted that the terms "first", "second", and the like, herein do not denote any order, quantity, combination, or importance, but rather are used to nomenclature different components of the application, and do not imply singular or plural quantities or combinations thereof, and the like. Also, the term "comprises", "comprising", or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but can also include other elements not expressly listed or inherent to such process, method, article, or apparatus. An element proceeded by "comprises... a" does not, without more constraints, exclude the presence of additional identical elements in the process, method, article, or apparatus that comprises the element. The terms "an embodiment", "one embodiment", or similar phrases as used herein do not denote the same embodiment or implementations.

[0109] The above provides a communication fault processing method, system, electronic device and storage medium, and specific examples are applied herein to describe the principles and implementation manners of the application. The above embodiment descriptions are only used to help understand the method and core idea of the application; meanwhile, for those skilled in the art, the specific implementation manners and application ranges can be changed according to the idea of the application. In conclusion, the content of the specification should not be understood as a limitation of the application.

Claims

1. A communication fault handling method, characterized in that, The method includes: The MCU monitors the CAN communication link with the CAN transceiver and outputs the monitoring results. If the monitoring results indicate that no valid communication message is detected within a preset time period, a communication anomaly is determined and a communication fault flag is set. In response to the setting of the communication fault flag bit, the status information of the CAN transceiver is read; Based on the read status information, determine whether the CAN transceiver is malfunctioning; If the CAN transceiver malfunctions, a reset operation is performed on the CAN transceiver to restore it to normal operating mode.

2. The communication fault handling method according to claim 1, characterized in that, The MCU is configured with a communication timeout counter, which is set to decrement from an initial value by a preset step size. The MCU monitors the CAN communication link with the CAN transceiver and outputs the monitoring results, including: The MCU collects communication messages on the CAN communication link with the CAN transceiver and monitors the collected communication messages. If any valid communication message is detected at any time before the communication timeout counter decreases from its initial value to 0, the count value of the communication timeout counter is restored to the initial value, and a first monitoring result is output. The first monitoring result is used to characterize the collected communication message as a valid communication message. If no valid communication message is detected when the communication timeout counter decreases from the initial value to 0, a second monitoring result is output. The second monitoring result is used to indicate that no valid communication message has been collected within a preset time period.

3. The communication fault handling method according to claim 1, characterized in that, The step of reading the status information of the CAN transceiver includes: In response to a register read command issued by the MCU, the target field of the CAN transceiver's register is read, and the target field includes at least a mode bit field; Read the mode bit field to obtain the current working mode status information of the CAN transceiver; The step of determining whether the CAN transceiver is malfunctioning based on the read status information includes: Compare the current working mode status information with the preset normal working mode status information; If the current working mode status information is inconsistent with the preset normal working mode status information, and the working mode represented by the current working mode status information is any one of sleep mode, standby mode, or bus off mode, it is determined that the CAN transceiver has an abnormal working mode. If the current working mode status information is consistent with the preset normal working mode status information, and the working mode represented by the current working mode status information is not any of the sleep mode, the standby mode, or the bus shutdown mode, then it is determined that the CAN transceiver has a hardware malfunction.

4. The communication fault handling method according to claim 1, characterized in that, The step of reading the status information of the CAN transceiver includes: In response to a register read command issued by the MCU, the target field of the CAN transceiver's register is read, and the target field also includes a power supply status field; Read the power supply status field to obtain the power supply voltage status information of the CAN transceiver; The step of determining whether the CAN transceiver is malfunctioning based on the read status information includes: Compare the power supply voltage status information with the preset power supply voltage status information; If the power supply voltage value represented by the power supply voltage status information is less than the preset power supply voltage value represented by the preset power supply voltage status information, and / or the fluctuation frequency of the power supply voltage represented by the power supply voltage status information is greater than the preset fluctuation frequency represented by the preset power supply voltage status information, it is determined that the CAN transceiver has a voltage abnormality, and the fault flag corresponding to the voltage abnormality is set.

5. The communication fault handling method according to claim 1, characterized in that, Before performing a reset operation on the CAN transceiver via the MCU, the method further includes: Obtain a preset reset flag variable, which is used to identify the reset state of the CAN transceiver during the reset operation; Determine whether the reset flag variable has been set; If the reset flag variable is not set, the reset flag variable is set to indicate that a reset operation on the CAN transceiver has been triggered, and the current reset operation on the CAN transceiver is performed. If the reset flag variable has been set, ignore the current reset operation request for the CAN transceiver and continue to execute the already triggered reset operation.

6. The communication fault handling method according to claim 1, characterized in that, The step of resetting the CAN transceiver via the MCU includes: The MCU continuously applies a low-level control signal to the CAN transceiver to switch the CAN transceiver from a high-level state to a low-level state. If the duration of the continuous application of the low-level control signal meets the preset reset duration, the low-level control signal is switched to a high-level control signal so that the CAN transceiver switches from a low-level state to a high-level state. In response to the CAN transceiver switching from a low level state to a high level state, a reset operation is performed on the CAN transceiver.

7. The communication fault handling method according to claim 1, characterized in that, After performing a reset operation on the CAN transceiver via the MCU, the method further includes: The CAN communication link is rebuilt, and the rebuilding operation includes: Reconfigure the communication parameters of the CAN transceiver and activate its communication transmission and reception function; In response to activating the communication transceiver function of the CAN transceiver, read the abnormal status information of the CAN transceiver and clear the abnormal status information.

8. A communication fault handling system, characterized in that, The system includes: The monitoring module is used to monitor the CAN communication link between the MCU and the CAN transceiver and output the monitoring results. The first determining module is used to determine a communication anomaly and set a communication fault flag bit when the monitoring result indicates that no valid communication message has been detected within a preset time period. The reading module is used to read the status information of the CAN transceiver in response to the setting of the communication fault flag bit; The second determining module is used to determine whether the CAN transceiver is malfunctioning based on the read status information. The reset module is used to perform a reset operation on the CAN transceiver in the event of an abnormality, so as to restore the CAN transceiver to normal working mode.

9. An electronic device, characterized in that, It includes a processor, a memory, and a program or instructions stored in the memory and executable on the processor, wherein the program or instructions, when executed by the processor, implement the steps of the communication fault handling method as described in any one of claims 1-7.

10. A readable storage medium, characterized in that, The readable storage medium stores a program or instructions that, when executed by a processor, implement the steps of the communication fault handling method as described in any one of claims 1-7.