The process for reflashing an AutoPi device differs a little depending on the device version you have and the OS you are running. The steps in this guide were tested on Pop-os 6.1 (a Debian-derived Linux distribution) and Windows 10. The general workflow for the reflashing process is:
- Download the AutoPi OS image
- Set up Balena Ethcher (or alternative)
- Connect the device storage media
- Pre-CM4 devices (versions 3.0 - 6.3)
- CM4 devices (version 7.x+)
- Perform the flash
- Ensure your device is connecting to the correct environment
- Set up the device
Make sure that you select the right image for your device:
|Generation||Board Version||Release Page|
You may also check the autopi-core releases page for a newer compatible image.
We recommend using Etcher for flashing - it will take the GZ image directly and flash it. If using Windows, the
installation can be done through a regular .exe file. For Linux, follow the steps on Balena's Etcher repository. We've noticed that the first command does not always work on the first try. If that happens, update your package list through
sudo apt update and try again.
for Linux users
On Linux, we are installing by adding the Balena package repository and installing through our package manager, but keep in mind than an .AppImage file is available on Balena's website.
Your device contains an SD card with the AutoPi Core preinstalled. The SD card is located inside the device. You will need to unscrew the device to access and remove the SD card. For that you can follow the Upgrade/Replace Your Raspberry Pi Computer guide. Once you have the SD card in hand, place it in an SD card reader and connect it to your computer.
On Compute Module 4 devices there is no SD card. The Operating System is stored on a flash chip embedded on the Raspberry Pi board. This means that reflashing is a little more complicated than just taking an SD card out of the AutoPi device and flashing it through an SD card reader. These are the steps you'll need to take:
- Set up rpiboot (allows your computer to read/write the Raspberry Pi's flash memory)
- Put the device into EMMC FLASHING state
- Connect the device with a usb cable
Rpiboot is a utility provided by Raspberry Pi that allows your computer to read and write the flash chip. Most of the steps below need to be done only once per host computer. After the initial setup, all you should be required to do for this step is run the rpiboot utility.
Download the rpiboot installer and go through the setup. Once the installation is complete, run the newly added rpiboot program, which you can find in the Start menu.
More details on the rpiboot setup for Windows can be found on the Raspberry Pi Documentation site. But keep in mind that where the documentation is talking about jumper cables, on the AutoPi board, that means changing the device state.
Follow the setup steps in the Raspberry Pi usbboot documentation. Once you've started the rpiboot utility, your computer will start looking for a connected Compute Module device. The setup should look something like pictured below:
To do this, your device will need to be receiving power from either a vehicle, or a power supply with an adapter cable (the USB port can not be used for power). Details for button location and state transitions can be found in the AutoPi CM4 TMU documentation.
To put the task in more simple terms: press the button (located in one of the holes on the side of the device) until the blue LED starts flashing very fast. If you've just plugged your device into power, wait until the blue LED turns solid. Then do a short press of the button, to do a gentle shutdown. Once the blue LED turns dim, it has gone into hibernation. From here long press the button until the LED starts flashing slowly (approx 1 flash per second). The device is now in the USER SETUP state. After another long press, the LED should start flashing rapidly, at which point the device is in the correct EMMC FLASHING state.
Once you have both the rpiboot utility running on your computer and the device is in the correct state, you can connect the 2. Plug the micro-USB end of the cable into the exposed micro-USB port on the side of the device (the regular USB type-A ports on the back of the device can not be used for flashing), and the other end into your computer. If everything has gone according to plan, the rpiboot utiliy has now detected the device and mounted the device partitions if there are any. That should look something like pictured below:
At this point you can access the internal file system of the AutoPi's Raspberry Pi through the mounted drives. On this Linux distribution the mounting points are
/media/<user>/rootfs. On Windows you should be able to see at least one of the partitions in the File Explorer.
Using Balena Etcher or alternative, select the image file you downloaded earlier, and the storage device. Once that's done, click flash and wait for it to complete. It's worth noting, that if it fails on the first try, try again.
It is unsafe to remove the device from power while it is on or booting. The safest point when to unplug the device from power is right after unmounting.
Once the flashing is complete, unmount the storage device. After that you can remove the SD card from its reader and put it back into the AutoPi device. If using a CM4 device, unplug the CM4 device's USB cable and press the button to put the device into hibernation, then a short press to start up the device.
This step is required only if your company is using a dedicated environment. You can find out whether this is the case by checking what website you're going to to access your device. If it's different from my.autopi.io, for example my_company.autopi.io, then this is a dedicated environment and you need to follow this Guide: Move to a dedicated environment.
Next, you will need to have the device re-accepted in the AutoPi Cloud. To do so, you need to first have the device boot up and connect to the internet. After that, log in to my.autopi.io. You should immediately see a notification letting you know that the device's key isn't accepted.
Another way of accepting the key is to go to the Settings page and navigating to your device's general settings. There you should be able to see that the "Key state" field says unaccepted and a green "Accept" button should be showing. Clicking on the button, accepts the key.
When your device comes online the first time, the WiFi hotspot will have the following setup:
Remember to update your device from the Cloud after you reflash it, as that will ensure that all the configuration values are properly configured (like the WiFi, SSID and password), and that the device has the correct authentication token for uploading data to the cloud.
If you'd like to discuss this topic with us or other fellow community members, you can do so on our community page dedicated for this guide: Guide: Reflashing your device