tanshihaj
Posts: 7
Joined: Mon Jan 14, 2019 11:23 am

Compute Module Camera connection [solved]

Thu Jan 24, 2019 9:57 am

I have an compute module 2 with camera connected to unical port 0, sda & scl connected to gpio0&1, led to gpio4 and shutdown to gpio41.

I've modified example dts file from https://www.raspberrypi.org/documentati ... -camera.md for my gpio configuration. Camera detects, but there is some issues with raspistill / raspivid. When I'm trying to take a picture, it goes till Starting capture -1 and hangs out:

Code: Select all

[email protected]:~ $ raspistill -cs 0 -o test.jpg -v

raspistill Camera App v1.3.11

Width 2592, Height 1944, quality 85, filename test.jpg
Time delay 5000, Raw no
Thumbnail enabled Yes, width 64, height 48, quality 35
Link to latest frame enabled  no
Full resolution preview No
Capture method : Single capture

Preview Yes, Full screen Yes
Preview window 0,0,1024,768
Opacity 255
Sharpness 0, Contrast 0, Brightness 50
Saturation 0, ISO 0, Video Stabilisation No, Exposure compensation 0
Exposure Mode 'auto', AWB Mode 'auto', Image Effect 'none'
Flicker Avoid Mode 'off'
Metering Mode 'average', Colour Effect Enabled No with U = 128, V = 128
Rotation 0, hflip No, vflip No
ROI x 0.000000, y 0.000000, w 1.000000 h 1.000000
Camera component done
Encoder component done
Starting component connection stage
Connecting camera preview port to video render.
Connecting camera stills port to encoder input port
Opening output file test.jpg
Enabling encoder output port
Starting capture -1
Led on camera after running program lights up. If I'm terminating raspistill light stays lighted up till poweroff/reboot. But sometimes it works good (1 time for 10 tries), I can get valid jpeg image.

Can somebody suggest how can I find where is the problem?

My dt-blob.dts:

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 = "pull_down";  }; // CAMERA 0 LED/CLK/IO1
        [email protected] { function = "output"; termination = "pull_down";  }; // CAMERA 0 SHUTDOWN/GPIO/IO0
        [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";    }; // 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 = <1>;
        };
        [email protected]_0_LED {
          type = "internal";
          number = <4>;
        };
        [email protected]_0_SHUTDOWN {
          type = "internal";
          number = <41>;
        };
        [email protected]_0_UNICAM_PORT {
          type = "internal";
          number = <0>;
        };
        [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>;
        };
      }; // pin_defines

    }; // pins_cm3

  };

};

Uncommented lines in /boot/config.txt:

Code: Select all

start_x=1
gpu_mem=128
enable_uart=1
Last edited by tanshihaj on Mon Jan 28, 2019 12:17 pm, edited 1 time in total.

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

Re: Compute Module Camera connection

Mon Jan 28, 2019 11:00 am

Confirm the camera module works on a standard Pi before trying to get it to work on the CM.

Your configuration looks fine. I suspect the sensor isn't reliably producing any data on the CSI bus, which could be due to a dodgy sensor, or bad cabling.

Your logging reports raspistill trying to capture at 2592x1944 (5MPix). Raspberry Pi haven't sold the 5MPix V1 sensor for several years, so I suspect your module is manufactured by some other company. Please eliminate that as the problem.
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.

tanshihaj
Posts: 7
Joined: Mon Jan 14, 2019 11:23 am

Re: Compute Module Camera connection

Mon Jan 28, 2019 12:16 pm

6by9 wrote:
Mon Jan 28, 2019 11:00 am
Confirm the camera module works on a standard Pi before trying to get it to work on the CM.

Your configuration looks fine. I suspect the sensor isn't reliably producing any data on the CSI bus, which could be due to a dodgy sensor, or bad cabling.

Your logging reports raspistill trying to capture at 2592x1944 (5MPix). Raspberry Pi haven't sold the 5MPix V1 sensor for several years, so I suspect your module is manufactured by some other company. Please eliminate that as the problem.
I've tested this camera module with raspberry pi 3 b board, and it works fine. Nevertheless, it seems problem with this particular camera. I've bought new one today and it works fine both with compute module and 3 b board. Closing thread.

Return to “Compute Module”