0% found this document useful (0 votes)
111 views118 pages

RKNN Model Conversion Guide for RK3588

The document provides a user manual for converting and deploying models using FastDeploy on an Ubuntu PC and RK3588 development board. It details the steps for model conversion from pdmodel to onnx and then to rknn format, as well as the deployment process on the board. Additionally, it introduces the RKLLM toolkit for deploying large language models on the RK3588 platform, outlining the necessary preparations and steps for model conversion and deployment.

Uploaded by

gerardo51251
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
111 views118 pages

RKNN Model Conversion Guide for RK3588

The document provides a user manual for converting and deploying models using FastDeploy on an Ubuntu PC and RK3588 development board. It details the steps for model conversion from pdmodel to onnx and then to rknn format, as well as the deployment process on the board. Additionally, it introduces the RKLLM toolkit for deploying large language models on the RK3588 platform, outlining the necessary preparations and steps for model conversion and deployment.

Uploaded by

gerardo51251
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co.

, Ltd

pdmodel model using FastDeploy

[Link]. Ubuntu PC Model Conversion

1)Open the terminal on the PC and activate the python3.8 environment created using
Anaconda3 before activation
test@test:~$ conda activate fastdeploy

2)In the script for model conversion, it is necessary to import the yaml module and the
six module. You can execute the following command to install them
(fastdeploy)test@test:~$ pip install pyyaml six

3)Execute the following command to download the ResNet50_vd_infer.tgz file


(fastdeploy)test@test:~$ wget [Link]

4)After decompressing the ResNet50_vd_infer.tgz file, you can obtain the


ResNet50_vd_infer folder, which contains the pdmodel file [Link] and other
related files
(fastdeploy)test@test:~$ tar -xvf ResNet50_vd_infer.tgz

5)You can use the following command to convert the pdmodel model to an onnx model
through paddle2onnx. After executing this command, the converted onnx model file
ResNet50_vd_infer.onnx will appear in the ResNet50_vd_infer folder
(fastdeploy)test@test:~$ paddle2onnx --model_dir ResNet50_vd_infer \
--model_filename [Link] \
--params_filename [Link] \
--save_file ResNet50_vd_infer/ResNet50_vd_infer.onnx \
--enable_dev_version True \
--opset_version 10 \
--enable_onnx_checker True

6)Then use the following command to fix the shape to [1,3,224,224]. After executing
the command, the ResNet50_vd_infer.onnx file will be modified
(fastdeploy)test@test:~$ python -m [Link] --input_model \
ResNet50_vd_infer/ResNet50_vd_infer.onnx \

433
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

--output_model ResNet50_vd_infer/ResNet50_vd_infer.onnx \
--input_shape_dict "{'inputs':[1,3,224,224]}"

7)To convert the onnx model to the rknn model, you need to use the script in the
FastDeploy SDK. Execute the following command to download FastDeploy
(fastdeploy)test@test:~$ git clone [Link]

8)Then transfer the ResNet50_vd_inner folder to the corresponding directory in


FastDeploy
(fastdeploy)test@test:~$ mv ResNet50_vd_infer \
FastDeploy/examples/vision/classification/paddleclas/rockchip/rknpu2/

9)Switch to the directory for model conversion


(fastdeploy)test@test:~$ cd FastDeploy/examples/vision/classification/paddleclas/rockchip/rknpu2/

10)By executing the following command, you can convert the onnx model to an rknn
model, and finally obtain the rknn model file
ResNet50_vd_infer_rk3588_unquantized.rknn in the ResNet50_vd_infer directory
(fastdeploy)test@test:~/FastDeploy/examples/vision/classification/paddleclas/rockchip/rknpu2/$ python ./rknpu2_tools/[Link] \
--config_path ./rknpu2_tools/config/ResNet50_vd_infer_rknn.yaml \
--target_platform rk3588

11)When deploying on the board side, the rknn model file name used is
ResNet50_vd_infer_rk3588.rknn, so it is necessary to rename the
ResNet50_vd_infer_rk3588_unquantized.rknn file to ResNet50_vd_infer_rk3588.rknn
(fastdeploy)test@test:~/FastDeploy/examples/vision/classification/paddleclas/rockchip/rknpu2/$ mv ResNet50_vd_infer/ResNet50_vd_infer_rk3588_unquantized.rknn \

ResNet50_vd_infer/ResNet50_vd_infer_rk3588.rknn

[Link]. Board End Model Deployment

1)Open the terminal on the board and activate the Python 3.9 environment created using
Anaconda3 before activation
orangepi@orangepi:~$ conda activate fastdeploy

2)Run the fastdeploy_init.sh script to configure the environment

434
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

(fastdeploy)orangepi@orangepi:~$ source FastDeploy/build/fastdeploy-0.0.3/fastdeploy_init.sh

3)Switch to the example directory for deploying ResNet50 models in FastDeploy


(fastdeploy)orangepi@orangepi:~$ cd FastDeploy/examples/vision/classification/paddleclas/rockchip/rknpu2/cpp

4)Create a directory structure in this directory


(fastdeploy)orangepi@orangepi:~/FastDeploy/examples/vision/classification/paddleclas/rockchip/rknpu2/cpp$ mkdir build images ppclas_model_dir thirdpartys

5)Copy the compiled fastdeploy-0.0.3 folder to the thirdpartys folder


(fastdeploy)orangepi@orangepi:~/FastDeploy/examples/vision/classification/paddleclas/rockchip/rknpu2/cpp$ cp -r ~/FastDeploy/build/fastdeploy-0.0.3/ thirdpartys/

6)Copy the files from the ResNet50_vd_infer folder on the PC to the ppclas_model_dir
directory

7)Switch to the images directory


(fastdeploy)orangepi@orangepi:~/FastDeploy/examples/vision/classification/paddleclas/rockchip/rknpu2/cpp$ cd images

8)Download test images from the images directory using wget


(fastdeploy)orangepi@orangepi:~/FastDeploy/examples/vision/classification/paddleclas/rockchip/rknpu2/cpp/images$ wget [Link]

w/release/2.4/deploy/images/ImageNet/ILSVRC2012_val_00000010.jpeg

9)Then switch to the build directory for compilation


(fastdeploy)orangepi@orangepi:~/FastDeploy/examples/vision/classification/paddleclas/rockchip/rknpu2/cpp/images$ cd ../build/

10)Using cmake to configure the content that needs to be compiled, after executing the
command, some files will appear in the current directory, including the Makefile file file
(fastdeploy)orangepi@orangepi:~/FastDeploy/examples/vision/classification/paddleclas/rockchip/rknpu2/cpp/build$ cmake ..

11)Execute the following command to start compiling


(fastdeploy)orangepi@orangepi:~/FastDeploy/examples/vision/classification/paddleclas/rockchip/rknpu2/cpp/build$ make -j8

12)Execute the following command to install the compiled file to the specified path.
After executing the command, an additional install directory will appear in the current
directory
(fastdeploy)orangepi@orangepi:~/FastDeploy/examples/vision/classification/paddleclas/rockchip/rknpu2/cpp/build$ make install

435
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

13)Switching to the install directory and using the model for inference is done here
(fastdeploy)orangepi@orangepi:~/FastDeploy/examples/vision/classification/paddleclas/rockchip/rknpu2/cpp/build$ cd install

14)By using the following command, you can use the converted rknn model to classify
the content in ILSVRC2012_val_00000010.jpeg images
(fastdeploy)orangepi@orangepi:~/FastDeploy/examples/vision/classification/paddleclas/rockchip/rknpu2/cpp/build/install$ ./rknpu_test \
./ppclas_model_dir/ ./images/ILSVRC2012_val_00000010.jpeg

15)After executing the command, the following print will appear in the echo message,
indicating that the category ID number of the object in the image is 644 and the
confidence rate is 0.072998
ClassifyResult(
label_ids: 644,
scores: 0.072998,
)

3.39. Method for Running RKLLM Large Model with RK3588

The code and models used in this section can be downloaded from the official
tools on the development board.

3.39.1. Introduction to RKLLM


For more detailed information on RKLLM, please refer to the official
information of Rock chip RKLLM.

RKLLM can help users quickly deploy LLM models to the RK3588 development
board. The overall framework is shown in the following figure:

436
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

[Link]. Introduction to RKLLM toolchain

[Link].1. RKLLM Toolkit Function Introduction

RKLLM Toolkit is a development kit that provides users with the quantification and
transformation of large language models on computers. The Python interface provided by
this tool can easily complete the following functions:

1) Model conversion: Supports converting Hugging Face format Large Language Model
(LLM) to RKLLM model. Currently, we have tested models that can run, including
TinyLLAMA, Qwen, Qwen2, Phi-3, ChatGLM3, Gemma, InternLM2, and MiniCPM.
The converted RKLLM model can be loaded and used on the RK3588 platform.

2) Quantization function: Supports quantifying floating-point models to fixed-point


models. Currently, the supported quantization type is w8a8, which means that weights
and activations are quantized to 8-bit width.

[Link].2. Introduction to RKLLM runtime features

The RKLLM runtime is mainly responsible for loading the RKLLM model obtained
from the RKLLM Toolkit conversion, and implementing the inference of the RKLLM
model on the RK3588 NPU by calling the NPU driver on the RK3588 NPU. When

437
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

inferring the RKLLM model, users can define their own inference parameter settings for
the RKLLM model, define different text generation methods, and continuously obtain the
inference results of the model through pre-defined callback functions. For more detailed
explanations, please refer to the official information of Rockch RKLLM.

[Link]. Introduction to RKLLM Development Process

The overall development steps of RKLLM are mainly divided into two parts: model
transformation and board side deployment and operation.

1) Perform model conversion on Ubuntu PC. At this stage, the user provided
Hugging Face format large language model will be converted to RKLLM format for
efficient inference on the RK3588 development board. This step includes:

a. Build RKLLM Toolkit environment: Use Conda on Ubuntu PC to build the


runtime environment for RKLLM Toolkit.

b. Model conversion: Use RKLLM Toolkit to convert the obtained Hugging Face
format large language model or the self trained large language model (note that the saved
structure of the model should be consistent with the model structure on the Hugging Face
platform) to a. rkllm format file that can run on the RK3588 development board.

c. Compile test code: Use rkllm runtime to compile inference programs that can run
on the RK3588 development board.

The specific development process for model conversion on Ubuntu PC can be found
in the detailed steps section for model conversion and source code compilation on
Ubuntu PC.

2) Deploy and run on the development board side. This stage covers the actual
deployment and operation of the model on the RK3588 development board. It usually
includes the following steps:

a. Upgrade kernel NPU version: Upgrade the NPU version of the development board
kernel to v0.9.6.

438
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

b. Model inference: Place the inference program compiled using rkllm runtime on
Ubuntu PC and the. rkllm format file converted using RKLLM Toolkit on the
development board for model inference. You can directly run inference on the
development board. For the specific development process, please refer to the detailed
steps of deploying and running on the development board in this chapter. You can
also deploy the server-side service on the development board. Ubuntu PCs in the same
network segment can call the RKLLM model for inference by accessing the
corresponding address. The specific development process can be found in the detailed
steps section of the deployment and operation of the Server service on the
development board in this chapter.

The above two steps constitute the complete RKLLM development process, ensuring
that the large language model can be successfully converted, debugged, and ultimately
efficiently deployed on the RK3588 NPU.
3.39.2. Preparation of tools
1) A PC equipped with Ubuntu 22.04 operating system. In this document, we will
demonstrate using the Ubuntu 22.04 (x64) operating system. Please test other
versions of the operating system yourself.

2) A RK3588 development board.


3.39.3. Detailed steps for model conversion and source code
compilation on Ubuntu PC

[Link]. Building RKLLM Toolkit Environment

1) First, download the RKLLM toolchain.


test@test:~$ git clone [Link]

2) After downloading, use the ls command to check if the downloaded file is correct
test@test:~/test$ ls
rknn-llm
test@test:~$ cd rknn-llm
test@test:~/rknn-llm$ ls
[Link] doc LICENSE [Link] res rkllm-runtime

439
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

rkllm-toolkit rknpu-driver

3) The specific file directory in rknn llm is as follows:


test@test:~/rknn-llm$ sudo apt install tree
test@test:~/rknn-llm$ tree
doc
└──Rockchip_RKLLM_SDK_CN.pdf # RKLLM SDK Explanation document

rkllm-runtime
├──examples
│ └── rkllm_api_demo # Board end inference call example project
│ └── rkllm_server_demo # RKLLM-Server Deployment Example Project
├──runtime
│ └── Android
│ └── librkllm_api
│ └──arm64-v8a
│ └── [Link] # RKLLM Runtime library
│ └──include
│ └── rkllm.h # Runtime Header file
│ └── Linux
│ └── librkllm_api
│ └──aarch64
│ └── [Link] # RKLLM Runtime library
│ └──include
│ └── rkllm.h # Runtime Header file
rkllm-toolkit
├──examples
│ └── huggingface
│ └── [Link]
├──packages
│ └── [Link]
│ └── rkllm_toolkit-x.x.x-cp38-cp38-linux_x86_64.whl
rknpu-driver
└──rknpu_driver_0.9.6_20240322.tar.bz2

4) Then download and install the miniforge3 installation package.

440
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

test@test:~$ wget -c [Link]

test@test:~$ chmod 777 Miniforge3-Linux-x86_64.sh

test@test:~$ bash Miniforge3-Linux-x86_64.sh

Mirror websites sometimes crash, causing the miniforge3 package to not be


downloaded. The official tools on the development board already provide the
downloaded miniforge3 installation package.
When running bash Miniforge3-Linux-x86_64.sh, simply press Enter for all
options.

5) Then enter the Conda base environment.


test@test:~$ source ~/miniforge3/bin/activate
(base) test@test:~$

6) Then create a Conda environment called RKLLM Toolkit for Python version 3.8
(recommended version).
(base) test@test:~$ conda create -n RKLLM-Toolkit python=3.8

7) Then enter the RKLLM Toolkit Conda environment.


(base) test@test:~$ conda activate RKLLM-Toolkit
(RKLLM-Toolkit) test@test:~$

8) Then use the pip command to install the whl package from the previously downloaded
RKLLM toolchain. The directory is:rknn-llm/rkllm-toolkit/packages/
rkllm_toolkit-1.0.1-cp38-cp38-linux_x86_64.whl。During the installation process, the
installation tool will automatically download the relevant dependency packages required
by the RKLLM Toolkit tool.
(base) test@test:~$ pip3 install rknn-llm/rkllm-toolkit/packages/rkllm_toolkit-1.0.1-cp38-cp38-linux_x86_64.whl

