Orange Pi Zero Plus spi nor flash - anyone know how to configure for booting


Recommended Posts

25 minutes ago, g40 said:

Does the DT control which USB interface is used? Repeating the exercise above with a card plugged into USB 2 or 3 does not work.

If USB1 work, but not USB2 and USB3, I don't know where is the issue since I've enabled all of them in DT.

In U-Boot command prompt, what "usb info" is reporting after having done "usb reset" ?

Link to post
Share on other sites
Donate and support the project!

Hello Martin

 

u-boot is detecting the OHCI/EHCI controllers. But it is only finding storage attached to USB0. In this case a USB=>SD card adapter.  If I swap the thumb drive into USB0 and and SD adapter into USB2 or 4, it gets correctly identified. It's slightly annoying but definitely not a show-stopper.

 

=> usb reset
resetting USB...
EHCI failed to shut down host controller.
EHCI failed to shut down host controller.
USB0:   USB EHCI 1.00
USB1:   USB OHCI 1.0
USB2:   USB EHCI 1.00
USB3:   USB OHCI 1.0
USB4:   USB EHCI 1.00
USB5:   USB OHCI 1.0
scanning bus 0 for devices... 2 USB Device(s) found
scanning bus 2 for devices... 1 USB Device(s) found
scanning bus 4 for devices... 1 USB Device(s) found
       scanning usb for storage devices... 1 Storage Device(s) found

=> usb storage
  Device 0: Vendor: Mass     Rev: 1.00 Prod: Storage Device
            Type: Removable Hard Disk
            Capacity: 7580.0 MB = 7.4 GB (15523840 x 512)

=> usb storage
  Device 0: Vendor: SanDisk Rev: 1.00 Prod: Cruzer Blade
            Type: Removable Hard Disk
            Capacity: 7632.0 MB = 7.4 GB (15630336 x 512)

 

Link to post
Share on other sites
On 1/1/2019 at 2:18 PM, martinayotte said:

I will investigate when I get chance, time is the missing ingredient ...

 

Hi Martin

 

I've been playing with the 2018.11 release of U-Boot. The problem with not finding USB devices on busses > 0 seems to have been fixed. Annoyingly the device tree has been completely revised so there is a deal of patching to be done.

 

I also got u-boot network support enabled in 2018.05 with some device tree changes. 

 

I'll try and get patches out  in due course. LMK if you'd like the changes.

 

Thanks for all the help. 

Link to post
Share on other sites
On 10/22/2018 at 12:40 AM, markbirss said:

Here what I did with a recent ARMBIAN 5.64 user-built Ubuntu 18.04.1 to flash the mx25l1606e (2048 Kbytes) spi flash with u-boot-sunxi-with-spl.bin

Thanks for the instruction :)
WIth these I did flash today my 2 Opi Zero with 
/usr/lib/linux-u-boot-dev-orangepizero_5.77_armhf/u-boot-sunxi-with-spl.bin

(which I did build with the armbian-build-system today).

Now this is my first testdrive to boot armbian from a usb-port :) before this I did only boot from MicroSD or eMMC on ther boards.

 

Flashing went OK, but for comparing I couldnt use 

mtd_debug read /dev/mtd0 0 404407 ./current.bin

because this gives me a 

Segmentation fault
( mtd-utils                           1:2.0.0-1                         armhf        Memory Technology Device Utilities )

 

So for creating the file for compare I did use the following command succesfull:
dd if=/dev/mtd0  bs=1 count=404407 of=./current.bin


then the compare also went OK:
cmp  /usr/lib/linux-u-boot-dev-orangepizero_5.77_armhf/u-boot-sunxi-with-spl.bin ./current.bin

 

