flan

flash over CAN — write to dashboard flash using the Megasquirt to bridge serial traffic onto the CAN bus.

Usage

flan -p port -c CANid file1 ...

Description

flan is a command-line utility which uses the Megasquirt Serial Protocol to pass flash updates through the Megasquirt and across the CAN bus to the dashboard. All communications are verified by responses from the dashboard which should make updating reasonably reliable.

The dashboard firmware includes a small monitor component which handles the flash updating protocol. The monitor watches all CAN communications. When flan starts, it sends a special packet which the monitor recognises. Ordinary dashboard function is stopped and monitor mode starts. The dashboard will also enter monitor mode if the next-page button is closed when the dashboard is powered up. This provides a safe fallback if a firmware update goes wrong (someone pulls a cable or whatever).

Once flan has received a response acknowledging that the dashboard is in monitor mode it starts transmitting the update 64 bytes at a time. As each chunk is sent to the dashboard flan prints a dot on the screen. The dashboard's processor flash memory is mostly organised in 512 byte pages. At each page boundary, flan confirms that what has been written to flash matches what was transmitted, prints a + and starts a new line.

The result is a not very pretty progress report on the update.

The monitor code is not able to update itself. This keeps the fallback position safe, but means any bugs in the monitor code won't be easy to fix.

Note

Make sure you aren't running TunerStudio at the same time as flan. They'll fight over the serial port.

Errors and Remedies

Monitor Boot Mode

Thought has gone into making sure there is a recovery path when things fail. At the lowest level of all is monitor boot mode, which is much like using the Megasquirt boot jumper, except you don't need a screwdriver.

To enter monitor boot mode: with the power off, hold down the page button, turn on the power, wait a second, release the button. The dashboard will wait ready to receive firmware and/or configuration data via CAN.

If flan still can't get a response using CAN ID 10 there is a deeper problem somewhere.

Code <> Env Error

This error indicates that the configuration environment is generated for an incompatible version of the code. At the moment there is only one version of both, but in future, extra features may be added and configurations and code will need to be upgraded together. Depending on what led to seeing this error either the code needs to be upgraded or the configuration rebuilt.

Sig Mismatch Error

This error tells you that the Megasquirt signature doesn't match the signature in the dashboard's configuration environment. The dashboard will need its configuration rebuilt with the correct signature.

Technical Stuff

This document gives reasonable details of how the flan protocol has been layered on top of the Megasquirt Serial Protocol.