9) If the following command is executed without any errors, it indicates successful


installation.
(RKLLM-Toolkit) test@test:~$ python
>>> from [Link] import RKLLM

441
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

[Link]. Model Conversion

In this section, we provide eight examples of model transformations for users to


choose from. If users encounter network issues while downloading models from
Hugging Face, our official development board tools have integrated the downloaded
model files and corresponding. rkllm conversion files.

[Link].1. Converting the TinyLLAMA model

1) Install Git LFS on the Ubuntu operating system first. If it is already installed, you can
skip this step.
(RKLLM-Toolkit) test@test:~$ sudo apt update

(RKLLM-Toolkit) test@test:~$ sudo apt install curl git

(RKLLM-Toolkit) test@test:~$ curl -s [Link] | sudo bash

(RKLLM-Toolkit) test@test:~$ sudo apt install git-lfs

(RKLLM-Toolkit) test@test:~$ git lfs install

2) Next, download the TinyLLAMA model.


(RKLLM-Toolkit) test@test:~$ git clone [Link]

3) Modify the value of the modelpath variable in rknn llm/rkllm


toolkit/examples/huggingface/[Link] to the absolute path where the downloaded
TinyLlama-1.1B-Chat-v1.0 folder is located, and then modify the value in parentheses of
ret = llm.export_rkllm ("./[Link]") to the path of the. rkllm grid file to be saved. We
will modify it to ret=llm. export_rkllm ("./[Link]").
(RKLLM-Toolkit) test@test:~$ vim rknn-llm/rkllm-toolkit/examples/huggingface/[Link]
modelpath = "/path/your/TinyLlama-1.1B-Chat-v1.0" #Fill in your own path
ret = llm.export_rkllm("./[Link]")

4) Then run the rknn-llm/rkllm-toolkit/examples/huggingface/[Link] file in Python to


convert the large model.
(RKLLM-Toolkit) test@test:~$ cd ~/rknn-llm/rkllm-toolkit/examples/huggingface
(RKLLM-Toolkit) test@test:~/rknn-llm/rkllm-toolkit/examples/huggingface$ python [Link]

5) The output of successful conversion is as follows:

442
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

6) Finally, a successful conversion will result in a [Link] file in the current


directory, with a size of approximately 1.09G.
(RKLLM-Toolkit) test@test:~/rknn-llm/rkllm-toolkit/examples/huggingface$ ls
[Link] [Link]

[Link].2. Convert Qwen model

1) Install Git LFS on the Ubuntu operating system first. If it is already installed, you can
skip this step.
(RKLLM-Toolkit) test@test:~$ sudo apt update

(RKLLM-Toolkit) test@test:~$ sudo apt install curl git

(RKLLM-Toolkit) test@test:~$ curl -s [Link] | sudo bash

(RKLLM-Toolkit) test@test:~$ sudo apt install git-lfs

(RKLLM-Toolkit) test@test:~$ git lfs install

2) Next, download the Qwen model.


(RKLLM-Toolkit) test@test:~$ git clone [Link]

3) Modify the value of the modelpath variable in


rknn-llm/rkllm-toolkit/examples/huggingface/[Link] to the absolute path where the
downloaded Qwen-1_8B-Chat folder is located, and then modify ret = llm.export_rkllm
("./[Link]") to include the path of the .rkllm format file to be saved in parentheses.
We will modify it to ret = llm.export_rkllm ("./[Link]").
(RKLLM-Toolkit) test@test:~$ vim rknn-llm/rkllm-toolkit/examples/huggingface/[Link]
modelpath = "/path/your/Qwen-1_8B-Chat" #Fill in your own path
ret = llm.export_rkllm("./[Link]")

4) Then run the rknn-llm/rkllm-toolkit/examples/huggingface/[Link] file in Python to


convert the large model.
(RKLLM-Toolkit) test@test:~$ cd ~/rknn-llm/rkllm-toolkit/examples/huggingface
(RKLLM-Toolkit) test@test:~/rknn-llm/rkllm-toolkit/examples/huggingface$ python [Link]

443
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

5) The output of successful conversion is as follows:

6) Finally, a successful conversion will result in the [Link] file in the current
directory, which is approximately 2.01GB in size.
(RKLLM-Toolkit) test@test:~/rknn-llm/rkllm-toolkit/examples/huggingface$ ls
[Link] [Link]

[Link].3. Convert Qwen2 model

1) Install Git LFS on the Ubuntu operating system first. If it is already installed, you can
skip this step.
(RKLLM-Toolkit) test@test:~$ sudo apt update

(RKLLM-Toolkit) test@test:~$ sudo apt install curl git

(RKLLM-Toolkit) test@test:~$ curl -s [Link] | sudo bash

(RKLLM-Toolkit) test@test:~$ sudo apt install git-lfs

(RKLLM-Toolkit) test@test:~$ git lfs install

2) Next, download the Qwen2 model.


(RKLLM-Toolkit) test@test:~$ git clone [Link]

3) Modify the value of the modelpath variable in


rknn-llm/rkllm-toolkit/examples/huggingface/[Link] to the absolute path where the
downloaded Qwen1.5-0.5B folder is located, and then modify ret = llm.export_rkllm
("./[Link]") to include the path of the .rkllm format file to be saved in parentheses.
We will modify it to ret = llm.export_rkllm ("./[Link]").
(RKLLM-Toolkit) test@test:~$ vim rknn-llm/rkllm-toolkit/examples/huggingface/[Link]
modelpath = "/path/your/Qwen1.5-0.5B" #Fill in your own path
ret = llm.export_rkllm("./[Link]")

4) Run the rknn-llm/rkllm-toolkit/examples/huggingface/[Link] file in Python to convert


large models.

444
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

(RKLLM-Toolkit) test@test:~$ cd ~/rknn-llm/rkllm-toolkit/examples/huggingface


(RKLLM-Toolkit) test@test:~/rknn-llm/rkllm-toolkit/examples/huggingface$ python [Link]

5) The output of successful conversion is as follows:

6) Finally, a successful conversion will result in the [Link] file in the current
directory, which is approximately 746MB in size.
(RKLLM-Toolkit) test@test:~/rknn-llm/rkllm-toolkit/examples/huggingface$ ls
[Link] [Link]

[Link].4. Convert Phi-3 model

1) Install Git LFS on the Ubuntu operating system first. If it is already installed, you can
skip this step.
(RKLLM-Toolkit) test@test:~$ sudo apt update

(RKLLM-Toolkit) test@test:~$ sudo apt install curl git

(RKLLM-Toolkit) test@test:~$ curl -s [Link] | sudo bash

(RKLLM-Toolkit) test@test:~$ sudo apt install git-lfs

(RKLLM-Toolkit) test@test:~$ git lfs install

2) Next, download the Phi-3 model


(RKLLM-Toolkit) test@test:~$ git clone [Link]
(RKLLM-Toolkit) test@test:~$ cd Phi-3-mini-4k-instruct
(RKLLM-Toolkit) test@test:~/Phi-3-mini-4k-instruct$ git reset --hard 291e9e30e38030c23497afa30f3af1f104837aa6
(RKLLM-Toolkit) test@test:~/Phi-3-mini-4k-instruct$ cd ..

3) Modify the value of the modelpath variable in rknn llm/rkllm


toolkit/examples/huggingface/test. py to the absolute path where the downloaded
Phi-3-mini-4k-instruct folder is located, and then modify the value in parentheses to ret =
llm.export_rkllm ("./[Link]") to the path of the .rkllm format file to be saved. We
will modify it to ret = llm.export_rkllm ("./[Link]").
(RKLLM-Toolkit) test@test:~$ vim rknn-llm/rkllm-toolkit/examples/huggingface/[Link]

445
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

modelpath = "/path/your/Phi-3-mini-4k-instruct" #Fill in your own path


ret = llm.export_rkllm("./[Link]")

4) Then run the rknn-llm/rkllm-toolkit/examples/huggingface/[Link] file in Python to


convert the large model.
(RKLLM-Toolkit) test@test:~$ cd ~/rknn-llm/rkllm-toolkit/examples/huggingface
(RKLLM-Toolkit) test@test:~/rknn-llm/rkllm-toolkit/examples/huggingface$ python [Link]

5) The output of successful conversion is as follows:

6) The successful conversion will result in the [Link] file in the current directory,
which is approximately 3.66GB in size.
(RKLLM-Toolkit) test@test:~/rknn-llm/rkllm-toolkit/examples/huggingface$ ls
[Link] [Link]

[Link].5. Convert ChatGLM3 model

1) Install Git LFS on the Ubuntu operating system first. If it is already installed, you can
skip this step.
(RKLLM-Toolkit) test@test:~$ sudo apt update

(RKLLM-Toolkit) test@test:~$ sudo apt install curl git

(RKLLM-Toolkit) test@test:~$ curl -s [Link] | sudo bash

(RKLLM-Toolkit) test@test:~$ sudo apt install git-lfs

(RKLLM-Toolkit) test@test:~$ git lfs install

2) Next, download the ChatGLM3 model.


(RKLLM-Toolkit) test@test:~$ git clone [Link]
(RKLLM-Toolkit) test@test:~$ cd chatglm3-6b
(RKLLM-Toolkit) test@test:~/chatglm3-6b$ git reset --hard 103caa40027ebfd8450289ca2f278eac4ff26405
(RKLLM-Toolkit) test@test:~/chatglm3-6b$ cd ..

446
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

3) Modify the value of the modelpath variable in rknn llm/rkllm


toolkit/examples/huggingface/test. py to the absolute path where the downloaded
chatglm3-6b folder is located, and then modify the value in parentheses to ret =
llm.export_rkllm ("./[Link]") to the path of the .rkllm format file to be saved. We
will modify it to ret = llm.export_rkllm ("./[Link]").
(RKLLM-Toolkit) test@test:~$ vim rknn-llm/rkllm-toolkit/examples/huggingface/[Link]
modelpath = "/path/your/chatglm3-6b" #Fill in your own path
ret = llm.export_rkllm("./[Link]")

4) Then run the rknn-llm/rkllm-toolkit/examples/huggingface/[Link] file in Python to


convert the large model.
(RKLLM-Toolkit) test@test:~$ cd ~/rknn-llm/rkllm-toolkit/examples/huggingface
(RKLLM-Toolkit) test@test:~/rknn-llm/rkllm-toolkit/examples/huggingface$ python [Link]

5) The output of successful conversion is as follows:

6) Finally, a successful conversion will result in the [Link] file in the current
directory, which is approximately 6.07G in size.
(RKLLM-Toolkit) test@test:~/rknn-llm/rkllm-toolkit/examples/huggingface$ ls
[Link] [Link]

[Link].6. Convert Gemma Model

1) Install Git LFS on the Ubuntu operating system first. If it is already installed, you can
skip this step.
(RKLLM-Toolkit) test@test:~$ sudo apt update

(RKLLM-Toolkit) test@test:~$ sudo apt install curl git

(RKLLM-Toolkit) test@test:~$ curl -s [Link] | sudo bash

(RKLLM-Toolkit) test@test:~$ sudo apt install git-lfs

(RKLLM-Toolkit) test@test:~$ git lfs install

447
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

2) Next, download the Gemma model.


(RKLLM-Toolkit) test@test:~$ git clone [Link]

(RKLLM-Toolkit) test@test:~$ cd gemma-2b-it


(RKLLM-Toolkit) test@test:~/gemma-2b-it$ git reset --hard de144fb2268dee1066f515465df532c05e699d48
(RKLLM-Toolkit) test@test:~/gemma-2b-it$ cd ..

3) Modify the value of the modelpath variable in


rknn-llm/rkllm-toolkit/examples/huggingface/[Link] to the absolute path where the
downloaded gemma-2b-it folder is located, and then modify the value in parentheses of
ret = llm.export_rkllm("./[Link]") to the path of the. rkllm format file to be saved.
We will modify it to ret = llm.export_rkllm("./[Link]").
(RKLLM-Toolkit) test@test:~$ vim rknn-llm/rkllm-toolkit/examples/huggingface/[Link]
modelpath = "/path/your/gemma-2b-it" #Fill in your own path
ret = llm.export_rkllm("./[Link]")

4) Then run the rknn-llm/rkllm-toolkit/examples/huggingface/[Link] file in Python to


convert the large model.
(RKLLM-Toolkit) test@test:~$ cd ~/rknn-llm/rkllm-toolkit/examples/huggingface
(RKLLM-Toolkit) test@test:~/rknn-llm/rkllm-toolkit/examples/huggingface$ python [Link]

5) The output of successful conversion is as follows:

6) Finally, a successful conversion will result in the [Link] in the current directory,
which is approximately 3.81GB in size.
(RKLLM-Toolkit) test@test:~/rknn-llm/rkllm-toolkit/examples/huggingface$ ls
[Link] [Link]

[Link].7. Converting the InternLM2 model

1) Install Git LFS on the Ubuntu operating system first. If it is already installed, you can
skip this step.

448
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

(RKLLM-Toolkit) test@test:~$ sudo apt update

(RKLLM-Toolkit) test@test:~$ sudo apt install curl git

(RKLLM-Toolkit) test@test:~$ curl -s [Link] | sudo bash

(RKLLM-Toolkit) test@test:~$ sudo apt install git-lfs

(RKLLM-Toolkit) test@test:~$ git lfs install

2) Next, download the InternLM2 model.


(RKLLM-Toolkit) test@test:~$ git clone [Link]
(RKLLM-Toolkit) test@test:~$ cd internlm2-chat-1_8b
(RKLLM-Toolkit) test@test:~/internlm2-chat-1_8b$ git reset --hard ecccbb5c87079ad84e5788baa55dd6e21a9c614d
(RKLLM-Toolkit) test@test:~/internlm2-chat-1_8b$ cd ..

3) Modify the value of the modelpath variable in


rknn-llm/rkllm-toolkit/examples/huggingface/[Link] to the absolute path where the
downloaded internlm2-chat-1_8b folder is located, and then modify the value in
parentheses of ret = llm.export_rkllm("./[Link]") to the path of the. rkllm formatted
file to be saved. We will modify it to ret = llm.export_rkllm("./[Link]").
(RKLLM-Toolkit) test@test:~$ vim rknn-llm/rkllm-toolkit/examples/huggingface/[Link]
modelpath = "/path/your/internlm2-chat-1_8b" #Fill in your own path
ret = llm.export_rkllm("./[Link]")

