SAMA5D27-SOM1-EK1 + ISC Camera

Moderator: nferre

iabdalkader
Posts: 2
Joined: Sat Aug 18, 2018 5:34 pm

SAMA5D27-SOM1-EK1 + ISC Camera

Sat Aug 18, 2018 5:54 pm

Hi, I made a sensor breakout for the EK ISC Connector (J27) and enabled the relevant kernel options (following this guide: https://www.at91.com/linux4sam/bin/view ... M/UsingISC) and I added a dtsi for the sensor (based on at91-sama5d2_xplained_ov7740.dtsi).
The sensor seems to be detected at the right I2C address (0x5C), however when running v4l2-ctl --all (or v4l2grab) the image width and height are both set to 0. Can someone please explain what I'm missing or how to debug this further ? Thanks!

Code: Select all

# uname --all
Linux openmv 4.9.87-linux4sam_5.8 #1 Sat Aug 18 17:17:08 EET 2018 armv7l GNU/Linux

Code: Select all

#v4l2-ctl --all
Driver Info (not using libv4l2):
        Driver name   : atmel_isc
        Card type     : Atmel Image Sensor Controller
        Bus info      : platform:atmel_isc f0008000.isc
        Driver version: 4.9.87
        Capabilities  : 0x84200001
                Video Capture
                Streaming
                Extended Pix Format
                Device Capabilities
        Device Caps   : 0x04200001
                Video Capture
                Streaming
                Extended Pix Format
Priority: 2
Video input : 0 (Camera: ok)
Format Video Capture:
        Width/Height      : 0/0
        Pixel Format      : 'YU12'
        Field             : None
        Bytes per Line    : 0
        Size Image        : 0
        Colorspace        : Default
        Transfer Function : Default (maps to Rec. 709)
        YCbCr/HSV Encoding: Default (maps to ITU-R 601)
        Quantization      : Default (maps to Limited Range)
        Flags             : 

User Controls
        brightness 0x00980900 (int)    : min=-1024 max=1023 step=1 default=0 value=0 flags=slider
        contrast 0x00980901 (int)    : min=-2048 max=2047 step=1 default=256 value=256 flags=slider
        white_balance_automatic 0x0098090c (bool)   : default=1 value=1
        gamma 0x00980910 (int)    : min=0 max=2 step=1 default=2 value=2 flags=slider

Code: Select all

# v4l2grab -d /dev/video0 -o test.jpg
Image width set to 0 by device /dev/video0.
Image height set to 0 by device /dev/video0.
Unable to set frame interval.
VIDIOC_REQBUFS error 12, Cannot allocate memory
This is the dtsi file based on the at91-sama5d2_xplained_ov7740.dtsi example:

Code: Select all

/ {
	ahb {
		apb {
			isc: isc@f0008000 {
				pinctrl-names = "default";
				pinctrl-0 = <&pinctrl_isc_base &pinctrl_isc_data_8bit &pinctrl_isc_data_9_10 &pinctrl_isc_data_11_12>;
				status = "okay";

				port {
					isc_0: endpoint@0 {
						remote-endpoint = <&mt9v032_0>;
                        bus-width    = <10>;
                        hsync-active = <1>;
                        vsync-active = <1>;
                        pclk-sample  = <1>;
					};
				};
			};

			i2c1: i2c@fc028000 {
				mt9v032: camera@5c {
					compatible = "aptina,mt9v034";
					reg = <0x5C>;
					pinctrl-names = "default";
					pinctrl-0 = <&pinctrl_sensor_standby &pinctrl_sensor_reset>;
					clocks = <&isc>;
					clock-names = "isc-mck";
					assigned-clocks = <&isc>;
					assigned-clock-rates = <26000000>;
					resetb-gpios = <&pioA 102 GPIO_ACTIVE_LOW>;
					standby-gpios = <&pioA 103 GPIO_ACTIVE_HIGH>;

					port {
						mt9v032_0: endpoint {
							remote-endpoint = <&isc_0>;
						};
					};
				};
			};

			pinctrl@fc038000 {
				pinctrl_isc_base: isc_base {
					pinmux = <PIN_PC21__ISC_PCK>,
						 <PIN_PC22__ISC_VSYNC>,
						 <PIN_PC23__ISC_HSYNC>,
						 <PIN_PC24__ISC_MCK>;
					bias-disable;
				};

				pinctrl_isc_data_8bit: isc_data_8bit {
					pinmux = <PIN_PC20__ISC_D11>,
						 <PIN_PC19__ISC_D10>,
						 <PIN_PC18__ISC_D9>,
						 <PIN_PC17__ISC_D8>,
						 <PIN_PC16__ISC_D7>,
						 <PIN_PC15__ISC_D6>,
						 <PIN_PC14__ISC_D5>,
						 <PIN_PC13__ISC_D4>;
					bias-disable;
				};

				pinctrl_isc_data_9_10: isc_data_9_10 {
					pinmux = <PIN_PC12__ISC_D3>,
						 <PIN_PC11__ISC_D2>;
					bias-disable;
				};

				pinctrl_isc_data_11_12: isc_data_11_12 {
					pinmux = <PIN_PC10__ISC_D1>,
						 <PIN_PC9__ISC_D0>;
					bias-disable;
				};

				pinctrl_sensor_standby: sensor_standby {
					pinmux = <PIN_PD7__GPIO>;
					bias-disable;
				};

				pinctrl_sensor_reset: sensor_reset {
					pinmux = <PIN_PD6__GPIO>;
					bias-disable;
				};
			};
		};
	};
};
blue_z
Location: USA
Posts: 1786
Joined: Thu Apr 19, 2007 10:15 pm

Re: SAMA5D27-SOM1-EK1 + ISC Camera

Mon Aug 20, 2018 3:15 am

iabdalkader wrote:... the image width and height are both set to 0.
That seems to be an understatement, as you seem to have shown nothing that indicates positive communication with the sensor device.
Recheck all of your connections.
Review the system log for salient isc, i2c, and mt9v034 driver messages.
If necessary:
(a) Enable debug for the pinctrl subsystem (via menuconfig) to verify pin assignments.
(b) Insert printk()s to the probe() and register() routines of mt9v034.c to verify driver installation.

Regards
iabdalkader
Posts: 2
Joined: Sat Aug 18, 2018 5:34 pm

Re: SAMA5D27-SOM1-EK1 + ISC Camera

Mon Aug 20, 2018 3:37 pm

Hi,
blue_z wrote:
Mon Aug 20, 2018 3:15 am
That seems to be an understatement, as you seem to have shown nothing that indicates positive communication with the sensor device.
Here's the dmesg output, like I said the sensor is detect:

Code: Select all

mt9v032 1-005c: Probing MT9V032 at address 0x5c
random: fast init done
 mmcblk0: p1 p2
mt9v032 1-005c: MT9V024/MT9V034 rev1 detected at address 0x5c
I finally managed to get an image from the sensor after fixing the dts (see the notes) and initializing the try crop struct in this function mt9v032_set_format() to any fixed values. Note this function is called from atmel_isc.c with a different v4l2_subdev_pad_config than the one passed to (and initialized in) mt9v032_open() so the try crop->width and crop->height are both set to 0 which in turn sets format->width and format->height to 0. I added some printk's to mt9v032_set_format() and this is the output:

Code: Select all

MT9V032: set_format() fmt-which: TRY
MT9V032: set_format() format_in: width:0 height:0
MT9V032: set_format() crop: left:0 top:0 width:0 height:0
MT9V032: set_format() clamped width:0 clamped height:0 hratio:4 vratio:4
MT9V032: set_format() format_out width:0 height:0

MT9V032: set_format() fmt-which: ACTIVE
MT9V032: set_format() format_in: width:0 height:0
MT9V032: set_format() crop: left:1 top:5 width:752 height:480
MT9V032: set_format() clamped width:188 clamped height:120 hratio:4 vratio:4
MT9V032: set_format() format_out width:188 height:120
If I set the crop width/height it seems to work but I can't change the resolution, ex:

Code: Select all

   
     __crop = __mt9v032_get_pad_crop(mt9v032, cfg, format->pad,
					format->which);
    __crop->width = MT9V032_WINDOW_WIDTH_DEF;
    __crop->height = MT9V032_WINDOW_HEIGHT_DEF;

Please let me know if there's a way I can debug this further or if I should report a bug somewhere.

Notes:
* link_frequencies must be set in mt9v032 node.
* The clock polarities are vsync=1 hsync=1 pixclk=1/0
* Frequencies other than ~27MHz cause "device busy" errors when opening video0.

Return to “SAMA5-based”

Who is online

Users browsing this forum: No registered users and 1 guest