Switch between two sensors connected to same port

Hi,

Is it possible to have two different sensors connected to the same CSI port? The individual sensor drivers have been developed and verified to be working when compiled separately.

However, I need to demonstrate the two different sensors in the field without the ability to flash the TX2 completely.

The hardware setup is two different sensors each having TI953 serializers connected to Rx port 0 and 1 of TI960 deserializer. The deserializer output is connected to CSI port 0 of TX2.

The two sensors don’t need to run simultaneously so there shouldn’t be any conflict in CSI data stream ID. The deserializer receiver just needs to be pointed to the right port during start stream function call.

I have tried creating this combined driver. Whenever the 2nd sensor is probed, all communication won’t work. But when I don’t probe the 2nd sensor, and just initialize the 2nd serializer, I am able to stream using the 1st sensor and detect the i2c addr(alias) of the 2nd sensor and serializer.

Is this driver configuration possible? Are there other options that I can do for this use-case?

Thank you.

Only two sensors? I would like suggest to connect to different CSI port and have auto detect to enable/disable them. Please have a check for the sensor programing for the plugin manager.

Hi ShaneCCC,

Unfortunately, I can no longer change the hardware connection from the deserializer to the CSI ports of TX2. Is there an alternative that can be done at software/driver side only?

You can try handle all the thing at your kernel sensor driver.

Hi ShaneCCC,

I am having problems with my kernel sensor driver.

If I probe the sensor 2, I lose communication with the sensor 1 and I don’t get any response from sensor 2.

If I just probe the first sensor, I can stream without problems and can write to registers of serializer 2 and sensor 2.

For your case I think you can try to integrate 2 sensor control to one sensor driver.

Hi ShaneCCC,

Thanks for the suggestion.

In that case, I will only have 1 probe function for the sensor driver right?

I am assuming that s_fmt, g_fmt, s_stream and sensor-specific register access functions should be declared separately for the 2 sensors. Can you specify which other functions should be declared separately?

Hi ShaneCCC,

I am able to access the 2 sensors and write the mode tables and start stream commands using a single driver.

However, I am getting “PXL_SOF syncpt timeout! err = -11.” I am also getting “libv4l2: error dequeuing buf: Input/output error” in the terminal when starting stream from sensor 1.

I am still using the same settings as the one working in the individual sensor drivers.

Based on deserializer register settings, there is data received up to deserializer level from either sensor.

Do you have any idea why?

Have a check below link to enable the trace to get more information.

https://elinux.org/Jetson_TX2_Camera_BringUp

Hi ShaneCCC,

Thanks for the tip.

I was able to get more information from the trace. It showed CRC issues which is now fixed.

I am now able to stream from two sensors using the same driver and same CSI port, but not simultaneously.

However, I am now still limited by the setup because if I use a different format for the 2nd sensor, I am unable to stream for it. The 1st sensor uses RAW12 format, while the 2nd uses RGB888. Is there a way to configure the driver to allow sensor modes having different formats?

I think you can report this sensor support two formats and use the _set_fmt to switch the formats.

v4l2-ctl -d /dev/video0 --set-fmt-video=width=1920,height=1080,pixelformat=RG10 .......