pocitadlo

OGN CUBEs Firmware Updates

In early February, when the sunny but still freezing weather allowed, I had been testing new firmware for the upcoming season 2023. The units under test were located on the roof of our lab building where new features had to be validated in field conditions. Especially helpful was the WT9 Dynamic in performing its repeated take-offs and landings at LKCM right behind the nearby peak.

For this firmware validations I conveniently use(d) the OGN Cube Control android app I developed some time ago for seamless upgrades without the necessity of removing the device from our gliders. Still on Monday afternoon it all worked flawlessly. On Tuesday (as I discovered months later) something happened. And finally on Wednesday morning when I wanted to apply the final firmware amendment I had just seen some Chinese symbols in the app! What the ****!? I keep my phone out of the endless Google update mayhem just to keep things consistent. Even the app was in the dev version (not installed from the Play) in order to retain full control over problems that may (and yes, they do) occur in the app. And the same issue appeared on all devices I know of at very similar time. So what was the trouble? Google had changed “something” in the very core of the Android API, pushed this improvement into all devices (even those with all updates explicitly disabled) and broke the app. And not only my app, many of them.

The solution seemed to be obvious – upgrade the android development toolkit, Flutter, Dart and the development workspace in general, clean, rebuild, deploy, done, right? Not at all! As of now the project is irreversibly broken and the app cannot be even build. It seem the entire app needs to be re-implemented for the new API from the very bottom up 😐

As many of you might have already guessed that is not that simple task for one summer weekend. Although the season is basically over the CUBEs still deserve firmware upgrade. The following is a step-by-step guide (for a bit more skillful readers) how to keep your CUBEs recent.

Prerequisites: you need a computer with (*buntu) linux (but any other distro will do just fine) and bluetooth capability. This can till be done easily in the hangar without removing your CUBE from the airplane.

Step #1: Run terminal/console app and install tools needed for communication between the scripts over bluetooth:

sudo bash
apt install bluez git python3
hcitool scan
^D

Provided your CUBE is powered you shall see it in the list after the scan command. If not, execute the scan again.

Step #2: From github download the firmware upgrade scripts:

git clone https://github.com/ibisek/firmwareLoader.git
cd firmwareLoader
python3 -m venv venv
source ./venv/bin/activate
pip install -r requirements.txt 
deactivate

Step #3: Obtain the actual firmware file you need for your particular CUBE from a ognCubeReleases github repository. For the last step you need to know which MCU is inside your unit. To be über-certain you may want to open the box and see the type is in there. But in general, it should be like this:

  • OGN CUBE 2 -> STM32F103CBT6
  • OGN CUBE 3 -> STM32F103CBT6
  • OGN CUBE 3.5 -> STM32L152CC..

!!WARNING!! By flashing incorrect firmware “architecture” you might be unable to perform easy re-flashing again. It can still be done on site but it is a bit more elaborate..

The F103 (Cubes 2+3) have the aircraft type (glider/tow/uav) fixed in the bin file. Hence you want to choose the appropriate one. The CUBEs 3.5 can be configured and the fw comes as a glider by default. The configuration shall be retained during firmware upgrade but if you needed to change the type in the future I can tell you how someday later..

cd bin-files

wget https://github.com/ibisek/ognCubeReleases/raw/master/releases/ognCube3.5.l152-2023-11-30-GLD-0x2800.bin

wget https://github.com/ibisek/ognCubeReleases/raw/master/releases/ognCube3.f103-2023-02-10-UAV-0x2800.bin

wget https://github.com/ibisek/ognCubeReleases/raw/master/releases/ognCube3.f103-2023-03-06-GLD-0x2800.bin

wget https://github.com/ibisek/ognCubeReleases/raw/master/releases/ognCube3.f103-2023-03-06-POWERED-0x2800.bin

cd ..

Step #4: Flash the firmware. The unit needs to be powered-on for at least 20s before executing the script below – not to be within the initial 10s-long bootloader mode (yet). The LED shall indicate it is in satellite acquisition mode (two consequent relatively short flashes –) or already transmitting (very short flashes twice a second).

sudo ./findAndFlash.sh

The flashing process will reboot the unit automatically.

Q&A:

  • How do I know which version is the CUBE on? Connect to the unit using for example the Serial Bluetooth Terminal android app to see the prompted information. Here you can spot two dates – bootloader (comes right after power-on) and firmware version (right after bootloader yields control to the actual OGN code). The latter is what matters.