4) Then run the rknn-llm/rkllm-toolkit/examples/huggingface/[Link] file in Python to


convert the large model.
(RKLLM-Toolkit) test@test:~$ cd ~/rknn-llm/rkllm-toolkit/examples/huggingface
(RKLLM-Toolkit) test@test:~/rknn-llm/rkllm-toolkit/examples/huggingface$ python [Link]

5) The output of successful conversion is as follows:

6) Finally, a successful conversion will result in the [Link] file in the current
directory, which is approximately 1.94G in size.
(RKLLM-Toolkit) test@test:~/rknn-llm/rkllm-toolkit/examples/huggingface$ ls
[Link] [Link]

449
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

[Link].8. Convert MiniCPM model

1) Install Git LFS on the Ubuntu operating system first. If it is already installed, you can
skip this step.
(RKLLM-Toolkit) test@test:~$ sudo apt update

(RKLLM-Toolkit) test@test:~$ sudo apt install curl git

(RKLLM-Toolkit) test@test:~$ curl -s [Link] | sudo bash

(RKLLM-Toolkit) test@test:~$ sudo apt install git-lfs

(RKLLM-Toolkit) test@test:~$ git lfs install

2) Next, download the MiniCPM model.


(RKLLM-Toolkit) test@test:~$ git clone [Link]

(RKLLM-Toolkit) test@test:~$ cd MiniCPM-2B-sft-bf16

(RKLLM-Toolkit) test@test:~/MiniCPM-2B-sft-bf16$ git reset --hard 79fbb1db171e6d8bf77cdb0a94076a43003abd9e

(RKLLM-Toolkit) test@test:~/MiniCPM-2B-sft-bf16$ cd ..

3) Modify the value of the modelpath variable in


rknn-llm/rkllm-toolkit/examples/huggingface/[Link] to the absolute path of the
downloaded MiniCPM-2B-sft-bf16 folder, and then modify the value in parentheses of
ret = llm.export_rkllm("./[Link]") to the path of the .rkllm formatted file to be saved.
We will modify it to ret = llm.export_rkllm("./[Link]").
(RKLLM-Toolkit) test@test:~$ vim rknn-llm/rkllm-toolkit/examples/huggingface/[Link]
modelpath = "/path/your/MiniCPM-2B-sft-bf16" #Fill in your own path
ret = llm.export_rkllm("./[Link]")

4) Then run the rknn-llm/rkllm-toolkit/examples/huggingface/[Link] file in Python to


convert the large model.
(RKLLM-Toolkit) test@test:~$ cd ~/rknn-llm/rkllm-toolkit/examples/huggingface
(RKLLM-Toolkit) test@test:~/rknn-llm/rkllm-toolkit/examples/huggingface$ python [Link]

5) The output of successful conversion is as follows:

450
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

6) Finally, a successful conversion will result in the [Link] file in the current
directory, which is approximately 3.07GB in size.
(RKLLM-Toolkit) test@test:~/rknn-llm/rkllm-toolkit/examples/huggingface$ ls
[Link] [Link]

[Link]. Compile Test Code

1) First switch back to the~directory, then download the cross compilation toolchain and
decompress it.
(RKLLM-Toolkit) test@test:~/rknn-llm/rkllm-toolkit/examples/huggingface$ cd ~
(RKLLM-Toolkit) test@test:~$ sudo apt install cmake
(RKLLM-Toolkit) test@test:~$ wget
[Link]
86_64-[Link]
(RKLLM-Toolkit) test@test:~$ tar -xJf gcc-arm-10.2-2020.11-x86_64-[Link]

2) Then modify the GCC_COMPILER_PATH in the


rknn-llm/rkllm-runtime/examples/rkllm_api_demo/[Link] to
~/gcc-arm-10.2-2020.11-x86_64-aarch64-none-linux-gnu/bin/aarch64-none-linux-gnu。
(RKLLM-Toolkit) test@test:~$ vim rknn-llm/rkllm-runtime/examples/rkllm_api_demo/[Link]

3) Then compile the test code using rknn-llm/rkllm-runtime/examples/rkllm_api_demo/


[Link].
(RKLLM-Toolkit) test@test:~$ cd rknn-llm/rkllm-runtime/examples/rkllm_api_demo
(RKLLM-Toolkit) test@test:~/rknn-llm/rkllm-runtime/examples/rkllm_api_demo$ bash [Link]

4) Finally, compile and view the generated llm_demo file.


(RKLLM-Toolkit) test@test:~/rknn-llm/rkllm-runtime/examples/rkllm_api_demo$ ls
build/build_linux_aarch64_Release

451
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

[Link] CMakeFiles cmake_install.cmake llm_demo Makefile


3.39.4. Detailed steps for deploying and running the development
board

[Link]. Upgrading the NPU version of the kernel

1) Due to the high NPU kernel version required for the provided RKLLM, users need to
confirm whether the minimum NPU kernel version on the board is v0.9.6 before using
the RKLLM Runtime for model inference. If the NPU version is lower than v0.9.6,
please download the latest image from the official website or download the latest kernel
for self updating. The specific query command is as follows:
orangepi@orangepi:~$ sudo cat /sys/kernel/debug/rknpu/version
RKNPU driver: v0.9.6

2) If the queried NPU version is lower than v0.9.6, use one of the following methods to
upgrade:
a. Download the Linux image with the lowest version of 1.0.4 from the official
website, and refer to the instructions in this manual to burn the downloaded
image into the development board.

b. Firstly, download the kernel deb package with a minimum version of 1.0.
4 from the official website, and refer to the section on compiling the lin
ux kernel in this manual to update the kernel. Then place the header file
rknn-llm/rkllm-runtime/runtime/Linux/librkllm_api/include/rkllm.h in /usr/incl
ude/, and the library file rknn-llm/rkllm-runtime/runtime/Linux/librkllm_api/
aarch64/librkllmrt.s in /usr/lib/.
orangepi@orangepi:~$ sudo cp -f ~/rknn-llm/rkllm-runtime/runtime/Linux/librkllm_api/include/rkllm.h /usr/include/

orangepi@orangepi:~$ sudo cp -f ~/rknn-llm/rkllm-runtime/runtime/Linux/librkllm_api/aarch64/[Link] /usr/lib/

[Link]. Model inference

It is recommended to use a development board with 8GB or more of memory for


testing. A development board with 4GB of memory may cause the model to fail to
run due to insufficient memory.

452
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

[Link].1. TinyLLAMA model inference

1) Firstly, upload the llm_demo program and [Link] model file compiled on
Ubuntu PC to the development board.
orangepi@orangepi:~$ ls
llm_demo [Link]

2) Then run the following command to limit the maximum number of file descriptors
that can be opened (run every terminal opened).
orangepi@orangepi:~$ ulimit -HSn 102400

3) Then run the following command to start the model.


orangepi@orangepi:~$ chmod 777 llm_demo
orangepi@orangepi:~$ ./llm_demo ./[Link]

4) If it runs successfully, the following interface will pop up.

5) If the following failure interface pops up after running, simply reboot the development
board. If the fourth step runs successfully, skip this step.

orangepi@orangepi:~$ sudo reboot

6) After entering the question in the interactive interface and pressing enter, the

453
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

successful test result is as follows:


Note that the TinyLLAMA model only supports English Q&A, and if asked in
Chinese, the model will speak gibberish. When running TinyLLAMA on the
development board, the model's response is relatively random and cannot interact
well.

7) Finally, enter exit to exit.


user: exit

[Link].2. Qwen model inference

1) Firstly, upload the compiled llm_demo program and [Link] model file on
Ubuntu PC to the development board.
orangepi@orangepi:~$ ls
llm_demo [Link]

2) Then run the following command to limit the maximum number of file descriptors
that can be opened (run every terminal opened).
orangepi@orangepi:~$ ulimit -HSn 102400

3) Then run the following command to start the model.


orangepi@orangepi:~$ chmod 777 llm_demo
orangepi@orangepi:~$ ./llm_demo ./[Link]

4) If it runs successfully, the following interface will pop up.

454
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

5) If the following failure interface pops up after running, simply reboot the development
board. If the fourth step runs successfully, skip this step.

orangepi@orangepi:~$ sudo reboot

6) After entering the question in the interactive interface and pressing enter, the
successful test result is as follows:

7) Finally, enter exit to exit.


user: exit

455
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

[Link].3. Qwen2 model inference

1) Firstly, upload the compiled llm_demo program and [Link] model file on
Ubuntu PC to the development board.
orangepi@orangepi:~$ ls
llm_demo [Link]

2) Then run the following command to limit the maximum number of file descriptors
that can be opened (run every terminal opened).
orangepi@orangepi:~$ ulimit -HSn 102400

3) Then run the following command to start the model.


orangepi@orangepi:~$ chmod 777 llm_demo
orangepi@orangepi:~$ ./llm_demo ./[Link]

4) If it runs successfully, the following interface will pop up.

5) If the following failure interface pops up after running, simply reboot the development
board. If the fourth step runs successfully, skip this step.

orangepi@orangepi:~$ sudo reboot

6) After entering the question in the interactive interface and pressing enter, the

456
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

successful test result is as follows

7) Finally, enter exit to exit


user: exit

[Link].4. Phi-3 model inference

1) Firstly, upload the compiled llm_demo program and [Link] model file on Ubuntu
PC to the development board.
orangepi@orangepi:~$ ls
llm_demo [Link]

2) Then run the following command to limit the maximum number of file descriptors
that can be opened (run every terminal opened).
orangepi@orangepi:~$ ulimit -HSn 102400

3) Then run the following command to start the model.


orangepi@orangepi:~$ chmod 777 llm_demo
orangepi@orangepi:~$ ./llm_demo ./[Link]

4) If it runs successfully, the following interface will pop up.

457
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

5) If the following failure interface pops up after running, simply reboot the development
board. If the fourth step runs successfully, skip this step.

orangepi@orangepi:~$ sudo reboot

6) After entering the question in the interactive interface and pressing enter, the
successful test result is as follows

7) Finally, enter exit to exit


user: exit

[Link].5. ChatGLM3 model inference

1) Firstly, upload the compiled llm_demo program and [Link] model file on

458
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

Ubuntu PC to the development board.


orangepi@orangepi:~$ ls
llm_demo [Link]

2) Then run the following command to limit the maximum number of file descriptors
that can be opened (run every terminal opened).
orangepi@orangepi:~$ ulimit -HSn 102400

3) Then run the following command to start the model.


orangepi@orangepi:~$ chmod 777 llm_demo
orangepi@orangepi:~$ ./llm_demo ./[Link]

4) If it runs successfully, the following interface will pop up.

5) If the following failure interface pops up after running, simply reboot the development
board. If the fourth step runs successfully, skip this step.

orangepi@orangepi:~$ sudo reboot

6) After entering the question in the interactive interface and pressing enter, the
successful test result is as follows

459
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

7) Finally, enter exit to exit


user: exit

[Link].6. Gemma model inference

1) Firstly, upload the compiled llm_demo program and [Link] model file on
Ubuntu PC to the development board.
orangepi@orangepi:~$ ls
llm_demo [Link]

2) Then run the following command to limit the maximum number of file descriptors
that can be opened (run every terminal opened).
orangepi@orangepi:~$ ulimit -HSn 102400

3) Then run the following command to start the model.


orangepi@orangepi:~$ chmod 777 llm_demo
orangepi@orangepi:~$ ./llm_demo ./[Link]

4) If it runs successfully, the following interface will pop up.

460
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

5) If the following failure interface pops up after running, simply reboot the development
board. If the fourth step runs successfully, skip this step.

orangepi@orangepi:~$ sudo reboot

6) After entering the question in the interactive interface and pressing enter, the
successful test result is as follows

7) Finally, enter exit to exit


user: exit

[Link].7. InternLM2 model inference

1) Firstly, upload the llm_demo program and [Link] model file compiled on

461
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

the Ubuntu PC to the development board.


orangepi@orangepi:~$ ls
llm_demo [Link]

2) Then run the following command to limit the maximum number of file descriptors
that can be opened (run every terminal opened).
orangepi@orangepi:~$ ulimit -HSn 102400

3) Then run the following command to start the model.


orangepi@orangepi:~$ chmod 777 llm_demo
orangepi@orangepi:~$ ./llm_demo ./[Link]

4) If it runs successfully, the following interface will pop up.

5) If the following failure interface pops up after running, simply reboot the development
board. If the fourth step runs successfully, skip this step.

orangepi@orangepi:~$ sudo reboot

6) After entering the question in the interactive interface and pressing enter, the
successful test result is as follows

462
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

7) Finally, enter exit to exit


user: exit

[Link].8. MiniCPM model inference

1) Firstly, upload the compiled llm_demo program and [Link] model file on
Ubuntu PC to the development board.
orangepi@orangepi:~$ ls
llm_demo [Link]

2) Then run the following command to limit the maximum number of file descriptors
that can be opened (run every terminal opened).
orangepi@orangepi:~$ ulimit -HSn 102400

3) Then run the following command to start the model.


orangepi@orangepi:~$ chmod 777 llm_demo
orangepi@orangepi:~$ ./llm_demo ./[Link]

4) If it runs successfully, the following interface will pop up.

463
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

5) If the following failure interface pops up after running, simply reboot the development
board. If the fourth step runs successfully, skip this step.

orangepi@orangepi:~$ sudo reboot

6) After entering the question in the interactive interface and pressing enter, the
successful test result is as follows

7) Finally, enter exit to exit


user: exit

3.39.5. Detailed steps for deploying and running the development


board side server
The development board and Ubuntu PC must be on the same network segment
when running this section.

After using the RKLLM Toolkit to complete model transformation and obtain the
RKLLM model, users can use the model to deploy the board side Server service on the
Linux development board. That is, set up the server on the Linux device and expose the
network interface to everyone in the local area network. Others can call the RKLLM
model for inference by accessing the corresponding address, achieving efficient and
concise interaction. There are two different server deployment implementations:

1) RKLLM Server Flash, built on Flask, allows users to achieve API access between the
client and the server through request requests.

464
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

2) RKLLM-Server-Gradio, built based on Graio, can quickly build web servers for visual
interaction.

