ECU testing

4 mins read

As vital embedded systems, electronic control units (ECUs) impact numerous functions in a car and must undergo rigorous testing.

Credit: Limitless Visions -

Hardware-in-the-loop testing (HIL) is imperative in any test workflow because it allows engineers to test ECUs under real-world conditions using digital twins of the various systems in the car instead of actual hardware.

For successful HIL testing, companies need a flexible and integrated platform from creating the digital twins through simulation all the way to continuous and automated testing. HIL testing accelerates development, increases safety, and is cost-effective when implemented well.

ECUs are embedded controllers managing various tasks: They receive sensor inputs, drive actuators, monitor signals, and interface with other embedded systems. ECUs need to provide precise and deterministic control feedback quickly.

The ECU is a safety-critical component, and its optimal functional robustness can only be achieved by rigorous testing in an iterative process. Therefore, the risk of potential malfunctions is minimized.

Testing ensures safe operation under all conditions, including extreme ones. By testing continuously, bugs can be detected early in the development process when they are still easy to catch. This avoids delays and reduces costs.

Furthermore, ECUs are embedded components in a complex system of actuators and other ECUs, and testing ensures they interact flawlessly. It assures joint operation and helps detect and resolve common communication issues. In essence, testing enables meeting quality standards, ensures customer satisfaction, and may prevent iterations late in the process.

The development process can involve various testing methodologies and different levels of testing: The early ECU design is tested using Model-in-the-loop (MIL), software functionalities are validated with Software-in-the-loop (SIL) and Hardware-in-the-loop (HIL) testing allows engineers to test ECUs, software and hardware against real-world inputs and conditions. In the testing process, the ECU undergoes verification against defined requirements through meticulous test plans that include various sets of inputs and accepted ranges for the results. It also undergoes system-level integration tests involving other controllers and emulated or real plant components.

ECU testing challenges

ECU testing is a complex task: As an ECU can handle many control functions, the whole system needs to be comprehensively tested to ensure that all functions and their dependencies are validated. System-level testing of ECUs can be tricky because different suppliers are involved. Communication issues and unexpected system behaviour may occur. Another challenge is safety. Tests, including all operating scenarios and faulty conditions, must be conducted without endangering people or damaging hardware.

On the other hand, short turn-around times and agility are key for innovation and a fast distribution of updates. Teams need to be able to squeeze out every bit of performance during testing and still comply with the rules and standards. The latter typically requires traceability of the test results.

HIL testing

HIL testing is a key part of a testing workflow to validate control systems and ECUs, where the device under test (here: the ECU) is connected to the HIL test system through real I/O connectivity and communication protocols.

A HIL test setup is comprised of three main components:

  • The device under test (ECU) and additional components like domain controllers, sensors, and actuators
  • A HIL test system with a real-time capable processor that runs the emulated plant components (also called digital twin) and includes I/O connectivity and protocols to emulate signals for communication with the ECU and to acquire data.
  • A workstation running application software that supports running the HIL tests and enables test automation.

Let's imagine you are testing an electric drive controller and connecting it to the physical plant, like a power inverter and electric motor. Once the system is energised, it becomes dangerous. Testing the controller with a virtual HIL setup ensures safety and minimises the risk of damaging equipment. Edge cases and tests under faulty conditions can be conducted with high reliability and without endangering people or damaging hardware. HIL testing facilitates the process and reduces costs – costly prototypes and time spent on the test track can be avoided. Engineers are also less dependent on hardware lead times. Tests can be automated, run 24/7, and be triggered continuously upon every control design update. When testing is perceived as easy, and when test results are available quickly, engineers are more innovative. They get instant feedback on their designs and don't have to wait long until their novel algorithms run on the ECU and get tested.

HIL trends and problems

Establishing a HIL setup is complex, and companies may face problems. Firstly, some don't have the know-how to set up a HIL test system. Trivialities like implementing protocols and interfaces may introduce bottlenecks. Also, connecting to third-party software and hardware may sometimes lead to substantial integration efforts: Companies overlook the need for additional I/O, have trouble getting support, or the models don't run in real-time. They are busy setting up the tests and lose a lot of time. Also, system complexity increases, and power efficiency and safety requirements become stricter, demanding traceability and certification.

As the competition is tough and technology is advancing, it can be challenging to keep pace. Companies need to manage many software variants and HIL setups. At the same time, development cycles get shorter and shorter. Trends like software-defined vehicles (SDV) make it necessary to upgrade ECUs during their entire lifecycle: Testing never ends, meaning testing continuously becomes a requirement.

An integrated platform for HIL tests

To develop, manage, and execute HIL test campaigns, companies need a flexible and integrated solution and tools that support these challenges: Speedgoat test systems, together with MATLAB and Simulink (MathWorks), have formed a powerful and unified test platform that enables engineers to work in one integrated system. Engineers use the same environment to design controls and perform HIL tests. Software and hardware are designed for one another, so there are no interoperability issues. Updated models can be deployed with a few clicks, and engineers can switch between desktop and real-time execution flawlessly.

Such a platform must be scalable - the test system can scale with the models' complexity or evolving I/O. Setting up the interface from the model to the controller hardware takes a few clicks. Simulink dashboard components and MATLAB apps allow engineers to administrate and automate testing tasks efficiently. 24/7 HIL testing with continuous integration becomes the default.

The Speedgoat/MathWorks solution supports ASAM XIL-compliant third-party tools for test automation. Furthermore, the solution supports all major standards, networks, and protocols, such as ISO® 26262 for ASIL-A to -D, CAN, Automotive Ethernet or AUTOSAR.

As a fully serviced solution, Speedgoat also offers engineering services that help integrate complex and custom rack-based HIL test systems, including signal conditioning and cabling, as well as training and consulting services. Hardware repair and software maintenance offerings ensure that downtimes are avoided (or kept to a minimum) and that the system remains up-to-date.


HIL testing allows engineers to vet ECUs before testing them with the real system. The virtual setup also creates a safe testing environment for edge cases without the risk of harming people or damaging hardware. It makes testing more accessible and faster while reducing costs and pushing innovation. The key to success is a unified design and testing environment. It allows for fast setups as well as continuous integration and automation.

  • Speedgoat specialises in state-of-the-art real-time systems for real-time testing using Simulink and Simulink Real-Time, the real-time operating system from MathWorks.