|
1 |
| -# beagle_devkit_camera_driver |
| 1 | +# Technexion implementation of camera driver for Ti BeagleY-AI and BeaglePlay |
2 | 2 |
|
3 | 3 | [](https://www.technexion.com/products/embedded-vision/)
|
4 | 4 |
|
5 | 5 | [](https://www.technexion.com)
|
6 | 6 | [](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html)
|
7 | 7 |
|
8 |
| -## Introduction |
| 8 | +In this guide, you can use the following cameras on BeagleY-AI. |
9 | 9 |
|
10 |
| -[TechNexion Embedded Vision Solutions](https://www.technexion.com/products/embedded-vision/) provide embedded system developers access to high-performance, industrial-grade camera solutions to accelerate their time to market for embedded vision projects. |
| 10 | +[TechNexion cameras Developer Guide with Ti BeaglePlay/BeagleY-AI](https://tn-docusaurus.vercel.app/docs/embedded-vision/tevs/usage-guides/ti/) |
11 | 11 |
|
12 |
| -## Support System Version |
13 |
| - |
14 |
| -- [BeagleY-AI Debian 12.5 2024-06-19 XFCE](https://www.beagleboard.org/distros/beagley-ai-debian-12-5-2024-06-19-xfce) [[kernel 6.1.80-ti-arm64-r57]](https://github.com/beagleboard/linux/tree/v6.1.80-ti-arm64-r57) |
15 |
| - |
16 |
| -## Support Camera Modules |
17 |
| - |
18 |
| -#### MIPI Cameras |
19 |
| -- TEVS-AR0144 |
20 |
| -- TEVS-AR0145 |
21 |
| -- TEVS-AR0234 |
22 |
| -- TEVS-AR0521 |
23 |
| -- TEVS-AR0522 |
24 |
| -- TEVS-AR0821 |
25 |
| -- TEVS-AR0822 |
26 |
| -- TEVS-AR1335 |
27 |
| - |
28 |
| -[More Camera Products Details...](https://www.technexion.com/products/embedded-vision) |
29 |
| - |
30 |
| -## Supported TI Development Kit |
31 |
| - |
32 |
| -- [BeagleY-AI](https://www.ti.com/tool/BEAGLEY-AI) |
33 |
| - |
34 |
| ---- |
35 |
| -## Install TN Camera on TI Development Kit |
36 |
| - |
37 |
| -#### Adaptor for **BeagleY-AI** |
38 |
| - |
39 |
| -TEVS-RPI22 Adaptor for TEVS |
40 |
| - |
41 |
| -> Connect TEVS camera and TEVS-RPI22 adaptor to **BeagleY-AI - "CSI0"** directly. |
42 |
| -
|
43 |
| -<a href="https://www.technexion.com/products/embedded-vision/mipi-csi2/evk/tevs-ar0144-c-s33-ir-rpi22/" target="_blank"> |
44 |
| - <img src="https://www.technexion.com/wp-content/uploads/2024/12/tevs-ar0144-c-s33-ir-rpi22.png" width="400" height="400" /> |
45 |
| -</a> |
46 |
| - |
47 |
| -[**Instructional Video**](https://youtu.be/GyAlPh3KJTI?list=PLdUUBf0zT0W8feLAI_IhhhCr6w073zJ-L&t=46) |
48 |
| - |
49 |
| ---- |
50 |
| - |
51 |
| -#### Method 1 - Using Technexion Pre-built modules, only for **kernel 6.1.80-ti-arm64-r57** |
52 |
| - |
53 |
| -1. Make a SD card with *"BeagleY-AI Debian 12.5 2024-06-19 XFCE"* image. |
54 |
| - |
55 |
| -2. Mount boot partition and configure sysconf.txt before the first boot. |
56 |
| - |
57 |
| -```shell |
58 |
| -$ vim /media/${user}/BOOT/sysconf.txt |
59 |
| - |
60 |
| -> # root_password - Set a password for the root user (not used in ubuntu) |
61 |
| -> root_password=root |
62 |
| -> |
63 |
| -> # user_name - Set a user name for the user (1000) |
64 |
| -> user_name=beagle |
65 |
| -> |
66 |
| -> # user_password - Set a password for user (1000) |
67 |
| -> user_password=beagle |
68 |
| -``` |
69 |
| - |
70 |
| -3. Boot BeagleY-AI with SD card. |
71 |
| - |
72 |
| -4. Download pre-built modules. |
73 |
| - |
74 |
| -```shell |
75 |
| -$ wget https://download.technexion.com/demo_software/EVK/TI/BeagleY-AI/pre-built-modules/latest/tn_camera_module_beagley_ai_6.1.80.tar.gz |
76 |
| -``` |
77 |
| - |
78 |
| -4. Uncompress the modules. |
79 |
| - |
80 |
| -```shell |
81 |
| -$ tar -xf tn_camera_module_beagley_ai_6.1.80.tar.gz |
82 |
| -``` |
83 |
| - |
84 |
| -5. Run installation script. |
85 |
| - |
86 |
| -```shell |
87 |
| -$ cd tn_camera_module_beagley_ai_6.1.80/ |
88 |
| -$ sh tn_install.sh |
89 |
| -[sudo] password for beagle: |
90 |
| -****** TechNexion Camera Driver Installation ****** |
91 |
| -This installation is easy to install TechnNexion Camera Drivers for BeagleY-AI. |
92 |
| -Before start to install camera driver, You should BACKUP your image and config |
93 |
| -to avoid any file you lost while installing process. |
94 |
| -Do you want to continue?[Y/n]y |
95 |
| -Continuing with the installation... |
96 |
| -Install TN-CAM modules: tevs.ko.xz |
97 |
| -Installed TN-CAM module file Done. |
98 |
| -Install TN-CAM DTBO file: k3-am67a-beagley-ai-csi0-tevs-rpi22.dtbo |
99 |
| -Installed TN-CAM DTBO file Done. |
100 |
| -Add TN-CAM Configuration for modules: tevs-rpi22 |
101 |
| -label microSD (default) |
102 |
| -Install TN-CAM service... |
103 |
| -Launch TN-CAM Service... |
104 |
| -Created symlink /etc/systemd/system/multi-user.target.wants/tn_cam.service → /etc/systemd/system/tn_cam.service. |
105 |
| -Finish Camera Driver Installation. Return Code:[1] |
106 |
| -You should Reboot Device to enable TEVS Cameras. |
107 |
| -Do you want to reboot now?[Y/n]y |
108 |
| -Rebooting.... |
109 |
| -``` |
110 |
| -
|
111 |
| ---- |
112 |
| -
|
113 |
| -#### Method 2 - Build drivers from source code (cross-compiling) |
114 |
| -
|
115 |
| -1. You can reference [BeagleBone Cookbook - The Kernel](https://docs.beagleboard.org/latest/books/beaglebone-cookbook/07kernel/kernel.html). |
116 |
| -
|
117 |
| -2. Make sure the dependencies. |
118 |
| -
|
119 |
| -```shell |
120 |
| -$ sudo apt install -y git bc bison flex libssl-dev make libc6-dev libncurses5-dev |
121 |
| - |
122 |
| -# Install the 64-bit toolchain for a 64-bit kernel |
123 |
| -$ sudo apt install -y crossbuild-essential-arm64 |
124 |
| -``` |
125 |
| -
|
126 |
| -3. Get the kernel sources. |
127 |
| -
|
128 |
| -```shell |
129 |
| -# beagleboard linux kerbel |
130 |
| -$ git clone --depth=1 -b v6.1.80-ti-arm64-r57 https://github.com/beagleboard/linux.git |
131 |
| - |
132 |
| -# technexion beagle camera driver |
133 |
| -$ git clone --depth=1 -b v6.1.80-ti-arm64 https://github.com/TechNexion-Vision/beagle_devkit_camera_driver.git |
134 |
| -``` |
135 |
| -
|
136 |
| -4. Copy TN beagle camera driver to beagleboard linux kernel. |
137 |
| -
|
138 |
| -```shell |
139 |
| -$ cp -rv beagle_devkit_camera_driver/drivers/media/i2c/* linux/drivers/media/i2c/ |
140 |
| -$ cp -rv beagle_devkit_camera_driver/arch/arm64/boot/dts/ti/* linux/arch/arm64/boot/dts/ti/ |
141 |
| -``` |
142 |
| -
|
143 |
| -5. Build sources. |
144 |
| -
|
145 |
| -```shell |
146 |
| -$ cd linux |
147 |
| - |
148 |
| -# default configuration |
149 |
| -$ make distclean |
150 |
| -$ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- bb.org_defconfig |
151 |
| - |
152 |
| -# config camera |
153 |
| -$ make menuconfig |
154 |
| -# -> Device Drivers |
155 |
| -# -> Multimedia support (MEDIA_SUPPORT [=m]) |
156 |
| -# -> Media ancillary drivers |
157 |
| -# -> Camera sensor devices (VIDEO_CAMERA_SENSOR [=y]) |
158 |
| -# -> TechNexion TEVS sensor support |
159 |
| -# Set "VIDEO_TEVS" to module, |
160 |
| -# Press "m", save to original name (.config) and exit |
161 |
| - |
162 |
| -# build kernel |
163 |
| -$ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- LOCALVERSION="-tn" -j$(nproc) |
164 |
| -$ mkdir -p modules |
165 |
| -$ sudo make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- INSTALL_MOD_PATH=./modules modules_install |
166 |
| -``` |
167 |
| -
|
168 |
| -6. Plug in the SD card which burned *"BeagleY-AI Debian 12.5 2024-06-19 XFCE"* image to PC. |
169 |
| -
|
170 |
| -7. Configure sysconf.txt before the first boot. |
171 |
| -
|
172 |
| -```shell |
173 |
| -$ vim /media/${user}/BOOT/sysconf.txt |
174 |
| - |
175 |
| -> # root_password - Set a password for the root user (not used in ubuntu) |
176 |
| -> root_password=root |
177 |
| -> |
178 |
| -> # user_name - Set a user name for the user (1000) |
179 |
| -> user_name=beagle |
180 |
| -> |
181 |
| -> # user_password - Set a password for user (1000) |
182 |
| -> user_password=beagle |
183 |
| -``` |
184 |
| -
|
185 |
| -8. Install onto the SD card. |
186 |
| -
|
187 |
| -```shell |
188 |
| -$ sudo cp arch/arm64/boot/Image /media/$(users)/BOOT/ |
189 |
| -$ sudo cp arch/arm64/boot/dts/ti/*.dtbo /media/$(users)/BOOT/overlays/ |
190 |
| -# you can use "make kernelversion" to check kernel version |
191 |
| -$ sudo cp -ra modules/lib/modules/$(make kernelversion)-tn/ /media/$(users)/rootfs/lib/modules/ |
192 |
| -$ sync |
193 |
| -``` |
194 |
| -
|
195 |
| -9. Boot BeagleY-AI with SD card. |
196 |
| -
|
197 |
| -10. Modify the extlinux.conf file to add camera configuraion. |
198 |
| -
|
199 |
| -```shell |
200 |
| -$ sudo nano /boot/firmware/extlinux/extlinux.conf |
201 |
| - |
202 |
| -> label microSD (default) |
203 |
| -> kernel /Image |
204 |
| -> append console=ttyS2,115200n8 root=/dev/mmcblk1p3 ro rootfstype=ext4 resume=/dev/mmcblk1p2 rootwait net.ifnames=0 quiet |
205 |
| -> fdtdir / |
206 |
| -> fdt /ti/k3-am67a-beagley-ai.dtb |
207 |
| -> fdtoverlays /overlays/k3-am67a-beagley-ai-csi0-tevs-rpi22.dtbo |
208 |
| -> initrd /initrd.img |
209 |
| -``` |
210 |
| -Add the overlay to `label microSD (default)` and append `fdtoverlays /overlays/k3-am67a-beagley-ai-csi0-tevs-rpi22.dtbo` after the `fdt` line. |
211 |
| -
|
212 |
| -11. Restart system. |
213 |
| -
|
214 |
| -```shell |
215 |
| -$ sudo reboot |
216 |
| -``` |
217 |
| -
|
218 |
| ---- |
219 |
| -
|
220 |
| -## Bring up Camera by GStreamer |
221 |
| -
|
222 |
| -If you succeed in initialing the camera, you can follow the steps to open the camera. |
223 |
| -
|
224 |
| -1. Check the media deivce. |
225 |
| -
|
226 |
| -```shell |
227 |
| -$ media-ctl -d /dev/media0 -p |
228 |
| -Device topology |
229 |
| -- entity 1: 30102000.ticsi2rx (7 pads, 7 links) |
230 |
| - type V4L2 subdev subtype Unknown flags 0 |
231 |
| - device node name /dev/v4l-subdev0 |
232 |
| - pad0: Sink |
233 |
| - [fmt:UYVY8_1X16/640x480 field:none colorspace:srgb xfer:srgb ycbcr:601 quantization:lim-range] |
234 |
| - <- "cdns_csi2rx.30101000.csi-bridge":1 [ENABLED,IMMUTABLE] |
235 |
| - pad1: Source |
236 |
| - [fmt:UYVY8_1X16/640x480 field:none colorspace:srgb xfer:srgb ycbcr:601 quantization:lim-range] |
237 |
| - -> "30102000.ticsi2rx context 0":0 [ENABLED,IMMUTABLE] |
238 |
| - pad2: Source |
239 |
| - -> "30102000.ticsi2rx context 1":0 [ENABLED,IMMUTABLE] |
240 |
| - pad3: Source |
241 |
| - -> "30102000.ticsi2rx context 2":0 [ENABLED,IMMUTABLE] |
242 |
| - pad4: Source |
243 |
| - -> "30102000.ticsi2rx context 3":0 [ENABLED,IMMUTABLE] |
244 |
| - pad5: Source |
245 |
| - -> "30102000.ticsi2rx context 4":0 [ENABLED,IMMUTABLE] |
246 |
| - pad6: Source |
247 |
| - -> "30102000.ticsi2rx context 5":0 [ENABLED,IMMUTABLE] |
248 |
| - |
249 |
| -- entity 9: cdns_csi2rx.30101000.csi-bridge (5 pads, 2 links) |
250 |
| - type V4L2 subdev subtype Unknown flags 0 |
251 |
| - device node name /dev/v4l-subdev1 |
252 |
| - pad0: Sink |
253 |
| - [fmt:UYVY8_1X16/640x480 field:none colorspace:srgb xfer:srgb ycbcr:601 quantization:lim-range] |
254 |
| - <- "tevs 5-0048":0 [ENABLED,IMMUTABLE] |
255 |
| - pad1: Source |
256 |
| - [fmt:UYVY8_1X16/640x480 field:none colorspace:srgb xfer:srgb ycbcr:601 quantization:lim-range] |
257 |
| - -> "30102000.ticsi2rx":0 [ENABLED,IMMUTABLE] |
258 |
| - pad2: Source |
259 |
| - pad3: Source |
260 |
| - pad4: Source |
261 |
| - |
262 |
| -- entity 15: tevs 5-0048 (1 pad, 1 link) |
263 |
| - type V4L2 subdev subtype Sensor flags 0 |
264 |
| - device node name /dev/v4l-subdev2 |
265 |
| - pad0: Source |
266 |
| - [fmt:UYVY8_1X16/640x480@1/60 field:none colorspace:srgb xfer:srgb ycbcr:601 quantization:full-range |
267 |
| - crop.bounds:(0,0)/640x480 |
268 |
| - crop:(0,0)/640x480] |
269 |
| - -> "cdns_csi2rx.30101000.csi-bridge":0 [ENABLED,IMMUTABLE] |
270 |
| - |
271 |
| -- entity 21: 30102000.ticsi2rx context 0 (1 pad, 1 link) |
272 |
| - type Node subtype V4L flags 0 |
273 |
| - device node name /dev/video3 |
274 |
| - pad0: Sink |
275 |
| - <- "30102000.ticsi2rx":1 [ENABLED,IMMUTABLE] |
276 |
| - |
277 |
| -... |
278 |
| - |
279 |
| -``` |
280 |
| -
|
281 |
| -2. List device support formats and resolutions. |
282 |
| -
|
283 |
| -```shell |
284 |
| -# list support format |
285 |
| -$ v4l2-ctl -d /dev/v4l-subdev2 --list-subdev-mbus-codes |
286 |
| - |
287 |
| -> ioctl: VIDIOC_SUBDEV_ENUM_MBUS_CODE (pad=0) |
288 |
| -> 0x200f: MEDIA_BUS_FMT_UYVY8_1X16 |
289 |
| - |
290 |
| -# list support frame size with format |
291 |
| -$ v4l2-ctl -d /dev/v4l-subdev2 --list-subdev-framesize code=0x200f |
292 |
| - |
293 |
| -> ioctl: VIDIOC_SUBDEV_ENUM_FRAME_SIZE (pad=0) |
294 |
| -> Size Range: 640x480 - 640x480 |
295 |
| -> Size Range: 1280x720 - 1280x720 |
296 |
| -> Size Range: 1280x800 - 1280x800 |
297 |
| - |
298 |
| -# list support frame intercal with format and resolution |
299 |
| -$ v4l2-ctl -d /dev/v4l-subdev2 --list-subdev-frameintervals \ |
300 |
| -pad=0,width=1280,height=720,code=0x2006 |
301 |
| - |
302 |
| -> ioctl: VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL (pad=0) |
303 |
| -> Interval: 0.017s (60.000 fps) |
304 |
| -``` |
305 |
| -
|
306 |
| -3. Bring up the camera (/dev/video3) with 640x480 by Gstreamer pipeline. |
307 |
| -
|
308 |
| -```shell |
309 |
| -$ DISPLAY=:0 gst-launch-1.0 v4l2src device=/dev/video3 ! \ |
310 |
| -"video/x-raw, format=UYVY, width=640, height=480" ! fpsdisplaysink sync=false |
311 |
| -``` |
312 |
| -
|
313 |
| -4. Change resolution with 1280x720 and bring up by Gstreamer pipeline directly. |
314 |
| -
|
315 |
| -```shell |
316 |
| -# modify media resoltion |
317 |
| -media-ctl -V '"tevs 5-0048":0 [fmt:UYVY8_1X16/1280x720]' |
318 |
| -media-ctl -V '"30102000.ticsi2rx":0 [fmt:UYVY8_1X16/1280x720]' |
319 |
| - |
320 |
| -$ DISPLAY=:0 gst-launch-1.0 v4l2src device=/dev/video3 ! \ |
321 |
| -"video/x-raw, format=(string)UYVY, width=(int)1280, height=(int)720" ! \ |
322 |
| -fpsdisplaysink video-sink=glimagesink sync=false |
323 |
| -``` |
324 |
| -
|
325 |
| ---- |
326 |
| -
|
327 |
| -## Troubleshooting |
328 |
| -
|
329 |
| -
|
330 |
| ---- |
331 |
| -
|
332 |
| -## WIKI Pages |
333 |
| -
|
334 |
| -[TechNexion Camera Modules for TI BeaglePlay](https://tn-docusaurus.vercel.app/docs/embedded-vision/tevs/usage-guides/ti/ti-beagleplay-tevs-camera-usage-guide) |
335 |
| -
|
336 |
| -[TechNexion Camera Modules for TI BeagleY-AI](https://tn-docusaurus.vercel.app/docs/embedded-vision/tevs/usage-guides/ti/ti-beagley-ai-tevs-camera-usage-guide) |
0 commit comments