Crafting A Flight Computer From Scratch

Jan 17, 2024 |

Our cryogenic bi-liquid sounding rocket EX-4 from Project Nixus being transported from the assembly area to the launchpad at EuRoC 2023 in Portugal.

In the late summer of 2021, a small, ambitious electronics team within the Rocketry division of WARR (we’re hosted at the Technical University of Munich and the group’s German name is “Wissenschaftliche Arbeitsgemeinschaft für Raketentechnik und Raumfahrt”) faced a challenge – to construct their very first in-house designed flight computer entirely from scratch. With just a handful of developers on the team, and lacking both experience and sponsorship, the task seemed daunting. However, fueled by determination and guided by months of systems engineering, reviews with industry experts, and intensive design considerations, the team embarked on its adventure.

The first task for the avionics-firmware team was to develop drivers for a multitude of interfacing systems. These included components such as inertial measurement units (IMUs) and GPS interfaced over SPI, thermocouples, and barometers connected through I2C, as well as the datalogging system operating over UART. The complexity of the project demanded that we adopted a real-time operating system, leading to the integration of FreeRTOS. As the team delved into the intricacies of managing six quasi-parallel running tasks, they encountered a new challenge – understanding the nuances of FreeRTOS’s task scheduling on the STM32F4 microcontroller.

Navigating the Complexity With Tracealyzer

As the system grew in complexity, understanding the inner workings of the microcontroller became increasingly challenging. The solution we found was Percepio’s Tracealyzer software, generously sponsored by Percepio. This software proved to be a game-changer, offering profound insights into the operating system’s internal mechanisms. Tracealyzer played a pivotal role in analyzing code performance and identifying timing-related bugs, crucial for a flight computer operating under stringent real-time constraints.

Managing a multitude of high-frequency sensor inputs also posed a challenge. We buffered all incoming data in a dedicated data structure large enough to hold 400 complete readings, to keep data acquisition as fast as possible. Data could then be transferred to our onboard logging system, as well as to the telemetry downlink, in larger chunks.

We needed to ensure that the data acquisition and logging tasks weren’t scheduled too often or too seldom, striking a balance for our sensor-heavy operation. Tracealyzer’s simple visualizations were key to achieve this: We could see when our data structure was accessed, how much time it took to shift the data and that no data was lost, making sure our system handled the influx of sensor data while leaving room for all the other critical tasks on the rocket. In short, Tracealyzer assured our data acquisition process hit the sweet spot between speed and reliability.

Three Tracealyzer views of our flight computer’s software: event log on the top left, the vertical timeline (which shows a very helpful visualisation of the event log) on the right, and the bottom left shows the CPU load graph.

The flight computer needed to execute critical tasks for hours, from the launchpad to the rocket’s ascent into the skies. These tasks included maintaining communication with mission control, monitoring temperatures and pressures in fuel and oxidizer tanks, running a Kalman filter for state estimation, logging data onboard to an SD card while simultaneously transmitting it to a ground station, detecting apogee for parachute deployment, managing engine sequences, and controlling the rocket’s valves.

A Balancing Act of Real-Time Operations

The fact that we had analyzed the behavior of our code with Tracealyzer before we took part in the European Rocketry Competition (EuRoC) in Portugal last October allowed us to be a lot more confident in the robustness of our system.

The ability to monitor FreeRTOS’s handling of datalogging, state estimation, launch control, and engine sequences in real-time proved critical. The flight computer needed to execute these tasks with precision, as the engine sequence demands accuracy down to milliseconds, and launch control played a pivotal role in providing data for the engine sequence, especially in case of sensor anomalies suggesting an abort.

In conclusion, the journey of the electronics team in developing a flight computer from scratch was a testament to the power of determination, innovation, and the invaluable support of tools like Tracealyzer. The team emerged with a lot of experience, as well as a sophisticated and reliable flight computer. Not to mention that we won the New Space Design Award at EuRoC 2023.

Joshua Batmaz, Avionics Firmware Lead, WARR Rocketry

Percepio offers free Tracealyzer licenses to qualifying academic institutions and students. Please visit the Licensing page to review the terms and apply for an academic license.