|
1 | 1 | # Intel® RealSense™ camera driver for GMSL* interface |
2 | 2 |
|
3 | | -# D457 MIPI on Jetson AGX Xavier |
4 | | -The RealSense MIPI platform driver enables the user to control and stream RealSense 3D MIPI cameras. |
| 3 | +# D457 MIPI on NVIDIA® Jetson AGX Xavier™ and AGX Orin™ |
| 4 | +The RealSense™ MIPI platform driver enables the user to control and stream RealSense™ 3D MIPI cameras. |
5 | 5 | The system shall include: |
6 | | -* Jetson platform (Currently Supported JetPack versions are: 6.0, 5.1.2, 5.0.2, 4.6.1) |
7 | | -* RealSense De-Serialize board (https://store.intelrealsense.com/buy-intel-realsense-des457.html) |
| 6 | +* NVIDIA® Jetson platform (Currently Supported JetPack versions are: 6.0, 5.1.2, 5.0.2, 4.6.1) |
| 7 | +* De-Serialize board |
| 8 | +* NVIDIA® Jetson AGX Orin™ Passive adapter board from [Leopard Imaging LI-JTX1-SUB-ADPT](https://leopardimaging.com/product/accessories/adapters-carrier-boards/for-nvidia-jetson/li-jtx1-sub-adpt/) |
8 | 9 | * RS MIPI camera (e.g. https://store.intelrealsense.com/buy-intel-realsense-depth-camera-d457.html) |
9 | 10 |
|
10 | 11 | > Note: This MIPI reference driver is based on RealSense de-serialize board. For other de-serialize boards, modification might be needed. |
11 | 12 |
|
12 | 13 |  |
13 | 14 |
|
14 | 15 |
|
15 | | -## Jetson AGX Xavier board setup |
| 16 | +# Documentation |
16 | 17 |
|
17 | | -Please follow the [instruction](https://docs.nvidia.com/sdk-manager/install-with-sdkm-jetson/index.html) to flash JetPack to the Jetson AGX Xavier with NVIDIA SDK Manager or other methods NVIDIA provides. Make sure the board is ready to use. |
18 | | - |
19 | | -## Build kernel, dtb and D457 driver |
20 | | - |
21 | | -The developers can set up the source code with NVIDIA's Jetson git repositories by using the provided setup script: |
22 | | - |
23 | | -``` |
24 | | -# Using setup script, recommended for developers. If JetPack version is not given, default version will be chosen. |
25 | | -./setup_workspace.sh [JetPack_version] |
26 | | -``` |
27 | | - |
28 | | -Or download Jetson Linux source code tarball from |
29 | | -- [JetPack 6.0-DP BSP sources](https://developer.nvidia.com/downloads/embedded/l4t/r36_release_v2.0/sources/public_sources.tbz2) |
30 | | -- [JetPack 5.1.2 BSP sources](https://developer.nvidia.com/downloads/embedded/l4t/r35_release_v4.1/sources/public_sources.tbz2) |
31 | | -- [JetPack 5.0.2 BSP sources](https://developer.nvidia.com/embedded/l4t/r35_release_v1.0/sources/public_sources.tbz2) |
32 | | -- [JetPack 4.6.1 BSP sources](https://developer.nvidia.com/embedded/l4t/r32_release_v7.1/sources/t186/public_sources.tbz2) |
33 | | - |
34 | | -``` |
35 | | -# JetPack 6.0 |
36 | | -mkdir -p l4t-gcc/6.0 |
37 | | -cd ./l4t-gcc/6.0 |
38 | | -wget https://developer.nvidia.com/downloads/embedded/l4t/r36_release_v2.0/toolchain/aarch64--glibc--stable-2022.08-1.tar.bz2 -O aarch64--glibc--stable-final.tar.bz2 |
39 | | -tar xf aarch64--glibc--stable-final.tar.bz2 --strip-components 1 |
40 | | -cd ../.. |
41 | | -wget https://developer.nvidia.com/downloads/embedded/l4t/r36_release_v2.0/sources/public_sources.tbz2 |
42 | | -tar xjf public_sources.tbz2 |
43 | | -cd Linux_for_Tegra/source |
44 | | -tar xjf kernel_src.tbz2 |
45 | | -tar xjf kernel_oot_modules_src.tbz2 |
46 | | -tar xjf nvidia_kernel_display_driver_source.tbz2 |
47 | | -
|
48 | | -# JetPack 5.1.2 |
49 | | -mkdir -p l4t-gcc/5.1.2 |
50 | | -cd ./l4t-gcc/5.1.2 |
51 | | -wget https://developer.nvidia.com/embedded/jetson-linux/bootlin-toolchain-gcc-93 -O aarch64--glibc--stable-final.tar.gz |
52 | | -tar xf aarch64--glibc--stable-final.tar.gz |
53 | | -cd ../.. |
54 | | -wget https://developer.nvidia.com/downloads/embedded/l4t/r35_release_v4.1/sources/public_sources.tbz2 |
55 | | -tar xjf public_sources.tbz2 |
56 | | -cd Linux_for_Tegra/source/public |
57 | | -tar xjf kernel_src.tbz2 |
58 | | -
|
59 | | -# JetPack 5.0.2 |
60 | | -mkdir -p l4t-gcc/5.0.2 |
61 | | -cd ./l4t-gcc/5.0.2 |
62 | | -wget https://developer.nvidia.com/embedded/jetson-linux/bootlin-toolchain-gcc-93 -O aarch64--glibc--stable-final.tar.gz |
63 | | -tar xf aarch64--glibc--stable-final.tar.gz --strip-components 1 |
64 | | -cd ../.. |
65 | | -wget https://developer.nvidia.com/embedded/l4t/r35_release_v1.0/sources/public_sources.tbz2 |
66 | | -tar xjf public_sources.tbz2 |
67 | | -cd Linux_for_Tegra/source/public |
68 | | -tar xjf kernel_src.tbz2 |
69 | | -
|
70 | | -# JetPack 4.6.1 |
71 | | -mkdir -p l4t-gcc/4.6.1 |
72 | | -cd ./l4t-gcc/4.6.1 |
73 | | -wget http://releases.linaro.org/components/toolchain/binaries/7.3-2018.05/aarch64-linux-gnu/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu.tar.xz |
74 | | -tar xf gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu.tar.xz --strip-components 1 |
75 | | -cd ../.. |
76 | | -wget https://developer.nvidia.com/embedded/l4t/r32_release_v7.1/sources/t186/public_sources.tbz2 |
77 | | -tar xjf public_sources.tbz2 |
78 | | -cd Linux_for_Tegra/source/public |
79 | | -tar xjf kernel_src.tbz2 |
80 | | -``` |
| 18 | +- NVIDIA® Jetson AGX Orin™ board setup - AGX Orin™ [JetPack 6.0](./README_JP6.md) setup guide |
| 19 | +- NVIDIA® Jetson AGX Xavier™ board setup - AGX Xavier™ [JetPack 5.x.2](./README_JP5.md) setup guide |
| 20 | +- NVIDIA® Jetson AGX Xavier™ board setup - AGX Xavier™ [JetPack 4.6.1](./README_JP4.md) setup guide |
| 21 | +- Build Tools manual page [Build Manual page](./README_tools.md) |
| 22 | +- Driver API manual page [Driver API page](./README_driver.md) |
81 | 23 |
|
82 | | -Apply D457 patches and build the kernel image, dtb and D457 driver. |
| 24 | +## NVIDIA® Jetson AGX Xavier™ and AGX Orin™ board setup |
83 | 25 |
|
84 | | -``` |
85 | | -# if using setup script |
86 | | -./apply_patches.sh [--one-cam | --dual-cam] apply [JetPack_version] |
87 | | -
|
88 | | -# or, if using direct download method |
89 | | -# ./apply_patches_ext.sh [--one-cam | --dual-cam] ./Linux_for_tegra/source/public [JetPack_version] |
90 | | -# for JP6.0, source path is ./Linux_for_tegra/source : |
91 | | -# ./apply_patches_ext.sh ./Linux_for_tegra/source 6.0 |
92 | | -
|
93 | | -Note: The `--one-cam` and `--dual-cam` option applies only for JetPack 5.0.2, |
94 | | -compatible with adapter: https://store.intelrealsense.com/buy-intel-realsense-des457.html. |
95 | | -By setting the `--one-cam` option it builds DT with only camera on GMSL link A (default). |
96 | | -By setting the `--dual-cam` option it builds DT with dual cameras on GMSL link A and B. |
97 | | -The default is to single camera configuration for JetPack 5.0.2. |
98 | | -
|
99 | | -# build kernel, dtb and D457 driver |
100 | | -# install dependencies |
101 | | -sudo apt install build-essential bc flex bison |
102 | | -# method 1: build kernel Debian packages |
103 | | -./build_all_deb.sh [--no-dbg-pkg] [JetPack_version] [JetPack_source_dir] |
104 | | -# method 2: build kernel and modules only |
105 | | -./build_all.sh [JetPack_version] [JetPack_source_dir] |
106 | | -
|
107 | | -# remove our patches from JetPack kernel source code if using setup script |
108 | | -# ./apply_patches.sh reset [JetPack_version] |
109 | | -``` |
110 | | - |
111 | | -Debian packages will be generated in `images` folder. |
| 26 | +Please follow the [instruction](https://docs.nvidia.com/sdk-manager/install-with-sdkm-jetson/index.html) to flash JetPack to the Jetson AGX Xavier with NVIDIA SDK Manager or other methods NVIDIA provides. Make sure the board is ready to use. |
112 | 27 |
|
113 | | -## Install kernel and D457 driver to Jetson Orin |
114 | | -<details> |
115 | | -<summary>JP6.0 build results</summary> |
| 28 | +**NOTE** : On Jetsons with modified factory setup modifications to build and deploy steps should be made by developer. |
116 | 29 |
|
117 | | -- kernel image (not modified): `images/6.0/rootfs/boot/Image` |
118 | | -- dtb overlay: `images/6.0/rootfs/boot/tegra234-camera-d4xx-overlay.dtbo` |
119 | | -- oot modules: `images/6.0/rootfs/lib/modules/5.15.122-tegra/extra` |
| 30 | +# JetPack build |
120 | 31 |
|
121 | | -Following steps required: |
| 32 | +- [JetPack 6.0](./README_JP6.md#build-environment-prerequisites) |
| 33 | +- [JetPack 5.1.2](./README_JP5.md#build-kernel-dtb-and-d457-driver) |
| 34 | +- [JetPack 5.0.2](./README_JP5.md#build-kernel-dtb-and-d457-driver) |
| 35 | +- [JetPack 4.6.1](./README_JP4.md#build-kernel-dtb-and-d457-driver) |
122 | 36 |
|
123 | | -1. Copy entire directory `images/6.0/rootfs/lib/modules/5.15.122-tegra/extra/` from host to `/lib/modules/5.15.122-tegra/extra/` on Orin |
124 | | -2. Copy `tegra234-camera-d4xx-overlay.dtbo` from host to `/boot/tegra234-camera-d4xx-overlay.dtbo` on Orin |
125 | | -3. Run $ `sudo /opt/nvidia/jetson-io/jetson-io.py` |
126 | | - 1. Configure Jetson AGX CSI Connector |
127 | | - 2. Configure for compatible hardware |
128 | | - 3. Jetson RealSense Camera D457 |
129 | | - 4. $ `sudo depmod` |
130 | | - 5. $ `echo "d4xx" | sudo tee /etc/modules-load.d/d4xx.conf` |
131 | | -4. Reboot |
| 37 | +### Verify driver after installation |
| 38 | +- Driver API manual page [Driver API page](./README_driver.md) |
132 | 39 |
|
133 | | -Copy them to the right places: |
| 40 | +**NOTE** |
134 | 41 |
|
135 | | -``` |
136 | | -scp -r images/6.0/rootfs/boot/tegra234-camera-d4xx-overlay.dtbo nvidia@10.0.0.116:~/ |
137 | | -scp -r images/6.0/rootfs/lib/modules/5.15.122-tegra/extra nvidia@10.0.0.116:~/ |
138 | | -# RealSense metadata patched kernel modules |
139 | | -scp -r images/6.0/rootfs/lib/modules/5.15.122-tegra/kernel/drivers/media/v4l2-core/videodev.ko nvidia@10.0.0.116:~/ |
140 | | -scp -r images/6.0/rootfs/lib/modules/5.15.122-tegra/kernel/drivers/media/usb/uvc/uvcvideo.ko nvidia@10.0.0.116:~/ |
141 | | -# Kernel Image with SENSOR_HID support for RealSense USB cameras with IMU |
142 | | -scp -r images/6.0/rootfs/boot/Image nvidia@10.0.0.116:~/ |
143 | | -``` |
| 42 | +- Each JetPack version's kernel may be different, the user needs to change the kernel version in file names and paths accordingly, for example for JetPack 4.6.1 the version is `4.9.253-d457` or `4.9.253-tegra`, depending on the build method applied. |
| 43 | +- For JetPack 4.6.1, the dtb file is not included in the deb package. User needs to manually copy `images/4.6.1/arch/arm64/boot/dts/tegra194-p2888-0001-p2822-0000.dtb` file to board and edit `extlinux.conf` to point to it. |
| 44 | +- It's recommended to save the original kernel image as backup boot option in `/boot/extlinux/extlinux.conf`. |
144 | 45 |
|
145 | | -on target: |
| 46 | + |
| 47 | +## Available directives on max9295/max9296 register setting |
146 | 48 |
|
| 49 | +- Dump registers |
147 | 50 | ``` |
148 | | -sudo cp ~/tegra234-camera-d4xx-overlay.dtbo /boot/ |
149 | | -# backup: |
150 | | -sudo tar -cjf /lib/modules/$(uname -r)/modules_$(uname -r)_extra.tar.bz2 /lib/modules/$(uname -r)/extra |
151 | | -sudo cp -r ~/extra /lib/modules/$(uname -r)/ |
152 | | -# enable RealSense metadata: |
153 | | -sudo cp uvcvideo.ko /lib/modules/5.15.122-tegra/kernel/drivers/media/usb/uvc/uvcvideo.ko |
154 | | -sudo cp videodev.ko /lib/modules/5.15.122-tegra/kernel/drivers/media/v4l2-core/videodev.ko |
155 | | -# backup kernel (better to have additional boot entry in extlinux.conf) |
156 | | -sudo cp /boot/Image /boot/Image.orig |
157 | | -sudo cp Image /boot/Image |
| 51 | +cat /sys/bus/i2c/drivers/max9295/30-0040/register_dump |
| 52 | +cat /sys/bus/i2c/drivers/max9296/30-0048/register_dump |
158 | 53 | ``` |
159 | 54 |
|
160 | | -Enable d4xx overlay: |
161 | | - |
162 | | -With Jetson-IO tool: |
163 | | -`sudo /opt/nvidia/jetson-io/jetson-io.py` |
| 55 | +- Dump setting version |
164 | 56 |
|
165 | | -1. Configure Jetson AGX CSI Connector |
166 | | -2. Configure for compatible hardware |
167 | | -3. Jetson RealSense Camera D457 |
168 | | - |
169 | | -With command line |
170 | | - |
171 | | -`sudo /opt/nvidia/jetson-io/config-by-hardware.py -n 2="Jetson RealSense Camera D457"` |
172 | | - |
173 | | -Expected: |
174 | 57 | ``` |
175 | | -nvidia@ubuntu:~$ sudo /opt/nvidia/jetson-io/config-by-hardware.py -n 2="Jetson RealSense Camera D457" |
176 | | -Configuration saved to /boot/tegra234-camera-d4xx-overlay.dtbo. |
177 | | -Reboot system to reconfigure. |
| 58 | +cat /sys/module/max9295/parameters/max9295_setting_verison |
| 59 | +cat /sys/module/max9296/parameters/max9296_setting_verison |
178 | 60 | ``` |
179 | | -Enable d4xx autoload: |
180 | | - |
181 | | -`echo "d4xx" | sudo tee /etc/modules-load.d/d4xx.conf` |
182 | | - |
183 | | -`sudo depmod` |
184 | | - |
185 | | ---- |
186 | | - |
187 | | -</details> |
188 | | - |
189 | | -## Install kernel and D457 driver to Jetson AGX Xavier |
190 | | - |
191 | | -1. Install the kernel and modules |
192 | | - |
193 | | -1.1 If building with `build_all_deb.sh` |
194 | 61 |
|
195 | | -Copy the Debian package `linux-image-5.10.104-d457_5.10.104-d457-1_arm64.deb` to the Jetson AGX Xavier board and install with `sudo dpkg -i linux-image-5.10.104-d457_5.10.104-d457-1_arm64.deb`. The header, libc-dev, dbg and firmware packages are optional. |
| 62 | +- Disable updating setting dynamically (updating setting manually by running script). |
| 63 | + **0** means disable updating setting dynamically, while **1** means enable updating setting dynamically. |
196 | 64 |
|
197 | | -1.2 If building with `build_all.sh` |
198 | | - |
199 | | -The necessary files are: |
200 | | - |
201 | | -- kernel image `images/<JetPack_version>/arch/arm64/boot/Image` |
202 | | -- dtb `images/<JetPack_version>/arch/arm64/boot/dts/nvidia/tegra194-p2888-0001-p2822-0000.dtb`, or `images/4.6.1/arch/arm64/boot/dts/tegra194-p2888-0001-p2822-0000.dtb` for JetPack 4.6.1. |
203 | | -- D457 driver `images/<JetPack_version>/drivers/media/i2c/d4xx.ko` |
204 | | -- UVC Video driver `images/<JetPack_version>/drivers/media/usb/uvc/uvcvideo.ko` |
205 | | -- V4L2 Core Video driver `images/<JetPack_version>/drivers/media/v4l2-core/videobuf-core.ko` |
206 | | -- V4L2 VMalloc Video driver `images/<JetPack_version>/drivers/media/v4l2-core/videobuf-vmalloc.ko` |
207 | | - |
208 | | -And copy them to the right places: |
209 | 65 | ``` |
210 | | -sudo cp Image /boot |
211 | | -sudo cp tegra194-p2888-0001-p2822-0000.dtb /boot/dtb |
212 | | -sudo cp d4xx.ko /lib/modules/5.10.104-tegra/kernel/drivers/media/i2c/ |
213 | | -sudo cp uvcvideo.ko /lib/modules/5.10.104-tegra/kernel/drivers/media/usb/uvc/ |
214 | | -sudo cp videobuf-core.ko /lib/modules/5.10.104-tegra/kernel/drivers/media/v4l2-core/ |
215 | | -sudo cp videobuf-vmalloc.ko /lib/modules/5.10.104-tegra/kernel/drivers/media/v4l2-core/ |
216 | | -sudo depmod |
| 66 | +echo 0 | sudo tee /sys/module/max9295/parameters/max9295_dynamic_update |
| 67 | +echo 0 | sudo tee /sys/module/max9296/parameters/max9296_dynamic_update |
217 | 68 | ``` |
218 | 69 |
|
219 | | -2. Edit `/boot/extlinux/extlinux.conf` primary boot option's LINUX/FDT lines to use built kernel image and dtb file: |
| 70 | +- Refresh max9295/max9295 register values, this is used for forcely set serdes setting when necessary |
220 | 71 |
|
221 | 72 | ``` |
222 | | -LINUX /boot/Image-5.10.104-d457 |
223 | | -FDT /usr/lib/linux-image-5.10.104-d457/tegra194-p2888-0001-p2822-0000.dtb |
| 73 | +echo 1 | sudo tee /sys/bus/i2c/drivers/max9295/30-0040/refresh_setting |
| 74 | +echo 1 | sudo tee /sys/bus/i2c/drivers/max9296/30-0048/refresh_setting |
224 | 75 | ``` |
225 | | - |
226 | | -3. Make D457 I2C module autoload at boot time: `echo "d4xx" | sudo tee /etc/modules-load.d/d4xx.conf` |
227 | | - |
228 | | -After rebooting Jetson, the D457 driver should work. |
229 | | - |
230 | | -**NOTE** |
231 | | - |
232 | | -- Each JetPack version's kernel may be different, the user needs to change the kernel version in file names and paths accordingly, for example for JetPack 4.6.1 the version is `4.9.253-d457` or `4.9.253-tegra`, depending on the build method applied. |
233 | | -- For JetPack 4.6.1, the dtb file is not included in the deb package. User needs to manually copy `images/4.6.1/arch/arm64/boot/dts/tegra194-p2888-0001-p2822-0000.dtb` file to board and edit `extlinux.conf` to point to it. |
234 | | -- It's recommended to save the original kernel image as backup boot option in `/boot/extlinux/extlinux.conf`. |
0 commit comments