Dual Autofocus modules on the updated Jetson Nano carrier board

I am trying to use the Arducam Autofocus module on the updated Jetson Nano board that support two sensors.

https://www.seeedstudio.com/blog/2020/01/16/new-revision-of-jetson-nano-dev-kit-now-supports-new-jetson-nano-module/

I have image fom both sensors and the Motorized sample works for one sensor.

It essentially calls:

i2cset -y 6 0x0c %d %d

I tried poking around for how to focus the second sensor. I tried using different busses and it works sometimes nut inconsistently.

I tried running i2cdetect but cant seem to detect the chip on the address.

Could you shed some light on how to make the module work in this setting?

Kind regards

Jesper Taxbøl

Hi,

It seems the second motor is defective.

Can you test the second camera on RaspberryPi Mode 3B platform? Using this demo

https://github.com/ArduCAM/RaspberryPi/tree/master/Motorized_Focus_Camera/C

If it still can’t work ,Please contact our [email protected] for replacement.

 

I am pretty sure the module works.

It seems I have trouble finding the correct way to control the second camera on the new jetson nano board.

I tried guessing on the i2c port with some luck. One of the neighbour i2c busses let me control second sensor.

When i try to control simultainously all all control signals are sent to first sensor.

I could also not hear the mechanical parts of the camera if the camera was not delivering images.

I wonder if there is something happening behind the scenes when the camera is being initialized.

Kind regards

Jesper Taxbøl

Hi,

As normal the two camera are the same. one can work and the other should be the same.

I give you some advice:

You can connect the normal camera to the Jetson nano board, then run “i2cdetect -r -y 6” to see it exist 0x0C, which is the motor’s i2c address.

Then test the defective camera using the same way. If you can’t find the 0x0C,which means the focus motor is defective. You can contact our [email protected] for replacement

 

Hi,

As normal the two camera are the same. one can work and the other should be the same.

I give you some advice:

You can connect the normal camera to the Jetson nano board, then run “i2cdetect -r -y 6” to see it exist 0x0C, which is the motor’s i2c address.

Then test the defective camera using the same way. If you can’t find the 0x0C,which means the focus motor is defective. You can contact our [email protected] for replacement

Hi,

As normal the two camera are the same. one can work and the other should be the same.

I give you some advice:

You can connect the normal camera to the Jetson nano board, then run “i2cdetect -r -y 6” to see it exist 0x0C, which is the motor’s i2c address.

Then test the defective camera using the same way. If you can’t find the 0x0C,which means the focus motor is defective. You can contact our [email protected] for replacement

Hi,

As normal the two camera are the same. one can work and the other should be the same.

I give you some advice:

You can connect the normal camera to the Jetson nano board, then run “i2cdetect -r -y 6” to see it exist 0x0C, which is the motor’s i2c address.

Then test the defective camera using the same way. If you can’t find the 0x0C,which means the focus motor is defective. You can contact our [email protected] for replacement

Hi,

Our engineer give you some advise to check if the sensor’s motor is defective.

1.run DISPLAY=:0.0 gst-launch-1.0 nvarguscamerasrc ! ‘video/x-raw(memory:NVMM), width=3280, height=2464, format=(string)NV12, framerate=(fraction)20/1’ ! nvoverlaysink -e

2.After you can preview the image. run i2cdetect -r -y 6 to check it it exist the 0x0c which is the focus motor’s i2c address. If you can’t see the ox0c address, which means the focus motor is defective.

Hi,

I have now done some further testing on the updated Nano board

https://www.siliconhighwaydirect.co.uk/product-p/945-13450-0000-100.htm

  1. Single camera tests
    I can run the sample code on on a single camera connected to port one or two. I get a nice image and the focus can be adjusted.

In both cases cameras are identified as “sensor-id 0” on the nvarguscamerasrc

In both cases I am unable to detect the motor id, both before starting the camera feed and after. The scanner does though stall for 1 second when scanning the 0c address.