As Info: the Zero seems to need more power for the USB-Drive (16GB USB 3.0 SanDisk  Ultra Fit), because with the normal USB-Power I do use the Zero does disappear from the network after some time :(

 

Link to post
Share on other sites

@c.man I rechecked the instructions from markbirss he wrote at October 22, 2018 in this thread today against my OrangePi R1 and it works like a charme to boot

via spi-flash (as u-boot) from USB (so your USB msata should also work):

 

Add overlay:
spi-jedec-nor
to

 /boot/armbianEnv.txt
overlays=pi-jedec-nor

(or complete by an OPi R1: overlays=analog-codec spi-jedec-nor usbhost2 usbhost3 )

via armbin-config -> system -> hardware

 

Install mtd-utils:
apt install mtd-utils

Verify existence of the mtd device (will only work if your board actually has a supported spi chip)
mtd_debug info /dev/mtd0:
 

mtd.type = MTD_NORFLASH
mtd.flags = MTD_CAP_NORFLASH
mtd.size = 16777216 (16M)
mtd.erasesize = 65536 (64K)
mtd.writesize = 1
mtd.oobsize = 0
regions = 0

 

Erase the mtd device
flash_erase /dev/mtd0 0 256
--> Erasing 64 Kibyte @ ff0000 -- 100 % complete

 

Find the local "u-boot-sunxi-with-spl.bin" and it's size in bytes (455007)
find / -name u-boot-sunxi-with-spl.bin
--> /usr/lib/linux-u-boot-dev-orangepi-r1_20.05.0-trunk_armhf/u-boot-sunxi-with-spl.bin

 

ls -l /usr/lib/linux-u-boot-dev-orangepi-r1_20.05.0-trunk_armhf/u-boot-sunxi-with-spl.bin
--> -rw-rw-r-- 1 root root 455007 Mai 25 14:46
/usr/lib/linux-u-boot-dev-orangepi-r1_20.05.0-trunk_armhf/u-boot-sunxi-with-spl.bin

 

Write the local u-boot-sunxi-with-spl.bin to the mtd device
nandwrite -p /dev/mtd0 /usr/lib/linux-u-boot-dev-orangepi-r1_20.05.0-trunk_armhf/u-boot-sunxi-with-spl.bin

Writing data to block 0 at offset 0x0
Writing data to block 1 at offset 0x10000
Writing data to block 2 at offset 0x20000
Writing data to block 3 at offset 0x30000
Writing data to block 4 at offset 0x40000
Writing data to block 5 at offset 0x50000
Writing data to block 6 at offset 0x60000

 

Write the mtd device to a local file to compare with local u-boot-sunxi-with-spl.bin

(using the size of bytes the u-boot file used 455007)
mtd_debug read /dev/mtd0 0 455007 current.bin
--> Copied 455007 bytes from address 0x00000000 in flash to current.bin

 

Compare the current.bin with the local /usr/lib/linux-u-boot-next-orangepizero_5.64_armhf/u-boot-sunxi-with-spl.bin
cmp /usr/lib/linux-u-boot-dev-orangepi-r1_20.05.0-trunk_armhf/u-boot-sunxi-with-spl.bin ./current.bin

--> No Output compares OK ;)

 

If that is OK - then power off, remove sdcard, write normal armbian-image to usb (if usb-stick or write the image before boot with dd to your msata device).

If USB-Stick insert it in USB-Port and start your device.

Now you will see it boot from USB (as in these hidden Messages):
 

Spoiler

U-Boot SPL 2020.04-armbian (May 25 2020 - 14:45:50 +0300)
DRAM: 256 MiB
Trying to boot from sunxi SPI


U-Boot 2020.04-armbian (May 25 2020 - 14:45:50 +0300) Allwinner Technology

CPU:   Allwinner H3 (SUN8I 1680)
Model: Xunlong Orange Pi R1
DRAM:  256 MiB
MMC:   mmc@1c0f000: 0, mmc@1c10000: 1
Loading Environment from FAT... MMC: no card present
In:    serial
Out:   serial
Err:   serial
Net:   phy interface0
eth0: ethernet@1c30000
starting USB...
Bus usb@1c1a000: USB EHCI 1.00
Bus usb@1c1a400: USB OHCI 1.0
Bus usb@1c1b000: USB EHCI 1.00
Bus usb@1c1c000: USB EHCI 1.00
Bus usb@1c1c400: USB OHCI 1.0
scanning bus usb@1c1a000 for devices... 1 USB Device(s) found
scanning bus usb@1c1a400 for devices... 1 USB Device(s) found
scanning bus usb@1c1b000 for devices... 1 USB Device(s) found
scanning bus usb@1c1c000 for devices... 2 USB Device(s) found
scanning bus usb@1c1c400 for devices... 1 USB Device(s) found
       scanning usb for storage devices... 1 Storage Device(s) found
