Guide: Upgrading firmware with only a serial/uart connection via u-boot

Please use a terminal that supports YMODEM file transfers. For Windows there is Tera Term. On Linux I recommend GNU screen, but ensure lrzsz is also installed, as the file transfer feature uses it.

Set up connection at 115200 bps, 8N1.

First, prepare the files you want to flash, such as from the latest release:

  • u-boot-spl.bin.normal.out
  • visionfive2_fw_payload.img

Boot in flash mode, without a sdcard inserted, or otherwise interrupt u-boot’s autoboot:

Hit any key to stop autoboot:  0
StarFive #

After sending loady command, start the YMODEM upload through your terminal’s interface.


StarFive # loady
## Ready for binary (ymodem) download to 0xA0000000 at 115200 bps...
CCxyzModem - CRC mode, 1(SOH)/128(STX)/0(CAN) packets, 7 retries
## Total Size      = 0x0001fe80 = 130688 Bytes
StarFive #

There is some assurance that the transfer went well, as YMODEM uses a CRC16 checksum on every block sent (1KB blocks). Should that not be enough, it is possible to check CRC32 of the whole file and manually compare.

StarFive # crc32 $loadaddr $filesize
crc32 for a0000000 ... a001fe7f ==> ca14da8e

OK. It’s the same file. Let’s flash it next. First, detect the SPI Flash:

StarFive # sf probe
SF: Detected gd25lq128 with page size 256 Bytes, erase size 4 KiB, total 16 MiB

Then, time to flash the file we transferred.

For u-boot-spl.bin.normal.out the offset at the flash is zero:

#WARNING: This is for u-boot-spl.bin.normal.out. Ensure that is the file we loaded!
StarFive # sf update $loadaddr 0x0 $filesize
device 0 offset 0x0, size 0x1fe80
130688 bytes written, 0 bytes skipped in 0.600s, speed 221563 B/s

Whereas for visionfive2_fw_payload.img the right offset is 0x100000:

#WARNING: This is for visionfive2_fw_payload.img.  Ensure that is the file we loaded!
StarFive # sf update $loadaddr 0x100000 $filesize
device 0 offset 0x100000, size 0x2aae85
867973 bytes written, 1929216 bytes skipped in 5.750s, speed 497796 B/s

Once done, reboot by either using the reset command or physically pressing the reset button.


Painfully, editing is no longer possible.

On Linux, the recommended terminal is minicom. Shows a nice menu on C-a s for sending files.

It is possible to do YMODEM with GNU screen, but it’s relatively painful as it doesn’t have an UI for that. In long command mode, exec !! sx --ymodem <filepath> .


On Windows I would recommend TeraTerm Pro. I just flash my board using your method with it.


Thank you for this straight forward set of instructions. I was having some trouble getting TFTP on my PC talking to the board properly.

I’d like to echo what @cwt said about TeraTerm as well, has YMODEM support and worked perfectly.

1 Like

The open source Tera Term is what I have used on Windows, too.

Which I installed via chocolatey.

Note that Tera Term does also support Kermit, which is a better protocol overall. (use loadb instead of loady)

1 Like

I got my adafruit serial adapter just today, this worked wonderfully and I’m running image69 perfectly now! Thank you so much for making this guide!


@rvalles how did you transfer the file?

Thanks to @rvalles , nice work.
While you’re transferring firmwre, though, you can go get a cup of coffee. since it needs almost 5minutes


Screen has always worked better for me and I have used X, Y, and Z modem transfers, but I agree it’s not super intuitive.

1 Like

Ironically, Konsole (the KDE/Plasma terminal) has file transfers, but for some reason it’s only ZMODEM. Somebody must really like ZMODEM :sweat_smile:

Implementing X/YMODEM for them is one item in my “maybe TODO” list, for a day of boredom.

Yep, perfect if you do, like me, love your coffee.

But if you hate coffee, it is possible to change the baudrate to something faster on both ends. 115200 is only the default.

I have not tested other speeds, but loady is like loady [addr [baud]].

Current usb-ttl adapters typically do 1mbit/s, sometimes more. I have successfully done 10mbit/s before, with different boards/setups.

I know Z implements a sliding window so it’s more efficient, especially at higher speeds (no pauses inserted, waiting for acknowledgements). I’m not sure how X and Y compare to each other, but presumably complexity goes up X → Y → Z.

1 Like

After XMODEM appeared, there were a bunch of extensions to it, most notably XMODEM-CRC (crc16-xmodem instead of a crude 8bit sum, easily identified by the use of ‘C’ as handshake in the receiver) and XMODEM-1K (1K blocks instead of 128 byte, implies CRC).

YMODEM requires both of these extensions, and adds a zero packet that contains metadata like filename and size (thus there isn’t trailing garbage as padding as with XMODEM), as well as the ability to send/receive multiple files in one batch.

If I have to get more complex than YMODEM, I’d go to Kermit, much older protocol yet highly reliable and also capable of high speeds with sliding windows.

ZMODEM is a totally different protocol vs X/YMODEM, relatively complex.

X/YMODEM and Kermit still work over TCP, whereas ZMODEM in my experience has a lot of trouble in that situation, thus my distrust of ZMODEM.

1 Like

Thanks @rvalles. I didn’t have access to ethernet so couldn’t load the new firmware. I did have a serial connector and was able to make it work and finally installed image-69.

1 Like