Microcontroller Upgrade: Migrating Firmware from Assembly to C

Project in a Nutshell: We transferred the equipment produced by the client to a new microcontroller to replace the discontinued one. Our engineers selected an optimal microcontroller, adapted the firmware, and migrated it from Assembly to C. As a result, we prevented possible delays in the production of touch sensors and maintained the required functionality. 

about the project

Client & Challenge

A leading manufacturer of sensor technologies for industrial automation and control discovered that a microcontroller from NXP was discontinued, so they can't use it in their distance sensor within production equipment anymore. Our client contacted Promwad to address this issue to avoid possible production downtime and, as a result, financial losses and reputational risks.
 

We started our cooperation based on the time & materials model, having assembled a team of professionals with the right competencies for the task at hand: 

  • a project manager;
  • two software engineers;
  • a software architect. 

The Promwad team worked with experts from the client's side: a hardware engineer and a firmware architect. To synchronise efforts and discuss progress, we prepared weekly reports. 

Solution

1. MCU Selection

The project had two main technical objectives: 

  • Selection of a suitable microcontroller to meet the specific requirements of the system.  
  • Conversion of existing firmware code from Assembly to C and adapting it to a new microcontroller: migration to a more modern development language is necessary because assembler is considered obsolete.
project stages

For the upgraded software, it was necessary to maintain full compatibility in terms of the number of pulses, signal period and duty cycle. We also aimed to save object detection modes: pump in, pump out, object mode, background mode, and proximity mode. 

The project team experimented with various MCU models and, after testing, settled on the MC9S08SH8 hardware platform from NXP. 

2. Software Development

The new firmware, rewritten in C, had to meet the RAM and physical memory requirements, as C code typically takes up more memory than Assembly code. Optimisations were required to make the firmware run efficiently on the microcontroller: we configured the possibility to move the executable program to a flash memory area that was not used before. 

The Promwad engineers used the Super Loop architecture without interruptions with fixed cycle time as the programme structure. Software with such a structure runs continuously, executing the same series of tasks in a loop without any pauses, maintaining predictable and consistent system operation. 

project challenges

During the project, we encountered a problem — the lack of schematics and descriptions of the customer's specialised equipment. As a solution, we created a data exchange protocol and configuration processes that recorded and analysed the data exchange between the systems in Python so that the principle of interaction became clear.  

Our software engineers also developed a simulator programme for the sensor to test and validate the developed communication protocol and ensure it works correctly with the equipment. 

Business Value

results

By replacing the microcontroller and firmware in the distance sensor as part of the production equipment, the customer ensured the continued stable operation of their equipment without downtime and risks of financial loss. 

 

More of What We Do for Firmware Development

  • Custom MCU Firmware Development: explore our expertise in MCU firmware development, including board support packages, device drivers, middleware and more. 

Other Case Studies

Tell us about your project!

All submitted information will be kept confidential.