Page 2
StarFive does not assume any liability rising out of the application or use of any product or circuit, and specifically disclaims any and all liability, including without limitation indirect, incidental, special, exemplary, or consequential damages.
Page 3
Preface About this guide and technical support information. About this document This document is intended to: • introduce the 40-pin header. • provide instructions to configure and debug GPIO, I2C, SPI, PWM, and UART. • provide peripheral examples to use the 40-pin GPIO header. Revision History Table ...
1. Overview The 40-pin header allows VisionFive 2 single board computers to interface with a variety of external components, which enables developers to create their projects. This document is intended to: • introduce the 40-pin header as described in this chapter.
Table 3-1 Hardware Preparation Type Item Notes General VisionFive 2 single board computer General These items are used for flashing Debian OS into • 32 GB (or more) micro-SD card a micro-SD card. • micro-SD card reader • Computer (Windows/macOS/Linux) •...
Two methods are provided to flash images. One is for Mac/Linux, the other is for Windows. For detailed instructions on flashing Debian OS to a Micro-SD card, refer to Flashing OS to a Micro-SD Card section in VisionFive 2 Single Board Computer Quick Start Guide.
/media/<UserName>/root/usr/lib/linux-image-5.15.0-starfive/starfive/ 3.2.4.2. Method 2: Adding Startup Item To replace dtb file by adding a startup item, perform the following: 1. Execute the following commands under the root directory of Linux: sudo cp arch/riscv/boot/dts/starfive/<DTB_File> <Mount_Direcotry>/ root/usr/lib/linux-image-<Kernel_Version>/starfive/ Tip: ◦ <DTB_File>: Different boards use different dtb files: ▪...
Page 14
| 3 - Preparation 5. When you see the U-Boot startup item, select the menu item set in the previous step, for example, Debian GNU/Linux bookworm/sid 5 . 15 . 0-starfive (customized). Tip: Multiple startup items can be added according to the actual number of DTB files.
| 5 - I2C Operations 5.1.2. Configuring dts File 7 channels of I2C bus are supported: i2c0 to i2c6. The DTSI file, jh7110-visionfive-v2.dtsi, is under /linux/arch/riscv/boot/dts/starfive. The following is the default setting. You can configure the unoccupied GPIOs as required. Figure 5-2 Example File Content Note: The I2C GPIO pin number is the number indicated in the Pin Name.
6. SPI Operations This chapter describes how to configure and debug SPI GPIO. 6.1. Configuring SPI GPIO The DTSI file, jh7110-visionfive-v2.dtsi, is under /linux/arch/riscv/boot/dts/starfive. 7 channels of SPI bus are supported: spi0 to spi6. 6.1.1. Modify Pins The configured SPI GPIO number is the number indicated in the Pin Name. For more details about the GPIO Pin Name, see the GPIO Pinout (on page 9) in this document.
3. Execute the following command under the test tool directory: make CROSS_COMPILE=riscv64-linux-gnu- ARCH=riscv Result: The output file is spidev_test in the same directory. 4. Upload spidev_test to VisionFive 2, and change the execution permission by executing the following: chmod +x spidev_test 5. Confirm the SPI device. ls /dev/spidev* Result: Figure ...
7. PWM Operations This chapter describes how to configure and debug PWM GPIO: 7.1. Configuring PWM GPIO The DTSI file, jh7110-visionfive-v2.dtsi, is under /linux/arch/riscv/boot/dts/starfive. 8 channels of PWM are supported at the most. 7.1.1. Modify Pin The following figure shows the example file content to modify the pin: Figure ...
This chapter describes how to configure and debug UART GPIO: 8.1. Configuring UART GPIO The DTSI file, jh7110-visionfive-v2.dtsi, is under /linux/arch/riscv/boot/dts/starfive. 6 channels of UART are supported at the most. The configured UART GPIO number is the number contained in the Pin Name. For more details about the GPIO Pin Name, see GPIO Pinout (on page 9) in this document.
| 8 - UART Operations 1. Connect the jumper wires from the USB-to-Serial Converter to the 40-Pin GPIO header of the VisionFive 2 as follows. Figure 8-4 Connect the Converter to the Header 5V Power 3.3V Power 5V Power GPIO58 (I2C SDA) GPIO57 (I2C SCL) GPIO5 (UART TX) GPIO55 GPIO6 (UART RX) GPIO38 GPIO42 GPIO43 GPIO54...
| 8 - UART Operations 3. Start VisionFive 2 minicom by typing the following command on the PC: minicom -o -D /dev/ttyS1 Figure 8-7 Example Output 4. Configure Ubuntu minicom by typing the following: sudo minicom -s 5. Select Serial port setup, and configure minicom as follows: Figure ...
| 8 - UART Operations 7. To test UART send function, you can input characters, such as , on the VisionFive 2 minicom. Then you will hello ubuntu see the character are outputted on the Ubuntu minicom as the following: Figure ...
Need help?
Do you have a question about the VisionFive 2 and is the answer not in the manual?
Questions and answers