chipyard vcu118 prototype & linux boot continuously failed

224 views
Skip to first unread message

韩丰泽

unread,
Jan 27, 2025, 12:53:42 PMJan 27
to Chipyard
I'm following chipyard doc prototype guide

and baremetal-ide sdcard setup guide 


trying to prototype on vcu118 and boot linux from sdcard

however, after multiple attempts, all I got is sdcard timeout error message
屏幕截图 2025-01-25 004535.png

For FPGA synthesis step, I use command
make SUB_PROJECT=vcu118 CONFIG=RocketVCU118Config

after Vivado syn&impl complete, I got bitstream file(VCU118FPGATestHarness.bit), also checked the generated xdc file
屏幕截图 2025-01-25 005248.png
looks good to me

and I tried to build vcu118fpga linux image following baremetal-ide guides:


building linux images is not successful due to failed downloading img file:

屏幕截图 2025-01-25 010014.png

I checked the github repo, indeed no such files exist called br.b8b4.img


But I found there is a "br-base" default pre-built bin image in my firemarshal folder, located at

chipyard/software/firemarshal/images/firechip/br-base/br-base-bin-nodisk-flat

I assume this may work as well? I use spike simulator to run br-base-bin-nodisk-flat, it works out.

so I flash this "br-base-bin-nodisk-flat" bin file to the sdcard, insert sdcard to "pmod2microsd" module and plug to pmod port for vcu118.

also, flash the bitstream file to vcu118 board.

the who hardware setup looks like this:

微信图片_20250125011347.jpg
for my pmod module:
微信图片_20250125011448.jpg

for sd card, I use SanDisk Ultra Micro SD card, just the same as baremetal-ide doc recommended


I've been failed for so many times, really discouraged. why I always get message after press reset button:

INIT
CMD0
sd_cmd: timeout
ERROR

looking forward to somebody who can help me.

Amirmohammad Nazari

unread,
Jun 2, 2025, 6:42:39 PMJun 2
to Chipyard
Hi, 

I have encountered the same issue. Have you been able to solve it yet?

Amirmohammad Nazari

unread,
Jun 3, 2025, 2:33:26 PMJun 3
to Chipyard
Hello,

I've identified the root cause of the SDCard issue. According to the "SD Specifications Part 1 Physical Layer Simplified Specification", the SPI clock frequency during initialization must be less than 400 KHz. However, a recent Chipyard commit incorrectly sets this value higher, which causes the SD card to fail during the initialization sequence.

To resolve this, I modified sd.c as shown below to ensure proper initialization at 400 kHz and adjust the frequency afterward:

diff --git a/fpga/src/main/resources/vcu118/sdboot/sd.c b/fpga/src/main/resources/vcu118/sdboot/sd.c
index bc1a68e8..162ec295 100644
--- a/fpga/src/main/resources/vcu118/sdboot/sd.c
+++ b/fpga/src/main/resources/vcu118/sdboot/sd.c
@@ -27,7 +27,7 @@
 // SPI SCLK frequency, in kHz
 // We are using the 25MHz High Speed mode. If this speed is not supported by the
 // SD card, consider changing to the Default Speed mode (12.5 MHz).
-#define SPI_CLK        25000
+#define SPI_CLK        12500
 
 // SPI clock divisor value
 // @see https://ucb-bar.gitbook.io/baremetal-ide/baremetal-ide/using-peripheral-devices/sifive-ips/serial-peripheral-interface-spi
@@ -90,7 +90,8 @@ static void sd_poweron(void)
        long i;
        // HACK: frequency change
 
-       REG32(spi, SPI_REG_SCKDIV) = SPI_DIV;
+       // REG32(spi, SPI_REG_SCKDIV) = SPI_DIV;
+       REG32(spi, SPI_REG_SCKDIV) = (F_CLK / 0.4);     // 400KHz for initialization
        REG32(spi, SPI_REG_CSMODE) = SPI_CSMODE_OFF;
        for (i = 10; i > 0; i--) {
                sd_dummy();
@@ -185,7 +186,8 @@ static int copy(void)
        kprintf("LOADING 0x%x B PAYLOAD\r\n", PAYLOAD_SIZE_B);
        kprintf("LOADING  ");
 
-       REG32(spi, SPI_REG_SCKDIV) = SPI_DIV;
+       // REG32(spi, SPI_REG_SCKDIV) = SPI_DIV;
+       REG32(spi, SPI_REG_SCKDIV) = (F_CLK / 5); // 5MHz
        if (sd_cmd(0x52, BBL_PARTITION_START_SECTOR, 0xE1) != 0x00) {
                sd_cmd_end();
                return 1;

Additionally, I had to change the root password of Linux image based on instructions in this.

Jerry Zhao

unread,
Jun 3, 2025, 3:50:24 PMJun 3
to chip...@googlegroups.com
Would you be able to PR the fix?

--
You received this message because you are subscribed to the Google Groups "Chipyard" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chipyard+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/chipyard/b82696ba-c358-4663-b9d0-4e873d06981dn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages