VisionFive2 Flash

From Waveshare Wiki
Jump to: navigation, search

Update Onboard Flash Firmware

Each system version may have different Flash firmware. For the latest version, please refer to the official documentation to compile the newest SDK system. Alternatively, you can download the pre-compiled official files from GitHub.
https://github.com/starfive-tech/VisionFive2/releases

#Download the file with the following two names
u-boot-spl.bin.normal.out
visionfive2_fw_payload.img

https://github.com/starfive-tech/Tools/tree/master/recovery

Restore binary files: jh7110-recovery-xxxxxxxx.bin

If the content in your board's flash is damaged or if you wish to update it, please use the following method:

Method One

Use "tftpboot" command to update:

Preparation

  • A PC.
  • VisionFive 2 host.
  • USB To UART module, with cables for connection.
  • A network cable, with the same LAN as the PC.

Host Setting

  • Install tftp:
sudo apt-get update
sudo apt-get install tftp-hpa tftpd-hpa
sudo apt-get install xinetd
  • Create the file folder for storing files:
mkdir /home/ubuntu/tftpboot
chmod 777 /home/ubuntu/tftpboot
  • Create the file folder "/etc/xinetd.d/tftp":

If there is no "/etc/xinetd.d" directory, you can create it by yourself, and then input the following commands:

server tftp
{
    socket_type = dgram
    protocol = udp
    wait = yes
    user = root
    server = /usr/sbin/in.tftpd
    server_args = -s /home/ubuntu/tftpboot
    disable = no
    per_source = 11
    cps = 100 2
    flags = IPv4
}
  • Open tftp service:
sudo service tftpd-hpa start
TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/home/ubuntu/tftpboot"
TFTP_ADDRESS=":69"
TFTP_OPTIONS="-l -c -s"

"TFTP_DIRECTORY" is the tftp file folder directory created above, and then we can put all the files that need to be transmitted by TFTP into this folder, so we need to give these files the corresponding permissions.

  • Reboot the TFTP server:
sudo service tftpd-hpa restart
  • Put the compiled/downloaded flash files into the configured file folder.
  • Get the host IP:
ifconfig

VisonFive2 Setting

  • Connect the host and the VisionFive2 with the USB to UART module.
  • Then, connect the network cable, open the terminal, and connect the power.
  • If the terminal is displayed as below, you can press any keys to stop.

Vision Five 2 Flsh-03.jpg

  • Input the following commands for initial configuration:
# Set the IP address of VisionFive2 to the same network segment as the host computer.
setenv ipaddr 192.168.10.171     
# Ubuntu host IP:
setenv serverip 192.168.10.174    
  • Ping the host to see if you can communicate successfully.
ping 192.168.10.174

Vision Five 2 Flsh-04.jpg

  • Initialize the SPI flash:
sf probe

Vision Five 2 Flsh-05.jpg

  • Get the SPL binary file and load it into Flash:
tftpboot 0xa0000000 ${serverip}:u-boot-spl.bin.normal.out
sf update 0xa0000000 0x0 $filesize

Vision Five 2 Flsh-06.jpg

  • Get the U-Boot binary file and upload it in Flash:
tftpboot 0xa0000000 ${serverip}:visionfive2_fw_payload.img
sf update 0xa0000000 0x100000 $filesize

Vision Five 2 Flsh-07.jpg

  • The flash is now updated. Press the reset button to reboot VisionFive2.

Method Two

Program the sdcard.img, toggle the DIP switch to the position as shown below:
VisionFive20009.jpg
Connect to the USB to UART module, connect to the power supply and you can see it normally boots.
User account: root
Password: starfive
Input "ifconfig" to get the IP address. Please note that only the network port close to the HDMI interface can be used.
VisionFive2010.jpg
Use MobaXterm software to establish SSH for connecting to the corresponding IP: VisionFive2011.jpg
Download the corresponding package, and drag the corresponding file to the system: VisionFive2013.jpg
VisionFive20011.jpg
Using the command "cat /proc/mtd" to check the MTD partition:
VisionFive2014.jpg
Enter the command: Update SPL command example:

flashcp -v u-boot-spl.bin.normal.out /dev/mtd0

Update U-Boot command example:

flashcp -v visionfive2_fw_payload.img /dev/mtd1

VisionFive2015.jpg
If you only wish to update the Flash firmware, you can stop here. However, if your Flash files are corrupted, please proceed with the following steps:
Power off, disconnect the power, and switch the switch to the corresponding position.
VisionFive2016.jpg
Update via serial port using the xmodem protocol to transfer the file jh7110-recovery-20221205.bin.
VisionFive2017.jpg
Power off, then follow the regular startup process to boot the Debian system.

Method Three

If you find the above process cumbersome, you can use serial port transmission with the xmodem protocol for all files, but it's slower and has a higher error rate.
Transmit the file jh7110-recovery-20221205.bin, press 0, then enter to transfer the file u-boot-spl.bin.normal.out; press 2, then enter to transmit the file visionfive2_fw_payload.img.
VisionFive2018.jpg

Resources