jetson-customize-camera
NVIDIA/skills
透過從樹內感測器 DTSI 渲染核心 DT 覆蓋層,在 Jetson Thor 或 Orin 自訂載板上記能 MIPI/GMSL 相機感測器。
...展開全部自訂相機(CSI/MIPI/GMSL 感測器啟動)
概述
Tegra264(Thor)和 Tegra234(Orin)提供單一的tegra-capture-vi
控制器,其前端由 NVCSI 及一組固定的 CSI 埠構成。相機
初始化流程如下:
- 感測器選取— 從 NVIDIA 隨樹提供且
在有效平台上被
.dtsi參照的感測器集之中進行選取。 - 載板 + 模組支援檢查— 依據《相機 開發指南》、《適應指南》§相機、載板原理圖、 模組技術規格手冊(TRM)以及載板引腳映射進行驗證。
- 佈線— 若存在,則源自樹內
tegra(DTSI 即是 佈線的權威來源);若感測器為客製化,則由使用者 針對各感測器分別提供佈線資訊。-camera- *.dtsi - 核心-DT 疊加層— 對樹內 DTSI 進行 cpp-expand 處理,萃取其
fragment@N主體,並將其追加至針對活躍目標的 複合自訂疊加層.dts檔案中 (參見../../references/bsp-customization-kernel-dtb.md), 並使用fdtoverlay驗證複合檔案。/jetson-build-source負責編譯該複合檔案,並管理 載體配置檔中OVERLAY_DTB_FILE+=的註冊。
採用代理模式,而非表格驅動— 感測器清單是在執行時透過
通配符匹配樹內各感測器的 dtbos 來建構的。沒有_THOR_CAMERAS字典,沒有
questions.json,問題路徑中也沒有 Python 渲染器。
無需編輯 ODMDATA— 攝影機不佔用 UPHY 通道(CSI 屬於 獨立的 PHY 資源池)。此技能僅發送核心 DT 疊加層; 載體配置檔中的 ODMDATA 行不會被此技能修改。
輸出為單次提交:
- 將 Camera
fragment@N區塊(若複合根節點中尚未存在,則 附加jetson-header-name)附加至複合 自訂覆蓋層.dts檔案,依據../../references/bsp-customization-kernel-dtb.md→ 提交至bsp_sources/hardware 儲存庫。/jetson-build-source會將複合檔編譯為.dtbo,並 負責其 Makefile 及 flash-conf 註冊。
何時呼叫
- 當使用者指定「啟用相機」、「設定 CSI」、「連接 Hawk /
Owl / IMX 感測器」、「MIPI 相機」、「GMSL 相機」,或要求在
自訂載板上手動啟動
tegra-capture-vi/ NVCSI 時。 - 系統雖能成功開機,但執行
`v4l2-ctl --list-devices` 卻未顯示 任何 `tegra-capture-vi` 通道,或需確認新安裝的 子卡上的感測器枚舉狀況。 - 先前已啟用一個感測器,而使用者希望新增另一個 感測器(多感測器啟用)。
先決條件:
- 具備 active 配置檔,且包含
reference_devkit:+custom_carrier:blocks 區塊。 存在 (/Linux_for_Tegra/.git /jetson-init-source)。- 已執行
/jetson-derive-carrier— 載波的 flash-conf 分支已 位於覆蓋層追蹤器中。 目錄存在,且包含樹內各感測器的/bsp_sources/hardware/nvidia/ /nv-public/overlay/ .dtsi檔案(由/jetson-init-source 的分支 A 壓縮檔解壓縮所導入)。包含 C++ 所需的巨集標頭檔(若使用分支 B,可能需要 執行/bsp_sources/kernel/kernel-noble/include/dt-bindings/ source_sync.sh—— 請參閱下文步驟 5a.i)。- 於提示字元處註冊或提供的權威文件:
相機開發指南(位於
bsp_developer_guide鏡像或 獨立路徑中)、適配指南 § 相機、載板原理圖、SoC 技術規格手冊(TRM)、模組設計指南。 - PATH 環境變數中須包含
dtc、cpp及fdtoverlay。
操作程序
詳細的分步操作流程(步驟 1–7,包含所有表格、程式碼
區塊及邏輯閘)請參閱
references/procedure.md。摘要:
- 步驟 1— 確定有效目標平台並開啟「權威來源」文件。
- 步驟 2— 透過通配符瀏覽樹狀結構中的 各平台相機 dtbos,列舉受支援的感測器;分類為 DPHY 直連/GMSL/ 自訂類型。切勿自行發明感測器。
- 步驟 3 / 3a— 根據 DTSI、相機開發指南、適應指南 §相機、SoC TRM、 模組設計指南、原理圖及載板引腳映射,交叉核對載板與模組的支援狀況。請先渲染 接線表,然後觸發「確認或自訂」閘門。
- 步驟 4(僅限自訂路徑)— 根據主機板引腳映射,批次自動填入 各感測器的接線問題。
- 步驟 5— 將精確且僅一個
/* custom-bsp: camera:片段追加至複合式自訂覆蓋層*/ .dts檔案中(參見../../references/bsp-customization-kernel-dtb.md)。 Clone 路徑會對樹內 DTSI 進行 C++ 展開;自訂路徑則將步驟 4 的 答案與模式表就地拼接。 以冪等方式設定 複合根節點上的jetson-header-name。透過dtc+fdtoverlay進行驗證(預編譯單片段閘門; 後編譯深度樹唯一性閘門)。透過 工作流程的提交訊息預覽閘門進行提交。 - 步驟 6— 透過
pin_verifier.py驗證輔助 CAM 接腳 SFIO(cam_i2c_*、extperiph、reset/PWDN/PWR_EN GPIO);若發現路由不符,請轉交至_clk /jetson-customize-pinmux。 - 步驟 7— 將運行狀態 JSON 附檔以原子寫入方式儲存至
並輸出標題,接著依照/target-platform/ .jetson-customize-camera.json references/procedure.md中的指示,透過 依序的「AskUserQuestion」提示驅動下游的下一步鏈 步驟 7.此流程鏈是已記錄的工作流程關卡,而非用以釐清 的提問 — 自動模式並不會豁免此步驟。切勿以 列印的「下一步:…」行取代提示。
注意事項
- 雙片段陷阱。請精確地將僅一個帶有相機標籤的
片段@N貢獻至複合結構中。若存在第二個攜帶狀態 覆寫的片段,將觸發 dtc 深度合併 → 產生重複的同級子樹 (例如兩個tca9546@70)→ 執行時首次匹配會捨棄由 dtsi 提供的深度樹 → 相機將靜默地不進行枚舉。僅針對 此技能的標記設置檢查點(步驟 5c)。 - 複合體根
節點的相容性由全域管理,而非由此 技能管理。請勿從樹內任何感測器專屬 dtbo 的相容性(受開發套件 SKU 限制)進行擴展。如有需要,請修正複合體根節點。 - 來自樹內任何單一感測器 DTBO 的
jetson-header-name。已修正, 與載波無關;讀取一次,貼上至元數據根節點。 - 切勿將樹內各感測器的 dtbo 附加至
OVERLAY_DTB_FILE。若同時註冊您渲染的覆蓋層以及 樹內的tegra將會產生一個虛幻的子裝置綁定,導致相機枚舉失效。-p3971-camera- -overlay.dtbo - Stub 疊加層是一個已知的陷阱。若提交
tegra-capture-vi { status="okay"; num-channels=卻未包含 ports / sensor / nvcsi 主體,將導致相機損壞(; } 所有通道初始化失敗)。請透過 cpp + dtc 拼接完整的感測器主體。 - 感測器模式表必須透過拼接生成,絕不可手動編寫。
mode、sensor_modes、pixel_phase— 應逐字複製自 樹中最近的 DTSI 定義。 camera_common_regulator_get (null) 錯誤:-EINVAL= 缺少avdd-reg/iovdd-reg/dvdd-reg字串 — 拼接完整的 感測器本體;恆定供電軌則回退至虛擬穩壓器。- 外部
&label參照必須存在於基礎 DTB 的__symbols__中。 若標籤不存在,請使用target-path = "/tegra-capture-vi"; 否則fdtoverlay將以非零狀態退出並回報FDT_ERR_NOTFOUND。 - 在
dt-bindings/gpio/gpio.h發生cpp錯誤:沒有此檔案= L4T 原始碼樹尚未加入暫存區。請重新執行/jetson-init-source(分支 B 的source_sync.sh會載入這些標頭檔)。切勿自行生成 巨集展開。 - 未編輯 ODMDATA,亦未編輯 flash-conf。相機不佔用
UPHY 通道。載板配置檔中的
ODMDATA="..."保持不變。OVERLAY_DTB_FILE+=由/jetson-build-source第 5.0a 步驟負責 — 此步驟絕不觸碰載板快閃記憶體配置。 - 請勿修改上游 BSP(位於
)。所有 修改皆存於(overlay 追蹤器)及/Linux_for_Tegra/ (overlay/bsp_sources/ .dts) 中,遵循「原始狀態 + 客製化」的提交模式。
參考資料
references/procedure.md— 完整的 分步操作步驟 1–7 流程(摘自此 SKILL.md)。references/csi-dt-bindings.md— CSI / nvcsi / vi DT 綁定參考說明。references/overlay-template.md— 關於元數據根節點(metadata-root)與克隆主體(clone-body)疊加結構的指引。references/camera-overlay-templates/— 起始.dts.tmpl範本:dphy-direct.dts.tmpl、gmsl-serdes.dts.tmpl。../../scripts/pin_verifier.py— 共用 HSIO 接腳驗證程式(步驟 6)。../../references/platform_template.yaml—文件:步驟 1 所使用的區塊。../../context/bsp-customization-workflow.md— 疊加層編輯協定。../jetson-customize-pinmux/SKILL.md— 由步驟 6 自動調用的同級技能,用於修正 HSIO 接腳與 SFIO 之間的不匹配(CAM I²C、MCLK、重置 GPIO)。../jetson-derive-carrier/SKILL.md— 必須首先執行;產生載體基礎覆蓋層(即*-dynamic.dtbo),此技能的複合堆疊將基於該覆蓋層建立。../jetson-init-source/SKILL.md— 產生覆疊追蹤器 +bsp_sources儲存庫(包含hardware/nvidia/各感測器專屬的 DTSI 樹),本技能 會讀取並將變更提交至此處。/
---
name: jetson-customize-camera
description: Enable MIPI/GMSL camera sensors on a Jetson Thor or Orin custom carrier by rendering a kernel-DT overlay from the in-tree sensor DTSI.
license: Apache-2.0
---
# Customize camera (CSI / MIPI / GMSL sensor bring-up)
## Overview
Tegra264 (Thor) and Tegra234 (Orin) expose a single `tegra-capture-vi`
controller fronted by NVCSI and a fixed set of CSI ports. Camera
bring-up is:
1. **Sensor selection** — picked from the set NVIDIA ships in-tree
`.dtsi` references for on the active platform.
2. **Carrier + module support check** — verified against the Camera
Development Guide, Adaptation Guide §Camera, carrier schematic,
Module TRM, and carrier pinmap.
3. **Wiring** — derived from the in-tree
`tegra<soc>-camera-<sensor>*.dtsi` when one exists (**the DTSI IS
the wiring source of truth**); captured per-sensor from the user
when the sensor is custom.
4. **Kernel-DT overlay** — cpp-expand the in-tree DTSI, extract its
`fragment@N` body, append into the composite custom overlay
`.dts` for the active target (per
[`../../references/bsp-customization-kernel-dtb.md`](../../references/bsp-customization-kernel-dtb.md)),
verify the composite with `fdtoverlay`.
`/jetson-build-source` compiles the composite and owns the
carrier conf's `OVERLAY_DTB_FILE+=` registration.
**Agentic, not table-driven** — sensor list is built at runtime by
globbing in-tree per-sensor dtbos. No `_THOR_CAMERAS` dict, no
`questions.json`, no Python renderer in the question path.
**No ODMDATA edit** — cameras don't consume UPHY lanes (CSI is a
separate PHY pool). The skill emits only a kernel-DT overlay; the
ODMDATA line in the carrier conf is untouched by this skill.
The output is **one commit**:
- Camera `fragment@N` block (plus `jetson-header-name` on the
composite root if not already present) appended to the composite
custom overlay `.dts` per
[`../../references/bsp-customization-kernel-dtb.md`](../../references/bsp-customization-kernel-dtb.md)
→ committed to the `bsp_sources/` hardware repo.
`/jetson-build-source` compiles the composite to `.dtbo` and
owns its Makefile + flash-conf registration.
## When to invoke
- The user says "enable camera", "configure CSI", "wire a Hawk /
Owl / IMX sensor", "MIPI camera", "GMSL camera", or asks to bring
up `tegra-capture-vi` / NVCSI on a custom carrier.
- Flash boots but `v4l2-ctl --list-devices` shows no
`tegra-capture-vi` channels, OR sensor enumeration on a fresh
daughter-card needs to be confirmed.
- A sensor was previously enabled and the user wants to add another
(multi-sensor bring-up).
**Prerequisites:**
- Active profile with `reference_devkit:` + `custom_carrier:` blocks.
- `<source.root_path>/Linux_for_Tegra/.git` exists
(`/jetson-init-source`).
- `/jetson-derive-carrier` has run — the carrier flash-conf fork is
in the overlay tracker.
- `<source.root_path>/bsp_sources/hardware/nvidia/<chip-dir>/nv-public/overlay/`
exists and contains the in-tree per-sensor `.dtsi` files (sourced
by `/jetson-init-source`'s Branch A archive extract).
- `<source.root_path>/bsp_sources/kernel/kernel-noble/include/dt-bindings/`
contains the macro headers cpp needs (`source_sync.sh` may need to
run if Branch B was used — see Step 5a.i below).
- Source-of-truth docs registered or supplied at prompt:
Camera Development Guide (in `bsp_developer_guide` mirror or
separate path), Adaptation Guide §Camera, carrier schematic, SoC
TRM, Module Design Guide.
- `dtc`, `cpp`, `fdtoverlay` on PATH.
## Procedure
Detailed step-by-step procedure (Steps 1–7, with all tables, code
blocks, and gates) lives in
[`references/procedure.md`](references/procedure.md). Summary:
1. **Step 1** — Resolve active target + open source-of-truth docs.
2. **Step 2** — Enumerate supported sensors by globbing in-tree
per-platform camera dtbos; classify as DPHY-direct / GMSL /
custom. Never invent sensors.
3. **Step 3 / 3a** — Cross-check carrier + module support against
DTSI, Camera Development Guide, Adaptation Guide §Camera, SoC TRM,
Module Design Guide, schematic, and carrier pinmap. Render the
wiring table FIRST, then issue the confirm-or-customize gate.
4. **Step 4** (custom path only) — Batched per-sensor wiring
questions auto-filled from the carrier pinmap.
5. **Step 5** — Append exactly ONE `/* custom-bsp: camera:<sensor> */`
fragment to the composite custom overlay `.dts` (see
[`../../references/bsp-customization-kernel-dtb.md`](../../references/bsp-customization-kernel-dtb.md)).
Clone path cpp-expands the in-tree DTSI; custom path splices Step-4
answers + mode tables in-place. Idempotently set
`jetson-header-name` on the composite root. Verify with
`dtc` + `fdtoverlay` (pre-compile single-fragment gate;
post-compile deep-tree uniqueness gate). Commit via the
workflow's commit-message preview gate.
6. **Step 6** — Verify ancillary CAM pin SFIOs (`cam_i2c_*`,
`extperiph<m>_clk`, reset/PWDN/PWR_EN GPIOs) via
`pin_verifier.py`; route mismatches to `/jetson-customize-pinmux`.
7. **Step 7** — Atomic-write run-state JSON sidecar at
`<workspace>/target-platform/<profile-stem>.jetson-customize-camera.json`
and emit the headline, then drive the downstream next-step chain via
sequential `AskUserQuestion` prompts per `references/procedure.md`
Step 7. **The chain is a documented workflow gate, not a clarifying
question — auto-mode does NOT exempt it.** Never substitute a
printed "Next step: …" line for the prompts.
## Gotchas
- **Dual-fragment trap.** Contribute exactly ONE camera-tagged
`fragment@N` to the composite. A second one carrying status
overrides triggers dtc deep-merge → duplicate sibling subtrees
(e.g. two `tca9546@70`) → runtime first-match drops the dtsi-
supplied deep tree → camera silently doesn't enumerate. Gate on
this skill's marker only (Step 5c).
- **Composite root `compatible` is owned globally, not by this
skill.** Don't widen from any in-tree per-sensor dtbo's
`compatible` (devkit-SKU-gated). Fix the composite root if needed.
- **`jetson-header-name` from any in-tree per-sensor dtbo.** Fixed,
carrier-agnostic; read once, paste onto the metadata root.
- **DO NOT also append the in-tree per-sensor dtbo to
`OVERLAY_DTB_FILE`.** Registering both your rendered overlay AND
the in-tree `tegra<soc>-p3971-camera-<sensor>-overlay.dtbo`
produces a phantom subdev bind that bricks camera enumeration.
- **Stub overlay is a known footgun.** Committing
`tegra-capture-vi { status="okay"; num-channels=<N>; }` with no
ports / sensor / nvcsi body bricks the camera (`all channel init
failed`). Splice the FULL sensor body via cpp + dtc.
- **Sensor mode tables must be spliced, never hand-authored.**
`mode<N>`, `sensor_modes`, `pixel_phase` — copy verbatim from the
closest in-tree DTSI.
- **`camera_common_regulator_get (null) ERR: -EINVAL`** = missing
`avdd-reg` / `iovdd-reg` / `dvdd-reg` strings — splice the FULL
sensor body; always-on rails fall back to dummy regulator.
- **External `&label` refs must exist in base DTB's `__symbols__`.**
Use `target-path = "/tegra-capture-vi"` when the label is absent;
`fdtoverlay` exits non-zero with `FDT_ERR_NOTFOUND` otherwise.
- **`cpp` failure on `dt-bindings/gpio/gpio.h: No such file`** =
L4T source tree isn't staged. Re-run `/jetson-init-source` (Branch
B's `source_sync.sh` fetches the headers). Never fabricate the
macro expansion.
- **No ODMDATA edit, no flash-conf edit.** Camera doesn't consume
UPHY lanes. The carrier conf's `ODMDATA="..."` is untouched.
`OVERLAY_DTB_FILE+=` is owned by `/jetson-build-source` Step
5.0a — this skill never touches the carrier flash conf.
- **Don't touch the upstream BSP at `<bsp_image.root_path>`.** All
edits land in `<source.root_path>/Linux_for_Tegra/` (overlay
tracker) and `<source.root_path>/bsp_sources/` (overlay `.dts`)
under the pristine + customization commit pattern.
## References
- [`references/procedure.md`](references/procedure.md) — full
step-by-step Steps 1–7 procedure (extracted from this SKILL.md).
- [`references/csi-dt-bindings.md`](references/csi-dt-bindings.md) —
CSI / nvcsi / vi DT binding reference notes.
- [`references/overlay-template.md`](references/overlay-template.md) —
guidance on the metadata-root + clone-body overlay shape.
- [`references/camera-overlay-templates/`](references/camera-overlay-templates/)
— starter `.dts.tmpl` templates: `dphy-direct.dts.tmpl`,
`gmsl-serdes.dts.tmpl`.
- [`../../scripts/pin_verifier.py`](../../scripts/pin_verifier.py)
— shared HSIO pin verifier (Step 6).
- [`../../references/platform_template.yaml`](../../references/platform_template.yaml)
— `documents:` block consumed by Step 1.
- [`../../context/bsp-customization-workflow.md`](../../context/bsp-customization-workflow.md#workflow-invariants)
— overlay edit protocol.
- [`../jetson-customize-pinmux/SKILL.md`](../jetson-customize-pinmux/SKILL.md) —
sibling skill auto-invoked by Step 6 to fix HSIO pin SFIO
mismatches (CAM I²C, MCLK, reset GPIOs).
- [`../jetson-derive-carrier/SKILL.md`](../jetson-derive-carrier/SKILL.md)
— must run first; produces the carrier base overlay (the
`*-dynamic.dtbo`) this skill's composite stacks after.
- [`../jetson-init-source/SKILL.md`](../jetson-init-source/SKILL.md) —
produces the overlay tracker + `bsp_sources` repo (with the
`hardware/nvidia/<chip-dir>/` per-sensor DTSI tree) this skill
reads and commits into.
安裝 jetson-customize-camera
請下載並將技能檔案解壓縮至您的 .claude/skills/ 目錄中。
下載 ZIP複製儲存庫並將技能檔案複製到您的專案中。
git clone https://github.com/NVIDIA/skills/tree/main/skills/jetson-customize-camera # Copy SKILL.md to your .claude/skills/ directory
複製





首頁
