A bus signal fault injection test system based on a single-chip microcomputer
The microcontroller-based bus signal fault injection test system solves the problems of high cost, complex operation and insufficient real-time performance of existing equipment, and realizes efficient and convenient fault injection testing. It is suitable for multi-channel CAN bus scenarios, reduces costs and improves real-time performance and fault tolerance.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Utility models(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-27
- Publication Date
- 2026-06-09
AI Technical Summary
Existing CAN bus signal fault injection devices are costly, complex to operate, and lack real-time performance, making it difficult to meet the efficiency, convenience, and real-time requirements of real-vehicle testing environments.
A bus signal fault injection test system based on a microcontroller is adopted, including a hardware system and a host computer. The microcontroller receives and stores CAN messages in real time through Ethernet communication, and calculates timestamps using an internal timer to achieve flexibility and accuracy in fault injection. Interoperability and isolation are achieved through two CAN channels to ensure the fault tolerance and reliability of the system.
It improves the flexibility and accuracy of fault injection, enhances the convenience and fault tolerance of the system, is suitable for multi-channel CAN bus testing scenarios, reduces testing costs and improves real-time performance.
Smart Images

Figure CN224343220U_ABST
Abstract
Description
Technical Field
[0001] This utility model relates to the field of signal fault injection testing, specifically to a bus signal fault injection testing system based on a microcontroller. Background Technology
[0002] In the field of automotive control, the CAN bus, as an important communication bus, is widely used in real vehicle testing environments. To ensure the reliability and safety of the system, it is necessary to perform fault injection testing on the CAN bus signal to verify the system's ability to cope with various fault conditions. CAN bus signal fault injection testing is a test method that verifies the system's behavior and fault tolerance under abnormal conditions by artificially introducing fault conditions. Its core principle is to use fault injection devices (such as CANoe, dedicated hardware devices, etc.) to simulate various fault scenarios in the CAN bus communication link and observe the response and processing capabilities of the device under test (such as ECU) to these faults. Fault injection testing usually includes the following steps: (1) Injecting specific fault signals into the CAN bus, such as message loss, signal interference, frame format errors, etc.; (2) While injecting faults, monitoring the data transmission on the CAN bus in real time and recording the response of the device under test; (3) Analyzing the monitoring data and evaluating whether the device under test can correctly detect faults and take appropriate fault tolerance measures.
[0003] Currently, the main devices used for fault injection into CAN bus signals in real vehicle testing environments are bus testing tools such as CANoe. These tools inject bus signal faults during message reception trigger events through their script editing functions. However, these devices have the following shortcomings: (1) High price: These bus testing tools are usually expensive, increasing the testing costs for enterprises and limiting their application in some small enterprises or low-cost projects. (2) Inconvenient to use: For different signals, tampered values, and fault types, the scripts need to be edited frequently. For ordinary users, script editing requires certain professional knowledge and experience, is complex to operate, and is prone to errors, which seriously affects the efficiency and convenience of testing. (3) Insufficient real-time performance: In addition to tools such as CANoe, other similar bus fault injection devices on the market are prone to system lag during long-term operation, resulting in insufficient real-time performance and failing to meet the real-time requirements for fault injection testing in real vehicle testing environments.
[0004] Therefore, current bus fault injection devices on the market have certain limitations in terms of cost, ease of use, and real-time performance, making it difficult to simultaneously meet the requirements of real vehicle testing environments for high efficiency, convenience, and real-time performance in fault injection testing. Utility Model Content
[0005] The present invention aims to provide a bus signal fault injection test system based on a microcontroller to solve the problems of traditional bus fault injection devices on the market in terms of operation, real-time performance, and accuracy.
[0006] To achieve the above objectives, the present invention adopts the following technical solution:
[0007] A bus signal fault injection test system based on a microcontroller includes: a hardware system and a host computer;
[0008] The host computer is used to send out the custom parameters required for fault injection and to monitor and analyze the data on the CAN line;
[0009] The hardware system includes a microcontroller;
[0010] The host computer and the microcontroller are connected via Ethernet communication, and the microcontroller is used to receive custom parameters sent by the host computer in real time.
[0011] The microcontroller receives messages from the CAN bus in real time through the CAN interface and stores the received message data in the buffer by triggering an interrupt.
[0012] The microcontroller calculates the timestamps of each collected message using an internal timer;
[0013] The microcontroller transmits the message-related information to the host computer.
[0014] The hardware system includes at least two CAN channels, which can forward messages to each other and are interoperable.
[0015] The principle and advantages of this solution are as follows: In practical applications, the host computer program communicates with the hardware system via Ethernet, facilitating users to issue fault injection parameters, achieving automated testing, and monitoring CAN bus data, thus improving the convenience and efficiency of testing; the microcontroller communicates with the host computer via the Ethernet interface, receives fault injection parameter settings, and sends the collected message data and system status information to the host computer. This communication method enables remote control and data transmission, improving the flexibility and convenience of testing.
[0016] The microcontroller receives messages from the bus via the CAN interface. Whenever a message is received, an interrupt is triggered, and the message data is stored in the internal buffer to ensure real-time and accurate message acquisition and avoid frame loss.
[0017] The microcontroller uses an internal timer to calculate the timestamp of each message and transmits the relevant information of the message (such as timestamp, message content, etc.) to the host computer. At the same time, the microcontroller ensures that the period of the CAN messages sent from the system is accurate through precise time control, so as not to change the sending period of the message itself and avoid bus failure.
[0018] The hardware system includes at least two CAN channels. These two CAN channels can forward messages to each other and are interoperable, enabling isolation between fault injection and normal communication, thereby improving the system's fault tolerance and reliability.
[0019] Preferably, as an improvement, after the hardware system receives the fault injection parameter settings from the host computer, it stores them in the microcontroller's memory. When the preset fault injection message matches the received one, it executes the preset action and sends it to the CAN bus via another CAN bus.
[0020] Technical benefits: It can accurately perform fault injection operations based on user-defined parameters, improving the flexibility and accuracy of fault injection.
[0021] Preferably, as an improvement, the host computer sets the fault injection method through a human-computer interaction interface.
[0022] Technical effect: The human-computer interaction interface improves the ease of use and the degree of automation.
[0023] Preferably, as an improvement, the host computer control hardware system sends CAN data to the required CAN channel.
[0024] Technical benefits: It facilitates the improvement of the system's fault tolerance and reliability.
[0025] Preferably, as an improvement, when testing multiple CAN channels, the hardware system is cascaded via Ethernet.
[0026] Technical benefits: This makes the system applicable to testing scenarios with multiple CAN buses, enhancing the system's versatility and scalability. Attached Figure Description
[0027] Figure 1 A schematic diagram of the control block of an embodiment of a bus signal fault injection test system based on a microcontroller;
[0028] Figure 2 A schematic diagram of system cascading for an embodiment of a bus signal fault injection test system based on a microcontroller;
[0029] Figure 3 A schematic diagram of host computer message transmission for an embodiment of a bus signal fault injection test system based on a microcontroller;
[0030] Figure 4 This is a schematic diagram of the host computer message reception in an embodiment of a bus signal fault injection test system based on a microcontroller. Detailed Implementation
[0031] The following detailed description illustrates the specific implementation method:
[0032] The basic implementation examples are as follows: Figure 1 As shown:
[0033] A bus signal fault injection test system based on a microcontroller includes: a hardware system and a host computer.
[0034] The host computer serves as the interface between the user and the testing system, responsible for distributing fault injection parameters, monitoring the testing process, and analyzing test results. Specifically, the user sets the fault injection method and parameters through the host computer's graphical user interface. These parameters include message ID, tampered data, number of tampering attempts, fault type (e.g., data tampering, message loss, frame format error), and the fault injection time interval. The host computer communicates with the hardware system via Ethernet, distributing the user-defined fault injection parameters to the hardware system. Simultaneously, it receives real-time message data and system status information from the hardware system, such as collected message data and fault injection results. The host computer can also control the hardware system to send CAN data to CAN1 / CAN2. Figure 3 , Figure 4 As shown, the host computer displays the message data on the CAN bus in real time, including the original message and the message after fault injection processing; displays the working status of the hardware system, such as the buffer status and communication status; analyzes the test results, generates test reports, and helps users evaluate the performance and fault tolerance of the device under test (DUT).
[0035] In an automotive CAN bus system, a message is the basic unit of communication between nodes (such as ECUs), used to transmit data and commands. The CAN bus supports multiple message nodes connecting simultaneously, and each node can act as either a sender or a receiver.
[0036] The hardware system is a collection of physical devices and related circuit components used to implement CAN bus signal fault injection testing. The hardware system includes a microcontroller, CAN interface module, Ethernet interface module, buffer, power supply module, and other auxiliary circuits. The microcontroller is the core hardware component of the bus signal fault injection testing system, responsible for real-time processing of CAN message acquisition, fault injection operations, and communication with the host computer.
[0037] The microcontroller used is an STM32F4VET6. It receives custom parameters from the host computer in real time and stores them in memory. When a received message matches a preset fault injection message, the microcontroller processes the message according to preset actions (such as data tampering or message discarding) and sends the processed message to the CAN bus via another CAN interface. This allows for accurate fault injection based on user-defined parameters, improving the flexibility and accuracy of fault injection.
[0038] The microcontroller receives messages from the CAN bus in real time via the CAN interface. Whenever a message is received, the microcontroller triggers an interrupt, storing the received message data in a buffer to ensure real-time and accurate message acquisition and avoid frame loss.
[0039] The microcontroller calculates the timestamp of each collected message through an internal timer. The microcontroller then sends the collected message data (timestamp, message content) and system status information to the host computer through an Ethernet interface, ensuring that the period of the CAN messages sent from the system is accurate and will not change the sending period of the message itself, thus avoiding bus failure.
[0040] When performing fault injection testing, fault injection needs to be performed on specific messages without affecting the normal communication of the device under test (DUT). The hardware system includes at least two CAN channels, with one channel used for normal communication and the other channel used for fault injection. This ensures that one DUT can receive and send messages normally, maintaining the normal operation of the system. At the same time, the other CAN channel can tamper with, discard, or perform other fault operations on specific messages to simulate fault scenarios in actual operation. By isolating the two CAN channels, it is ensured that the fault injection operation will not interfere with the normal communication of the DUT, thereby more accurately evaluating the behavior of the DUT under fault conditions.
[0041] The two CAN channels are interoperable and can forward messages between each other. For example, a message received from the normal communication channel can be forwarded to the fault injection channel, and vice versa. Messages can also be transparently transmitted between the two CAN channels. In some test scenarios, it is necessary to forward normal messages to the fault injection channel for processing, or forward messages that have undergone fault injection to the normal communication channel for verification. In actual vehicle networks, there are usually multiple ECU nodes that communicate via the CAN bus. The interoperability of the two CAN channels can simulate complex communication scenarios between multiple nodes, ensuring the integrity and consistency of messages during testing and avoiding message loss or inconsistency issues caused by channel isolation. The interoperability of the two CAN channels also ensures the consistency of message transmission time between different channels. Through the microcontroller's internal timer, the timestamp of the message is accurately calculated, achieving precise time synchronization and message cycle control, ensuring accurate message transmission cycles and avoiding impact on the normal communication of the device under test.
[0042] When testing multiple CAN channels is required, the hardware system is cascaded via Ethernet, such as... Figure 2As shown, this makes the system applicable to testing scenarios with multiple CAN buses, enhancing its versatility and scalability. In this embodiment, the CAN transceiver is a transceiver supporting the CAN 2.0 protocol, and the Ethernet communication module uses the LWIP protocol stack as its communication foundation. A switch chip with multi-channel Ethernet transceiver is employed. Due to the large number of communication links in this system, an isolation module is set up based on optocouplers. In the multi-block cascade, the host computer communicates with the hardware system through the switch. Data acquisition is performed in the hardware system, and the received messages are transmitted to the host computer software for display via Ethernet. The message flow is managed by the MCU's real-time clock to avoid CAN message delays.
[0043] The above descriptions are merely embodiments of this utility model. Commonly known technical solutions and / or characteristics are not described in detail here. It should be noted that those skilled in the art can make various modifications and improvements without departing from the technical solution of this utility model. These modifications and improvements should also be considered within the scope of protection of this utility model, and will not affect the effectiveness of the implementation of this utility model or the practicality of the patent. The scope of protection claimed in this application should be determined by the content of its claims, and the specific embodiments described in the specification can be used to interpret the content of the claims.
Claims
1. A bus signal fault injection test system based on a microcontroller, characterized in that, include: Hardware system and host computer; The host computer is used to send out the custom parameters required for fault injection and to monitor and analyze the data on the CAN line; The hardware system includes a microcontroller; The host computer and the microcontroller are connected via Ethernet communication, and the microcontroller is used to receive custom parameters sent by the host computer in real time. The microcontroller receives messages from the CAN bus in real time through the CAN interface and stores the received message data in the buffer by triggering an interrupt. The microcontroller calculates the timestamps of each collected message using an internal timer; The microcontroller transmits the message-related information to the host computer. The hardware system includes at least two CAN channels, which can forward messages to each other and are interoperable.
2. The bus signal fault injection test system based on a microcontroller according to claim 1, characterized in that: After receiving the fault injection parameter settings from the host computer, the hardware system stores them in the microcontroller's memory. When the preset fault injection message matches the received one, it executes the preset action and sends it to the CAN bus via another CAN bus.
3. The bus signal fault injection test system based on a microcontroller according to claim 2, characterized in that: The host computer configures the fault injection method through a human-computer interaction interface.
4. The bus signal fault injection test system based on a microcontroller according to claim 3, characterized in that: The host computer control hardware system sends CAN data to the required CAN channel.
5. The bus signal fault injection test system based on a microcontroller according to claim 4, characterized in that: When testing multiple CAN channels is required, the hardware system is cascaded via Ethernet.