Autoboot in 1 seconds, press <Space> to stop
MMC: no card present

Device 0: Vendor: SanDisk Rev: 1.00 Prod: Ultra Fit
            Type: Removable Hard Disk
            Capacity: 14832.0 MB = 14.4 GB (30375936 x 512)
... is now current device
Scanning usb 0:1...
Found U-Boot script /boot/boot.scr
3789 bytes read in 8 ms (461.9 KiB/s)
## Executing script at 43100000
U-boot loaded from SPI
Boot script loaded from usb
181 bytes read in 8 ms (21.5 KiB/s)
12460445 bytes read in 317 ms (37.5 MiB/s)
7446528 bytes read in 189 ms (37.6 MiB/s)
Found mainline kernel configuration
30841 bytes read in 10 ms (2.9 MiB/s)
504 bytes read in 11 ms (43.9 KiB/s)
Applying kernel provided DT overlay sun8i-h3-usbhost2.dtbo
504 bytes read in 12 ms (41 KiB/s)
Applying kernel provided DT overlay sun8i-h3-usbhost3.dtbo
4185 bytes read in 11 ms (371.1 KiB/s)
Applying kernel provided DT fixup script (sun8i-h3-fixup.scr)
## Executing script at 44000000
## Loading init Ramdisk from Legacy Image at 43300000 ...
   Image Name:   uInitrd
   Image Type:   ARM Linux RAMDisk Image (gzip compressed)
   Data Size:    12460381 Bytes = 11.9 MiB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
## Flattened Device Tree blob at 43000000
   Booting using the fdt blob at 0x43000000
EHCI failed to shut down host controller.
   Loading Ramdisk to 4941d000, end 49fff15d ... OK
   Loading Device Tree to 493ad000, end 4941cfff ... OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
...
[  OK  ] Started Getty on tty1.
[  OK  ] Started Serial Getty on ttyGS0.
[  OK  ] Started Serial Getty on ttyS0.
[  OK  ] Reached target Login Prompts.
[  OK  ] Reached target Multi-User System.
[  OK  ] Reached target Graphical Interface.
         Starting Update UTMP about System Runlevel Changes...
[  OK  ] Finished Update UTMP about System Runlevel Changes.

Armbian 20.05.0-trunk Focal ttyS0

orangepi-r1 login:
 

 

Link to post
Share on other sites

Hi, sorry if this is considered a necro bump.

 

I just received the Orange Pi Zero Plus H5, as it was seemingly out of production earlier this year. I have tried building u-boot from mainline (using v2020.07 and v2020.04) and both fail with the following error (SPI or FEL booting):

U-Boot SPL 2020.04-dirty (Sep 27 2020 - 20:11:48 +0000)
DRAM: 512 MiB
SPL: Unsupported Boot Device!
SPL: failed to boot from all boot devices
### ERROR ### Please RESET the board ###

 

Since I have read about people flashing u-boot from Armbian, I thought I would try FEL booting the u-boot included in the Armbian Focal image. Same deal:
 

U-Boot SPL 2020.04-armbian (Sep 02 2020 - 10:37:42 +0200)
DRAM: 512 MiB
SPL: Unsupported Boot Device!
SPL: failed to boot from all boot devices
### ERROR ### Please RESET the board ###

 

Yes, I did replace the Macronix 16MBit with Winbond 128MBit (25Q128FVSG), but I don't think this is the cause of my issues as they should both implement the same JEDEC commands.

 

Is u-boot SPI booting on the H5 just broken in recent u-boot releases? Or am I doing something fundamentally wrong?

I've spent many hours trying different u-boot configuration options (e.g. CONFIG_SPL_NOR_SUPPORT, CONFIG_SPL_SPI_SUPPORT, CONFIG_SPI_FLASH, etc),  and I cannot figure out why it's broken. The dts is correct, and according to all the documentation I can find, the defconfig should be sufficient to support loading u-boot from SPI.

Link to post
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...