Mikhail Kshevetskiy Posted July 3, 2023 Share Posted July 3, 2023 A lot of spi-nand flashes is supported linux kernel. It will be very helpful to add a possibility to read/write/erase such flashes using standard linux support. Unfortunately spi-nand support is not enabled in armbian linux kernel. example: recovery bootloader on the router board Orange Pi 4 configuration 1. Recompile orange pi 4 linux kernel to enable spi-nand driver (linux-5.10 or above is required). Make sure spinand, mtd and nandcore are built as modules 2. sudo armbian-config, go to “System → DTC” and replace spidev with spinand 3. install the following packages: mtd-utils 4. reboot board to apply changes Connect spi-nand chip to orange pi4 board Testpoint Meaning Where to connect 3.3V 3.3V power supply pin 17 of orange pi 4 connector DI SPI Data In pin 19 of orange pi 4 connector DO SPI Data Out pin 21 of orange pi 4 connector CLK SPI Clock pin 23 of orange pi 4 connector GND Ground pin 25 of orange pi 4connector CS# SPI Chip Select pin 24 of orange pi 4 connector WP# Write Protect short with HOLD# and 3.3V testpoints HOLD# Hold short with WP# and 3.3V testpoints restart spinand and mtd modules rmmod ofpart spinand mtd nandcore modprobe spinand modprobe mtd make sure the flash was detected dmesg | tail -n 6 [ 237.055291] spi-nand: probe of spi0.0 failed with error -524 [ 383.913569] spi-id: 00, ef, aa, 21 [ 383.913729] spi-id: ef, aa, 21, 00 [ 383.913878] spi-id: ef, aa, 21, 00 [ 383.913936] spi-nand spi0.0: Winbond SPI NAND was found. [ 383.913965] spi-nand spi0.0: 128 MiB, block size: 128 KiB, page size: 2048, OOB size: 64 Recovering bootloader Add partitions of your choice using mtdpart add /dev/mtd0 <PART_NAME> Erase & flash partition flash_erase /dev/mtd 0 0 nandwrite /dev/mtd image_file Disconnect flash from orange pi board and test it 0 Quote Link to comment Share on other sites More sharing options...
Solution Igor Posted September 28, 2023 Solution Share Posted September 28, 2023 On 7/3/2023 at 2:43 AM, Mikhail Kshevetskiy said: Unfortunately spi-nand support is not enabled in armbian linux kernel Here are kernel configs for all kernels. I am sure its easy to find correct ones: https://github.com/armbian/build/tree/main/config/kernel Enable and sent a PR. 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.