MCU Discontinued: How We Migrated an Engine Controller to STM32

Share
Discontinued MCU migrated to STM32L4 with FreeRTOS

Project Overview

Our customer manufactures a controller that starts, monitors, and protects diesel engines. The controller has been used for many years across a wide range of machines. After its original microcontroller was discontinued, the product needed a new hardware platform.

The customer designed a new STM32L4 board in-house. Oxeltech ported the existing firmware to the new hardware and moved the application from bare-metal software to FreeRTOS, preserving its existing functions and familiar operation.

The controller’s main functions include:

  • Reading key and stop inputs
  • Measuring engine speed, oil pressure, temperature, and battery voltage
  • Controlling the starter, glow plugs, and solenoids
  • Staying operational during cranking and completing shutdown tasks after ignition-off
  • Supporting an LCD interface and CAN communication

All of these functions needed to be retained during the migration.

The Challenge

The discontinued microcontroller put continued production at risk. To keep building and selling the product, the customer needed to move its established software to the new STM32L4 hardware.

The existing bare-metal application had grown over many years. It supported multiple customer-specific variants and several menu languages, with much of its code written directly for the original chip.

The migration therefore had to preserve more than the main engine-control functions. Menus, settings, CAN messages, and product variants all needed to work as before so users and service staff could continue working with the controller in the same way.

Our Solution

Moving the Application to FreeRTOS

We ported the existing bare-metal application to STM32L4 running FreeRTOS. Separate tasks were created for CAN communication, the display, memory, and the main engine-control application.

This structure separated engine control from slower operations such as display updates and EEPROM writes.

Adapting the Firmware to the New Hardware

We mapped every input and output from the old board to the customer’s new board and rewrote the low-level code for STM32.

This allowed the existing application functions to run on the new hardware while retaining the controller’s established behavior.

Engine controller circuit board redesigned for STM32

Figure: STM32L4 engine-controller board used for the firmware migration

Preserving Settings and Compatibility

Settings are stored in EEPROM with a CRC check, so corrupted data can be detected.

We also preserved the existing menus, settings, CAN messages, and product variants. This maintained the operation that users and service staff already knew.

The Result

All existing controller functions now run on the new STM32L4 hardware with FreeRTOS. Users and service staff continue to operate the product in the same way, and the customer can continue selling it to new and existing end users.

The modular FreeRTOS design and 32-bit platform also make new features easier to add.

Tools and Technologies

The project used STM32CubeIDE, FreeRTOS, and SEGGER J-Link, with CAN communication using SAE J1939.

If you are working on a product with a discontinued microcontroller and need to move your firmware to new hardware, we are happy to help. Feel free to Contact Us for firmware porting, RTOS, and embedded software development support.

Subscribe Our Newsletter