USB Firmware Upgrade
Introduction
This article describes how to upgrade the firmware file on the host to the flash memory of the development board through the Type-C data cable. When upgrading, you need to choose the appropriate upgrade mode according to the host operating system and firmware type.
Preparatory Tools
- ROC-RK3568-PC-SE development board
- Firmware
- Host computer
- Type-C data cable
Prepare Firmware
The firmware can be obtained by compiling the SDK, or downloaded from Resource Download as a public firmware (unified firmware). There are two types of firmware files:
-
A single unified firmware
The unified firmware is a single file packaged and merged by all files such as the partition table, bootloader, uboot, kernel, system and so on. The firmware officially released by Firefly adopts a unified firmware format. Upgrading the unified firmware will update the data and partition table of all partitions on the motherboard, and erase all data on the motherboard.
-
Multiple partition images
That is, files with independent functions, such as partition table, bootloader, and kernel, are generated during the development phase. The independent partition image can only update the specified partition, while keeping other partition data from being destroyed, it will be very convenient to debug during the development process.
Through the unified firmware unpacking / packing tool, the unified firmware can be unpacked into multiple partition images, or multiple partition images can be merged into a unified firmware.
Install the Upgrade Tool
Windows Operating System
- Tool: Use tools in the firmware package or download here Androidtool_xxx (version number)
AndroidTool defaults to display in Chinese. We need to change it to English. Open config.ini with a text editor (like notepad). The starting lines are:
#Language Selection: Selected=1(Chinese); Selected=2(English)
[Language]
Kinds=2
Selected=1
LangPath=Language\Change Selected=1 to Selected=2, and save. From now on, AndroidTool will display in English. Now, run AndroidTool.exe: (Note: If using Windows 7/8, you’ll need to right click it, select to run it as Administrator)
Note
In order to avoid the burning problem caused by the download tool version, it is recommended to use the tool packaged inside the public firmware package for burning.
After decompressing the public firmware package, it is as follows:
XXXX_Android11_HDMI_XXXX
├── XXXX_Android11_HDMI_XXXX.img
├── linux
│ └── Linux_Upgrade_Tool_v1.59.zip
└── windows
├── DriverAssitant_v5.1.1.zip
└── RKDevTool_Release_v2.81.zipInstall RK USB drive
Download Release_DriverAssistant.zip, extract, and then run the DriverInstall.exe inside.
In order for all devices to use the updated driver, first select Driver uninstall(驱动卸载) and then select Driver install(驱动安装).
Linux Operating System
There is no need to install device driver under Linux.
- Tool: Use tools in the firmware package or download here upgrade_tool_xxx (version number)
Install it into the system as follows for easy invocation:
unzip Linux_Upgrade_Tool_xxxx.zip
cd Linux_UpgradeTool_xxxx
sudo mv upgrade_tool /usr/local/bin
sudo chown root:root /usr/local/bin/upgrade_tool
sudo chmod a+x /usr/local/bin/upgrade_toolEnter Upgrade mode
There are two upgrade modes: Loader mode and MaskRom mode. Before flashing the firmware, we need to connect the device and make the board enter an upgradable mode.
Loader mode
Enter Loader mode by hardware
Connect the device and enter the Loader upgrade mode through the RECOVERY key as follows:
- Disconnect the power adapter first:
- Dual male USB data cable connects one end to the host and the other end to the development board.
- Press the
RECOVERYbutton on the device and hold.
- Connect to the power supply.
- About two seconds later, release the
RECOVERYbutton.
At this point, the device enters Loader mode.
Enter Loader mode by software
With the Type-C data cable connected, use the command in the serial debugging terminal or adb shell:
reboot loaderCheck the Loader mode
To determine whether the board has entered Loader mode, we can check it with the upgrade tool.
Windows Operating System
The AndroidTool displays the prompt Found One LOADER Device at the bottom:
The host should prompt for new hardware and configure the driver. Open Device manager and you will see the new Device Rockusb Device appear as shown below. If not, you need to go back to the previous step and reinstall the driver.
Linux Operating System
After running upgrade_tool, you can see a Loader prompt in the list of connected devices:
firefly@T-chip:~/severdir/down_firmware$ sudo upgrade_tool
List of rockusb connected
DevNo=1 Vid=0x2207,Pid=0x330c,LocationID=106 Loader
Found 1 rockusb,Select input DevNo,Rescan press <R>,Quit press <Q>:qNote
Loader mode does not write to SPI/NOR Flash, so there is no need to switch the storage. Just follow the "Upgrade the firmware" section below.
MaskRom mode
MaskRom mode is the last line of defense against device being bricked. Forced entry MaskRom involved hardware operation, have certain risk, so only in the situation that device failed entering the Loader mode, you can try MaskRom mode.
Warning
Please read carefully and operate carefully!
How to Enter MaskRom Mode
The operation steps are as follows:
- Disconnect all power supplies.
- Connect the device and host PC with Type-C data cable.
- Hold down the
Maskrombutton. - Connect DC power.
- Wait a few seconds, release the button.
When the board has NOR flash at the same time, if EMMC is empty and there are burned files in NOR flash, it is necessary to short circuit the D0 and GND test points near NOR flash to enter Maskrom mode.
Storage Selection in MaskRom Mode
When the ROC-RK3568-PC-SE is equipped with both NOR Flash (SPI Flash) and eMMC storage media, you need to confirm the target storage of the firmware before flashing in MaskRom mode. The default write targets of the two upgrade modes are as follows:
| Upgrade Mode | Default Write Target | Storage Switching |
|---|---|---|
| Loader mode | eMMC | Not required. Just follow the "Upgrade the firmware" section. |
| MaskRom mode | NOR Flash | Switch to eMMC before flashing a whole firmware |
The onboard NOR Flash location is shown below:
Note
In MaskRom mode, the firmware is written to NOR Flash by default. Since NOR Flash is too small to load the system image, it is only suitable for small files such as MiniLoaderAll.bin; flashing a whole unified firmware directly will fail due to insufficient space. Before flashing a whole firmware, make sure to switch the storage to eMMC according to the methods below.
Flash the latest official firmware or the firmware compiled from the latest SDK. No storage switching is required. Flash the whole firmware directly in MaskRom mode. Whether the flashing succeeds or not, when the device is powered off or restarted, the data in NOR Flash will be erased automatically (it takes about 30 to 60 seconds). After erasing, the device automatically enters Loader mode, and then you can flash the whole firmware following the "Upgrade the firmware" section.
What to do after a flashing failure
If the whole firmware is accidentally written into NOR Flash, the flashing will fail due to insufficient space. Handle it according to the current state of the device:
| Current State | Solution |
|---|---|
| No power-off or reboot after the failure | Click EraseFlash of the download tool to erase the NOR Flash, then switch to eMMC and flash again following Method 2 above |
| The device has been powered off or rebooted | Enter Loader mode through the Recovery key, click Go maskrom of AndroidTool to enter MaskRom mode again, then switch to eMMC and flash again following Method 2 above |
Clicking Go maskrom cannot enter MaskRom mode | Some old firmwares do not support returning to MaskRom mode from the bootloader in NOR Flash. In this case, re-enter Loader mode through the Recovery key, click EraseFlash to erase and reboot the board, then you can enter MaskRom mode |
Tip
If a serial debugging terminal is connected, you can run mtd erase nor0 in the U-Boot command line booted from NOR Flash (the serial log shows Bootdev(atags): mtd 2) to erase the NOR Flash and then reboot, or run rbrom to return to MaskRom mode, and then handle it according to the methods above.
Upgrade the firmware
Windows Operating System
Upgrade unified firmware - update.img
The steps to update the unified firmware update.img are as follows:
- Switch to the "upgrade firmware" page.
- Press the "firmware" button to open the firmware file to be upgraded. The upgrade tool displays detailed firmware information.
- Press the "upgrade" button to start the upgrade.
- If the upgrade fails, you can try to erase the Flash by pressing the
EraseFlashbutton first, and then upgrade. For boards with onboard Nor Flash, please refer to Storage Selection in MaskRom Mode.
Linux Operating System
Upgrade unified firmware - update.img
sudo upgrade_tool uf update.imgNote
If the upgrade fails, try erasing before upgrading.
# erase flash : Using the ef parameter requires the loader file or the corresponding update.img to be specified.
# update.img :The ubuntu firmware you need to upgrade.
sudo upgrade_tool ef update.img
# upgrade again
sudo upgrade_tool uf update.imgIf the upgrade fails because the firmware was written into Nor Flash, please refer to Storage Selection in MaskRom Mode to switch the upgrade storage.

