SDK Related - FAQ

Current SDK Information
This is a YOLOv5 object detection stream processing project based on Rockchip RV1126/RV1109.
By looking at the project structure and key files, the following information can be derived:
CAM126 / CAM126B-P: pay attention to the distinction
Go to CAM126 SDK | Go to CAM126B-P SDK
📁 RV1126 SDK File Download
Link: https://pan.baidu.com/s/1OSdhBi32C13lBNVC-Sz63w?pwd=fanc
Extraction code: fanc Copy this content and open the Baidu Network Disk mobile app for more convenient operation
Build Method Reference
📋 Project Summary
| Item | Content |
|---|---|
| Project Type | Rockchip RV1126/RV1109 platform embedded development + AI vision (YOLOv5) |
| Core Chip | RV1126 / RV1109 (Rockchip AIoT SoC with NPU, ARM 32-bit) |
| AI Model | YOLOv5 (object detection, based on RKNN) |
| OS / Build System | Buildroot, Debian |
| Linux Kernel | 4.19 (kernel/) |
| Key Files | Makefile, build.sh, kernel, rkflash.sh, RV1126_YOLOV5_DEPLOY_STREAM_PLAN.md |
📁 Main Directory Structure Description
| Directory | Purpose |
|---|---|
app/ | Application code (rkipc IPC, ipcweb-backend, YOLOv5 related samples, etc.) |
buildroot/ | Buildroot build system configuration |
debian/ | Debian root filesystem |
device/ | Device tree, board-level configuration, SDK build scripts |
docs/ | Project documentation (including RV1126_RV1109_Release_Note.txt) |
external/ | Third-party dependency libraries (rkmedia, rknpu, camera_engine_rkaiq, etc.) |
kernel/ | Linux kernel source code (4.19) |
prebuilts/ | Precompiled toolchains/binaries |
rkbin/ | Rockchip firmware/binaries (BL31, DDR init, etc.) |
tools/ | Packaging, flashing and other tool scripts |
u-boot/ | U-Boot bootloader |
🔍 Key File Notes
RV1126_YOLOV5_DEPLOY_STREAM_PLAN.md— The core description/planning document of this project, describing how to integrate YOLOv5 into the RKMedia sample and implement RTSP streaming.build.sh— Main build script.rkflash.sh— Flashing script (flashes the firmware to the RV1126 board).config.sh— Helper script for runtime configuration such as network/RTSP.
Common Code Locations
RV1126 SDK Linux V3.0.1
The current repository corresponds to version:
rv1126_rv1109_linux_v3.0.1_20230330Standard IPC products use the RKMedia solution by default (
rv1126_ipc_rkmedia), which already integrates web preview and RTSP/RTMP streaming.
Version information: docs/RV1126_RV1109/RV1126_RV1109_Release_Note.txt
Quick start document: docs/RV1126_RV1109/Rockchip_RV1126_RV1109_Quick_Start_Linux_CN.pdf
IPC Source Code
Standard defconfig: buildroot/configs/rockchip_rv1126_rv1109_defconfig
| Location | Purpose |
|---|---|
app/rkipc/src/rv1126_ipc_rkmedia/ | Default IPC main program (RKMedia solution, main.c, video/, sensor inis) |
app/rkipc/src/rv1126_ipc_rockit/ | IPC alternative solution (Rockit solution, similar structure) |
app/rkipc/src/rv1126_battery_ipc/ | Battery-type IPC (Tuya cloud, sleep/wake) |
app/rkipc/src/rv1126_snapshot/ | Snapshot-type products |
app/rkipc/common/ | Common modules (encoding, network, OSD, storage, ISP, etc.) |
app/rkipc/common/isp/rv1126/ | RV1126 ISP wrapper (distortion correction, noise reduction, etc.) |
external/rkmedia/ | RKMedia media framework |
external/camera_engine_rkaiq/ | ISP algorithm library (RKAIQ) |
buildroot/configs/rockchip_rv1126_rv1109_defconfig | Standard IPC product defconfig |
buildroot/board/rockchip/rv1126_rv1109/fs-overlay-sysv/ | overlay such as boot scripts |
Product variant comparison:
| Build Option | Source Directory | Media Framework |
|---|---|---|
BR2_PACKAGE_RKIPC_RV1126 | rv1126_ipc_rkmedia | RKMedia (default) |
COMPILE_FOR_RV1126_ROCKIT | rv1126_ipc_rockit | Rockit |
COMPILE_FOR_RV1126_BATTERY_IPC | rv1126_battery_ipc | Rockit |
COMPILE_FOR_RV1126_SNAPSHOT | rv1126_snapshot | EasyMedia |
How to modify:
- Business logic →
rv1126_ipc_rkmedia/+common/ - Resolution/stream parameters →
rkipc-*.ini(e.g.rkipc-imx415.ini) - Boot startup →
fs-overlay-sysv/etc/init.d/S98_lunch_init→/oem/usr/bin/RkLunch.sh - After modification, in the SDK root directory:
./build.sh(or rebuild therkipcpackage separately)
YOLOv5 + RTSP Streaming
The core transformation goal of this project. It is most recommended to modify the RKMedia streaming sample to achieve "detection + box drawing + streaming" at minimal cost.
| Location | Purpose |
|---|---|
external/rkmedia/examples/rkmedia_vi_rknn_venc_rtsp_test.c | Main streaming pipeline (VI → RKNN → VENC → RTSP); replace SSD with YOLOv5 here |
external/rknpu/rknn/rknn_api/examples/rknn_yolov5_demo/src/main.cc | YOLOv5 inference reference |
external/rknpu/rknn/rknn_api/examples/rknn_yolov5_demo/src/postprocess.cc | YOLOv5 post-processing reference |
external/rkmedia/examples/rtsp-nn.cfg | RTSP dual-stream configuration (main stream/sub stream) |
external/rkmedia/examples/CMakeLists.txt | RKMedia examples build entry |
How to modify:
- Model path/input size →
g_ssd_path,MODEL_INPUT_SIZEinrkmedia_vi_rknn_venc_rtsp_test.c - Post-processing logic → create
yolov5_postprocess.cc/.h, referring torknn_yolov5_demo - Build → modify
CMakeLists.txtto add the post-processing source files to the target - Stream configuration → adjust main/sub stream resolution in
rtsp-nn.cfg - Streaming URL →
rtsp://<board_ip>/live/main_stream
For detailed steps, see: RV1126_YOLOV5_DEPLOY_STREAM_PLAN.md
WEB Frontend
| Location | Purpose |
|---|---|
app/ipcweb-backend/www-rkipc/ | Frontend static pages (Angular build output, .js / .css) |
app/ipcweb-backend/src/ | Web backend API (*_api.cpp, rest_api.cpp) |
app/ipcweb-backend/ipcweb-env-arm/etc4oem/nginx/ | Nginx configuration (RV1126 is ARM 32-bit) |
Deployment path on the device: /usr/www (installed by buildroot's ipcweb-backend.mk).
How to modify:
- Modify page/UI: The SDK only contains the compiled
www-rkipc, without Angular source code; you need to request the frontend project from Rockchip, or you can only directly modify static resources (hard to maintain) - Modify interface/function: Modify
ipcweb-backend/src/*_api.cpp; the backend communicates withrkipcvia socket - After modification, rebuild the
ipcweb-backendpackage and flash the device
Relationship: Browser → Nginx → entry.cgi (ipcweb-backend) → socket → rkipc
IVA Human/Face
RV1126 standard IPC (
rv1126_ipc_rkmedia) differs from RV1126B: it does not use RockIVA by default, but uses the IVM closed-source library.
1. IVM Algorithm Library (closed-source, can only call APIs)
| Path | Content |
|---|---|
app/rkipc/common/ivm/ivm_dependent.h | IVM API header file (type definitions for human/face/vehicle detection, region intrusion, etc.) |
app/rkipc/common/ivm/event.c | IVM event handling (most logic is currently commented out and not enabled) |
app/rkipc/lib/arm-rockchip830-linux-gnueabihf/libivm_share.so | Precompiled IVM library |
IVM detection types (ivm_dependent.h):
IVM_DRAW_PEOPLE— HumanIVM_DRAW_FACE— FaceIVM_DRAW_CAR— Vehicle
2. Application Layer (source code can be modified)
| Path | Purpose |
|---|---|
app/rkipc/common/ivm/event.c | IVM initialization, frame submission, box drawing (currently commented out) |
app/rkipc/common/event/event.c | Region intrusion parameter read/write (ini config storage, no actual detection logic) |
app/rkipc/src/rv1126_ipc_rkmedia/rkipc-*.ini | [event.regional_invasion] parameters |
app/rkipc/src/rv1126_ipc_rkmedia/video/video.c | Video pipeline (event_process call is commented out) |
app/rkipc/common/rockiva/rockiva.c | RockIVA source code (exists, but rv1126_ipc_rkmedia does not compile/link it) |
Web-side region intrusion configuration: app/ipcweb-backend/src/event_api.cpp
3. Actual Current IPC Status
In the standard rv1126_ipc_rkmedia build:
CMakeLists.txtcompilescommon/ivm, but almost all detection logic inivm/event.cis commented outcommon/event/event.conly does ini parameter read/write;rk_event_init()is an empty implementation- The
event_process()call invideo.cis commented out - Region intrusion Web configuration is available, but actual AI detection is not running
If you need a face access control product, you can refer to the defconfig: rockchip_rv1126_rv1109_facial_gate_defconfig
4. How to Modify
| Requirement | Where to Modify |
|---|---|
| Switch/sensitivity/detection region | [event.regional_invasion] in rkipc-*.ini |
| Enable human/face detection (IVM) | Restore the commented-out code in common/ivm/event.c, and re-enable event_process() in video.c |
| Integrate RockIVA | Add common/rockiva compilation and librockiva linking in CMakeLists.txt (there is no precompiled external/iva/ library in the SDK; you need to obtain it yourself) |
| Custom YOLOv5 detection + streaming | Modify external/rkmedia/examples/rkmedia_vi_rknn_venc_rtsp_test.c (recommended, see above) |
| Change box color/style | Drawing logic in ivm/event.c or rkmedia_vi_rknn_venc_rtsp_test.c |
| Change the detection model itself | IVM/RockIVA are both closed-source; you can only replace the .so or request a new library from Rockchip |
After modification, rebuild the rkipc package and flash the device.
Two Distortion Correction Methods
There is lens distortion correction related code.
RV1126 uses ISP2.0 (rk_aiq_user_api_imgproc.h); distortion correction is implemented through RKAIQ's LDCH / FEC interfaces.
| Mode | Description | Hardware/Module |
|---|---|---|
| LDCH | Horizontal lens distortion correction (lightweight) | ISP / RKAIQ |
| FEC | Fisheye/large distortion lens correction | ISP / RKAIQ (FEC algorithm) |
Both default to close.
Difference from RV1126B: RV1126 standard IPC does not have a GDC hardware channel; FEC uses ISP software correction and does not support the RV1126B
fec_ini_file+ GDC calibration process. The distortion options on the Web page only supportLDCH/close.
Code Locations
Application layer (mainly modify here)
| File | Purpose |
|---|---|
app/rkipc/common/isp/rv1126/isp.c | rk_isp_set_distortion_correction(), rk_isp_set_ldch_level(), rk_isp_set_fec_level() |
app/rkipc/src/rv1126_ipc_rkmedia/rkipc-*.ini | [isp.0.enhancement] configuration items |
app/ipcweb-backend/src/image_api.cpp | Web settings for distortion parameters |
Underlying algorithm/driver
| Path | Purpose |
|---|---|
external/camera_engine_rkaiq/rkisp/ | RKAIQ ISP algorithm (rk_aiq_uapi_setLdchEn, setFecEn, etc.) |
kernel/drivers/media/platform/rockchip/isp/ | ISP kernel driver |
Documentation
app/rkipc/docs/Rockchip_Developer_Guide_Linux_RKIPC_CN.md(RV1126 IPC data flow, LDCH/FEC description)
Usage
1. Modify ini (most direct)
In [isp.0.enhancement] of app/rkipc/src/rv1126_ipc_rkmedia/rkipc-xxx.ini:
distortion_correction = LDCH ; or FEC / close
ldch_level = 50 ; 0~100, only valid for LDCH
fec_level = 50 ; 0~100, only valid for FEC
fec = close ; FEC switch (some inis have this field)
2. Web Page
Image enhancement → sDistortionCorrection (LDCH / close) + iLdchLevel
The RV1126 Web end does not support the FEC option (in the documentation, the options of
sDistortionCorrectionare["LDCH","close"]).
3. Runtime API
rk_isp_set_distortion_correction(0, "LDCH"); // or "FEC" / "close"
rk_isp_set_ldch_level(0, 50);
rk_isp_set_fec_level(0, 50);
4. Differences Between LDCH and FEC
- LDCH: ISP inline correction, low overhead, recommended for ordinary lenses
- FEC: ISP FEC algorithm correction, suitable for fisheye/large distortion lenses, higher overhead
Changing the Lens / New Board
- Ordinary lens with small distortion → use LDCH, just adjust
ldch_level. - Large distortion/fisheye → use FEC, adjust
fec_level; fine coefficients can be configured in theldcsection of the RKAIQ IQ JSON. - Board-level differences are mainly in
kernel/arch/arm/boot/dts/rockchip/rv1126-evb*.dts, unrelated to the distortion algorithm itself.
System Debugging
NPU Load Check
# Check the current NPU frequency
cat /sys/class/devfreq/ffbc0000.npu/cur_freq
# Check debugfs clock (if debugfs is mounted)
cat /sys/kernel/debug/clk/clk_npu_pll/clk_rate
NPU Frequency Adjustment
The NPU devfreq node of RV1126 is ffbc0000.npu (different from RV1126B's 22000000.npu).
root@rv1126-buildroot:/sys/class/devfreq# ls
ffbc0000.npu ...
At boot, S05NPU_init sets the NPU to the highest frequency by default (userspace mode):
read MAX_FREQ < /sys/class/devfreq/ffbc0000.npu/max_freq
echo $MAX_FREQ > /sys/class/devfreq/ffbc0000.npu/userspace/set_freq
✅ Recommended Operation: Keep Automatic Frequency Scaling
# Check available frequency scaling policies
cat /sys/class/devfreq/ffbc0000.npu/available_governors
# Set to ondemand automatic frequency scaling (if supported)
echo ondemand > /sys/class/devfreq/ffbc0000.npu/governor
cat /sys/class/devfreq/ffbc0000.npu/governor
🔧 Manually Fix the Frequency (for debugging)
-
Check the supported frequency list:
cat /sys/class/devfreq/ffbc0000.npu/available_frequenciesCommon RV1126 NPU levels are 200MHz, 300MHz, 400MHz, 500MHz, 600MHz, etc. (subject to the actual output).
-
Switch to userspace mode:
echo userspace > /sys/class/devfreq/ffbc0000.npu/governor -
Set the target frequency (e.g. 600000000 Hz):
echo 600000000 > /sys/class/devfreq/ffbc0000.npu/userspace/set_freq -
Confirm the current frequency:
cat /sys/class/devfreq/ffbc0000.npu/cur_freq
📌 Notes
- After manually fixing the frequency, the NPU will no longer automatically adjust based on load, which may cause overheating or unnecessary power consumption. It is recommended to restore automatic frequency scaling after debugging.
- If you run models with the RKNN API, the driver usually manages the frequency automatically and no manual adjustment is needed. Intervention is only needed for performance stress testing or power optimization.
- The SDK comes with an NPU frequency scaling test script:
external/rockchip-test/npu2/npu_freq_scaling.sh