Enabling FEL-Mode on Orange-Pi Zero for Flashing U-Boot to NOR-Flash

The Orange-Pi Zero is a popular open hardware single-board computer that can run Linux. It is well supported by current Linux kernels and the U-Boot bootloader.

Recent boards feature a NOR-Flash that can be used to store the U-Boot bootloader. You build U-Boot from source with the commands:

make orangepi_zero_defconfig

And then using the sunxi-tools (Debian Linux has these tools as a package for two releases or so) you can flash the bootloader into the NOR Flash. You first connect a Micro-USB cable from the Orange-Pi USB-OTG port (thats the small µ-USB on the board) to a computer (preferrably running Debian Linux, for other systems you're on your own). The Orange-Pi should not have a SD-card inserted. In my experiments the power supplied via USB to the Orange-Pi was enough to flash the boatloader to NOR flash using the command:

sunxi-fel -v -p spiflash-write 0 u-boot-sunxi-with-spl.bin

The file u-boot-sunxi-with-spl.bin was just built with the commands above. So far everything is documented on the sunxi.org Orange-Pi Zero site. Once you have flashed the bootloader, though, the Orange-Pi will no longer boot into the FEL mode needed for the above command to work, instead it will start U-Boot from NOR flash. If you ever want to flash a new version of U-Boot you need to start the Orange-Pi in FEL mode again. To get the Orange-Pi into FEL mode again, some methods are also documented on the sunxi.org site. Unfortunately the easiest method: Setting the RECOVERY pin to ground which is supported by many boards with a jumper is not so easy on the Orange-Pi Zero because the pin is connected to a pull-up resistor (R 123) without any jumper attached. Fortunately the resistor is easily accessible on the board, I've marked the side of R 123 on the board with the right red arrow in the picture.


This has to be connected to ground. I'm using the ground on the debug serial port (marked with the left red arrow) because all other ground connection are adjacent to a +5V pin and if you accidentally manage to connect +5V to something other on the board you could destroy it. So the ground pin on the debug serial port is the safest choice. You connect ground to the R 123 pin, both marked with red arrows, and then you power up the board (e.g. by connecting the OTG-USB). You can verify the board is really in FEL mode with the command:

sunxi-fel ver

This prints version information for the board and will issue an error message if FEL mode was not successfully entered. Once in FEL mode you can re-flash the boot loader if needed.

Success-message from the command above:

AWUSBFEX soc=00001680(H3) 00000001 ver=0001 44 08 scratchpad=00007e00 00000000 00000000

Error message if FEL mode was not entered:

ERROR: Allwinner USB FEL device not found!