[Link]. Upgrading the NPU version of the kernel

Due to the high NPU kernel version required for the provided RKLLM, users need to
confirm whether the minimum NPU kernel version on the board is v0.9.6 before using
the RKLLM Runtime for model inference. If the NPU version is lower than v0.9.6,
please refer to the section on upgrading kernel NPU version in this manual for self
updating. The specific query command is as follows:
orangepi@orangepi:~$ sudo cat /sys/kernel/debug/rknpu/version
RKNPU driver: v0.9.6

[Link]. Building a server based on Flask

[Link].1. Server side (development board side)

1) Firstly, upload the rkllm-runtime/examples/rkllm_server_demo/rkllm_server folder


and the converted. rkllm model file from the previously downloaded RKLLM toolchain
rknn-llm to the development board. Upload the .rkllm model file to the desired large
model.
orangepi@orangepi:~$ ls
[Link] [Link] rkllm_server [Link] [Link]
[Link] [Link] [Link] [Link]

2) Then, set rkllm_lib = [Link]('lib/[Link]') in the rkllm_server/flask_se


[Link] file to rkllm_lib = [Link]('/usr/lib/[Link]'), change rknnllm_para
m.use_gpu= True to rknnllm_param.use_gpu = False.
orangepi@orangepi:~$ vim rkllm_server/flask_server.py
rkllm_lib = [Link]('/usr/lib/[Link]')
rknnllm_param.use_gpu = False

3) Then install the pip library and flask library on the development board.
If using the Debian12 system, the command pip install flask==2.2.2 Werkzeug==2.2.2 -i [Link]
[Link]/simple Add --break-system-packages after it

465
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

The following command:

pip install flask==2.2.2 Werkzeug==2.2.2 -i [Link] --break-system-packages

orangepi@orangepi:~$ sudo apt update

orangepi@orangepi:~$ sudo apt install python3-pip -y


orangepi@orangepi:~$ pip install flask==2.2.2 Werkzeug==2.2.2 -i [Link]

4) Then switch to the rk llm server directory and run flask_server. py to start the service
rkllm_model_path is the absolute path of the transformed model
If you want to use TinyLlama, change --rkllm_model_path ~/[Link] to
--rkllm_model_path ~/[Link]。
If you want to use Qwen2, change --rkllm_model_path ~/[Link] to
--rkllm_model_path ~/[Link]。
If you want to use Phi-3, change --rkllm_model_path ~/[Link] to
--rkllm_model_path ~/[Link]。
If you want to use ChatGLM3, change --rkllm_model_path ~/[Link] to
--rkllm_model_path ~/[Link]。
If you want to use Gemma, change --rkllm_model_path ~/[Link] to
--rkllm_model_path ~/[Link]。
If you want to use InternLM2, change --rkllm_model_path ~/[Link] to
--rkllm_model_path ~/[Link]。
If you want to use MiniCPM, change --rkllm_model_path ~/[Link] to
--rkllm_model_path ~/[Link]。

orangepi@orangepi:~$ cd rkllm_server

orangepi@orangepi:~/rkllm_server$ python3 flask_server.py --target_platform rk3588 --rkllm_model_path ~/[Link]

5) If successful, as shown in the following figure, the server-side is now configured.

6) If the following failure interface pops up during runtime, simply reboot the

466
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

development board. If the fifth step runs successfully, skip this step.

orangepi@orangepi:~$ sudo reboot

[Link].2. Client(Ubuntu PC)

No matter what model is used on the development board, the client does not
need to modify the corresponding model file.

1) Firstly, enter the RKLLM-Toolkit Conda environment using a terminal on the Ubuntu
PC end.
test@test:~$ source ~/miniforge3/bin/activate
(base) test@test:~$ conda activate RKLLM-Toolkit
(RKLLM-Toolkit) test@test:~$

2) Then, in file rknn-llm/rkllm-runtime/examples/rkllm_server_demo/chat_api_flask.py,


server_url = '[Link] Change [Link] in 'to the
actual development board address needs to be adjusted by users based on the specific
address they deploy.
(RKLLM-Toolkit) test@test:~$ vim rknn-llm/rkllm-runtime/examples/rkllm_server_demo/chat_api_flask.py

3) Then run file rknn-llm/rkllm-runtime/examples/rkllm_server_demo/chat_api_flask.py.


(RKLLM-Toolkit) test@test:~$ python
rknn-llm/rkllm-runtime/examples/rkllm_server_demo/chat_api_flask.py

4) After running, just enter your own question and press enter

a. Use the TinyLLAMA model on the server side of the development board and test
it on the Ubuntu PC side, as shown in the following figure. TinyLLAMA can

467
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

only be used in English.

b. Use the Qwen model on the server side of the development board and test it on
the Ubuntu PC side, as shown in the following figure:

c. Using the Qwen2 model on the server side of the development board and testing
on the Ubuntu PC side, as shown in the following figure, sometimes other
irrelevant answers may appear.

d. Use the Phi-3 model on the server side of the development board and test it on
the Ubuntu PC side, as shown in the following figure:

e. Use the ChatGLM3 model on the server side of the development board and test
it on the Ubuntu PC side, as shown in the following figure:

f. Use the Gemma model on the server side of the development board and test it on
the Ubuntu PC side, as shown in the following figure:

468
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

g. Use the InternLM2 model on the development board server side and test it on the
Ubuntu PC side, as shown in the following figure:

h. Use the MiniCPM model on the server side of the development board and test it
on the Ubuntu PC side, as shown in the following figure:
MiniCPM performs poorly using this method and is not recommended.

[Link]. Building a server based on Graph

[Link].1. Server side (development board side)

1) Firstly, upload the rkllm-runtime/examples/rkllm_server_demo/rkllm_server folder


and the converted .rkllm model file from the previously downloaded RKLLM toolchain
rknn-llm to the development board. Upload the .rkllm model file to the development
board based on the large model you want to use
orangepi@orangepi:~$ ls
[Link] [Link] rkllm_server [Link]

2) Then modify rkllm_lib = [Link]('lib/[Link]') in file rkllm_server/gra


dio_server.py to rkllm_lib = [Link]('/usr/lib/[Link]') and rknnllm_param.
use_gpu= True to rknnllm_param.use_gpu = False.
orangepi@orangepi:~$ vim rkllm_server/gradio_server.py

469
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

rkllm_lib = [Link]('/usr/lib/[Link]')
rknnllm_param.use_gpu = False

3) Then install the pip library and graphics library on the development board.
If using the Debian12 system, it is necessary to set the command pip3 install gradio>=4.
24.0 -i [Link] Add --break-system-packages after
The following command:
pip3 install gradio>=4.24.0 -i [Link] --break-system-packages

orangepi@orangepi:~$ sudo apt update


orangepi@orangepi:~$ sudo apt install python3-pip -y
orangepi@orangepi:~$ pip3 install gradio>=4.24.0 -i [Link]

4) Then switch to the rkllm_server directory and run gradio_server.py to start the service.
rkllm_model_path is the absolute path of the converted model.
If you want to use TinyLlama, change --rkllm_model_path ~/[Link] to
--rkllm_model_path ~/[Link]。
If you want to use Qwen2, change --rkllm_model_path ~/[Link] to
--rkllm_model_path ~/[Link]。
If you want to use Phi-3, change --rkllm_model_path ~/[Link] to
--rkllm_model_path ~/[Link]。
If you want to use ChatGLM3, change --rkllm_model_path ~/[Link] to
--rkllm_model_path ~/[Link]。
If you want to use Gemma, change --rkllm_model_path ~/[Link] to
--rkllm_model_path ~/[Link]。
If you want to use InternLM2, change --rkllm_model_path ~/[Link] to
--rkllm_model_path ~/[Link]。
If you want to use MiniCPM, change --rkllm_model_path ~/[Link] to
--rkllm_model_path ~/[Link]。

orangepi@orangepi:~$ cd rkllm_server
orangepi@orangepi:~/rkllm_server$ python3 gradio_server.py --target_platform
rk3588 --rkllm_model_path ~/[Link]

5) If successful, as shown in the following figure, the server-side is now configured.

470
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

In the figure [Link] It does not mean that the IP address is this, the
actual IP address that needs to be used is the user's own development board's actual
address.

[Link].2. Client(Ubuntu PC)

1) Firstly, open a browser on any computer in the current local area network and directly
access "Development Board IP: 8080". The open interface is shown in the following
figure:

2) Then enter the question in the inputTextBox input box and press enter.

471
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

a. Use the TinyLLAMA model on the server side of the development board and test
it on the Ubuntu PC side, as shown in the following figure:

b. Use the Qwen model on the server side of the development board and test it on
the Ubuntu PC side, as shown in the following figure:

472
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

c. Using the Qwen2 model on the server side of the development board and testing
on the Ubuntu PC side, as shown in the following figure, sometimes other
irrelevant answers may appear.

d. Use the Phi-3 model on the server side of the development board and test it on
the Ubuntu PC side, as shown in the following figure:

473
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

e. Use the ChatGLM3 model on the server side of the development board and test
it on the Ubuntu PC side, as shown in the following figure:

f. Use the Gemma model on the server side of the development board and test it on
the Ubuntu PC side, as shown in the following figure:

474
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

g. Use the InternLM2 model on the development board server side and test it on the
Ubuntu PC side, as shown in the following figure:

h. Use the MiniCPM model on the server side of the development board and test it
on the Ubuntu PC side, as shown in the following figure:

475
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

3.39.6. Performance test results of running RKLLM large model on


RK3588
1) In order to conduct large-scale model performance testing, the first step is to d
ownload the large-scale model performance testing file [Link] from the official
tool. After downloading, replace it with the rknn-llm/rkllm-runtime/examples/rkl
lm_api_demo/src/[Link] file used on the PC to compile the testing code

2) Refer to the section on compiling test code to recompile the llm_demo file, and then

476
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

run the large model according to the detailed steps for deploying and running on the
development board.

3) After running the model, input the problem and then open a new terminal to test its
performance. Performance testing is conducted when the model answers questions.

4) NPU load test: Use another terminal to run the following command while the model is
answering questions:
orangepi@orangepi:~$ sudo cat /sys/kernel/debug/rknpu/load
NPU load: Core0: 51%, Core1: 51%, Core2: 51%,

5) CPU load, memory: Use another terminal to run the following command when
answering questions in the model:
When calculating CPU load, calculate the CPU% value/number of CPUs for the
llm_demo process
When calculating memory, use the MEM% value of the llm_demo process multiplied
by the total amount of MEM
You can click on the CPU options, and the interface will display in descending order
of CPU usage.

orangepi@orangepi:~$ htop

477
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

6) Inference: Inference speed, abbreviated as inference, refers to the number of tokens


output during model inference divided by the time taken for model inference. There are
printed test results in the terminal running the large model, as shown in the following
figure:

7) Pre fill: Calculate the number of input tokens divided by the time it takes for the
model to run and output the first token. Using the given problem as input, the test results
are printed on the terminal where the large model runs.
Due to the fact that different large-scale language models may use different
segmentation strategies when processing the same sentence, resulting in differences in the
number of generated tokens, and the actual number of input tokens is not provided with
corresponding acquisition channels in RKLLM, we used GPT to generate a problem with
256 tokens as input. Resulting in certain errors in the test results.

Q: What are the key differences between Convolutional Neural Networks (CNN) and
Recurrent Neural Networks (RNN) in processing image and time series data in the field
of deep learning? Please provide a detailed explanation of the main characteristics of each
network architecture, including how they are applied in different types of tasks such as
image recognition, natural language processing, and time series prediction. In addition,

478
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

discuss how these networks handle overfitting problems and how to use regularization
techniques such as dropout to improve the model's generalization ability. Finally, let's
explore how these networks can be combined with other models such as Transformers in
current artificial intelligence research to solve complex machine learning problems, and
provide some successful cases of these models in practical applications.

8) The test results of all models are shown in the following table:

Parameter CPU NPU Memory


Model Dtype Performance
size load load usage
Pre filled: 58.6157
token/s
TinyLLAMA 1.1B W8a8 15.9% 3*49% 1.376G
Reasoning : 12.7262
token/s
Pre filled:168.525
token/s
Qwen 1.8B W8a8 13.7% 3*50% 2.72G
Reasoning : 10.8891
token/s
Pre filled:440.511
token/s
Qwen2 0.5B W8a8 17.75% 3*34% 1.344G
Reasoning : 17.4542
token/s
Pre filled:22.8119
token/s
Phi-3 3.8B W8a8 13.13% 3*62% 4.288G
Reasoning : 4.72983
token/s
Pre filled:48.8464
token/s
ChatGLM3 6B W8a8 8.3% 3*75% 7.04G
Reasoning : 3.80383
token/s

479
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

Pre filled:112.489
token/s
Gemma 2B W8a8 8.25% 3*64% 4.8G
Reasoning : 6.41746
token/s
Pre filled:117.099
token/s
InternLM2 1.8B W8a8 11.87% 3*57% 2.432G
Reasoning : 9.139
token/s
Pre filled:77.4655
token/s
MiniCPM 2B W8a8 16.25% 3*52% 3.904G
Reasoning : 6.16648
token/s

3.40. How to shut down and restart the development board

1) During the running of the Linux system, if you directly unplug the Type-C power
supply and cut off the power, the file system may lose some data or be damaged.
Therefore, please use the poweroff command to shut down the Linux system of the
development board before cutting off the power. Then unplug the power supply.
orangepi@orangepi:~$ sudo poweroff

2) In addition, the development board is equipped with a power on/off button, and you
can also short press the power on/off button on the development board to shut down.

Note that after pressing the power button on the Linux desktop version, the
confirmation box shown in the figure below will pop up. You need to click the Shut
Down option before shutting down.

480
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

3) After shutting down, short press the power button on the development board to turn it
on.

4) The command to restart the linux system is


orangepi@orangepi:~$ sudo reboot

481
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

4. Orange Pi OS Arch System Instructions

4.1. Orange Pi OS Arch system adaptation status

Function OPi OS Arch Gnome Wayland


