OK before we continue, we have to check that we are able to store calibration either in the EEPROM (ATmega328, 'm32u4, 'm2560, ESP8266, ESP32) or (Q)SPI Flash (most Adafruit M0, M4, nRF52840 boards)
Search for and install Adafruit Sensor Calibration
We strongly recommend using Arduino IDE 1.8.10+ because it will automatically install any dependancy libraries. If you have to install manually, grab SdFat - Adafruit Fork, ArduinoJson, Adafruit SPIFlash, Adafruit Unified Sensor as well (see all dependencies here)
Compilation & Upload Check
Load sensor_calibration_read example - yes even though there is no calibration yet, this will let us verify the basics!
Here's what you should look for:
- At the top you'll see that Has EEPROM is 1 - indicating we're using the internal EEPROM
- It's OK to seeĀ No calibration loaded/found (its a fresh chip!)
- The hex block after the **WARNING** is the raw calibration data stored. It's normal to see all 0x00 or 0xFF's if this is the first time running the program.
- Finally you'll see Calibrations found:
- Magnetic Hard Offset should default to 0, 0, 0 (no offset)
- Magnetic Soft Offset should default to 1, 0, 0, 0, 1, 0, 0, 0, 1 - note that isn't all zeros! It's a 3x3 identity matrix.
- Gyro Zero Rate Offset should default to 0, 0, 0 (no offset)
- Accel Zero Rate Offset should default to 0, 0, 0 (no offset)
If you got this far, you're good! Go to the next page where we try to write calibrations
Here's what you should look for:
- At the top you'll see that Has FLASH is 1 - indicating we're using the external SPI Flash storage and that it successfully Mounted Filesystem!
- It's OK to see Failed to read file / No calibration loaded/found (we haven't made one yet!)
- Finally you'll see Calibrations found:
- Magnetic Hard Offset should default to 0, 0, 0 (no offset)
- Magnetic Soft Offset should default to 1, 0, 0, 0, 1, 0, 0, 0, 1 - note that isn't all zeros! It's a 3x3 identity matrix.
- Gyro Zero Rate Offset should default to 0, 0, 0 (no offset)
- Accel Zero Rate Offset should default to 0, 0, 0 (no offset)
If you got this far, you're good! Go to the next page where we try to write calibrations
Flash Unformatted Error
There's a chance, if you have a totally fresh board, that the flash is unformatted. In this case, when you upload the calibration reader, you'll get that the JEDEC Chip ID was read (it may vary), and that the flash size was detected - but failed to mount newly formatted filesystem!
If that happens, you have two ways to format the filesystem.
- Easiest way (we think) is to install CircuitPython - that's because you don't have to compile anything - simply enter the bootloader by click/double-clicking, and dragging over a UF2 file which will format the disk for you.
- Or, you can load the SdFat formatter example in the Adafruit SPIFlash library:
Compile, upload and check the serial monitor for instructions
Now re-upload/re-try the sensor calibration reading demo
Page last edited March 08, 2024
Text editor powered by tinymce.