Configuration Storage
The device configuration is a list of parameters. The saved copy is stored with a version number and a CRC32 checksum so the firmware can tell if it is valid.
| Device | Storage |
|---|---|
| dingoPDM, dingoPDM-Max | External FRAM over I2C |
| CANBoard | Internal MCU flash |
Read
On power up, after starting ChibiOS and I2C, the firmware reads the configuration:
- Read the configuration starting at address 0
- Check that the stored version matches the version the firmware expects
- Read the CRC32 stored right after the configuration
- Calculate the CRC32 of the configuration that was read and check that it matches
- Continue starting up
Read Failure
If any read step fails (no configuration saved, configuration from a different firmware version, or a bad CRC):
- All parameters are set to their default values
- The default configuration is written to memory
- If the write fails, the device goes to the error state with error
4(Configuration)
- If the write fails, the device goes to the error state with error
- The device continues starting up with the default configuration
Info
Some firmware updates change the configuration format. After one of those updates, the saved configuration no longer matches and the device starts with the default (blank) configuration.
Write your configuration back to the device with dingoConfig (Write All, then Burn). Keep a config file saved so this is quick.
Updating
Parameters are changed with CAN or USB messages, see Parameters. No special mode is needed, parameters can be changed while the device is running.
Note
A changed value is used immediately, but is not saved over a power cycle.
Send a Burn to save the configuration to memory.
A new Base ID is used right away. A new CAN bitrate is only used after a Restart (or power cycle), Burn before restarting or the change is lost.
Write
To reduce memory writes, the configuration is only written when a Burn message is received.
Write sequence:
- Check the FRAM ID (dingoPDM)
- Write the configuration starting at address 0
- Calculate the CRC32 of the configuration
- Write the CRC32 right after the configuration
- Send the result in the Burn response (
1= success,0= fail)