Banana Pi BPI-F3 (bananapi-bpi-f3)

== Contributors ==
* Haui2
== Users owning this device ==
== How to enter flash mode ==
Use the download (FEL) button or the DIP switch to enter fastboot mode.
FEL + RESET is used to enter Boot-ROM Fastboot.
== Installation ==
The company who builds the processor (Spacemit) also makes the Linux distribution that comes with it (Bianbu Linux) and holds the key to the proprietary u-boot fork that they make.
So currently you have to burn the bianbu image to an sd card and exchange the content of the rootfs with the one of the postmarketOS build.
We will update this once it has been figured out.
== Matrix channel ==
#SpacemiT:matrix.org
== Resources ==
=== Documentation ===
* Manufacturer documentation
* SoC documentation
* Manufacturer's forum
* SoC manufacturer's forum
* SoC manufacturer's ticket system
* Armbian forum
* Schematic
* Power Stone P1 documentation (chinese)
* Bianbu Linux documentation
* Works With RISC-V Wiki page about the SpacemiT K1
=== Articles ===
* Bringing up the Banana Pi F3
* Ubuntu 24.04 on BPI-F3 from SD-Card and running from NVME
* Steps to replace OpenSBI on Spacemit K1
* Compiling U-Boot for the BPI-F3
* Bits of networks - hardware and software overview
* Bits of networks - bootstraping upstream Debian
=== Software ===
* OpenOCD configuration (JTAG)
* Mr-Bossman/bpi-f3-buildroot
* lu-zero/bpi-f3-case
* bianbu-linux/uboot-2022.10
* BPI-SINOVOIP/armbian-build
* compile-farm/riscv64-kernel-build-bananapi-f3
* linux-spacemit package for Alpine
* cyyself/opensbi
* lu-zero/pi-linux
* Bianbu Linux Gitee
* sifive/freedom-u-sdk
* bianbu-linux/opensbi
* bianbu-linux/linux-6.6
* bianbu-linux/linux-6.1
== Revisions ==
There appears to be two revisions: one with a heatspreadder (FCCSP Package, 1.6 GHz) and the other without (FCBGA Package, 2.0 GHz)
== Picture ==
== GPIO / JTAG pinout ==
All operates on 3.3v.
PIN	GPIO	Function 	Function 	GPIO	PIN
1 	 	VCC3V3_SYS 	VCC5V0_OUT 	 	2
3 	52 	AP_I2C4_SDA	VCC5V0_OUT 	 	4
5 	51 	AP_I2C4_SCL	GND 	 	6
7 	70 	JTAG TDI 	R_UART0_TXD (N308)	47 	8
9 	 	GND 	R_UART0_RXD (N308)	48 	10
11 	71 	JTAG TMS 	 	74 	12
13 	72 	JTAG TCK 	GND 	 	14
15 	73 	JTAG TDO 	 	91 	16
17 	 	VCC3V3_SYS 	 	92 	18
19 	77 	SPI3_MOSI 	GND 	 	20
21 	78 	SPI3_MISO 	 	49 	22
23 	75 	SPI3_SCLK 	SPI3_CS 	76 	24
25 	 	GND 	 	50 	26
Func 	GPIO
UART0_TXD (X60)	68
UART0_RXD (X60)	69
GND 	
Func 	GPIO
LED 	96
FAN_PWM	79
== DIP switches ==
=== Front ===
QSPI_DATA1	QSPI_DATA0	Function
0 	0 	TF Card -> EMMC
1 	0 	TF Card -> SPI NOR
0 	1 	TF Card -> SPI NAND
1 	1 	TF Card -> SD
QSPI_DATA3	Function
0 	Normal boot
1 	Download mode
QSPI_DATA2	Function
0 	USB
1 	UART
=== Back ===
	
On some revisions there are pads on the back for a DIP switch.
1K resistor to VCC	1K resistor to VCC
JTAG_SEL 	Function
0 	GPIO (off)
1 	JTAG
10K resistor to GND	10K resistor to GND
MMC1_CMD 	Route
0 	X60
1 	N308
== Boot process ==
== Partition layout ==
=== PostmarketOS ===
This section needs expansion. You can help by adding to it. 
Name	Start	Size
 	 	
