Skip to content
View in the app

A better way to browse. Learn more.

Armbian Community Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

SPI flash boot doesn't work

Featured Replies

On 12/23/2020 at 12:54 PM, Panzerknacker said:

Boot from SPI directly to NVME works:

 

Latest U-Boot v2021.01-rc4 + this patch:

rockchip: roc-pc-rk3399: fix boot from SPI flash on spi1

https://patchwork.kernel.org/project/linux-rockchip/list/?series=403611

 

To build uboot on roc-pc:

make roc-pc-mezzanine-rk3399_defconfig
make -j6
./tools/mkimage -n rk3399 -T rkspi -d tpl/u-boot-tpl.bin:spl/u-boot-spl.bin idbloader-spi.img

 

To deploy uboot on spi:

dd if=idbloader-spi.img of=spi.img

                  (#0x60000 = 393216 = 4096 * 96)

dd if=u-boot.itb of=spi.img bs=4096 seek=96

flashcp -v spi.img /dev/mtd0

 

According to this, to run u-boot from flash I just need latest u-boot, apply patch from the link (CONFIG_SF_DEFAULT_BUS=1), copy config to .config, build it, flash it to SPI and it should work?

I did that and for my SOM-RK3399v2 (I have added SPI flash 16 MB chip to it), it starts to boot and it got stuck on line:

Trying to boot from SPI

 

I am trying for weeks, tried various .configs/OFFSets/various config options/printf debugging/... , various binary files (for RockPro64, PineBook Pro, Roc-PC, etc) and same error. U-boot flashed to SD/eMMC works. SPI flash works in Linux:

Quote

mtdinfo /dev/mtd0
mtd0
Name:                           spi0.0
Type:                           nor
Eraseblock size:                4096 bytes, 4.0 KiB
Amount of eraseblocks:          4096 (16777216 bytes, 16.0 MiB)
Minimum input/output unit size: 1 byte
Sub-page size:                  1 byte
Character device major/minor:   90:0
Bad blocks are allowed:         false
Device is writable:             true

 

Solved by jsorocil

  • Author
  • Solution

Finally found the problem - HW "issue". My SPI flash is not soldered (no place on motherboard) - it is connected with wires which are (presumably) too long. Workaround is to reduce SPI speed in u-boot and Linux.

 

U-boot:


diff --git a/arch/arm/dts/rk3399-rockpro64.dtsi b/arch/arm/dts/rk3399-rockpro64.dtsi
index 9bca258012..797dd80d38 100644
--- a/arch/arm/dts/rk3399-rockpro64.dtsi
+++ b/arch/arm/dts/rk3399-rockpro64.dtsi
@@ -677,7 +677,7 @@
        flash@0 {
                compatible = "jedec,spi-nor";
                reg = <0>;
-               spi-max-frequency = <10000000>;
+               spi-max-frequency = <1000000>;
        };
 };

 

Linux:

Recompile your device tree with reduced SPI speed:


        flash@0 {
                compatible = "jedec,spi-nor";
                reg = <0>;
-               spi-max-frequency = <10000000>;
+               spi-max-frequency = <1000000>;
        };

Guest
This topic is now closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.