HDMI 2.1 Video OK
HDMI 2.1 Video OK
HDMI 2.0 Audio OK
HDMI 2.0 Audio OK
USB2.0x3 OK
USB3.0x1 OK
Gigabit network port OK
Network port status light OK
WIFI OK
Bluetooth OK
Debug serial port OK
RTC OK
FAN interface OK
Emmc Extension ports OK
GPIO(40pin) OK
UART(40pin) OK
SPI(40pin) OK
I2C(40pin) OK
CAN(40pin) OK
PWM(40pin) OK
TF card boot OK
OV13850 Camera OK
OV13855 Camera OK
SPI+NVME start up OK
SPI+SATA start up OK
LCD OK
MIC OK
Headphone playback OK

482
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

Headphone recording OK
Tri-color LED light OK
GPU OK
NPU NO
VPU OK
On/off button OK
watchdog test OK
Chromium Hard solution video NO
MPV hard solution video OK

4.2. How to use SATA SSD in OPi OS Arch system

The m.2 interface shown in the figure below can use either nvme ssd or sata ssd.
Since the pcie2.0 controller and the sata controller are optional, only one of the
configurations can be opened at the same time. The OPi OS Arch image released by
Orange Pi opens the pcie configuration by default, so it can only recognize nvme ssd
by default. If you want to use sata ssd, you need to open the corresponding
configuration.

1) First you need to prepare a SATA SSD solid state drive

2) Then insert the SSD into the M.2 interface of the development board and secure it

483
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

3) There are two main ways to use sata ssd:


a. The OPi OS Arch system is installed in the tf card, and then the sata ssd is
inserted as an external storage device. This section mainly explains this usage.
b. Burn the OPi OS Arch system into the sata ssd, and then start the OPi OS Arch
system in the sata ssd. For this usage, please see the instructions in the section
"How to Burn Linux Image to SPIFlash+SATA SSD"

4) Then add the following configuration to /boot/extlinux/[Link]


[orangepi@orangepi ~]$ sudo vim /boot/extlinux/[Link]
LABEL Orange Pi
LINUX /Image
FDT /dtbs/rockchip/[Link]
FDTOVERLAYS /dtbs/rockchip/overlay/[Link] #Configuration
that needs to be added

5) Then restart the OPi OS Arch system

6) If everything is normal, use the sudo fdisk -l command after the system restarts to see
the sata ssd information
[orangepi@orangepi ~]$ sudo fdisk -l
.......
Disk /dev/sda: 238.47 GiB, 256060514304 bytes, 500118192 sectors
Disk model: Fanxiang S201 25
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 43FFB292-340D-654C-8C30-6C64AEDAA0F4

484
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

Device Start End Sectors Size Type


/dev/sda1 2048 500117503 500115456 238.5G Linux filesystem
.......

4.3. How to use the 10.1-inch MIPI LCD screen

4.3.1. 10.1-inch MIPI screen assembly method


1) First prepare the necessary accessories
a. 10.1 inch MIPI LCD display + touch screen

b. Screen adapter board + 31pin to 40pin cable

c. 30pin MIPI cable

d. 12pin touch screen cable

485
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

2) Connect the 12pin touch screen cable, 31pin to 40pin cable, and 30pin MIPI cable to
the screen adapter board as shown below. Note that the blue insulated side of the touch
screen cable is facing down, and the insulated side of the other two cables is facing up. ,
if connected incorrectly, it will cause no display or inability to touch.

3) Place the adapter board connected with the cable on top of the MIPI LCD screen as
shown below, and connect the MIPI LCD screen and the adapter board through a 31pin to
40pin cable.

4) Then connect the touch screen and the adapter board through the 12pin touch screen
cable. Pay attention to the orientation of the insulation surface.

486
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

5) Finally, connect it to the LCD interface of the development board through a 30pin
MIPI cable.

4.3.2. How to open the 10.1-inch MIPI LCD screen configuration


1) The OPi OS Arch image does not have the configuration to open the mipi LCD screen
by default. If you need to use the mipi LCD screen, you need to open it manually.

2) The interface of the mipi lcd screen on the development board is as shown below:

487
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

3) The method to open mipi lcd configuration is as follows:


[orangepi@orangepi ~]$ sudo vim /boot/extlinux/[Link]
LABEL Orange Pi
LINUX /Image
FDT /dtbs/rockchip/[Link]
FDTOVERLAYS /dtbs/rockchip/overlay/[Link] #Configuration
that needs to be added

4) Then restart the OPi OS Arch system

5) After restarting, you can see the LCD screen display as follows (default is vertical
screen):

4.3.3. Methods of rotating display and touch direction


1) First click on the area in the upper right corner of the desktop

488
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

2) Then open settings

3) Then select Displays

4) Then select the direction you want to rotate in the Orientation of Displays

489
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

5) Then select Apply

6) Then you can see that the screen has been rotated. At this time, you need to select
Keep Changes to finalize the rotation.

490
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

7) The display after the LCD screen is rotated 90 degrees is as follows::

8) The touch function of the OPi OS Arch system LCD screen will rotate with the
rotation of the display direction, no other settings are required.

4.4. Testing methods for OV13850 and OV13855 MIPI


cameras
Currently, the development board supports two MIPI cameras, OV13850 and
OV13855. The specific pictures are as follows:
a. OV13850 camera with 13 million MIPI interface

491
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

b. OV13855 camera with 13 million MIPI interface

The adapter board and FPC cable used by the OV13850 and OV13855 cameras are
the same, but the locations where the two cameras are connected to the adapter board are
different. The FPC cable is shown in the figure below. Please note that the FPC cable has
a direction. The end marked TO MB needs to be plugged into the camera interface of the
development board, and the end marked TO CAMERA needs to be plugged into the
camera adapter board.

There are a total of 3 camera interfaces on the camera adapter board, and only one
can be connected and used at the same time, as shown in the figure below, among which:
d. Connect the OV13850 camera to interface 1
e. Connect the OV13855 camera to interface 2
f. Interface 3 is not used, so just ignore it.

There are a total of 2 camera interfaces on the Orange Pi 5 Pro development board.
We define the positions of Cam1 and Cam2 as shown in the figure below:

492
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

The method of plugging the camera into the Cam1 interface of the development
board is as follows:

The method of plugging the camera into the Cam2 interface of the development
board is as follows:

After connecting the camera to the development board, we can use the following
method to test the camera:
a. First add the following configuration to /boot/extlinux/[Link]
[orangepi@orangepi ~]$ sudo vim /boot/extlinux/[Link]
LABEL Orange Pi
LINUX /Image
FDT /dtbs/rockchip/[Link]
FDTOVERLAYS /dtbs/rockchip/overlay/[Link] #Configuration
that needs to be added

The red font above demonstrates the configuration of opening the Cam1 interface.

493
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

The configuration of other interfaces is as shown in the following table. Just add the
corresponding dtbo configuration after FDTOVERLAYS. If you want to add multiple
configurations at the same time, separate them with spaces.
Camera dtbo configuration
Cam1 /dtbs/rockchip/overlay/[Link]
Cam2 /dtbs/rockchip/overlay/[Link]

b. Then restart the OPi OS Arch system


c. Then open a terminal on the desktop system and run the following script
orangepi@orangepi:~$ test_camera.sh
d. Then you can see the preview screen of the camera

4.5. How to set up the Chinese environment and install the


Chinese input method
1) First click on the area in the upper right corner of the desktop

494
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

2) Then open settings

3) Then find the Region & Language option

495
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

4) Then select Language

5) Then select Chinese

496
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

6) Then clickSelect

7) Then click Logout... to log out of the system, and then log in again.

497
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

8) Then you can see that the desktop is displayed in Chinese

9) Then install fcitx-im and fcitx-configtool


[orangepi@orangepi ~]$ sudo pacman -S fcitx-im fcitx-configtool
:: There are 3 members in group fcitx-im:
:: software warehouse community
1) fcitx 2) fcitx-qt5 3) fcitx-qt6

498
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

Enter a selection (default=all selected): 1

10) Then open the Fcitx configuration program

11) Then add Google Pinyin input method

499
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

12) Then we can open a terminal to test the Chinese input method. After opening the
terminal, if the English input method is still the default, we can switch to the Chinese
input method through the Ctrl+Space shortcut key, and then we can enter Chinese.

500
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

4.6. How to install wiringOP

Note that wiringOP is already pre-installed in the OPi OS Arch image released
by Orange Pi. Unless the wiringOP code is updated, there is no need to re-download,
compile and install it, you can just use it directly.

After entering the system, you can run the gpio readall command. If you can see
the following output, it means that wiringOP has been pre-installed and can be used
normally.

501
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

1) Download the code of wiringOP


[orangepi@orangepi ~]$ sudo pacman -Syy git
[orangepi@orangepi ~]$ git clone [Link] -b next

Note that Orange Pi 5 Pro needs to download the code of wiringOP next branch, please
don’t miss the -b next parameter.

If there is a problem downloading the code from GitHub, you can download the source code
compressed package of [Link] from the official tool on the Orange Pi 5 Pro data
download page.

2) Compile and install wiringOP


[orangepi@orangepi ~]$ sudo pacman -Syy make gcc
[orangepi@orangepi ~]$ cd wiringOP

502
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

[orangepi@orangepi wiringOP]$ sudo ./build clean


[orangepi@orangepi wiringOP]$ sudo ./build

3) The output of the test gpio readall command is as follows

4.7. 40pin interface GPIO, I2C, UART, SPI, CAN and PWM
testing

Note that if you need to set up fdt overlays to open multiple configurations at
the same time, please separate them with spaces and write them on one line like the
red font configuration below.

[orangepi@orangepi ~]$ sudo vim /boot/extlinux/[Link]


LABEL Orange Pi
LINUX /Image
FDT /dtbs/rockchip/[Link]
FDTOVERLAYS /dtbs/rockchip/overlay/[Link] /dtbs/rockchip/overlay/[Link]

4.7.1. 40pin GPIO port test


1) There are a total of 28 GPIO ports in the 40-pin development board that can be used.

503
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

The following uses pin No. 7 - the corresponding GPIO is GPIO1_B7 - the corresponding
wPi serial number is 2 - as an example to demonstrate how to set the high and low levels
of the GPIO port.

2) First set the GPIO port to output mode, and the third parameter needs to be the serial
number of the wPi corresponding to the input pin.
[orangepi@orangepi ~]$ gpio mode 2 out

3) Then set the GPIO port to output a low level. After setting, you can use a multimeter
to measure the voltage value of the pin. If it is 0v, it means the low level is set
successfully.
[orangepi@orangepi ~]$ gpio write 2 0

Using gpio readall, you can see that the value (V) of pin 7 becomes 0

4) Then set the GPIO port to output a high level. After setting, you can use a multimeter
to measure the voltage value of the pin. If it is 3.3v, it means the setting of the high level
is successful.
[orangepi@orangepi ~]$ gpio write 2 1

Using gpio readall, you can see that the value (V) of pin 7 changes to 1

504
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

5) The setting method for other pins is similar. You only need to modify the serial
number of wPi to the serial number corresponding to the pin.
4.7.2. How to set the pull-down resistor of the 40pin GPIO port
Note that the four GPIO pins below Orange Pi 5 Pro have external 3.3V
pull-ups, so the pull-down settings are invalid.

1) The following uses pin No. 11 - the corresponding GPIO is GPIO4_B2 - the
corresponding wPi serial number is 5 - as an example to demonstrate how to set the
pull-up and pull-down resistors of the GPIO port.

505
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

2) First, you need to set the GPIO port to input mode, and the third parameter needs to be
the serial number of the wPi corresponding to the input pin.
[orangepi@orangepi ~]$ gpio mode 5 in

3) After setting to input mode, execute the following command to set the GPIO port to
pull-up mode.
[orangepi@orangepi ~]$ gpio mode 5 up
4) Then enter the following command to read the level of the GPIO port. If the level is 1,
it means that the pull-up mode is set successfully.
[orangepi@orangepi ~]$ gpio read 5
1

5) Then execute the following command to set the GPIO port to pull-down mode
[orangepi@orangepi ~]$ gpio mode 5 down

6) Then enter the following command to read the level of the GPIO port. If the level is 0,
it means that the pull-down mode is set successfully.
[orangepi@orangepi ~]$ gpio read 5
0
4.7.3. 40pin SPI test
1) As can be seen from the picture below, the spi available for Orange Pi 5 Pro is spi0
and spi4

506
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

2) The corresponding pins of SPI0 and SPI4 in 40pin are as shown in the table below.
SPI0_M2 correspond 40pin SPI4_M2 correspond 40pin
MOSI Pin 19 Pin 16
MISO Pin 21 Pin 18
CLK Pin 23 Pin 27
CS0 Pin 24 Pin 28
CS1 Pin 26 None
dtbo 配置 spi0-m2-cs0-spidev spi4-m2-cs0-spidev
spi0-m2-cs1-spidev
spi0-m2-cs0-cs1-spidev

In the OPi OS Arch system, the spi function in 40pin is turned off by default and
needs to be turned on manually to use it.

Add the configuration in red font below to /boot/extlinux/[Link], then restart


the OPi OS Arch system to open spi0 and spi4. If you only need to open one, just fill
in one.

[orangepi@orangepi ~]$ sudo vim /boot/extlinux/[Link]


LABEL Orange Pi
LINUX /Image
FDT /dtbs/rockchip/[Link]
FDTOVERLAYS /dtbs/rockchip/overlay/[Link]
/dtbs/rockchip/overlay/[Link]

3) First check whether the device node of spidevx.x exists in the OPi OS Arch system. If
it exists, it means that SPI4 has been set up and can be used directly.
[orangepi@orangepi ~]$ ls /dev/spidev*

507
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

/dev/spidev0.0 /dev/spidev0.1 /dev/spidev4.0

The above is the result displayed after opening spi0-m2-cs0-cs1-spidev and


spi4-m2-cs0-spidev.

4) Without shorting the mosi and miso pins of SPI0 or SPI4, the output result of running
spidev_test is as follows. You can see that the data of TX and RX are inconsistent.
[orangepi@orangepi ~]$ sudo spidev_test -v -D /dev/spidev0.0
Or
[orangepi@orangepi ~]$ sudo spidev_test -v -D /dev/spidev4.0
spi mode: 0x0
bits per word: 8
max speed: 500000 Hz (500 KHz)
TX | FF FF FF FF FF FF 40 00 00 00 00 95 FF FF FF FF FF FF FF FF FF FF FF FF FF
FF FF FF FF FF F0 0D | ......@....▒..................▒.
RX | FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
FF FF FF FF FF FF FF FF | ................................

5) Then short-circuit the mosi and miso pins of SPI0 or SPI4 and then run spidev_test.
The output is as follows. You can see that the data sent and received are the same.
[orangepi@orangepi ~]$ sudo spidev_test -v -D /dev/spidev0.0
Or
[orangepi@orangepi ~]$ sudo spidev_test -v -D /dev/spidev4.0
spi mode: 0x0
bits per word: 8
max speed: 500000 Hz (500 KHz)
TX | FF FF FF FF FF FF 40 00 00 00 00 95 FF FF FF FF FF FF FF FF FF FF FF FF FF
FF FF FF FF FF F0 0D | ......@....▒..................▒.
RX | FF FF FF FF FF FF 40 00 00 00 00 95 FF FF FF FF FF FF FF FF FF FF FF FF FF
FF FF FF FF FF F0 0D | ......@....▒..................▒.
4.7.4. 40pin I2C test
1) As can be seen from the table below, the i2c available for Orange Pi 5 is i2c1, i2c4,
i2c5 and i2c8, a total of four groups of i2c buses.

508
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

2) The corresponding pins of the 4 sets of I2C buses in 40pin are shown in the table
below. I2C5_M2 and I2C5_M3 can only use one of them at the same time, not at the
same time. They are the same I2C5, just connected to different pins. Please do not think
that they are two different sets of I2C5 buses.
I2C bus SDA corresponds to SCL corresponds to dtbo corresponding
40pin 40pin configuration
I2C1_M4 Pin 3 Pin 5 i2c1-m4
I2C4_M3 Pin 27 Pin 28 i2c4-m3
I2C5_M2 Pin 35 Pin 37 i2c5-m2
I2C5_M3 Pin 7 Pin 15 i2c5-m3
I2C8_M2 Pin 33 Pin 32 i2c8-m2

In the OPi OS Arch system, i2c in 40pin is turned off by default and needs to be
turned on manually to use it.

Add the configuration in red font below to /boot/extlinux/[Link], and then


restart the OPi OS Arch system to open i2c1, i2c4, i2c5 and i2c8 at the same time. If
you only need to open one, just fill in one.

[orangepi@orangepi ~]$ sudo vim /boot/extlinux/[Link]


LABEL Orange Pi
LINUX /Image
FDT /dtbs/rockchip/[Link]
FDTOVERLAYS /dtbs/rockchip/overlay/[Link]
/dtbs/rockchip/overlay/[Link]
/dtbs/rockchip/overlay/[Link]
/dtbs/rockchip/overlay/[Link]

509
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

The red font configuration above needs to be written on one line, and different
configurations need to be separated by spaces.

3) After starting the OPi OS Arch system, first confirm that there is an i2c device node
under /dev
[orangepi@orangepi ~]$ ls /dev/i2c-*
/dev/i2c-0 /dev/i2c-10 /dev/i2c-4 /dev/i2c-6 /dev/i2c-9
/dev/i2c-1 /dev/i2c-2 /dev/i2c-5 /dev/i2c-7 /dev/i2c-8

4) Then connect an i2c device to the i2c pin of the 40pin connector

Generally, only one of the 3.3v pin and the 5v pin can be connected. Please
choose to connect the 3.3v pin or the 5v pin according to the specific i2c device
connected.

5) Then use the i2cdetect -y command. If the address of the connected i2c device can be
detected, it means that i2c can be used normally.
[orangepi@orangepi ~]$ sudo pacman -Syy i2c-tools
[orangepi@orangepi ~]$ sudo i2cdetect -y 1 #i2c1 commands
[orangepi@orangepi ~]$ sudo i2cdetect -y 4 #i2c4 commands
[orangepi@orangepi ~]$ sudo i2cdetect -y 5 #i2c5 commands
[orangepi@orangepi ~]$ sudo i2cdetect -y 8 #i2c8 commands
4.7.5. 40pin UART test
1) As can be seen from the table below, the available uarts for Orange Pi 5 Pro are uart0,
uart3, uart4, uart6 and uart7, a total of five groups of uart buses.

2) The corresponding pins of the five sets of UART buses in 40pin are as shown in the
table below. UART4_M0 and UART4_M2 can only use one of them at the same time, not
at the same time. They are the same UART4, just connected to different pins. Please do

510
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

not think that they are two different sets of UART4 buses.
UART bus RX corresponds to TX corresponds to dtbo corresponding
40pin 40pin configuration
UART0_M2 Pin 38 Pin 36 uart0-m2
UART3_M2 Pin 37 Pin 40 uart3-m2
UART4_M0 Pin 3 Pin 5 uart4-m0
UART4_M2 Pin 19 Pin 23 uart4-m2
UART6_M1 Pin 18 Pin 16 uart6-m1
UART7_M2 Pin 24 Pin 26 uart7-m2

In the OPi OS Arch system, the uart in 40pin is turned off by default and needs
to be turned on manually to use it.

Add the following configuration in red font to /boot/extlinux/[Link], and then


restart the OPi OS Arch system to open uart0, uart3, uart4, uart6 and uart7 at the
same time. If you only need to open one, then fill in one. .

[orangepi@orangepi ~]$ sudo vim /boot/extlinux/[Link]


LABEL Orange Pi
LINUX /Image
FDT /dtbs/rockchip/[Link]
FDTOVERLAYS /dtbs/rockchip/overlay/[Link]
/dtbs/rockchip/overlay/[Link]
/dtbs/rockchip/overlay/[Link]
/dtbs/rockchip/overlay/[Link]
/dtbs/rockchip/overlay/[Link]

The red font configuration above needs to be written on one line, and different
configurations need to be separated by spaces.

3) After entering the Linux system, first confirm whether there is a device node
corresponding to uart under /dev
[orangepi@orangepi ~]$ ls /dev/ttyS*
/dev/ttyS0 /dev/ttyS3 /dev/ttyS4 /dev/ttyS6 /dev/ttyS7 /dev/ttyS9

511
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

4) Then start testing the uart interface. First use Dupont wire to short-circuit the rx and tx
of the uart interface to be tested.

5) Use the gpio serial command to test the loopback function of the serial port as shown
below. If you can see the following print, it means the serial port communication is
normal (ttySX needs to be replaced with the node name corresponding to the uart, please
do not copy it)
[orangepi@orangepi ~]$ sudo gpio serial /dev/ttySX
[sudo] password for orangepi: #Enter password here

Out: 0: -> 0
Out: 1: -> 1
Out: 2: -> 2
Out: 3: -> 3
Out: 4: -> 4
Out: 5: -> 5^C
4.7.6. PWM test method
1) As can be seen from the table below, the available pwms for Orange Pi 5 Pro include
pwm0, pwm1, pwm3, pwm13, pwm14 and pwm15, a total of six pwms.

9) The corresponding pins of PWM in 40pin are as shown in the table below.
PWM14_M1 and PWM14_M2, PWM15_M1 and PWM15_M3 can only use one of them
at the same time, not at the same time. They are all the same PWM, just connected to
different pins. Please do not think that they are two different PWM buses.
PWM bus Corresponds to dtbo corresponding
40pin configuration
PWM0_M2 Pin 27 pwm0-m2
PWM1_M2 Pin 28 pwm1-m2
PWM3_M3 Pin 12 pwm3-m3

512
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

PWM13_M2 Pin 7 pwm13-m2


PWM14_M1 Pin 11 pwm14-m1
PWM14_M2 Pin 32 pwm14-m2
PWM15_M1 Pin 13 pwm15-m1
PWM15_M3 Pin 33 pwm15-m3

In the OPi OS Arch system, pwm in 40pin is turned off by default and needs to
be turned on manually to use it.

Add the configuration in red font below to /boot/extlinux/[Link], and then


restart the OPi OS Arch system to open pwm0, pwm1, pwm3, pwm13, pwm14 and
pwm15 at the same time. If you only need to open one, then fill in one That’s it.

[orangepi@orangepi ~]$ sudo vim /boot/extlinux/[Link]


LABEL Orange Pi
LINUX /Image
FDT /dtbs/rockchip/[Link]
FDTOVERLAYS /dtbs/rockchip/overlay/[Link]
/dtbs/rockchip/overlay/[Link]
/dtbs/rockchip/overlay/[Link]
/dtbs/rockchip/overlay/[Link]
/dtbs/rockchip/overlay/[Link]
/dtbs/rockchip/overlay/[Link]

The red font configuration above needs to be written on one line, and different
configurations need to be separated by spaces.

2) When a pwm is opened, there will be an additional pwmchipX (X is a specific number)


in/sys/class/pwm/. For example, after opening pwm13, the pwmchipX under
/sys/class/pwm/ will be Two became three
[orangepi@orangepi ~]$ ls /sys/class/pwm/
pwmchip0 pwmchip1 pwmchip2

3) Which pwmchip above corresponds to pwm13? Let’s first check the output of the ls
ls /sys/class/pwm/ -l command, as shown below:

513
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

4) From the following table, we can see that the base address of the pwm13 register is
febf0010. Looking at the output of the ls /sys/class/pwm/ -l command, we can see that
pwmchip2 is linked to [Link], so the corresponding pwmchip of pwm13 is
pwmchip2

5) Then use the following command to make pwm13 output a 50Hz square wave (please
switch to the root user first, and then execute the following command)
[root@orangepi orangepi]# echo 0 > /sys/class/pwm/pwmchip2/export
[root@orangepi orangepi]# echo 20000000 > /sys/class/pwm/pwmchip2/pwm0/period
[root@orangepi orangepi]# echo 1000000 > /sys/class/pwm/pwmchip2/pwm0/duty_cycle
[root@orangepi orangepi]# echo 1 > /sys/class/pwm/pwmchip2/pwm0/enable

514
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

6) The test method of pwm13 demonstrated above is similar to other pwm test methods.
4.7.7. CAN test method
1) As can be seen from the table below, the CAN bus available for Orange Pi 5 Pro is
CAN1, a total of one CAN bus

In the OPi OS Arch system, CAN in 40pin is turned off by default and needs to
be turned on manually to use it.

Add the configuration in red font below to /boot/extlinux/[Link], and then


restart the OPi OS Arch system to open CAN1.

[orangepi@orangepi ~]$ sudo vim /boot/extlinux/[Link]


LABEL Orange Pi
LINUX /Image
FDT /dtbs/rockchip/[Link]
FDTOVERLAYS /dtbs/rockchip/overlay/[Link]

515
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

The red font configuration above needs to be written on one line, and different
configurations need to be separated by spaces.

2) After entering the OPi OS Arch system, use the sudo ifconfig -a command. If you can
see the CAN device node, it means that CAN has been opened correctly.
[orangepi@orangepi ~]$ sudo pacman -Syy net-tools
[orangepi@orangepi ~]$ sudo ifconfig -a
can0: flags=128<NOARP> mtu 16
unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 10 (UNSPEC)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 91

can1: flags=128<NOARP> mtu 16


unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 10 (UNSPEC)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 92

3) The corresponding pin of CAN1 is


CAN1
TX pin Corresponds to
pin 13
RX pin Corresponds to
pin 11

4) For the method of using CANalyst-II analyzer to test CAN sending and receiving
messages, please refer to the section below using CANalyst-II analyzer to test sending
and receiving messages.

516
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

5. Linux SDK——orangepi-build usage instructions

5.1. Compilation system requirements

We can cross-compile the Linux image of the development board in an x64


computer, or we can compile the Linux image of the development board in the
Ubuntu22.04 system of the development board. Please choose one according to your
preference.

If you use orangepi-build to compile the Linux image in the Ubuntu22.04 system
of the development board, please dissipate heat (especially when the SSD is started).
If heat dissipation is not done properly, file system runaway errors may easily occur.
5.1.1. Compile using the Ubuntu22.04 system of the development
board
1) The Linux SDK, orangepi-build, supports running on Ubuntu 22.04 on the
development board (other systems have not been tested), so before downloading
orangepi-build, please first ensure that the Ubuntu version installed on the development
board is Ubuntu 22.04. The command to check the Ubuntu version installed on the
development board is as follows. If the Release field does not display 22.04, it means that
the Ubuntu version currently used does not meet the requirements. Please change the
system before performing the following operations.
orangepi@orangepi:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.1 LTS
Release: 22.04
Codename: jammy

2) Since the source code such as kernel and U-boot are stored on GitHub, it is very
important to ensure that the development board can download the code from
GitHub normally when compiling the image.
5.1.2. Compile using x64 Ubuntu22.04 computer
1) The Linux SDK, orangepi-build, supports running on computers with Ubuntu
22.04 installed. Therefore, before downloading orangepi-build, please first ensure that the

517
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

Ubuntu version installed on your computer is Ubuntu 22.04. The command to check the
Ubuntu version installed on the computer is as follows. If the Release field does not
display 22.04, it means that the Ubuntu version currently used does not meet the
requirements. Please change the system before performing the following operations.
test@test:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04 LTS
Release: 22.04
Codename: jammy

2) If the computer is installed with a Windows system and there is no computer with
Ubuntu 22.04 installed, you can consider using VirtualBox or VMware to install an
Ubuntu 22.04 virtual machine in the Windows system. But please note, do not compile
orangepi-build on the WSL virtual machine, because orangepi-build has not been tested
in the WSL virtual machine, so there is no guarantee that orangepi-build can be used
normally in WSL.

3) The installation image download address of Ubuntu 22.04 amd64 version is:
[Link]
或者
[Link]

4) After installing Ubuntu 22.04 on the computer or virtual machine, please first set the
software source of Ubuntu 22.04 to Tsinghua source, otherwise it is easy to make errors
due to network reasons when installing the software later.
a. For the method of replacing Tsinghua source, please refer to the instructions on
this page.
[Link]
b. Note that the Ubuntu version needs to be switched to 22.04

518
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

c. The contents of the /etc/apt/[Link] file that need to be replaced are:


test@test:~$ sudo mv /etc/apt/[Link] /etc/apt/[Link]
test@test:~$ sudo vim /etc/apt/[Link]
# The source code image is commented by default to improve apt update speed. You can uncomment it yourself if
necessary.
deb [Link] jammy main restricted universe multiverse
# deb-src [Link] jammy main restricted universe multiverse
deb [Link] jammy-updates main restricted universe multiverse
# deb-src [Link] jammy-updates main restricted universe multiverse
deb [Link] jammy-backports main restricted universe multiverse
# deb-src [Link] jammy-backports main restricted universe multiverse
deb [Link] jammy-security main restricted universe multiverse
# deb-src [Link] jammy-security main restricted universe multiverse

# Pre-release software source, not recommended to be enabled


# deb [Link] jammy-proposed main restricted universe multiverse
# deb-src [Link] jammy-proposed main restricted universe multiverse

d. After the replacement, you need to update the package information and ensure
that no errors are reported.
test@test:~$ sudo apt update
e. In addition, since the source code such as kernel and U-boot are stored on
GitHub, it is very important to ensure that the computer can download the
code from GitHub normally when compiling the image.

519
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

5.2. Obtain the source code of linux sdk

5.2.1. Download orangepi-build from github

1) Linux sdk actually refers to the orangepi-build set of codes. Orangepi-build is


modified based on the armbian build compilation system. Multiple versions of Linux
images can be compiled using orangepi-build. First download the orangepi-build code,
the command is as follows:
test@test:~$ sudo apt-get update
test@test:~$ sudo apt-get install -y git
test@test:~$ git clone [Link] -b next

Note that the Orange Pi 5 Pro development board needs to download the source
code of the next branch of orangepi-build. The above git clone command needs to
specify the branch of the orangepi-build source code as next.

Downloading the orangepi-build code through the git clone command does not
require entering the user name and password of the github account (the same is true
for downloading other codes in this manual). If after entering the git clone command,
Ubuntu PC prompts you to enter the user name of the github account. The name
and password are usually entered incorrectly in the address of the orangepi-build

520
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

warehouse behind git clone. Please carefully check whether there are any spelling
errors in the command, rather than thinking that we have forgotten to provide the
username and password of the github account.

2) The u-boot and linux kernel versions currently used by the development board are as
follows
branch u-boot version linux kernel version
legacy u-boot 2017.09 linux5.10

The branch mentioned here is not the same thing as the branch of
orangepi-build source code, please don't get confused. This branch is mainly used to
distinguish different kernel source code versions.
We currently define the linux5.10 bsp kernel provided by RK as the legacy
branch. If the mainline kernel is supported in the future, a current branch will be
added.

3) After orangepi-build is downloaded, it will contain the following files and folders
a. [Link]: Compile startup script
b. external: Contains configuration files, specific scripts, and source code of some
programs needed to compile the image, etc.
c. LICENSE: GPL 2 license file
d. [Link]: orangepi-build documentation
e. scripts: Common script for compiling linux images
test@test:~/orangepi-build$ ls
[Link] external LICENSE [Link] scripts

If you downloaded the orangepi-build code from github, after downloading, you
may find that orangepi-build does not contain the source code of u-boot and linux
kernel, and there is no cross-compilation tool required to compile u-boot and linux
kernel. chain, this is normal, because these things are stored in other separate github
repositories or some servers (their addresses will be detailed below). Orangepi-build
will specify the addresses of u-boot, Linux kernel and cross-compilation tool chain in
the script and configuration file. When running orangepi-build, when it finds that
these things are not available locally, it will automatically download them from the
corresponding places.

521
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

5.2.2. Download the cross-compilation tool chain


The cross-compilation tool chain will be downloaded only if you use
orangepi-build to compile the image on an x64 computer. When compiling the Linux
image of the development board in Ubuntu 22.04, the cross-compilation tool chain
will not be downloaded. At this time, orangepi-build/toolchains will be an empty
folder.

1) When orangepi-build is run for the first time, it will automatically download the
cross-compilation toolchain and put it in the toolchains folder. Every time you run
orangepi-build's [Link] script, it will check whether the cross-compilation toolchain in
toolchains exists. , if it does not exist, the download will be restarted, if it exists, it will
be used directly, and the download will not be repeated.

2) The mirror URL of the cross-compilation tool chain in China is the open source
software mirror site of Tsinghua University
[Link]

3) After toolchains is downloaded, it will contain multiple versions of cross-compilation


toolchains, and the development board will only use two of them.
test@test:~/orangepi-build$ ls toolchains/
gcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu
gcc-arm-11.2-2022.02-x86_64-arm-none-linux-gnueabihf
gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu

522
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

gcc-arm-9.2-2019.12-x86_64-arm-none-linux-gnueabihf
gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabi
gcc-linaro-5.5.0-2017.10-x86_64_arm-linux-gnueabihf
gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu
gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabi
gcc-linaro-aarch64-none-elf-4.8-2013.11_linux
gcc-linaro-arm-linux-gnueabihf-4.8-2014.04_linux
gcc-linaro-arm-none-eabi-4.8-2014.04_linux

4) The cross-compilation tool chain used to compile the Linux kernel source code is
a. linux5.10
gcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu

5) The cross-compilation tool chain used to compile u-boot source code is


a. v2017.09
gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu
5.2.3. orangepi-build complete directory structure description
1) After downloading, the orangepi-build warehouse does not contain the source code of
the linux kernel, u-boot and cross-compilation tool chain. The source code of the linux
kernel and u-boot is stored in an independent git warehouse.
a. The git warehouse where the Linux kernel source code is stored is as follows:
[Link]
b. The git warehouse where the b.u-boot source code is stored is as follows:
[Link]

2) When orangepi-build is run for the first time, it will download the cross-compilation
tool chain, u-boot and linux kernel source code. After successfully compiling the linux
image, the files and folders that can be seen in orangepi-build are:
a. [Link]: Compile startup script
b. external: Contains the configuration files needed to compile the image, scripts
for specific functions, and the source code of some programs. The rootfs
compressed package cached during the image compilation process is also stored
in external.
c. kernel: Stores the source code of the Linux kernel. The folder named
orange-pi-5.10-rk35xx stores the kernel source code of the legacy branch of the

523
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

RK3588/RK3588S series development board. Please do not modify the name of


the kernel source code folder manually. If it is modified, When the compilation
system is running, the kernel source code will be re-downloaded.
d. LICENSE: GPL 2 license file
e. [Link]: orangepi-build documentation
f. output: Store compiled u-boot, linux and other deb packages, compilation logs,
and compiled images and other files
g. scripts: Common script for compiling linux images
h. toolchains: Store cross-compilation tool chain
i. u-boot: Store the u-boot source code. The folder named v2017.09-rk3588 stores
the u-boot source code of the legacy branch of the RK3588/RK3588S series
development board. Please do not modify the name of the u-boot source code
folder manually. If Modified, the u-boot source code will be re-downloaded
when the compilation system is running.
j. userpatches: Store the configuration files needed to compile the script
test@test:~/orangepi-build$ ls
[Link] external kernel LICENSE output [Link] scripts toolchains
u-boot userpatches

5.3. Compile u-boot

1) Run the [Link] script, remember to add sudo permissions


test@test:~/orangepi-build$ sudo ./[Link]

2) Select U-boot package and press Enter

3) Then select the model of the development board

524
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

4) Then it will start to compile u-boot. Some of the information prompted during
compilation is as follows:
a. u-boot source code version
[ o.k. ] Compiling u-boot [ v2017.09 ]
b. Version of the cross-compilation tool chain
[ o.k. ] Compiler version [ aarch64-linux-gnu-gcc 7.4.1 ]
c. The path to the u-boot deb package generated by compilation
[ o.k. ] Target directory [ orangepi-build/output/debs/u-boot ]
d. The package name of the u-boot deb package generated by compilation
[ o.k. ] File name [ linux-u-boot-legacy-orangepi5pro_1.0.2_arm64.deb ]
e. Compilation time
[ o.k. ] Runtime [ 1 min ]
f. Repeat the command to compile u-boot. Use the following command without
selecting through the graphical interface. You can start compiling u-boot directly.
[ o.k. ] Repeat Build Options [ sudo ./[Link] BOARD=orangepi5pro
BRANCH=legacy BUILD_OPT=u-boot KERNEL_CONFIGURE=no ]

5) View the compiled u-boot deb package


test@test:~/orangepi-build$ ls output/debs/u-boot/
linux-u-boot-legacy-orangepi5pro_1.0.2_arm64.deb

6) The files contained in the generated u-boot deb package are as follows:
a. Use the following command to decompress the deb package
test@test:~/orangepi-build$ cd output/debs/u-boot
test@test:~/orangepi_build/output/debs/u-boot$ $ dpkg -x \

525
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

linux-u-boot-legacy-orangepi5pro_1.0.2_arm64.deb . (Note that there is a "." at


the end of the command.)
test@test:~/orangepi_build/output/debs/u-boot$ ls
linux-u-boot-legacy-orangepi5pro_1.0.2_arm64.deb usr
b. The decompressed file is as follows
test@test:~/orangepi-build/output/debs/u-boot$ tree usr
usr
└── lib
├── linux-u-boot-legacy-orangepi5pro_1.0.2_arm64
│ ├── [Link]
│ ├── rkspi_loader.img
│ └── [Link]
└── u-boot
├── LICENSE
├── orangepi_5_defconfig
└── platform_install.sh

3 directories, 6 files

7) When the orangepi-bulid compilation system compiles the u-boot source code, it will
first synchronize the u-boot source code with the u-boot source code of the github server.
Therefore, if you want to modify the u-boot source code, you first need to turn off the
download and update function of the source code. (You need to completely compile
u-boot once before you can turn off this function, otherwise it will prompt that the
source code of u-boot cannot be found. If the source code compressed package is
downloaded from Baidu Cloud Disk, there is no such problem, because the source
code of u-boot have been cached), otherwise the modifications will be restored. The
method is as follows:
Set the IGNORE_UPDATES variable in userpatches/[Link] to "yes"
test@test:~/orangepi-build$ vim userpatches/[Link]
IGNORE_UPDATES="yes"

8) When debugging u-boot code, you can use the following method to update u-boot in
the linux image for testing
a. Upload the compiled deb package of u-boot to the Linux system of the

526
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

development board
test@test:~/orangepi-build$ cd output/debs/u-boot
test@test:~/orangepi_build/output/debs/u-boot$ scp \
linux-u-boot-legacy-orangepi5pro_1.0.2_arm64.deb root@[Link]:/root
b. Then log in to the development board and uninstall the installed deb package of
u-boot
root@orangepi:~# apt purge -y linux-u-boot-orangepi5pro-legacy
c. Install the new u-boot deb package just uploaded
root@orangepi:~# dpkg -i linux-u-boot-legacy-orangepi5pro_1.0.2_arm64.deb
d. Then run the nand-sata-install script
root@orangepi:~# nand-sata-install
e. Then select 5 Install/Update the bootloader on SD/eMM to update u-boot in
the TF card or 7 Install/Update the bootloader on SPI Flash to update u-boot
in SPI Flash

f. After pressing the Enter key, a Warning will pop up first.

g. Press the Enter key again to start updating u-boot. After the update is completed,
the following information will be displayed.

527
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

h. Then you can restart the development board to test whether the u-boot
modification has taken effect.

9) Other useful information


a. In u-boot 2017.09 source code, the defconfig configuration file used by the
development board is
orangepi-build/u-boot/v2017.09-rk3588/configs/orangepi_5_pro_defconfig
b. In u-boot 2017.09 source code, the dts file used by the development board is
orangepi-build/u-boot/v2017.09-rk3588/arch/arm/dts/[Link]

5.4. Compile the linux kernel

1) Run the [Link] script, remember to add sudo permissions


test@test:~/orangepi-build$ sudo ./[Link]

2) Select Kernel package and press Enter

3) Then select the model of the development board

528
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

4) Then you will be prompted whether you need to display the kernel configuration
interface. If you do not need to modify the kernel configuration, select the first one. If
you need to modify the kernel configuration, select the second one.

5) If you choose to display the kernel configuration menu (the second option) in step 4),
the kernel configuration interface opened through make menuconfig will pop up. At this
time, you can directly modify the kernel configuration. After modification, save and exit.
Yes, after exiting, the kernel source code will start to be compiled.

529
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

a. If you do not need to modify the kernel configuration options, when running the
[Link] script, pass KERNEL_CONFIGURE=no to temporarily block the pop-up
of the kernel configuration interface.
test@test:~/orangepi-build$ sudo ./[Link] KERNEL_CONFIGURE=no
b. You can also set KERNEL_CONFIGURE=no in the
orangepi-build/userpatches/[Link] configuration file to permanently
disable this function.
c. If the following error is prompted when compiling the kernel, this is because the
Ubuntu PC terminal interface is too small, causing the make menuconfig interface
to be unable to be displayed. Please adjust the Ubuntu PC terminal to the maximum
size, and then rerun the [Link] script.

530
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

6) Part of the information prompted when compiling the kernel source code is explained
as follows:
a. Linux kernel source code version
[ o.k. ] Compiling current kernel [ 5.10.160 ]
b. The version of the cross-compilation tool chain used
[ o.k. ] Compiler version [ aarch64-none-linux-gnu-gcc 11.2.1 ]
c. The configuration file used by the kernel by default and the path where it is
stored
[ o.k. ] Using kernel config file [ config/kernel/[Link] ]
d. The path of the kernel-related deb package generated by compilation
[ o.k. ] Target directory [ orangepi-build/output/debs/ ]
e. The package name of the kernel image deb package generated by compilation
[ o.k. ] File name [ linux-image-legacy-rockchip-rk3588_1.0.2_arm64.deb ]
f. Compilation time
[ o.k. ] Runtime [ 5 min ]
g. Finally, the compilation command to repeatedly compile the last selected kernel
will be displayed. Use the following command without selecting through the
graphical interface, and you can directly start compiling the kernel source code.
[ o.k. ] Repeat Build Options [ sudo ./[Link] BOARD=orangepi5pro
BRANCH=legacy BUILD_OPT=kernel KERNEL_CONFIGURE=no ]

7) View the kernel-related deb package generated by compilation


a. linux-dtb-legacy-rockchip-rk3588_1.0.2_arm64.deb Contains dtb files used by the kernel
b. linux-headers-legacy-rockchip-rk3588_1.0.2_arm64.deb Contains kernel header files

531
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

c. linux-image-legacy-rockchip-rk3588_1.0.2_arm64.deb Contains kernel images and kernel


modules
test@test:~/orangepi-build$ ls output/debs/linux-*
output/debs/linux-dtb-legacy-rockchip-rk3588_1.0.2_arm64.deb
output/debs/linux-image-legacy-rockchip-rk3588_1.0.2_arm64.deb
output/debs/linux-headers-legacy-rockchip-rk3588_1.0.2_arm64.deb