=== Bianbu Linux ===
==== emmc ====
Contains a protected boot0 area containing the FSBL. Seperate address spaces?
boot0 	boot0 	user_data	user_data	user_data	user_data 	user_data 	user_data 	user_data
 	 	gpt 	fsbl 	env 	opensbi 	uboot 	bootfs 	rootfs
bootinfo_emmc.bin	FSBL.bin	 	unused 	unused(?)	fw_dynamic.itb	u-boot.itb	bootfs.img: Image, kernel.dtb, env.txt, bootlogo	rootfs.img
==== sdcard ====
 	gpt	fsbl 	env 	opensbi 	uboot 	bootfs 	rootfs
bootinfo_sd.bin	 	FSBL.bin	env.bin	fw_dynamic.itb	u-boot.itb	bootfs.img: Image, kernel.dtb, env.txt, bootlogo	rootfs.img
Name 	Start	Size	Image
bootinfo	0K 	512 	factory/bootinfo_sd.bin
fsbl 	128K 	256K	factory/FSBL.bin
env 	384K 	64K 	env.bin
opensbi 	1M 	1M 	fw_dynamic.itb
uboot 	2M 	2M 	u-boot.itb
bootfs 	4M 	256M	bootfs.ext4
rootfs 	260M 	- 	rootfs.ext4
==== nor+ssd ====
 NOR flash
bootinfo 	fsbl 	env 	opensbi 	uboot
bootinfo_spinor.bin	FSBL.bin	env.bin	fw_dynamic.itb	u-boot.itb
 NVME SSD
gpt	bootfs 	rootfs
 	bootfs.img: Image, kernel.dtb, env.txt, bootlogo	rootfs.img
Firmware layout documentation
=== Bits of networks Debian ===
Partition	Start (LBA)	Size	Name
1 	256 	512 	unused
2 	768 	128 	env
3 	2048 	2048	opensbi
4 	4096 	4096	uboot
5 	8192 	400M	bootfs
6 	- 	- 	rootfs
== Boot-ROM and bootinfo data==
This section needs expansion. You can help by adding to it.
Bootinfo possibly contains the boot vector and info about memory protected area (size of boot0). Boot-ROM uses it to load the FSBL.
Inner-workings of the Boot-ROM seem to be fully undocumented.
The Boot-ROM might be related to sdfirm.
$ xxd bootinfo_sd.bin
00000000: f014 07b0 0100 0100 5344 4300 0000 0000 ........SDC.....
00000010: 0002 0000 0000 0100 0000 0010 0000 0000 ................
00000020: 0000 0200 0000 0800 0060 0300 0000 0000 .........`......
00000030: 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000040: 4df8 cc36 0000 0000 0000 0000 0000 0000 M..6............
$ xxd bootinfo_emmc.bin
00000000: f014 07b0 0100 0100 654d 4d43 0000 0000 ........eMMC....
00000010: 0002 0000 0000 0100 0000 0010 0000 0000 ................
00000020: 0002 0000 0000 0000 0060 0300 0000 0000 .........`......
00000030: 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000040: 67dc ac43 0000 0000 0000 0000 0000 0000 g..C............
$ xxd bootinfo_spinor.bin
00000000: f014 07b0 0100 0100 4e4f 5246 0000 0000 ........NORF....
00000010: 0001 0000 0000 0100 0000 1000 0000 0000 ................
00000020: 0000 0200 0000 0700 0060 0300 0000 0000 .........`......
00000030: 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000040: d945 f055 0000 0000 0000 0000 0000 0000 .E.U............
$ xxd bootinfo_spinand.bin
00000000: f014 07b0 0100 0100 4e41 4e44 0000 0000 ........NAND....
00000010: 0008 0000 0000 0200 0000 0010 0000 0000 ................
00000020: 0000 0200 0000 0800 0060 0300 0000 0000 .........`......
00000030: 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000040: 044f c948 0000 0000 0000 0000 0000 0000 .O.H............
=== Boot vectors ===
This section needs expansion. You can help by adding to it.
== FSBL ==
This section needs expansion. You can help by adding to it.
Seems to be U-Boot SPL.
== OpenSBI ==
This section needs expansion. You can help by adding to it.
== U-Boot ==
This section needs expansion. You can help by adding to it.
== Linux kernel ==
This section needs expansion. You can help by adding to it.
== See also ==
* SpacemiT Key Stone K1
=== Purchase links ===
* Taobao
* Aliexpress
* Aliexpress