Cannot update device tree on Jetson Nano to add new resolution mode for IMX219

I have been trying to add a 640x480@180fps resolution mode to the IMX219 (RPi 2 camera) driver as the included 720p modes are unnecessarily high resolution. I have successfully modified the kernel (mainly imx219_mode_tbls.h) and recompiled it using these instructions and now the new resolution mode shows up when running v4l2-ctl --list-formats-ext.

I have also modified the device tree files tegra210-camera-rbpcv2-imx219.dtsi and tegra210-camera-rbpcv2-dual-imx219.dtsi to add a seventh mode that corresponds to the new stuff I added to imx219_mode_tbls.h. When compiling the kernel with make, it generates a bunch of files in Linux_for_Tegra/source/public/build/arch/arm64/boot/dts. I have tried copying these files to the /boot and /boot/dtb directories in the SD card for the Nano. I have also tried using dd to copy tegra210-p3448-0000-p3449-0000-a02.dtb to the 3rd and 10th partitions on the SD card with a 1024-byte offset, since that’s what I saw when I ran binwalk on those partitions.

Regardless of all this, the Jetson boots just fine but my seventh camera mode never appears in the device tree (running ls /proc/device-tree/cam_i2cmux/i2c@0/rbpcv2_imx219_a@10 only shows modes 0-5). Because of this, when I try running my application which sets the sensor_mode control to 6 and tries to request a 640x480 resolution, the ioctl call returns EINVAL. I have added some print statements and things to the kernel driver and I can see that it only thinks there are 6 total modes and fails because I am requesting one that it thinks is out of bounds.

I have seen various discussions on here regarding modifying the device tree, some of which talk about it needing to be encrypted in some way (which I don’t think it needs to be since it’s still booting fine after overwriting all instances of the device tree I could find?..), and lots of references to poorly-documented shell scripts that take me half an hour to even find the right downloads for that are supposed to magically fix everything (but, again, I have no idea how to use them because there is no documentation I can find).

So my main questions at this point are: How can I actually modify the device tree? Where is it getting the old one from that only has 6 modes?

I am using L4T 32.6.1 and a Jetson Nano developer kit (the version with an SD card instead of built-in flash).

hello dvdv ,

it looks you did not update device tree binary correctly.
could you please check you had FDT entry defined in the /boot/extlinux/extlinux.conf? otherwise, it’ll load device tree via DTB partition.
you may enable flash script to update DTB partition, for example, $ sudo ./ -r -k DTB jetson-nano-emmc mmcblk0p1

I added FDT /boot/tegra210-p3448-0000-p3449-0000-a02.dtb to the /boot/extlinux/extlinux.conf file and it is now loading my device tree and my application is able to start a stream with my custom video mode now. Thanks for the help!

However, I’m now running into a strange problem with the V4L2 driver returning corrupted frames at higher framrates, but that’s unrelated to this device tree issue, so I’ll start a new thread for that.