Preparation
Before executing a demo program, make sure you prepare the environment requirements, hardware, and software.
Environment Requirements
- Linux Kernel: Linux 6.6
- OS: Debian 13
- SBC: VisionFive 2 or VisionFive 2 Lite
- SoC: JH-7110
Hardware
| Type | M/O* | Item | Notes |
|---|---|---|---|
| General | M | VisionFive 2 Board or VisionFive 2 Lite Board | - |
| General | M |
|
These items are used for flashing Debian OS into a Micro-SD card. |
| I2C Demo | M |
|
Required for Read SHTC3 Data only |
| UART Demo | M |
|
Required for Read GPS Data only |
| GPIO Demo (Buzzer) | M | A passive buzzer | Required for Make a Buzzer Beep only |
| GPIO Demo (LED) | M |
|
Required for: |
| GPIO Demo (LED Matrix) | M | MAX7219 Serial Dot Matrix Display Module (with a 5-way female to female Dupont cable) | Required for LED Dot Matrix Display only |
| SPI LCD | M |
|
Required for LCD Display only |
| Button Detection Demo | M |
|
Required for Basic Edge Detection and Edge Detection with Timeout Setting only |
| LED Dot Matrix Display (with Button) | M |
|
Required for Use a Button to Control LED Dot Matrix only |
| Object Detection | M | Monitor and accessories:
|
Required for Detect Objects only For the compatible USB cameras, see JH7110 AVL. |
| M | Camera and accessories:
|
||
| M | A USB keyboard | ||
| O | A USB mouse | ||
|
Note: M: Mandatory; O: Optional
|
|||
Software
Make sure the following procedures are performed:
Note: This
section is not applicable to the running Docker or object detection demo
programs. For software preparation of these programs, see Run Docker or Detect Objects.
- Flash Debian OS into a Micro-SD card as described in Flash OS to a Micro-SD Card.
- Log into the Debian and make sure VisionFive 2 or VisionFive 2 Lite is connected to the Internet. For details, see Log into Debian.
- Execute the following command to install and create a Python3 Virtual
Environment on
Debian:
sudo apt install python3-venv python3 -m venv myvenv
Note: You may rename “myvenv” according to your preference. - Execute the
pipcommand on VisionFive 2 or VisionFive 2 Lite Debian to install the VisionFive.gpio package:Note: Due to the fact that pypi.org official website does not yet support uploading whl installation packages for the RISC-V platform, so it cannot directly executepython3 -m pip install VisionFive.gpiocommand to install online.Follow the steps below to install the VisionFive.gpio package.
- Execute the following command to install dependent package
within the newly created virtual
environment:
sudo apt install libxml2-dev libxslt-dev source ./myvenv/bin/activate python3 -m pip install requests wget bs4
- Execute the following command to run the installation script
Install_VisionFive_gpio.py:python3 Install_VisionFive_gpio.py
The installation script codes are as follows:import sys, os, requests PACKAGE = "VisionFive.gpio" PLATFORM = "linux_riscv64" def py_abi(): return f"cp{sys.version_info.major}{sys.version_info.minor}" def fetch_latest_wheel(): url = f"https://pypi.org/pypi/{PACKAGE}/json" data = requests.get(url).json() version = data["info"]["version"] files = data["releases"][version] abi = py_abi() for f in files: name = f["filename"] if name.endswith(".whl") and abi in name: return f["url"], name raise RuntimeError(f"No wheel found matching ABI {abi}") def rewrite_platform(name): base, ext = os.path.splitext(name) parts = base.split("-") parts[-1] = PLATFORM return "-".join(parts) + ext def download(url, path): with requests.get(url, stream=True) as r: r.raise_for_status() with open(path, "wb") as f: for chunk in r.iter_content(8192): f.write(chunk) def main(): url, orig = fetch_latest_wheel() newname = rewrite_platform(orig) print(f"Downloading: {url}") download(url, newname) print("Installing...") os.system(f"pip install {newname}") os.remove(newname) print("Done.") return 0 if name == "main": sys.exit (main())
- (Optional) Exit the Python3 Virtual
Environment.
deactivate
- Execute the following command to install dependent package
within the newly created virtual
environment: