inteintegrity2026-10-22

Run Vision and Language Models on Raspberry Pi 5 with RK1820

Connect an RK1820 M.2 accelerator to Raspberry Pi 5 over PCIe and run MobileNetV2 and Qwen2.5-0.5B locally with RKNN3 Runtime 1.1.0.

Raspberry PiRK1820RKNN3Rockchip

Raspberry Pi 5 can use a Rockchip RK1820 as an external AI accelerator over PCIe. This project verifies the complete path from hardware assembly and driver installation to a vision model and local language generation on a Pi 5 with an RK1820 M.2 2242 module.

The Pi runs Linux, RKNN3 Runtime, and the test applications. The RK1820 executes the model. We verified MobileNetV2 inference and Qwen2.5-0.5B text generation with Runtime 1.1.0 at an NPU frequency of 166 MHz.

Rockchip's RK1820_RK1828 Raspberry Pi M.2 Quick Start, V1.0.0, describes both RK1820 and RK1828 modules. The physical device tested in this project is an RK1820 2242. The results below do not establish performance or compatibility for every RK1828 module, adapter, or OS image.

Hardware and verified environment

ComponentTested configuration
HostRaspberry Pi 5 Model B Rev 1.1
AcceleratorRK1820 M.2 2242; device reports 2560 MB memory
ConnectionPCIe FPC cable and RK_EXT_PIHAT_RK182X adapter
PCIe link5.0 GT/s, x1
OSDebian 13.7 (trixie), ARM64
Kernel6.18.50+rpt-rpi-2712
Installation packagerknn3-rk182x-m2-2242_1.1.0_arm64.deb
PCIe driver3.3.1
Device firmware / RKNN3 API1.1.0 / 1.1.0
rknn-smi1.3.0
NPU frequency166 MHz

Use cooling for both the Pi and the accelerator. The Rockchip guide recommends the official Raspberry Pi 27W USB-C supply or an equivalent suitable supply. Check the adapter's input requirements and connector labels; a charger's total wattage alone does not establish suitability.

1. Assemble and power the hardware

Watch the installation video on YouTube

  1. Disconnect power before handling the module or PCIe cable.
  2. Insert the RK1820 into the adapter's M.2 slot and secure it with the appropriate screw.
  3. Connect the PCIe FPC cable between the Pi 5 and the adapter. Check the contact orientation and close both connector latches.
  4. Check the cooling and all connections before applying power.
  5. For the RK_EXT_PIHAT_RK182X adapter described in the guide, connect the supply to the adapter's USB-C power input. The adapter powers the complete system. Powering only the Pi's own USB-C input may leave the accelerator unpowered.

If the adapter has multiple USB-C connectors, identify the power input from its labeling or board documentation before connecting the supply.

2. Install the driver and Runtime

Obtain the module-specific Debian package from your board or SDK provider. This project uses the 2242 package; use the corresponding provider-approved package for a 2280 module.

The following commands run in a Linux shell on the Pi. Replace the SSH username and address with your own when connecting from your PC; no default password is required by these instructions.

bash
mkdir -p ~/rk1820_rk1828
cd ~/rk1820_rk1828

Copy rknn3-rk182x-m2-2242_1.1.0_arm64.deb into this directory, then install it:

bash
sudo apt update
sudo apt install -y ./rknn3-rk182x-m2-2242_1.1.0_arm64.deb

The installer builds the PCIe driver and installs the firmware, Runtime, device management tool, and test programs. Check that driver compilation and package configuration finish successfully before rebooting:

bash
sudo reboot

The Pi needs access to its configured APT repositories to obtain dependencies such as DKMS. If dependency downloads fail, the local .deb being found does not mean installation completed. Resolve repository connectivity and rerun the installation. Driver compilation also requires headers matching the running kernel; check uname -r and /lib/modules/$(uname -r)/build when diagnosing build failures.

3. Verify the device and select a supported frequency

After rebooting and reconnecting:

bash
lspci -nn
ls -l /dev/pcie-rkep-* 2>/dev/null
sudo rknn-smi info
sudo rknn-smi -v
sudo rknn-smi info -t npu_freq

Our PCIe enumeration included:

text
0001:01:00.0 Processing accelerators [1200]: Rockchip Electronics Co., Ltd RK182x Edge AI Computing Coprocessor [1d87:182a] (rev 01)

The device must have a /dev/pcie-rkep-* node, and rknn-smi info should report RK1820, Online, OK. Record the driver, firmware, and API versions before testing models.

Our 2242 module reported supported frequencies of 166, 200, 250, and 300 MHz. We used 166 MHz for initial testing:

bash
sudo rknn-smi set -t npu_freq -d 0 -s 166
sudo rknn-smi info -t npu_freq

Select a value from your device's actual Available NPU Freq output. Do not copy the 400 MHz example for a 2280 module onto this 2242 configuration.

If the device does not appear, inspect the link and driver separately:

bash
lsmod | grep rkep
sudo dmesg | grep -iE 'pcie|rkep|rknn' | tail -100

During initial setup, the driver was loaded but the external PCIe link reported link down, no RK endpoint appeared in lspci, and rknn-smi failed to initialize. Later checks showed link up, 5.0 GT/s PCIe x1 and the RK endpoint. A loaded driver alone does not prove the hardware link is working. Check adapter power and the FPC connection before repeatedly reinstalling the software. The available observations do not isolate which physical change restored that link.

4. Run MobileNetV2

Prepare a matching model and weight pair in:

text
~/rk1820_rk1828/MobileNetV2/
├── mobilenetv2-12.rknn
└── mobilenetv2-12.weight

This test reused the MobileNetV2 pair from an existing RKNN3 model package under rknn3_models/v1.0.0/cnn/MobilenetV2. That specific pair completed inference with Runtime 1.1.0; this is not a general claim that all older models are compatible. Obtain compatible preconverted models from the SDK provider, or use the RKNN3 model download (access code: rknn) and verify the supplied names and instructions.

Run on the Pi:

bash
cd ~/rk1820_rk1828/MobileNetV2
sudo rknn3_model_test \
  mobilenetv2-12.rknn \
  mobilenetv2-12.weight \
  0x1 '' '' 0 1

The installed 1.1.0 test tool takes core_mask immediately after the weight path. The empty arguments skip input and golden output files; 0 selects the shape and 1 runs one loop. Check rknn3_model_test --help if your tool version differs from this project or the older quick-start document.

Successful output includes model initialization, All 1 loops completed successfully, and the average model run time. In one recorded run at 166 MHz, the model run time was 11.343 ms, with a total per-loop time of 12.249 ms including input and output synchronization.

This command uses random input and skips comparison against golden outputs. It verifies the inference path, not classification accuracy. These single-run timings are observations, not a sustained throughput benchmark.

5. Generate text with Qwen2.5-0.5B

In the RKNN3 model download, enter access code rknn and navigate to:

text
RKNN3_SDK/rknn3_models/v1.1.0/llm/Qwen2.5-0.5B

Copy all four files from that same release into the Pi's working directory. Preserve the official filenames, which omit the -Instruct suffix used in the older guide:

text
~/rk1820_rk1828/Qwen2.5-0.5B/
├── Qwen2.5-0.5B.rknn
├── Qwen2.5-0.5B.weight
├── Qwen2.5-0.5B.tokenizer.gguf
└── Qwen2.5-0.5B.embed.bin

The four files total approximately 632 MB (603 MiB). Check download sizes and transfer integrity; do not combine an older model with an embedding file from a different model.

Run:

bash
cd ~/rk1820_rk1828/Qwen2.5-0.5B
sudo rknn3_session_test \
  Qwen2.5-0.5B.rknn \
  Qwen2.5-0.5B.weight \
  Qwen2.5-0.5B.tokenizer.gguf \
  Qwen2.5-0.5B.embed.bin \
  2048 256 0xff

This model provides a 2048-token context configuration, so we use 2048 rather than the older guide's 1024. The next argument limits generation to 256 new tokens, followed by the core mask.

The vendor test program runs built-in questions automatically; the command does not accept a question as a positional argument. Its original tests include Chinese and English questions about relativity. For the English community recording, we changed only the local test program's built-in Chinese question to Explain the basic concepts of relativity. and retained a backup. That presentation change is not required to run the downloaded model; an unmodified installation can still display the Chinese test first.

Check for readable generated text, performance statistics, and END TEST. Reaching the configured new-token limit is expected when the answer is longer than 256 tokens.

ObservationRecorded result
NPU frequency166 MHz
Context / maximum new tokens2048 / 256
English test 1 generation255 decode tokens in 3820.02 ms; 66.75 tokens/s
English test 2 generation255 decode tokens in 3821.18 ms; 66.73 tokens/s
Process exit code0
Device after the testOnline / OK

Generation rates are the test tool's Generate statistics. They exclude prefill and model initialization and vary with prompts, generation settings, frequency, and model release. The tool reports 256 output tokens and counts 255 tokens in its timed Generate stage; the values above preserve that distinction.

What this project demonstrates

The verified Pi 5 + RK1820 configuration supports both a CNN inference test and local language generation through RKNN3 Runtime. The same setup can serve as a starting point for an application that uses the Pi for input, orchestration, and its user interface while the RK1820 handles model inference. Longer stability tests and application-specific accuracy checks remain separate from this initial validation.