Skip to main content

SDK Related - FAQ

Navigation bar

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:

Warning

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​

RV1126 Compiling Firmware


📋 Project Summary​

ItemContent
Project TypeRockchip RV1126/RV1109 platform embedded development + AI vision (YOLOv5)
Core ChipRV1126 / RV1109 (Rockchip AIoT SoC with NPU, ARM 32-bit)
AI ModelYOLOv5 (object detection, based on RKNN)
OS / Build SystemBuildroot, Debian
Linux Kernel4.19 (kernel/)
Key FilesMakefile, build.sh, kernel, rkflash.sh, RV1126_YOLOV5_DEPLOY_STREAM_PLAN.md

📁 Main Directory Structure Description​

DirectoryPurpose
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_20230330

Standard 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

LocationPurpose
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_defconfigStandard IPC product defconfig
buildroot/board/rockchip/rv1126_rv1109/fs-overlay-sysv/overlay such as boot scripts

Product variant comparison:

Build OptionSource DirectoryMedia Framework
BR2_PACKAGE_RKIPC_RV1126rv1126_ipc_rkmediaRKMedia (default)
COMPILE_FOR_RV1126_ROCKITrv1126_ipc_rockitRockit
COMPILE_FOR_RV1126_BATTERY_IPCrv1126_battery_ipcRockit
COMPILE_FOR_RV1126_SNAPSHOTrv1126_snapshotEasyMedia

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 the rkipc package 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.

LocationPurpose
external/rkmedia/examples/rkmedia_vi_rknn_venc_rtsp_test.cMain streaming pipeline (VI → RKNN → VENC → RTSP); replace SSD with YOLOv5 here
external/rknpu/rknn/rknn_api/examples/rknn_yolov5_demo/src/main.ccYOLOv5 inference reference
external/rknpu/rknn/rknn_api/examples/rknn_yolov5_demo/src/postprocess.ccYOLOv5 post-processing reference
external/rkmedia/examples/rtsp-nn.cfgRTSP dual-stream configuration (main stream/sub stream)
external/rkmedia/examples/CMakeLists.txtRKMedia examples build entry

How to modify:

  • Model path/input size → g_ssd_path, MODEL_INPUT_SIZE in rkmedia_vi_rknn_venc_rtsp_test.c
  • Post-processing logic → create yolov5_postprocess.cc/.h, referring to rknn_yolov5_demo
  • Build → modify CMakeLists.txt to 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​

LocationPurpose
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 with rkipc via socket
  • After modification, rebuild the ipcweb-backend package 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)​

PathContent
app/rkipc/common/ivm/ivm_dependent.hIVM API header file (type definitions for human/face/vehicle detection, region intrusion, etc.)
app/rkipc/common/ivm/event.cIVM event handling (most logic is currently commented out and not enabled)
app/rkipc/lib/arm-rockchip830-linux-gnueabihf/libivm_share.soPrecompiled IVM library

IVM detection types (ivm_dependent.h):

  • IVM_DRAW_PEOPLE — Human
  • IVM_DRAW_FACE — Face
  • IVM_DRAW_CAR — Vehicle

2. Application Layer (source code can be modified)​

PathPurpose
app/rkipc/common/ivm/event.cIVM initialization, frame submission, box drawing (currently commented out)
app/rkipc/common/event/event.cRegion 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.cVideo pipeline (event_process call is commented out)
app/rkipc/common/rockiva/rockiva.cRockIVA 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.txt compiles common/ivm, but almost all detection logic in ivm/event.c is commented out
  • common/event/event.c only does ini parameter read/write; rk_event_init() is an empty implementation
  • The event_process() call in video.c is 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​

RequirementWhere 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 RockIVAAdd 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 + streamingModify external/rkmedia/examples/rkmedia_vi_rknn_venc_rtsp_test.c (recommended, see above)
Change box color/styleDrawing logic in ivm/event.c or rkmedia_vi_rknn_venc_rtsp_test.c
Change the detection model itselfIVM/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.

ModeDescriptionHardware/Module
LDCHHorizontal lens distortion correction (lightweight)ISP / RKAIQ
FECFisheye/large distortion lens correctionISP / 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 support LDCH / close.


Code Locations​

Application layer (mainly modify here)

FilePurpose
app/rkipc/common/isp/rv1126/isp.crk_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.cppWeb settings for distortion parameters

Underlying algorithm/driver

PathPurpose
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 sDistortionCorrection are ["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​

  1. Ordinary lens with small distortion → use LDCH, just adjust ldch_level.
  2. Large distortion/fisheye → use FEC, adjust fec_level; fine coefficients can be configured in the ldc section of the RKAIQ IQ JSON.
  3. 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
# 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)​

  1. Check the supported frequency list:

    cat /sys/class/devfreq/ffbc0000.npu/available_frequencies

    Common RV1126 NPU levels are 200MHz, 300MHz, 400MHz, 500MHz, 600MHz, etc. (subject to the actual output).

  2. Switch to userspace mode:

    echo userspace > /sys/class/devfreq/ffbc0000.npu/governor
  3. Set the target frequency (e.g. 600000000 Hz):

    echo 600000000 > /sys/class/devfreq/ffbc0000.npu/userspace/set_freq
  4. 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
AI Translation Notice

This page was translated into English by AI and is provided for reference only. The original document is written in Chinese. If there is any discrepancy, the Chinese version prevails.

本页英文内容由 AI 自动翻译生成,仅供参考;原文为中文,如有差异请以中文原文为准。

查看中文原文 / View the Chinese original →