8) The files contained in the generated deb package of linux-image are as follows
a. Use the following command to decompress the deb package
test@test:~/orangepi-build$ cd output/debs
test@test:~/orangepi_build/output/debs$ mkdir test
test@test:~/orangepi_build/output/debs$ cp \
linux-image-legacy-rockchip-rk3588_1.0.2_arm64.deb test/
test@test:~/orangepi_build/output/debs$ cd test
test@test:~/orangepi_build/output/debs/test$ dpkg -x \
linux-image-legacy-rockchip-rk3588_1.0.2_arm64.deb .
test@test:~/orangepi_build/output/debs/test$ ls
boot etc lib linux-image-legacy-rockchip-rk3588_1.0.2_arm64.deb usr
b. The decompressed file is as follows
test@test:~/orangepi-build/output/debs/test$ tree -L 2
.
├── boot
│ ├── config-5.10.160-rockchip-rk3588
│ ├── [Link]-5.10.160-rockchip-rk3588
│ └── vmlinuz-5.10.160-rockchip-rk3588
├── etc
│ └── kernel
├── lib
│ └── modules
├── linux-image-legacy-rockchip-rk3588_1.0.2_arm64.deb
└── usr
├── lib
└── share

9) When the orangepi-bulid compilation system compiles the linux kernel source code, it

532
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

will first synchronize the linux kernel source code with the linux kernel source code of
the github server. Therefore, if you want to modify the linux kernel source code, you first
need to turn off the update function of the source code (it needs to be completely
compiled once This function can only be turned off after the linux kernel source
code is obtained, otherwise it will prompt that the linux kernel source code cannot
be found. If the source code compressed package is downloaded from Baidu Cloud
Disk, there will be no such problem, because the linux source code has been cached),
otherwise the All modifications will be restored, as follows:
Set the IGNORE_UPDATES variable in userpatches/[Link] to "yes"
test@test:~/orangepi-build$ vim userpatches/[Link]
IGNORE_UPDATES="yes"

10) If the kernel is modified, you can use the following method to update the kernel and
kernel module of the development board Linux system
a. Upload the compiled deb package of the Linux kernel to the Linux system of the
development board
test@test:~/orangepi-build$ cd output/debs
test@test:~/orangepi-build/output/debs$ scp \
linux-image-legacy-rockchip-rk3588_1.0.2_arm64.deb root@[Link]:/root
b. Then log in to the development board and uninstall the installed deb package of
the Linux kernel.
root@orangepi:~# apt purge -y linux-image-legacy-rockchip-rk3588
c. Install the deb package of the new linux kernel just uploaded
root@orangepi:~# dpkg -i linux-image-legacy-rockchip-rk3588_1.0.2_arm64.deb
d. Then restart the development board and check whether the kernel-related
modifications have taken effect.
root@orangepi:~# reboot

10) Other useful information


a. The storage location of the kernel configuration file is as follows. Please do not
go to the kernel source code to find the kernel configuration file used by the
development board.
orangepi-build/external/config/kernel/[Link]
b. The location of the dts file used by the development board is
orangepi-build/kernel/orange-pi-5.10-rk35xx/arch/arm64/boot/dts/rockchip/rk3588s

533
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

-[Link]

5.5. Compile rootfs

1) Run the [Link] script, remember to add sudo permissions


test@test:~/orangepi-build$ sudo ./[Link]

2) Select Rootfs and all deb packages and press Enter

3) Then select the model of the development board

4) Then select the type of rootfs

534
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

5) Then select the type of image


a. Image with console interface (server) Represents the image of the server
version, which is relatively small in size.
b. Image with desktop environment Represents an image with a desktop, which
is relatively large in size.

6) If you are compiling the server version of the image, you can also choose to compile
the Standard version or the Minimal version. The Minimal version will have much less
pre-installed software than the Standard version (please do not choose the Minimal
version without special needs, because many things are not pre-installed by default.
Some functions may not be available)

7) If you are compiling a desktop version of the image, you need to select the type of
desktop environment. Currently, Ubuntu Jammy mainly maintains XFCE and Gnome
desktops, Ubuntu Focal only maintains XFCE desktops, Debian Bullseye mainly
maintains XFCE and KDE desktops, and Debian Bookwork mainly maintains XFCE
desktop

535
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

You can then select additional packages that need to be installed. Please press the
Enter key here to skip directly.

8) Then the compilation of rootfs will begin. Some of the information prompted during
compilation is as follows:
a. Type of rootfs
[ o.k. ] local not found [ Creating new rootfs cache for jammy]
b. The storage path of the rootfs compressed package generated by compilation
[ o.k. ] Target directory [ external/cache/rootfs ]
c. The name of the rootfs compressed package generated by compilation
[ o.k. ] File name [ [Link].lz4 ]
d. Compilation time
[ o.k. ] Runtime [ 13 min ]

536
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

9) View the compiled rootfs compressed package


a. [Link].lz4 is a
compressed package of rootfs. The meaning of each field in the name is:
a) jammy represents the type of Linux distribution of rootfs
b) xfce indicates that rootfs is the desktop version, and if it is cli, it indicates
the server version type.
c) arm64 represents the architecture type of rootfs
d) f930ff6ebbac1a72108a2e100762b18f is the MD5 hash value generated by
the package names of all software packages installed by rootfs. As long as
the list of software packages installed by rootfs is not modified, this value
will not change. The compilation script will use this MD5 hash value.
Determine whether rootfs needs to be recompiled
b. [Link] lists the
package names of all packages installed by rootfs
test@test:~/orangepi-build$ ls external/cache/rootfs/
[Link].lz4
[Link]
[Link]

10) If the required rootfs already exists under external/cache/rootfs, then compiling the
rootfs again will directly skip the compilation process and will not restart the compilation.
When compiling the image, it will also go to external/cache/rootfs to check whether it
already exists. There is a cached rootfs available. If it is available, use it directly. This can
save a lot of download and compilation time.

5.6. Compile linux image

1) Run the [Link] script, remember to add sudo permissions


test@test:~/orangepi-build$ sudo ./[Link]

2) Select Full OS image for flashing and press Enter

537
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

3) Then select the model of the development board

4) Then select the type of rootfs

5) Then select the type of image


a. Image with console interface (server) Represents the image of the server
version, which is relatively small in size.
b. Image with desktop environment Represents an image with a desktop, which
is relatively large in size.

538
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

6) If you are compiling the server version of the image, you can also choose to compile
the Standard version or the Minimal version. The Minimal version will have much less
pre-installed software than the Standard version (please do not choose the Minimal
version without special needs, because many things are not pre-installed by default.
Some functions may not be available)

7) If you are compiling a desktop version of the image, you need to select the type of
desktop environment. Currently, Ubuntu Jammy mainly maintains XFCE and Gnome
desktops, Ubuntu Focal only maintains XFCE desktops, Debian Bullseye mainly
maintains XFCE and KDE desktops, and Debian Bookwork mainly maintains XFCE
desktop

You can then select additional packages that need to be installed. Please press the
Enter key here to skip directly.

539
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

8) Then the compilation of the linux image will begin. The general process of
compilation is as follows:
a. Initialize the compilation environment of Ubuntu PC and install the software
packages required for the compilation process.
b. Download the source code of u-boot and linux kernel (if already cached, only
update the code)
c. Compile u-boot source code and generate u-boot deb package
d. Compile linux source code and generate linux-related deb packages
e. Make the deb package of linux firmware
f. Make the deb package of orangepi-config tool
g. Create a deb package with board-level support
h. If you compile the desktop version image, you will also create a desktop-related
deb package.
i. Check whether rootfs has been cached. If not, re-create rootfs. If it has been cached,
decompress it directly and use it.
j. Install the deb package generated previously into rootfs
k. Make some specific settings for different development boards and different types
of images, such as pre-installing additional software packages, modifying system
configurations, etc.
l. Then create the image file and format the partition. The default type is ext4.
m. Then copy the configured rootfs to the mirror partition.
n. Then update initramfs
o. Finally, write the bin file of u-boot into the image through the dd command.

540
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

9) After compiling the image, the following message will be prompted


a. The storage path of the compiled image
[ o.k. ] Done building
[ output/images/Orangepi5pro_1.0.2_debian_bullseye_desktop_xfce_linux5.10.160/
Orangepi5pro_1.0.2_debian_bullseye_desktop_xfce_linux5.[Link] ]
b. Compilation time
[ o.k. ] Runtime [ 19 min ]
c. Repeat the command to compile the image. Use the following command to start
compiling the image directly without selecting it through the graphical interface.
[ o.k. ] Repeat Build Options [ sudo ./[Link] BOARD=orangepi5pro
BRANCH=legacy BUILD_OPT=image RELEASE=bullseye BUILD_MINIMAL=no
BUILD_DESKTOP=no KERNEL_CONFIGURE=yes ]

6. Linux development manual

6.1. Method to compile the kernel source code separately in


the Linux system of the development board
1) First download the Linux kernel source code of the development board
orangepi@orangepi:~$ git clone --depth=1 -b orange-pi-5.10-rk35xx [Link]

If there is a problem downloading the code from github, you can download the
kernel source code compressed package from the official tool of the development
board, then upload it to the Linux system of the development board, and then unzip
it.

541
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

The command to decompress the kernel source code archive is:


orangepi@orangepi:~$ tar zxf [Link]
orangepi@orangepi:~$ mv orange-pi-5.10-rk35xx linux-orangepi

After decompression, please execute the following command to synchronize the


source code with github to ensure that the source code is in the latest state:
orangepi@orangepi:~$ cd linux-orangepi
orangepi@orangepi:~/linux-orangepi$ git pull

2) Then configure the default kernel configuration


orangepi@orangepi:~$ cd linux-orangepi
orangepi@orangepi:~/linux-orangepi$ make rockchip_linux_defconfig

The path of rockchip_linux_defconfig in the kernel source code is


arch/arm64/configs/

3) Then compile the kernel source code


orangepi@orangepi:~/linux-orangepi$ make -j10

4) Then install the kernel module


orangepi@orangepi:~/linux-orangepi$ sudo make modules_install

The installation path of the kernel module is: /lib/modules

After executing the sudo make modules_install command, you can see that there
is an additional kernel module folder under /lib/modules/:
orangepi@orangepi5pro:~$ ls /lib/modules
5.10.160+ 5.10.160-rockchip-rk3588

5) Then install the kernel image and uInitrd


orangepi@orangepi:~/linux-orangepi$ sudo make install

The installation path of the kernel image and uInitrd is: /boot/

542
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

After executing the sudo make install command, you can see that there is an
additional kernel file under /boot/:
orangepi@orangepi5pro:~/orange-pi-5.10-rk3588$ ls /boot/vmlinuz*
/boot/vmlinuz-5.10.160+ /boot/vmlinuz-5.10.160-rockchip-rk3588

What is actually loaded when the system starts is the file /boot/Image. Image is a
copy of the vmlinuz file.

6) Then install the dtb file into /boot/dtb


orangepi@orangepi:~/linux-orangepi$ sudo make dtbs_install INSTALL_DTBS_PATH=/boot/dtb/

7) Then restart the Linux system and the newly compiled kernel will be loaded.
orangepi@orangepi:~$ uname -r
5.10.160+

7. Instructions for use of Android 12 system

7.1. Supported Android versions

Android version Kernel version


Android 12 Linux5.10
Android 12 Box Linux5.10

7.2. Android function adaptation status

Function Android 12 Android12 Box

543
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

HDMI 2.1 Video OK OK


HDMI 2.1 Audio OK OK
HDMI 2.0 Video OK OK
HDMI 2.0 Audio OK OK
USB2.0x3 OK OK
USB3.0x1 OK OK
Gigabit network port OK OK
Network port status light OK OK
WIFI OK OK
Bluetooth OK OK
Debug serial port OK OK
RTC chip OK OK
FAN fan interface OK OK
eMMC expansion interface OK OK
GPIO(40pin) OK OK
UART(40pin) OK OK
SPI(40pin) OK OK
I2C(40pin) OK OK
PWM(40pin) OK OK
TF card boot OK OK
OV13850 camera OK OK
OV13855 camera OK OK
SPI+NVME boot OK OK
SPI+SATA boot OK OK
LCD OK NO
MIC OK OK
Headphone playback OK OK
Headphone recording OK OK
Tri-color LED light OK OK
GPU OK OK
NPU OK OK
VPU OK OK
On/off button OK OK
HDMI CEC function NO OK

544
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

7.3. WIFI connection test method

1) First click to enter Setting

2) Then select Network & internet

3) Then select Internet

4) Then turn on the Wi-Fi switch

5) If everything is normal after turning on Wi-Fi, you can scan for nearby Wi-Fi

545
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

hotspots.

6) Then select the Wi-Fi you want to connect to, and the password input interface shown
in the picture below will pop up.

7) Then use the keyboard to enter the password corresponding to Wi-Fi, and then use the
mouse to click the Enter button on the virtual keyboard to start connecting to Wi-Fi.

546
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

8) The display after successful Wi-Fi connection is as shown below:

7.4. How to use Wi-Fi hotspot

1) First, please make sure that the Ethernet port is connected to the network cable and
can access the Internet normally.

2) Then select Settings

3) Then select Network & internet

4) Then select Hotspot & tethering

547
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

5) Then select Wi-Fi hotspot

6) Then open the Wi-Fi hotspot. You can also see the name and password of the
generated hotspot in the picture below. Remember them and use them when connecting to
the hotspot (if you need to change the name and password of the hotspot, you need to turn
off the Wi-Fi first. -Fi hotspot before you can modify it)

7) You can take out your mobile phone at this time. If everything is normal, you can find
the WIFI hotspot with the same name (here AndroidAP_6953) shown under the Hotspot
name in the picture above in the WI-FI list searched by the mobile phone. Then you can
click AndroidAP_6953 to connect to the hotspot. The password can be seen under the
Hotspot password in the picture above.

548
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

8) After the connection is successful, it will be displayed as shown below (the interface
will be different on different mobile phones, the specific interface is subject to the one
displayed on your mobile phone). At this point, you can open a web page on your mobile
phone to see if you can access the Internet. If the web page can be opened normally, it
means that the WI-FI Hotspot of the development board can be used normally.

7.5. Bluetooth test method

1) First click to enter Setting

549
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd

2) Then select Connected devices

3) Then click Pair new device to turn on Bluetooth and start scanning for surrounding
Bluetooth devices

4) The searched Bluetooth devices will be displayed under Available devices

550

You might also like