9a3eedi
Posts: 2
Joined: Wed Jan 23, 2019 7:29 am

Cannot get two cameras to work with CM3 and Ubuntu MATE 16.04

Wed Jan 23, 2019 11:59 am

Hi,

I have a compute module 3 running Ubuntu MATE 16.04. I have attempted to get dual cameras to work, but I have been completely unsuccessful and it's not very clear to me why. I have tried to follow all the steps in this guide, as well as follow the steps in this thread, but to no avail. I have the same problems as described in the thread, namely that CAM1 works, but CAM0 isnt being detected. Performing the fix of removing i2c from config.txt did not solve the issue.

Output for raspi-gpio get shows up as:

Code: Select all

BANK0 (GPIO 0 to 27):
  GPIO 00: level=1 fsel=4 alt=0 func=SDA0
  GPIO 01: level=1 fsel=4 alt=0 func=SCL0
  GPIO 02: level=0 fsel=1 alt=  func=OUTPUT
  GPIO 03: level=0 fsel=1 alt=  func=OUTPUT
  GPIO 04: level=1 fsel=0 alt=  func=INPUT
  GPIO 05: level=1 fsel=0 alt=  func=INPUT
  GPIO 06: level=1 fsel=0 alt=  func=INPUT
  GPIO 07: level=1 fsel=0 alt=  func=INPUT
  GPIO 08: level=1 fsel=0 alt=  func=INPUT
  GPIO 09: level=0 fsel=0 alt=  func=INPUT
  GPIO 10: level=0 fsel=0 alt=  func=INPUT
  GPIO 11: level=0 fsel=0 alt=  func=INPUT
  GPIO 12: level=0 fsel=0 alt=  func=INPUT
  GPIO 13: level=0 fsel=0 alt=  func=INPUT
  GPIO 14: level=1 fsel=4 alt=0 func=TXD0
  GPIO 15: level=1 fsel=4 alt=0 func=RXD0
  GPIO 16: level=0 fsel=0 alt=  func=INPUT
  GPIO 17: level=0 fsel=0 alt=  func=INPUT
  GPIO 18: level=0 fsel=0 alt=  func=INPUT
  GPIO 19: level=0 fsel=0 alt=  func=INPUT
  GPIO 20: level=0 fsel=0 alt=  func=INPUT
  GPIO 21: level=0 fsel=0 alt=  func=INPUT
  GPIO 22: level=0 fsel=0 alt=  func=INPUT
  GPIO 23: level=0 fsel=0 alt=  func=INPUT
  GPIO 24: level=0 fsel=0 alt=  func=INPUT
  GPIO 25: level=0 fsel=0 alt=  func=INPUT
  GPIO 26: level=0 fsel=0 alt=  func=INPUT
  GPIO 27: level=0 fsel=0 alt=  func=INPUT
BANK1 (GPIO 28 to 45):
  GPIO 28: level=1 fsel=0 alt=  func=INPUT
  GPIO 29: level=1 fsel=0 alt=  func=INPUT
  GPIO 30: level=0 fsel=1 alt=  func=OUTPUT
  GPIO 31: level=0 fsel=1 alt=  func=OUTPUT
  GPIO 32: level=0 fsel=0 alt=  func=INPUT
  GPIO 33: level=0 fsel=0 alt=  func=INPUT
  GPIO 34: level=1 fsel=0 alt=  func=INPUT
  GPIO 35: level=1 fsel=0 alt=  func=INPUT
  GPIO 36: level=1 fsel=0 alt=  func=INPUT
  GPIO 37: level=0 fsel=0 alt=  func=INPUT
  GPIO 38: level=0 fsel=0 alt=  func=INPUT
  GPIO 39: level=0 fsel=0 alt=  func=INPUT
  GPIO 40: level=0 fsel=0 alt=  func=INPUT
  GPIO 41: level=0 fsel=0 alt=  func=INPUT
  GPIO 42: level=0 fsel=0 alt=  func=INPUT
  GPIO 43: level=0 fsel=0 alt=  func=INPUT
  GPIO 44: level=0 fsel=0 alt=  func=INPUT
  GPIO 45: level=0 fsel=0 alt=  func=INPUT
