Boot switches ignored when NVME and eMMC present

I run into strange problem today. All my boards have NVME drives. I added eMMC to one of them and everything worked as expected, I could switch between boot targets by flipping correct switch. That board is version 1.2A, and all media has 202308 images. Today I added eMMC to two other boards, which happened to be version 1.3B. Again all the latest images. eMMC worked as expected on these boards as well. However when I flipped boot switches on these two boards to NVME they kept booting from eMMC. Serial output was very confusing - it first tried to boot from eMMC and failed, followed with trying to boot from NVME and failed, then switched back to eMMC and boot succeeded. I removed the eMMC module and it booted from NVME.

Has anyone run into this problem? I’d rather not keep removing and reattaching the eMMC. In the worst case is there some Uboot command to direct the boot to specific device?

If it any help below is relevant part of boot log.

StarFive # bootd
Card did not respond to voltage select! : -110
switch to partitions #0, OK
mmc0(part 0) is current device
Try booting from MMC0 …
Failed to load ‘vf2_uEnv.txt’
Info: input data size = 485 = 0x1E5
Error: “boot2” not defined
starfive_pcie pcie@2B000000: Starfive PCIe bus probed.
PCI: Failed autoconfig bar 10
starfive_pcie pcie@2C000000: Starfive PCIe bus probed.
PCI: Failed autoconfig bar 10

Device 0: Vendor: 0x126f Rev: V0926A0 Prod: P300ABCB2302102024
Type: Hard Disk
Capacity: 488386.3 MB = 476.9 GB (1000215216 x 512)
… is now current device
Try booting from NVME0 …
Failed to load ‘vf2_uEnv.txt’
Info: input data size = 485 = 0x1E5
Error: “boot2” not defined

Device 0: Vendor: 0x126f Rev: V0926A0 Prod: P300ABCB2302102024
Type: Hard Disk
Capacity: 488386.3 MB = 476.9 GB (1000215216 x 512)
… is now current device
Try booting from NVME0 …
Failed to load ‘vf2_uEnv.txt’
Info: input data size = 485 = 0x1E5
Error: “boot2” not defined
Tring booting distro …
Card did not respond to voltage select! : -110
switch to partitions #0, OK
mmc0(part 0) is current device
Try booting from MMC0 …
406 bytes read in 5 ms (79.1 KiB/s)
Warning: defaulting to text format
52677 bytes read in 8 ms (6.3 MiB/s)
libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND
libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND
libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND
libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND
52677 bytes written in 13 ms (3.9 MiB/s)
Retrieving file: /extlinux/extlinux.conf
792 bytes read in 6 ms (128.9 KiB/s)
U-Boot menu
1: Debian GNU/Linux bookworm/sid 5.15.0-starfive
2: Debian GNU/Linux bookworm/sid 5.15.0-starfive (rescue target)

I would read the note on this page or the document history for a date (2023-07-14) when this change happened. And then look at the new boot flow priority. The only thing that I can think of is that maybe you have a power issue using both eMMC and NVMe that your power supply is just barely enough to supply both with their peak requirements nearly simultaneously.
EDIT: After reading the VisionFive 2 Errata Sheet (link below), it is probably a hardware issue with the JH7110, which can only be fixed by new silicon (e.g. JH8100). So it looks like booting from MicroSD cards and eMMC are depreciated, that booting should only be from UART or QSPI NOR FLASH.

Oh and this “StarFive recommends that you use 1-bit QSPI Nor Flash or UART mode since there is a low possibility that the VisionFive 2 may fail to boot in eMMC or SDIO3.0 boot mode. For more details, refer to eMMC/SDIO3.0 boot issue section in VisionFive 2 Errata Sheet.”

?
VF2 is not have NVME boot select…
It is boot from QSPI boot.
But QSPI code seems boot to NVME mainly . It is not write boot choosen in code.
If you want boot from emmc , use the emmc mode and keep emmc have its spl/uboot code.

PS: The best choosen is have a Setup Screen in uboot. (Like x86’s BIOS/UEFI.) The second choosen is have a cmdline tools in Linux, Like efibootmgr . But those are needed StarFive write the features.

Thanks for your help and all the pointers to docs. It’s too bad about recommendation of not booting from SD/eMMC. I’m using this board for work project and why I use NVME SSD for speed of development the idea was to use eMMC for final product. One thing that I noticed is that boot priority listed as NVMe > SD > eMMC. But in my case it boots from eMMC first.

1 Like

You can still boot from them, but it looks like the recommended, most reliable, way is now via the QSPI NOR flash. At a guess it is because the code loaded from QSPI can retry if there is a delayed response, or if parameters like clock frequencies need to be decreased the code can also deal with that (I’m just guessing here, I have not read the source code to see what it is really doing - yet).

1 Like

There are four options for the boot switch:

*) SD-card boot: Here the first boot is from ROM then handover to SD card boot sector with u-boot and forward-payload, which could theoretically be anything that the ROM can handover to.

*) e-MMC boot: same here like with SD

*) UART boot: the ROM hands over to UART interface

*) QSPI flash: is usually filled with u-boot and forward-payload, but could also be anything the ROM can hand over to.

The question here is really: What is the ROM exactly doing?

The mix-up between the boot modes is simply an inaccuracy in the separation between primary boot loader stage and secondary boot loader stage, which is caused by the complicated boot procedure with u-boot and OpenSBI.

ref: https://doc-en.rvspace.org/VisionFive2/Boot_UG/JH7110_SDK/c_preface_bug.html
“StarFive no longer recommends JH-7110 users to boot directly from SD card and eMMC”
ref: https://doc-en.rvspace.org//VisionFive2/Errata/VisionFive2_Errata/overview.html

No. Issue Affected Device Planned Fix
5 eMMC/SDIO3.0 boot issue Visionfive 2 StarFive next generation SoC

ref: https://doc-en.rvspace.org/JH7110/JH7110_Errata/JH7110_EVB/usb_boot.html
“For JH-7110, booting from SD card or eMMC is no longer recommended. Please be aware of this change when designing your device based on JH-7110.”

Apparently I was wrong about boot sequence. The doc now states:

System will detect in sequence whether it can boot from the following device sequence: SD > eMMC > NVMe. For example, if the boot program is found on the SD, eMMC will be ignored.

It appears that to be able to boot from NVME I need to remove MMC.

1 Like

It was revision 1.2 last time I linked to it now it is 1.3 so it has been updated (2023-09-07).

You may be able to enter the u-boot environment, inspect all the variables and modify the boot order to be the reverse. And “env save” to permanent storage after testing that your customised solution works (a few times).