Arducam

Raspberry Pi cameras (V1, V2, wide angle etc), HDMI capture modules etc.
Post Reply
fshero
Posts: 3
Joined: Mon Oct 14, 2019 3:55 pm

Arducam

Post by fshero » Mon Oct 14, 2019 4:24 pm

I'm currently trying to get an 18MP Arducam (UC-549, AR1820) working with the StereoPi Board. I installed all Arducam drivers and tried both camera connectors but none of them seems to work. None of the sample programs can connect to the camera. I even tried it with and without the dt_blob.bin in the boot partition but nothing changed.

I connected this camera to a Raspberry Pi Zero before, where all Arducam drivers were installed and this worked for me. So is there anything different to the CSI port on the StereoPi than on the Pi Zero?
Because the cameras communicate over i2c I checked the connection with "i2cdetect -y 0". The Pi Zero is successfully displaying the I2C-Adress (0x37) and I can read out the registers. But on the StereoPi there is nothing.

Has anybody maybe tried to get an Arducam running with the StereoPi? Do I need to configure anything else?
Attachments
20191014_182034.jpg
Arducam connected to StereoPi
20191014_182034.jpg (5.66 MiB) Viewed 338 times

User avatar
Realizator
Site Admin
Posts: 299
Joined: Tue Apr 16, 2019 9:23 am
Contact:

Re: Arducam

Post by Realizator » Mon Oct 14, 2019 5:07 pm

Hi Fshero,
I looked at this module's description (by following your link). But all the docs tells me, that it uses 22 pin cable, but not 15 pin cable like Pi cameras. But on your photo I see 15 pins cable. Are you using some adapter/converter 22->15 pin?
Could you please give me a link to the docs for the module you use. I will look inside the configuration specific.
Eugene a.k.a. Realizator

fshero
Posts: 3
Joined: Mon Oct 14, 2019 3:55 pm

Re: Arducam

Post by fshero » Mon Oct 14, 2019 7:12 pm

Hi Realizator,
thank you for your fast reply :)

I am using a 22 pin to 15 pin cable like this without any adapter. I tested the cable before the other way around (camera: 15 pin <-> Raspberry Pi zero: 22 Pin) and the connection was successful. Now I thought, it should also work the other way around. On the advertising pictures of the MIPI cameras from the Arducam website, is exactly such a cable used to connect a 22-pin camera to a 15-pin Raspberry Pi 3/4:

Image

I also compared the pin-out from my Arducam with the pin-out from the StereoPi schematic:
MIPI_CSI_22_pin_vs_15_pin.png
MIPI_CSI_22_pin_vs_15_pin.png (40.98 KiB) Viewed 332 times
Except the data lane 2 and 3 everything matches. But this two lanes are not required, because MIPI-CSI can also work with only 2 lanes (0 and 1). Even the raspberry pi zero is missing lane 2 and 3(see Raspberry Pi Zero schematic) on its connector (and with the zero, the camera worked). So the cable should perform well.

Here is the link of the SDK and drivers on github if you are interested. I'm pretty sure I've installed everything properly.

Do you have any idea what I could try next?

User avatar
Realizator
Site Admin
Posts: 299
Joined: Tue Apr 16, 2019 9:23 am
Contact:

Re: Arducam

Post by Realizator » Tue Oct 15, 2019 7:03 am

I can suggest it is an issue with I2C configuration.
Both Arducam drivers and StereoPi's device tree (dt-blob.bin) describes it's own usage of I2C.
1st notice: StereoPi's dt-blob.bin loads by Raspbian only in the case, when Raspbian detects Compute Module while boot. That is, if you instert the same micro SD card to, say, Pi Zero, dt-blob.bin won't be loaded.
2nd notice: if you will look inside our dt-blob.bin source (dt-blob.dts), you can find we use I2C_0 for control cameras. But Arducam uses another settings.

The case is that both Arducam drivers and StereoPi's settings use low-level configuration of the same things, thus all this stuff is not working "out of the box".


So I think the easiest way to force all that things to work is to set appropriate I2C in Arducam settings (i2c-0 instead i2c_vc), but you need to do it carefully and in all configuration files.
Another approach is to set appropriate reconfiguration of CMs pins in a device tree (dt-blob.dts) and compile it to dt-blob.bin. Under "appropriate" I mean configure right the same I2C for each camera, used by Arducam.
Eugene a.k.a. Realizator

fshero
Posts: 3
Joined: Mon Oct 14, 2019 3:55 pm

Re: Arducam

Post by fshero » Tue Oct 15, 2019 12:48 pm

Thank you for your advices!
Now I managed to get two Arducams to work by looking into the dt_blob.dts and mapping the right pins.

In case somebody has the same problem:

In the Arducam SDK there is a method called "arducam_init_camera2(&camera_instance, cam_interface)". Here you can specify some camera-pins manually over the "cam_interface" struct. For the Arducams you need the following camera_interface struct (I got the pin numbers out of the dt_blob.dts):

Code: Select all

    struct camera_interface cam_interface = {
        .i2c_bus = 0,           // /dev/i2c-0  or /dev/i2c-1   
        .camera_num = camera_num,        // mipi interface num
        .sda_pins = {0, 28},    // enable sda_pins[camera_num], disable sda_pins[camera_num ? 0 : 1]
        .scl_pins = {1, 29},    // enable scl_pins[camera_num], disable scl_pins[camera_num ? 0 : 1]
        .led_pins = {39, 30},
        .shutdown_pins ={44, 45},
    };

Hope that helps somebody too and thanks again to Realizator for your help :D

User avatar
Realizator
Site Admin
Posts: 299
Joined: Tue Apr 16, 2019 9:23 am
Contact:

Re: Arducam

Post by Realizator » Tue Oct 15, 2019 1:17 pm

Wow, fshero, congratulations! :)
I will add this info to our Wiki.
I've also sent you a personal email. Could you please answer?
Eugene a.k.a. Realizator

User avatar
Realizator
Site Admin
Posts: 299
Joined: Tue Apr 16, 2019 9:23 am
Contact:

Re: Arducam

Post by Realizator » Wed Oct 16, 2019 2:16 pm

Ok, I've added this info to our Wiki.
Eugene a.k.a. Realizator

Post Reply