VisionFive2 Flash

From Waveshare Wiki
Jump to: navigation, search

Update Onboard Flash Firmware

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

# Download the files 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 file: jh7110-recovery-xxxxxxxx.bin

The firmware of VisionFive2 Lite is consistent with VisionFive2
If the content in the flash on your board is damaged or you want to update, use the following method

Method 1: Windows System Update

Windows Preparation

  • Download Tftpd64, official download address: https://pjo2.github.io/tftpd64/
  • Configure TFTP server:
  • Create a folder: G:\VisionFive-img\u-boot\2510 (This is an example)
  • Put u-boot-spl.bin.normal.out and visionfive2_fw_payload.img in this folder
  • Open Tftpd64
  • Current Directory: Select the folder you just created
  • Server interfaces: Select the network card IP for the computer to connect to the local area network (must be in the same network segment as VisionFive2)

VisionFive2 Flash-12.jpg

VisionFive2 Setting

  • Connect the host to the VisionFive2/VisionFive2 Lite via the USB to serial port module
  • Connect the network cable, turn on the terminal, and connect the power supply
  • When the terminal displays at the position shown in the figure below, press any key to stop it from continuing downward

VisionFive2-flash-1.jpg

  • Enter the following command for initial configuration
# Set the IP address of VF2 to be in the same CIDR segment as the host
setenv ipaddr 192.168.9.177
# Set the IP of the host (set by Server interfaces in the Tftpd64 software)
setenv serverip 192.168.9.170
# Check if the connection is successful
ping 192.168.9.170  

VisionFive2 Flash-19.jpg

  • Initialize SPI flash
sf probe

VisionFive2 Flash-20.jpg

  • Get SPL binary file and load it into flash
tftpboot 0xa0000000 visionfive2_fw_payload.img
sf update 0xa0000000 0x100000 $filesize

VisionFive2 Flash-22.jpg

  • Get U-Boot binary file and load it into flash
tftpboot 0xa0000000 u-boot-spl.bin.normal.out
sf update 0xa0000000 0x0 $filesize

VisionFive2 Flash-21.jpg

  • flash is now updated, press the Reset button on VisionFive2 to restart, VisionFive2 Lite needs to be powered on again

If All Configurations Are Correct But Connection Fails

  • The following prompt may appear when executing the ping 192.168.9.170 command

VisionFive2 Flash-13.jpg

  • This situation is usually blocked by the Windows firewall, we can turn off the firewall and then try
  • Follow the steps below to turn off the firewall. After the transmission is complete, do not forget to turn on the firewall again

600px-VisionFive2 Flash-14.png600px-VisionFive2 Flash-15.png600px-VisionFive2 Flash-16.png600px-VisionFive2 Flash-17.pngVisionFive2 Flash-18.png

Method 2: Linux Host Update

Use the tftpboot command to update

Preparation

  • One PC host (I'm using Ubuntu here)
  • VisionFive2 host
  • USB to serial port module (with a cable), for connecting to VisionFive2 host
  • One network cable, which must be under the same LAN as the PC host

Host-side Settings

  • Install tftp
sudo apt-get update
sudo apt-get install tftp-hpa tftpd-hpa
sudo apt-get install xinetd
  • Create a folder to store files
mkdir /home/ubuntu/tftpboot
chmod 777 /home/ubuntu/tftpboot
  • Create a new file /etc/xinetd.d/tftp

If the /etc/xinetd.d directory does not exist, create it yourself, and then enter the following content:

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
}
  • Start 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 folder directory we created above. In the future, we will place all files that need to be transferred via TFTP in this folder and grant the appropriate permissions to these files.

  • Start tftp server
sudo service tftpd-hpa restart
  • Place the two compiled/downloaded Flash files into the folder you just configured
  • Get the host IP
ifconfig

VisionFive2 Setting

  • Connect the host to the VisionFive2 via the USB to serial port module
  • Connect the network cable, turn on the terminal, and connect the power supply
  • When the terminal displays at the position shown in the figure below, press any key to stop it from continuing downward

VisionFive2-flash-1.jpg

  • Enter the following command for initial configuration
# The IP address of the device and the address of the VisionFive2 settings must be the same network segment as the host
setenv ipaddr 192.168.10.171     
# IP address of the Ubuntu host
setenv serverip 192.168.10.174    
  • Ping the host to see if the communication is successful
ping 192.168.10.174

VisionFive2-flash-2.jpg

  • Initialize SPI flash
sf probe

600px-VisionFive2-flash-3.jpg|600px]]

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

VisionFive2-flash-4.jpg

  • Get U-Boot binary file and load it into flash
tftpboot 0xa0000000 ${serverip}:visionfive2_fw_payload.img
sf update 0xa0000000 0x100000 $filesize

VisionFive2-flash-5.jpg

  • flash is now updated, press the Reset button on VisionFive2 to restart, VisionFive2 Lite needs to be powered on again

Method 3: Serial Port Update

If you find the above methods troublesome, you can use the serial port to transfer all files using the xmodem protocol, but the speed is relatively slow and the error rate is high
Connect the serial port to VisionFive2

  • VisionFive2 operation

Dial the switch to the corresponding position, then power on
VisionFive2 Flash-8.jpg

  • VisionFive2 Lite operation

Press and hold the Boot button, then power on
VisionFive2 Flash-24.jpg

  • Transmission process

Transfer file jh7110-recovery-20221205.bin, press 0 then Enter to transfer file u-boot-spl.bin.normal.out; press 2 then Enter to transfer file visionfive2_fw_payload.img
VisionFive2 Flash-10.jpg