BANK2 (GPIO 46 to 53):
  GPIO 46: level=1 fsel=0 alt=  func=INPUT
  GPIO 47: level=1 fsel=1 alt=  func=OUTPUT
  GPIO 48: level=0 fsel=4 alt=0 func=SD0_CLK
  GPIO 49: level=1 fsel=4 alt=0 func=SD0_CMD
  GPIO 50: level=1 fsel=4 alt=0 func=SD0_DAT0
  GPIO 51: level=1 fsel=4 alt=0 func=SD0_DAT1
  GPIO 52: level=1 fsel=4 alt=0 func=SD0_DAT2
  GPIO 53: level=1 fsel=4 alt=0 func=SD0_DAT3
If I understand correctly, GPIOs 28 and 29 should show up as SDA1 and SCL1, but they don't...

I have created my dt-blob.bin file by compiling the following DTS file

Code: Select all

/dts-v1/;

/ {
  videocore {

    pins_cm3 {

      pin_config {

        [email protected] {
          polarity = "active_high";
          termination = "pull_down";
          startup_state = "inactive";
          function = "input";
        }; // pin

        [email protected]  { function = "input";  termination = "pull_up";    }; // CAMERA 0 I2C0 SDA
        [email protected]  { function = "input";  termination = "pull_up";    }; // CAMERA 0 I2C0 SCL
        [email protected]  { function = "output"; termination = "no_pulling"; }; // CAMERA 0 LED
        [email protected]  { function = "output"; termination = "no_pulling"; }; // CAMERA 0 SHUTDOWN
        [email protected] { function = "uart0";  termination = "no_pulling"; drive_strength_mA = < 8 >; }; // TX uart0
        [email protected] { function = "uart0";  termination = "pull_up"; drive_strength_mA = < 8 >; }; // RX uart0
        [email protected] { function = "input";  termination = "pull_up";    }; // CAMERA 1 I2C0 SDA
        [email protected] { function = "input";  termination = "pull_up";    }; // CAMERA 1 I2C0 SCL
        [email protected] { function = "output"; termination = "no_pulling"; }; // CAMERA 1 LED
        [email protected] { function = "output"; termination = "no_pulling"; }; // CAMERA 1 SHUTDOWN
        [email protected] { function = "input";  termination = "pull_up";    }; // SMPS_SCL
        [email protected] { function = "input";  termination = "pull_up";    }; // SMPS_SDA
        [email protected] { function = "sdcard"; termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD CLK
        [email protected] { function = "sdcard"; termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD CMD
        [email protected] { function = "sdcard"; termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD D0
        [email protected] { function = "sdcard"; termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD D1
        [email protected] { function = "sdcard"; termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD D2
        [email protected] { function = "sdcard"; termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD D3
        [email protected] { function = "input";  termination = "no_pulling"; polarity = "active_low"; }; // Hotplug
        [email protected] { function = "output"; termination = "no_pulling"; polarity = "active_low"; }; // EMMC_ENABLE_N
      }; // pin_config

      pin_defines {
        [email protected]_CONTROL_ATTACHED {
           type = "external";
           number = <0>;
        };
        [email protected]_ENABLE {
           type = "external";
           number = <1>;
        };
        [email protected]_LOW {
           type = "absent";
        };
        [email protected]_DISK_ACTIVITY {
           type = "absent";
        };
        [email protected]_RUN {
           type = "absent";
        };
        [email protected]_SDA {
           type = "internal";
           number = <46>;
        };
        [email protected]_SCL {
           type = "internal";
           number = <47>;
        };
        [email protected]_CLK {
           type = "absent";
        };
        [email protected]_LPO_CLK {
           type = "absent";
        };
        [email protected]_LIMIT_1A2 {
           type = "absent";
        };
        [email protected]_1V8_SEL {
           type = "absent";
        };
        [email protected] {
           type = "absent";
        };
        [email protected] {
           type = "absent";
        };
        [email protected]_MODE {
           type = "absent";
        };
        [email protected]_CARD_DETECT {
           type = "absent";
        };
        [email protected]_SDA {
           type = "absent";
        };
        [email protected]_SCL {
           type = "absent";
        };

        [email protected]_CAMERAS {
          type = "internal";
          number = <2>;
        };
        [email protected]_0_LED {
          type = "internal";
          number = <2>;
        };
        [email protected]_0_SHUTDOWN {
          type = "internal";
          number = <3>;
        };
        [email protected]_0_UNICAM_PORT {
          type = "internal";
          number = <1>;
        };
        [email protected]_0_I2C_PORT {
          type = "internal";
          number = <0>;
        };
        [email protected]_0_SDA_PIN {
          type = "internal";
          number = <0>;
        };
        [email protected]_0_SCL_PIN {
          type = "internal";
          number = <1>;
        };
        [email protected]_1_LED {
          type = "internal";
          number = <30>;
        };
        [email protected]_1_SHUTDOWN {
          type = "internal";
          number = <31>;
        };
        [email protected]_1_UNICAM_PORT {
          type = "internal";
          number = <0>;
        };
        [email protected]_1_I2C_PORT {
          type = "internal";
          number = <0>;
        };
        [email protected]_1_SDA_PIN {
          type = "internal";
          number = <28>;
        };
        [email protected]_1_SCL_PIN {
          type = "internal";
          number = <29>;
        };
      }; // pin_defines

    }; // pins_cm3

  };

};
This is the same file as found in the guide, and I don't see anything wrong with it.

Finally, here's my config.txt file

Code: Select all

start_x=1
gpu_mem=256
dtparam=audio=off
There's nothing in it related to i2c, which was apparently the cause of the issues in the thread. So I'm not sure what else I've missed....

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6895
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Cannot get two cameras to work with CM3 and Ubuntu MATE 16.04

Wed Jan 23, 2019 12:51 pm

9a3eedi wrote:
Wed Jan 23, 2019 11:59 am
Hi,

I have a compute module 3 running Ubuntu MATE 16.04. I have attempted to get dual cameras to work, but I have been completely unsuccessful and it's not very clear to me why. I have tried to follow all the steps in this guide, as well as follow the steps in this thread, but to no avail. I have the same problems as described in the thread, namely that CAM1 works, but CAM0 isnt being detected. Performing the fix of removing i2c from config.txt did not solve the issue.

Output for raspi-gpio get shows up as:
If I understand correctly, GPIOs 28 and 29 should show up as SDA1 and SCL1, but they don't...
Incorrect. They should show up as SDA0 and SCL0 (and GPIOs 0&1 revert to INPUT) when the GPU tries to talk to that sensor. The mapping will remain until it needs to talk to the other one.
9a3eedi wrote:I have created my dt-blob.bin file by compiling the following DTS file

This is the same file as found in the guide, and I don't see anything wrong with it.

Finally, here's my config.txt file

Code: Select all

start_x=1
gpu_mem=256
dtparam=audio=off
There's nothing in it related to i2c, which was apparently the cause of the issues in the thread. So I'm not sure what else I've missed....
All that looks fine, so I'd check wiring.
You can manually probe the sensors too, but please remember to remove these changes to config.txt once you're done.
- Add "dtparam=i2c_vc=on" to /boot/config.txt
- Set the GPIOs for CAM0 connector (CAM1 configuration).

Code: Select all

sudo raspi-gpio set 0 ip
sudo raspi-gpio set 1 ip
sudo raspi-gpio set 28 a0
sudo raspi-gpio set 29 a0
- Power up the sensor

Code: Select all

sudo raspi-gpio set 30 dh
sudo raspi-gpio set 31 dh
- Probe on I2C

Code: Select all

sudo i2cdetect -y 0
The sensor should respond (0x36 for V1, or 0x10 for V2).

Repeat for the other sensor
- Set the GPIOs to CAM1 connector (CAM0 configuration).

Code: Select all

sudo raspi-gpio set 0 a0
sudo raspi-gpio set 1 a0
sudo raspi-gpio set 28 ip
sudo raspi-gpio set 29 ip
- Power up the sensor

Code: Select all

sudo raspi-gpio set 2 dh
sudo raspi-gpio set 3 dh
- Probe on I2C

Code: Select all

sudo i2cdetect -y 0
- The sensor should respond.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

9a3eedi
Posts: 2
Joined: Wed Jan 23, 2019 7:29 am

Re: Cannot get two cameras to work with CM3 and Ubuntu MATE 16.04

Thu Jan 24, 2019 9:27 am

You were right, it was the connections between the GPIO pins. I replaced the wires and it now works!

I can't believe this was the problem the whole time!

Return to “Compute Module”