Using IMX219-camera with TX2 4GB

Hello!

I’m trying to get a camera to work with GStreamer on a TX2 4GB.

The camera is an IMX219 module (I think it is this one from Amazon) and connected to the TX2 4GB through a MIPI-connector on our custom PCB/carrier board.

The MIPI-connector is connected to CAM0 and CSI0 on the TX2 4GB (PINS G8, H8, H26, H27, G27, G28, F28, and F29) on the PCB.

I have tried to run GStreamer with
gst-launch-1.0 nvarguscamerasrc ! omxh264enc ! splitmuxsink location=%02d.mp4 max-size-time=1000000000 max-files=100”,
but get an error with
Error generated. /dvs/git/dirty/git-master_linux/multimedia/nvgstreamer/gst-nvarguscamera/gstnvarguscamerasrc.cpp, execute:725 No cameras available”.

I have tried to look for /dev/video0, but it doesn’t exist.
I’ve also looked for imx219 in dmesg with “dmesg | grep -i imx219”, but that doesn’t return any results.

As far as I understand from searching this forum, I must edit some files in the device tree to enable the camera, but I have yet to understand where to begin.

Can anyone please help me get the camera working?

Best regards
Magnus Johansen

Hi,
By default we support Raspberry Pi camera v2 on Jetson Nano, Xavier NX, TX2 NX. For this camera, you would need to get help from the vendor for sensor driver porting. It is not plug and play.

Thank you for the quick reply!
I will contact the vendor for help.

However, I do have some follow-up questions.

Why does is the camera plug and play on the Jetson Nano (in the Nano dev kit), but not on the TX2 4GB?

Is it not possible to use the same driver on both devices?

I’m sorry if they seem stupid, but I just want to understand.

Best regards
Magnus

Hi,
The socket of connecting to cameras is different. For TX2, please refer to this picture:
What are the parameters of the camera that comes with the TX2 development board?

I see.
Does that mean that the drivers for the TX2 4GB are set up for a different camera connector (the one in the picture you provided)?

We have our own PCB/carrier board, which has a CSI/MIPI-connector (like on the Nano dev kit).
What must be done for the TX2 4GB to recognize the MIPI-connector?

Hi,
Please refer to sensor driver programming guide in developer guide , and debug tips in
Jetson/l4t/Camera BringUp - eLinux.org

Hi, Dane!

Thank you for the references. I’ve been looking through them over the weekend, but there are still some things I don’t quite understand.

I’ve seen in the kernel and source code that a (generic?) driver for a (generic?) IMX219 is present. I understand that there might be some technical differences between cameras, but are they really so different that the kernel doesn’t even recognize that a camera is connected?

I’m sorry for bugging you, but I’m just trying to understand how the camera might be recognized, and how I might make it work.

-Magnus

Hi,
You would need to add device tree accordingly. The device tree for Raspberry Pi camera v2 is in the dts files of Jetson Nano/Xavier NX/TX2 NX. You can refer to it and add to dts of TX2 4GB. And i2c bus number, connected CSI ports depend on hardware design. Would need to change it accordingly.

Please also refer to this tutorial:
Jetson Embedded Platform (JEP) Develop a V4L2 Sensor Driver

Hi, Dane!

Thank you for the information! I think I’m starting to understand the fundamentals now.

I downloaded the source code for Nano, and think I found the device tree for the camera in tegra210-porg-camera-rbpcv2-imx219.dtsi and tegra210-camera-rbpcv2-imx219.dtsi.

And i2c bus number, connected CSI ports depend on hardware design. Would need to change it accordingly.

I see that on the Nano it uses i2c@546c0000, but how do I know which bus and CSI ports I should use for the TX2 4GB?

The camera is connected to the following pins (if that helps):

  • I2C_CAM_CLK (C6)
  • I2C_CAM_DAT (D6)
  • CAM0_PWR# (G8)
  • CAM0_RST# (H8)
  • CSI0 data and clock pins (F28, F29, G27, G28, H26, H27)

Hi,
Please check product design guide and confimr the pins are correctly connected:
https://developer.nvidia.com/embedded/dlc/jetson-tx2-series-oem-product-design-guide

Please also try to get help from the camera vendor. To confirm if the board is compatible with TX2 4GB and if there is existing device tree/driver you can apply directly.

I’m still waiting for a reply from the vendor, however, I still want to keep working on it in the meantime.

I’ve looked through the MIPI CSI section of the Product Design Guide (ch. 9), and from what I can tell the pins are correctly connected. I’m still not sure about the i2c buses though. I see that most camera drivers for the TX2 series use “i2c@3180000”, so should I use that, or is it chosen in a particular way?

Hi,
Yes, I2C CAM is i2c@3180000. Please map table 66 in product design guide with device tree.

aliases {
                sdhci0 = "/sdhci@3400000";
                sdhci1 = "/sdhci@3420000";
                sdhci2 = "/sdhci@3440000";
                sdhci3 = "/sdhci@3460000";
                i2c0 = "/i2c@3160000";
                i2c1 = "/i2c@c240000";
                i2c2 = "/i2c@3180000";
                i2c3 = "/i2c@3190000";
                i2c4 = "/bpmp_i2c";
                i2c5 = "/i2c@31b0000";
                i2c6 = "/i2c@31c0000";
                i2c7 = "/i2c@c250000";
                i2c8 = "/i2c@31e0000";

In the table the index starts from 1 and in device tree it starts from 0, so index 1 in table maps to index 0 in device tree. Please note this.

Sorry for the late reply.
I’ve been sick for a week with Covid, but I’m back on the project now!

Thanks for the info. I found the table in the design guide and saw that the third i2c is indeed for the camera.

I am going to attempt to write a driver for the camera this week, using the existing driver for rbpcv2 on the Nano as a base. If there is anything you think I should know about that you haven’t shared yet feel free to share it!

I will come back with the results as soon as I am able to.

Best regards
Magnus

Quick update!

I’ve been having trouble figuring out how to flash the updated device tree to the Jetson.
I tried to use the “dtc” command on the main file (tegra186-quill-p3489-0888-a00-00-base.dts), however, it failed to parse the file.
I did some research and found out that the file in the source code is not a pure device tree.

I did find the device tree in the dtb-format in the kernel/dtb folder and converted that back to dts using the “dtc” command.
However, I find that file more confusing to work with, probably because the source code is segmented into several files, while the device tree has all those files combined into one giant file.

I have also been pulled off this project for a couple of weeks, but I will update here to keep this thread alive until I’m back.

-Magnus