@ewp Oh, QSPI is not set. My W25Q256 SPI NOR FLASH is normal. May I know where it is set?
Hi @xiaomin,
I soldered W25N02KV onto IOB and tested. Here is the abbreviated output from U-Boot.
U-Boot 2021.10 (Oct 05 2023 - 19:50:02 +0100) cvitek_cv180x
DRAM: 63.3 MiB
NAND: Init SPI Nand Flash Controller ... cvsnfc_read_byte read data 0x22aaef, offset 0
Device ID : 0xef 0xaa 0x22 Model: W25N02KV
SPI NAND device support plane bit ! chip->options 0x1400
====== SPI NAND INFO ======
model name: W25N02KV, MID=0xef, DID=0xaa 0x22
chip size=256MB, diesize=0MB, erase size=128KB
page size=2KB, oob size=128B, badblock_pos=0x2, flags=0xc
ECC enable offset=0xb0, ECC_EN mask=0x10, STATUS offset=0xc0, STATUS mask=0x30
device found, Manufacturer ID: 0xef, Chip ID: 0xaa
Unknown W25N02KV
256 MiB, MLC, erase size: 128 KiB, page size: 2048, OOB size: 128
Tuning SPINAND run on maximum speed...
This was U-Boot I built from my branch develop+4
on github. After building, I unzipped upgrade.zip onto an SD Card and booted. With the above, direct boot from NAND is failing. Maybe I will try with W25N01GV. I have one of those with a known good image flashed already.
WD.C.SCS/0/0.WD.URPL.USBI.BS/NOR.PS. E:PARAM1 magic (0x448504946)
PS. E:PARAM1 magic (0x0)
PS. E:PARAM1 magic (0xffffffffffffffff)
PS. E:PARAM1 magic (0xffffffffffffffff)
PS. E:PARAM1 magic (0x448504946)
PS. E:PARAM1 magic (0x0)
PS. E:PARAM1 magic (0xffffffffffffffff)
PS. E:PARAM1 magic (0xffffffffffffffff)
E:Boot failed (8).
E:ra=0x440a264
E:RESET:panic:-1
In your case the 0xFF suggests the bus is reading high all the time, perhaps a soldering issue only? Was the W25Q256 testing okay on the IOB? If IOB is configured for NOR it should not boot NAND.
I see this error with W25N01GV on IOB:
unrecognized device id!!!
Device ID : 0xff 0xff
drivers/mtd/nand/raw/cvitek/cvsnfc.c(864): BUG: Hardware configuration error.Please configure SPI Nand Flash pagesize and ecctype!
Strange. I will see if I can find more time for investigation.
I soldered the W25N02KV back onto my own breakout board, and the Duo booted directly from the SPI NAND. So the issue somehow is how I am using the IOB. I suspect the IOB is wired for SPI NOR, though the schematics show SPI NAND.
I am on my self-made IOB board, and the manual says that the difference between nand and nor startup is whether the SPI MOSI pin uses pull-up resistance or pull-down resistance. I use nand configuration (pull-down) for one board and nor configuration (pull-up) for the other, and the welded W25Q256JVEIQ in the nor configuration can start normally. The welded W25N01GVZEIG in the nand configuration shows that nand cannot be recognized, and the ID read is 0xff, 0xff.
unrecognized device id!!!
Device ID : 0xff 0xff
drivers/mtd/nand/raw/cvitek/cvsnfc.c(864): BUG: Hardware configuration error.Please configure SPI Nand Flash pagesize and ecctype!
And the other nor flash is very normal.
My hardware should be designed correctly.my hardware should be designed correctly because w25q256 and w25n01 have the same pins
Hi @xiaomin after reflowing, I get this on serial output on IOB:
Device ID : 0xef 0xaa 0x21 Model: W25N01GVxxIG
SPI NAND device support plane bit ! chip->options 0x1400
====== SPI NAND INFO ======
model name: W25N01GVxxIG, MID=0xef, DID=0xaa 0x21
chip size=128MB, diesize=0MB, erase size=128KB
page size=2KB, oob size=64B, badblock_pos=0x2, flags=0xc
So in my case it was a soldering issue.
But booting direct from NAND still fails. The BL log suggests to me the IOB is configured for NOR rather than NAND:
WD.C.SCS/0/0.WD.URPL.USBI.BS/NOR.PS. E:PARAM1 magic (0x448504946)
On my board that works with NAND I see this:
WD.URPL.USBI.BS/NAND.PS.PE.BS.BE.J
Your print looks like uboot has recognized w25n02, but there seems to be some issues with the driver.
Okay, thank you. I also need to check the welding issues with my NAND configuration board
Agreed, on my board I just change 4k7 pull up on MOSI to 4k7 pull-down and NAND just works. Your schematic looks the same to me.
Some ideas:
- What does the bootloader log show with no SD card inserted?
- Are you rebuilding with the
milkv-duospinand
board variant? - Any info in U-Boot when adding
CONFIG_LOGLEVEL=7
tobuild/boards/cv180x/cv1800b_milkv_duo_spinand/u-boot/cvitek_cv1800b_milkv_duo_spinand_defconfig
?
For information, I soldered W25Q256 SPI NOR to official IOB and can boot directly using that without any SD Card. I find it useful to put a PXE boot on NOR since an NFS root filesystem permits a faster development turn-around.
The official IOB board does not have a welding resistance pulled up to 3.3V, so it defaults to NOR.
Hi, I encountered a strange problem. uboot recognized nand and I have updated fip, boot, and rootfs to nand. However, after uboot started Linux, it seems that Linux did not recognize nand. I have added nand’s device information to the device tree. Have you ever encountered this problem?
No, I have not seen that. In case it’s useful, here are some of my settings.
U-Boot.
cv180x_c906# printenv
mtdids=nand0=cvsnfc
root=ubi.mtd=ROOTFS ubi.block=0,0 root=/dev/ubiblock0_0 rootfstype=squashfs
mtdparts=mtdparts=cvsnfc:2560K(fip),6144K(BOOT),128K(ENV),128K(ENV_BAK),71680K(ROOTFS),20480K(SYSTEM),4096K(CFG),-(DATA)
nandboot=setenv bootargs ${root} ${mtdparts} console=$consoledev,$baudrate $othbootargs;nand read ${uImage_addr} BOOT;mw.l 4330058 1 1; md.l 4330058 1; mw.l 3000154 0 1;bootm ${uImage_addr}#config-cv1800b_milkv_duo_spinand;
Linux
[ 0.000000] Kernel command line: ubi.mtd=ROOTFS ubi.block=0,0 root=/dev/ubiblock0_0 rootfstype=squashfs mtdparts=cvsnfc:2560K(fip),6144K(BOOT),128K(ENV),128K(ENV_BAK),71680K(ROOTFS),20480K(SYSTEM),4096K(CFG),-(DATA) console=ttyS0,115200 earlycon=sbi loglevel=9 riscv.fwsz=0x80000
[ 0.600955] cvsnfc 4060000.cv-spinf: IRQ: nr 12
[ 0.606469] SPI Nand ID Table Version 1.4
[ 0.610690] nand: device found, Manufacturer ID: 0xef, Chip ID: 0xaa
[ 0.617321] nand: Winbond W25N02KV
[ 0.620879] nand: 256 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
[ 0.628726] mtd->bitflip_threshold 6
[ 0.632992] Bad block table found at page 131008, version 0x01
[ 0.639309] Bad block table found at page 130944, version 0x01
[ 0.645720] spi_nand_tsb_set_ecc_detect_bits set detect bits 0x8
[ 0.651985] orginal BFD 128
[ 0.654926] new BFD 128
[ 0.657489] 8 cmdlinepart partitions found on MTD device cvsnfc
[ 0.663637] Creating 8 MTD partitions on "cvsnfc":
[ 0.668623] 0x000000000000-0x000000280000 : "fip"
[ 0.675825] 0x000000280000-0x000000880000 : "BOOT"
[ 0.683053] 0x000000880000-0x0000008a0000 : "ENV"
[ 0.690210] 0x0000008a0000-0x0000008c0000 : "ENV_BAK"
[ 0.697599] 0x0000008c0000-0x000004ec0000 : "ROOTFS"
[ 0.705192] 0x000004ec0000-0x0000062c0000 : "SYSTEM"
[ 0.712616] 0x0000062c0000-0x0000066c0000 : "CFG"
[ 0.719781] 0x0000066c0000-0x000010000000 : "DATA"
[root@milkv-duo]~# cat /proc/cmdline
ubi.mtd=ROOTFS ubi.block=0,0 root=/dev/ubiblock0_0 rootfstype=squashfs mtdparts=cvsnfc:2560K(fip),6144K(BOOT),128K(ENV),128K(ENV_BAK),71680K(ROOTFS),20480K(SYSTEM),4096K(CFG),-(DATA) console=ttyS0,115200 earlycon=sbi loglevel=9 riscv.fwsz=0x80000
[root@milkv-duo]~# mtdinfo
Count of MTD devices: 8
Present MTD devices: mtd0, mtd1, mtd2, mtd3, mtd4, mtd5, mtd6, mtd7
Sysfs interface supported: yes
I don’t see cvi-spif
in the boot logs. Is your device tree selecting a different SPI driver to mine?
@ewp
I use your github’s build/boards/cv180x/cv1800b_ Milkv_ Duo_ Spinand/Linux/vitek_ CV1800b_ Milkv_ Duo_ Spinand_ The configuration file of defconfig can also run normally, it looks like my Linux cvitek_ CV1800b_ Milkv_ Duo_ Spinand_ There is an issue with the defconfig configuration. My uboot did not make any code modifications, and 4x is also normal.
Did you disable 4x? I had reliability issues using it.
@ewp I haven’t modified that part of the code, so I haven’t found any issues yet. Maybe I need to test for more time to confirm if there are any stability issues
Thanks @xiaomin. I would also be interested if your builds have write access to NAND (via UBI). I have not spent much time on that so far.
I have tried using a readable and writable image of the yaffs2 file system, but encountered some issues during the boot process. At present, the official example only generates Squashfs format.
@ewp
I have studied the official settings. For device stability, the root file system partition in Nand is set to a read-only file system, but the system and data are ubi read-write partitions, and a corresponding directory is required to successfully mount. I mounted the system to opt and the data to/mnt/data. Currently, both read and write data are stored in these two areas. It can also be packaged and upgraded through data and system partitioning.