How to Send I2C Camera Commands.

Hello,

I have a Jetson TX2 developer kit with the CSI MIPI Camera.
I would like to know how I can send I2C commands to the camera.
Currently as I run the i2cdetect command I am unable to find/locate the camera.
Some forum entries suggested that the camera is using the CAM_I2C device, however, I am not able to find this in the /dev folder nor is it being detected by i2cdetect.
I would like to write to and query the camera registers using the I2C protocol.
That is write and read the camera registers as an I2C device.
How can I do this?
If NVidia doesn’t support this, then how can I write to the different camera register?

Thanks.

Hi,

There are several aspect to check when working with cameras/drivers, but as a direct answer to your question, you can use i2cget and i2cset to communicate with i2c devices.

If the camera does not appears at i2cdetect it may be related with a reset condition at the camera, clock not being provided or similar, usually you use i2cdetect to identify and check communication with the i2c camera at i2c bus.

About the information that you found at the forum, if you are using OV5693 or similar it is true, those cameras are controlled via i2c.

Regards.

Are those “reset condition at the camera, clock not being provided or similar” done/fixed via jumpers or some firmware? How to change those settings?

Thanks.

Hi,

If you are using the Devkit with OV5693 camera and flashing default firmware with JetPack everything should be set and ready to detect and perform video capture.

This guide: [url]https://developer.ridgerun.com/wiki/index.php?title=Installing_JetPack_4.2_-_Nvidia_SDK_Manager[/url] explains how to flash TX2 with JetPack 4.2.

In my case I am currently using a Jetson TX2 with devkit and OV5693, at dmesg I can see the OV5693 being probed successfully:

nvidia@nvidia:~$ dmesg | grep ov5693
[ 3.518325] ov5693 2-0036: probing v4l2 sensor.
[ 3.519205] ov5693 2-0036: tegracam sensor driver:ov5693_v2.0.6
[ 4.813935] tegra-vi4 15700000.vi: subdev ov5693 2-0036 bound
nvidia@nvidia:~$

And camera being detected and driver working at 0x36 i2c-2
nvidia@nvidia:~$ sudo i2cdetect -y -a -r 0x02
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: – – – – – – – – – – – – – – – –
10: – – – – – – – – – – – – – – – –
20: – – – – – – – – – – – – – – – –
30: – – – – – – UU – – – – – – – – –
40: – – – – – – – – – – – – – – – –
50: – – – – – – – – – – – – – – – –
60: – – – – – – – – – – – – – – – –
70: – – – – – – – – – – – – – – – –
nvidia@nvidia:~$

Also I can see buffers being captured from the camera when using this pipeline:

gst-launch-1.0 -e nvarguscamerasrc ! ‘video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)NV12, framerate=(fraction)30/1’ ! fakesink silent=false -v

To answer your question, reset signal, clock and interface configuration are performed by the firmware, basically the kernel ov5693 driver and devicetree. No jumper modifications are required.

Regards.

Thanks for your help, I appreciate it.

As I try to run i2cget -y 2 0x36 0x06 → I get a “device busy message”.
If I add in a -f: i2cget -y -f 2 0x36 0x06 → I get a zero.
I get a zero for any register address.

I also tried this when the camera was running and when the camera was not running.
It seems that the driver has some lock on the I2C bus where it will not allow a user to directly access it as suggested by the “device busy message”.

Is there a way to communicate with the camera without getting the “device busy message” or a zero (if -f is used) ?

Thanks.

Hi,

In this case the OV5693 has 16bit address registers, for example if you want to read OV5693 device id you need to set i2c address first and then read the registers.

Example: read OV5693 device id at address 0x300a
sudo i2cset -f -y 2 0x36 0x30 0x0a
sudo i2cget -f -y 2 0x36 #-----------------> will print 0x56
sudo i2cset -f -y 2 0x36 0x30 0x0b
sudo i2cget -f -y 2 0x36 #-----------------> will print 0x90

Which in my case stands for the sensor-id that I am using 0x5690, you can get a similar idea if checking camera driver and headers, for example: [url]drivers/external_drivers/camera/drivers/media/i2c/ov5693/ov5693.h - kernel/x86 - Git at Google

Regards.

Hi,
if i want to write vale to OV5693 ,how to do it?