May I ask if it is possible for DUO to start through SPI NAND

我这里有个SPI NAND模块,引出了CS DO CLK DI四个脚。模块上面有一个W25N01
请问如果要驱动这个模块,硬件和软件需要如何修改
I have an SPI NAND module here, which leads to the four legs of CS DO CLK DI. There is a W25N01 on the module

May I ask how to modify the hardware and software to drive this module

我觉得不妨参考下这个 简单的i2c oled 驱动尝试 - Duo - MilkV Community

I have been unable to get the CPU to recognize a W25N01 SPINAND, but it will recognize a W25Q256 SPINOR and boot into u-boot. I am not sure if there is a limited set of supported NANDs? Is there a method to get debug output during mask ROM boot?

1 Like

Are you asking if you want to boot the system from the SPI flash or boot the system from an SD card and then read data from the SPI flash?

Hi @Carbon,

The aim is to boot completely from SPI flash (NAND) in my case. Using my own crafted IOB I can boot from SPI NOR flash and use the SD for ‘upgrades’. I can even use the NOR to PXE boot. My official IOB v1.11 arrived today. Maybe that will reveal an error in my own PCB.

Is there a method to get debug output during mask ROM boot?

Answering my own question, I have determined the USB UART bridge plays a part here. I believe external pull-up resistors are needed to change the initial serial noise into boot ROM output. Changing from CH340 to CP2102 fixed this in my case.

Thanks!

1 Like

I’m sorry, we have not conducted any research on booting the system from SPI Flash. If you wish to implement this functionality, I recommend referring to the documentation provided by the CPU manufacturer to see if there are any relevant instructions available

https://developer.sophgo.com/thread/471.html

Hi @Carbon,

I have managed to boot from SPI NAND flash successfully now (Winbond W25N01GVxxIG 1Gbit). The only limitation was having to disable QSPI mode and use only x1 mode. I have pushed the relevant commit to github in case anybody is interested.

Thanks!

2 Likes

Hi, this sounds very interesting, could you share more detailed steps to the community?

Awesome, thank you for your research and sharing!

Hi @xiaomin,

Try building with commit 1f6e45b on this branch on github while I put something together for the hardware side. It’s currently on a breadboard and I have no spare NAND to rebuild on a custom PCB (currently used with NOR) or IOB.

Once the image is built you unzip the upgrade.zip file onto an SD/TF card and boot. Then cvi_update will run automatically and write to your SPI NAND. Then you can eject the SD and boot from NAND.

I did write code to read/write the NAND myself externally but never got it to boot this way. I am waiting for some new chips to arrive then I will try NAND on IOB.

Thanks.

Here’s a simple single-sided PCB you can build and try. Only tested with SPI NOR flash W25Q256 (32 MByte) so far. Use a jumper between the middle pin and your choice of NOR or NAND to choose :slight_smile:

image

1 Like

@ewp Cool, thank you for sharing

Is it possible to solder the SPI memory on USB&Ethernet IOB board?

Schematics indicates this is the place for SPI NAND flash. I will try it when my new chips arrive.

image

Thanks for tip @ewp :grinning:

For information, I tested the same PCB (a second home-made board) with SPINAND flash (W25N01) and that also works as expected.

U-Boot

DRAM:  63.3 MiB
gd->relocaddr=0x823e4000. offset=0x21e4000
NAND:  Device ID : 0xef 0xaa 0x21  Model: W25N01GVxxIG
Tuning SPINAND run on maximum speed...
fip_info[0] total count=4

Linux

[root@milkv]~# mtdinfo 
Count of MTD devices:           8
Present MTD devices:            mtd0, mtd1, mtd2, mtd3, mtd4, mtd5, mtd6, mtd7
Sysfs interface supported:      yes
2 Likes

@ewp Are you using your fork for SPI NAND test? GitHub - ewpa/duo-buildroot-sdk: Milk-V Duo Official buildroot SDK.

Yes, that’s what I am using currently for SPI NAND.

hi,
my IOB cannot recognize w25n01gvzeig in u-boot, but I found that the ubboot driver has this NAND. How did you solve this problem? The device ID read by the u-boot is 0xff 0xff. Is there a problem with the driver?

Have you disabled Quad SPI support in U-Boot before attempting?