How to modify the device tree and add your own camera driver。

I am a newbie and recently needed to use a sony IMX415 camera on a project.
The platform orin Nano 4G is used
jetson36.3
Please tell me how to modify the device tree and which file needs to be modified. How to add an IMX415 camera driver

Hello @56101855,

Do you have the IMX415 camera driver sources at hand ?

Adding this support should be fairly simple if so.
A rough idea on the steps would be:

  1. Add the .c and .h files into the /kernel/nvidia/drivers/media/i2c/ directory.
  2. Add the .dtsi files into the hardware directory for the Jetson Orin Nano platform
  3. Add the driver into the tegra_conf file for it to be compiled.
  4. Change the base dtsi so that it inclused your dtsi for the camera to be supported.
  5. Compile dtb, kernel and modules.
  6. Flash or move the files into the board
  7. Test.

I know that is a bit loose of a description, however, if you need a bit more details please let us know, we would be glad to setup a call with you for free so we could guide you a bit more.

Also, please do not hesitate to reach out if you require further assistance we would be glad to help.

regards,
Andrew

Thank you for your help。
May I ask if there are detailed operation steps? I do not know how to modify the device tree.

Hello @56101855,

Sure, we could help you with more more detailed steps.

However, in order to do that we first need to understand what are we starting with.
Please help me answer the following questions:

  1. Do you have .c and .dtsi files for the camera driver? Or whats your starting point?
  2. Have you already managed to download Jetpack and the Jetpack sources?
  3. Are you familiar with the Jetpack compilation process ?

With those details we could help you with more detailed instructions.

regards,
Andrew

There’s a camera program. c files and. dTSI file. I also downloaded the jetpack source code and compiled the kernel, but didn’t know how orin Nano modified the device tree.

Hello @56101855,

Thanks for the extra info.

Here is a more detailed guide on how to add your camera DTB to your system:

  1. Add you .dtsi file to your hardware/nvidia/platform/t23x/p3768/kernel-dts/cvb. This will make the camera DTB available for the main dtb of your board.
  2. Lets identify the base dtsi file for your HW configuration. If we assume you are using a Jetson Orin Nano Devkit, according to NVIDIA’s documentation, you would be using a P3767 System on Module (SOM) connected to a P3768 carrier board. Therefore, referring back to NVIDIA’s documentation on DTB porting your system should be using a dtb named tegra234-p3767-0003-p3768-0000-a0.dtb, which dtsi file could be found at: hardware/nvidia/platform/t23x/p3768/kernel-dts/tegra234-p3767-0003-p3768-0000-a0.dts. Now, if you want to verify this is the DTB file you are using on your board, you can run the following command on your Jetson dmesg | grep dts which should output a long string with the name of the dtb file at the end.
  3. Once we identify the base dtsi, we can start tracing back up to which dtsi file we need to modify to include our camera device tree. For instance, starting at tegra234-p3767-0003-p3768-0000-a0.dts, we see that it includes tegra234-p3767-0000-p3768-0000-a0.dts, which includes cvb/tegra234-p3768-0000-a0.dtsi which finally includes tegra234-p3768-camera-rbpcv3-imx477.dtsi and tegra234-p3768-camera-rbpcv2-imx219.dtsi which are the default cameras used on the board. You can then remove those includes and ad yours #include "YOUR_CAMERA.dtsi"
  4. Compile the DTB and move it into the board.
  5. Test the changes.

Hope this explains a bit better the process.
However, don’t hesitate to reach back if you require further assistance.

regards,
Andrew

Hello @56101855,

I think the steps provided by proventusnova are an excelent guide.

There are also a this guide that you can use to understand better all the steps:
https://docs.nvidia.com/jetson/archives/r36.3/DeveloperGuide/SD/CameraDevelopment/SensorSoftwareDriverProgramming.html

Manuel Leiva
Embedded SW Engineer at RidgeRun
Contact us: support@ridgerun.com
Developers wiki: https://developer.ridgerun.com
Website: www.ridgerun.com

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.