i2cdetect -y -r 6
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: – – – – – – – – – – – – –
10: UU – – – – – – – – – – – – – – –
20: – – – – – – – – – – – – – – – –
30: – – – – – – – – – – – – – – – –
40: UU – – – – – – – – – – – – – – –
50: – – – – – – – – – – – – – – – –
60: – – – – 64 – – – – – 6a – – – – –
70: – – – – – – – –

Since I am able to control the motor in both cases I am sure the motor works.

  1. Dual camera tests
    When connecting both cameras I get nice images from both cameras but motor control is problematic.

In this case sensors have to be referred as sensor-id 0 and 1 on the nvarguscamerasrc. I use this pipeline

gst-launch-1.0 nvarguscamerasrc sensor-id=0 ! ‘video/x-raw(memory:NVMM),width=3820, height=2464, framerate=21/1, format=NV12’ ! nvvidconv flip-method=0 ! ‘video/x-raw,width=960, height=616’ ! nvvidconv ! nvegltransform ! nveglglessink -e

and

gst-launch-1.0 nvarguscamerasrc sensor-id=1 ! ‘video/x-raw(memory:NVMM),width=3820, height=2464, framerate=21/1, format=NV12’ ! nvvidconv flip-method=0 ! ‘video/x-raw,width=960, height=616’ ! nvvidconv ! nvegltransform ! nveglglessink -e

It is random which motor I control with the motor control example. I get motor control on busses 6,7 and 8.

I am certain both camera units work and there is some complexity that need to be sorted out to be able to control two motors. My personal theory is that the i2c bus is connected ehen the camera is initialized and there is not accounted for more than one motor sensor.

Do you have the updated Nano board available for tetsting in your lab?

Kind regards

Jesper

@tax

Unfortunately, our jetson nano B01 was recently damaged and we are waiting for a new arrival.

However, by looking at the source code, i2c-7 and i2c-8 should be able to control two different modules. I am not sure where the problem is. Can you describe in detail the phenomenon of writing i2c-7 and i2c-8? , Even better if there are pictures or videos.

I finally got it to work somewhat using bus 7 and 8

Could you point me to the sourcecode defining those busses. I assume its somewhere within nvargcamerasrc?

My camera script is:

 

GST_DEBUG=5 gst-launch-1.0 -v \
nvcompositor name=mix \
sink_0::xpos=0 sink_0::ypos=0   sink_0::width=640 sink_0::height=480 \
sink_1::xpos=0 sink_1::ypos=480 sink_1::width=640 sink_1::height=480 ! \
nvoverlaysink overlay-w=640 overlay-h=960 overlay-x=1920 overlay-y=0 \
nvarguscamerasrc sensor-id=0 ! 'video/x-raw(memory:NVMM),width=640, height=480, framerate=30/1, format=NV12' !  nvvidconv flip-method=2 ! mix. \
nvarguscamerasrc sensor-id=1 ! 'video/x-raw(memory:NVMM),width=640, height=480, framerate=30/1, format=NV12' !  nvvidconv flip-method=2 ! mix. \

 

My test script for focus control (when cameras are initialized)

import os
import time


def focusing(val, bus):
    print("setting %d"%(val))
    value = (val << 4) & 0x3ff0 data1 = (value >> 8) & 0x3f
    data2 = value & 0xf0
    os.system("i2cset -y %d 0x0c %d %d" % (bus, data1,data2))
    time.sleep(0.1)

fmin = 10
fmax = 300

f = 10
step = 10

def invert(v):
    v -= fmin
    v = (fmax-fmin)-v
    v += fmin
    return v

while True:
    f += step
    if step > 0:
        if f >= fmax:
            step *= -1
            f = fmax
    else:
        if f <= fmin:
            step *= -1
            f = fmin
    focusing(f,7)
    focusing(invert(f),8)

Hi @tax,

The source code I am talking about is the code of the kernel driver, you can download the code of the kernel from here.

The code I checked is in this directory public_sources/kernel_src/kernel/kernel-4.9/drivers/i2c/muxes