What is Lichee Pi Zero?
Lichee Pi zero is a SD-card size ARM Cortex-A7 development board. It’s designed to be simple and affordable yet expandable and flexible. One can use it as a general compute module to make other things like handheld game consoles, calculators, IoT devices, or even (under powered) laptops. Or one can simply use it to learn ARM/Linux development.
What is on my Lichee Pi Zero?
There is nothing much on the Lichee Pi Zero core board. An Allwinner V3s SoC, a SD card slot, a USB-OTG port, a DPI TFT connector, a breadboard compatible connector, some power related chips, and that is it. Optionally, one can solder a SPI NOR (like W25X64) or a SPI NAND (like GD5F1G, but not yet supported.) on to it.
The reason why I say it is expandable and flexible comes from its GPIO connector. First, obviously one can solder 2.54mm headers on to it, making it breadboard compatible.
Second, it’s also a standard 1.27mm “stamp hole” connector, making it possible to solder it as a CPU module to other boards.
Third, it’s also possible to use all pins without a custom breakout board. Just install another 2.54mm header and you can get all the pins out of Lichee Pi.
Here is the full pin map of Lichee Pi:
DPI LCD / DVP Camera Connector
This connector is located at the back of the board. One can connect a 4.3″ 480*272 40pin / 5.0″ 480*272 40pin / 5.0″ 800*480 40pin LCD panel directly to this connector, which is very convenient. One can also use converter boards to connect other LCDs or convert it to LVDS/VGA/HDMI. Note the maximum resolution supported is 1024*768. Anything higher than this would not work.
The DVP camera share the same port with the LCD, which means that you may not use DVP camera and DPI LCD together. So, generally it is recommended to use a MIPI CSI camera rather than DVP camera since it does not conflict with DPI LCD.
How to install Linux on to it
Alright, it depends on where you want to install Linux to.
In theory, you can boot Linux from SD card, SPI NOR flash, SPI NAND flash, Ethernet and USB. Currently SD, SPI NOR and Ethernet are supported and tested. We will use talk about SD card boot in this document.
How does Lichee Pi Zero (Allwinner V3s) Boot?
The first step of booting is an internal 32KB boot ROM(BROM). This is a common practice among ARM processors in order to eliminate external parallel NOR Flash. The BROM would try to load program from external storage (SD/MMC, then SPI NOR, last SPI NAND). This program is called boot0 by Allwinner, but specifically SPL here. If the BROM failed to load this program, it would enter USB boot operation.
The second step is the SPL. The SPL is actually a minimal u-boot with few specific tasks. The SPL would be loaded into V3s’ internal SRAM, and the SPL would do the following things:
- Initialize Clock/UART/DRAM and boot device (SD/MMC/SPI Flash)
- Copy the full u-boot from boot device to DRAM
- Jump to the full u-boot.
The third step is the u-boot, which would load the kernel. In normal case, the u-boot would try to read the first partition of SD-card and execute the script “boot.scr”. Generally, the boot.scr included three commands: load the kernel to SDRAM, load the device tree blob to SDRAM, run the kernel.
What is on a typical bootable SD-card?
Here is the structure diagram of a typical bootable SD-card:
Basically, you need to have partition map, u-boot with SPL, boot script, device tree blob, kernel and rootfs image in order to create a bootable SD-card.
How to create a bootable SD-card?
First, one would need a Linux PC. Virtual machines are also supported.
I recommend use pre-built image to get started. Pre-built image can be downloaded from baidu netdisk: https://pan.baidu.com/s/1nv7Fq2X (access password: 5gec). Extract it the zero_imager.zip to zero_imager. And there are several pre-build images available. The description can be found in README_ROOTFS.txt. I chose mindb. Copy that corresponding tar file (do NOT extract) to the zero_imager folder.
Plug the microSD card into the card reader and connect to your PC, check its corresponding device filename (eg. /dev/sdb, or /dev/mmcblk0 on some laptops).
If you are using 480*272 LCD instead of 800*480 one, please open write_boot.sh and change “sudo dd if=u-boot-sunxi-with-spl_800480.bin of=$1 bs=1024 seek=8 &&\” to “sudo dd if=u-boot-sunxi-with-spl_480272.bin of=$1 bs=1024 seek=8 &&\”
Use the following command to create the bootable SD-card:
chmod +x *.sh
sudo ./write_all.sh /dev/sdX brmin/brpy/minmin/mindb/minX
Insert the SD-card into Lichee Pi and it should work. Connect a USB keyboard and login with root / licheepi to play with it.
Play with pre-built image
The pre-built image have many drivers built-in. You can connect a USB-HUB to the USB port, then connect keyboard, mouse and a wireless/wired netword card. Use apt to install your favorite program. Or you can use card reader or SCP to copy files over to the Lichee Pi. Compile your own program with gcc, or just use python. There are many choices, you can start making things without touching the kernel or other low-level things.
Follow the tutorials
Follow other tutorials to make your own kernel or rootfs. Porting other distros or connecting other peripherals to Lichee Pi Zero would be a fun task.
Official Todo List
Lichee Pi is more or less like a personal project, we need your help to improve the documentation and code of Lichee Pi. There is an official todo list at http://www.kancloud.cn/lichee/lpi0/317738. Help us and get rewarded!