linux-sunxi
wiki page- OrangePi Zero schematics
Stock Armbian kernel is not compiled with CONFIG_SPI_GPIO
enabled, so the spi-gpio
module is not available.
The Armbian build system is fairly easy to use, e.g. with Vagrant. There may be issues with the dependency solver when installing vagrant-disksize
. If so, setting the environment variable VAGRANT_DISABLE_STRICT_DEPENDENCY_ENFORCEMENT=1
can help.
Enable GPIO-bitbang in SPI drivers and build with:
./compile.sh BRANCH=current BOARD=orangepizero KERNEL_ONLY=yes RELEASE=buster
Install the new kernel through the deb
packages in output/
. linux-image-*
and linux-headers-*
should be sufficient.
Install the device-tree overlay humpback-spi-cfg.dts:
armbian-add-overlay humpback-spi-cfg.dts
This configures a SPI master for the FPGA’s external flash memory and a corresponding spidev
userspace driver.
Use Flashrom. AT25SF081
is only supported since v1.1-rc1. The package in buster
is 1.0. Since there’re no dependencies, the easiest is to download the package from the bullseye archive directly (arch: armhf).
Test if the flash is detected:
flashrom -p linux_spi:dev=/dev/spidev0.0
should print something like:
Found Atmel flash chip "AT25SF081" (1024 kB, SPI) on linux_spi.
Install dependencies:
apt install gpiod
Use flash.sh.
as alternative to writing the flash directly? Can load bitstream at boot.
- ArchLinux ARM image, upgrade to kernel 5.1.0-rc5-1 works
Working on linux-5.1-rc5 tree. The toplevel devicetree is arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts
. Compilation:
zcat /proc/config.gz > .config
make sun8i-h2-plus-orangepi-zero.dtb
The configuration flash on the board is a AT25SF081-SHD-T
(datasheet). The configuration flow is described in the corresponding application note. In SPI master configuration mode, this basically looks like:
- hold
SS
(chipselect) high - pull
CRESET
low - write bitstream to flash
- pull
CRESET
high to load the bitstream into FPGA - check
CDONE
One can write the bitstream to the flash memory using the flashrom utility (need v1.1-rc1+). flashrom
’s linux_spi
driver requires access to the SPI bus via spidev
. One can add a bit-banged SPI driver to the devicetree (linux tree patch). The flash.sh script runs the configuration flow (requires libgpiod).
Note: there is support for iCE40 in SPI slave configuration mode for the kernel’s fpga_manager
(source, devicetree bindings documentation).