Skip to contentSkip to conversation

OMAP3 isp single-shot

DISCUSSION Daniel Lundborg 3 participants 10 messages Mar 23, 2011 – May 25, 2011 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

Hello,

I am successfully using the gumstix overo board together with a camera sensor Aptina MT9V034 with the kernel 2.6.35 and patches from
http://git.linuxtv.org/pinchartl/media.git (isp6).

I can use the media-ctl program and yavta to take pictures in continous streaming mode.

media-ctl -r -l '"mt9034 3-0048":0->"OMAP3 ISP CCDC":0[1], "OMAP3 ISP CCDC":1->"OMAP3 ISP CCDC output":0[1]'
media-ctl -f '"mt9v034 3-0048":0[SGRBG10 752x480], "OMAP3 ISP CCDC":1[SGRBG10 752x480]

and then:

yavta -f SGRBG10 -s 752x480 -n 1 --capture=1 -F /dev/video2

Is there a way to set the ISP in single shot mode?

I have tested setting the mt9v034 in snapshot mode and manually trigger the camera, but the ISP does not send a picture. Is there a way to solve this with the current OMAP3 isp code?

I have before successfully used the isp parts from the Nokia N900 project..

/Daniel

#1 lore raw
Quoted 1 line · Daniel Lundborg

Hello,

Hi Daniel,

(Cc'ing Laurent.)

Quoted 3 lines

I am successfully using the gumstix overo board together with a camera sensor Aptina MT9V034 with the kernel 2.6.35 and patches from
http://git.linuxtv.org/pinchartl/media.git (isp6).

Which branch did you use?

Quoted 8 lines

I can use the media-ctl program and yavta to take pictures in continous streaming mode.

media-ctl -r -l '"mt9034 3-0048":0->"OMAP3 ISP CCDC":0[1], "OMAP3 ISP CCDC":1->"OMAP3 ISP CCDC output":0[1]'
media-ctl -f '"mt9v034 3-0048":0[SGRBG10 752x480], "OMAP3 ISP CCDC":1[SGRBG10 752x480]

Quoted 6 lines

and then:

yavta -f SGRBG10 -s 752x480 -n 1 --capture=1 -F /dev/video2

Is there a way to set the ISP in single shot mode?

Single shot for the ISP is the same as to queue just one buffer. I assume the single shot mode is something that the sensor supports?

Quoted 3 lines

I have tested setting the mt9v034 in snapshot mode and manually trigger the camera, but the ISP does not send a picture. Is there a way to solve this with the current OMAP3 isp code?

Do you get any errors, or you just don't get any video buffers?

As the sensor works in streaming mode, are you sure it outputs the image of correct size in the single shot mode?

Quoted 1 line

I have before successfully used the isp parts from the Nokia N900 project..

This is nice to hear! :-)

Regards,

Signature · 2 lines
Sakari Ailus
[email protected]
#3 lore raw
In reply to Daniel Lundborg

Hi Daniel,

Quoted 11 lines · On Thursday 24 March 2011 11:26:01 Daniel Lundborg wrote:
Quoted 7 lines
Quoted 4 lines · Daniel Lundborg

I am successfully using the gumstix overo board together with a camera sensor Aptina MT9V034 with the kernel 2.6.35 and patches from
http://git.linuxtv.org/pinchartl/media.git (isp6).

Which branch did you use?

I am using the media-2.6.35-0006-sensors branch which could be found just a couple of weeks ago. It has the mt9v032 sensor in it. My mt9v034 driver is based on the mt9v032 code.

Now that the OMAP3 ISP driver is on its way to mainline, I've reorganized the repository. You can use the media-2.6.38-0002-sensors branch for 2.6.38.

Quoted 44 lines
Quoted 14 lines
Quoted 8 lines

I can use the media-ctl program and yavta to take pictures in continous streaming mode.

media-ctl -r -l '"mt9034 3-0048":0->"OMAP3 ISP CCDC":0[1], "OMAP3 ISP CCDC":1->"OMAP3 ISP CCDC output":0[1]'
media-ctl -f '"mt9v034 3-0048":0[SGRBG10 752x480], "OMAP3 ISP CCDC":1[SGRBG10 752x480]

Quoted 5 lines

and then:

yavta -f SGRBG10 -s 752x480 -n 1 --capture=1 -F /dev/video2

Is there a way to set the ISP in single shot mode?

Quoted 8 lines

Single shot for the ISP is the same as to queue just one buffer. I assume the single shot mode is something that the sensor supports?

Quoted 3 lines

I have tested setting the mt9v034 in snapshot mode and manually trigger the camera, but the ISP does not send a picture. Is there a way to solve this with the current OMAP3 isp code?

Do you get any errors, or you just don't get any video buffers?

This is the output from yavta when I put the sensor in streaming mode:

root@overo:~/yavta# ./yavta -f SGRBG10 -s 752x480 -n 1 --capture=1 -F
/dev/video2

Device /dev/video2 opened: OMAP3 ISP CCDC output (media). Video format set: width: 752 height: 480 buffer size: 721920 Video format: BA10 (30314142) 752x480
1 buffers requested.
length: 721920 offset: 0
Buffer 0 mapped at address 0x4014d000.
0 (0) [-] 0 721920 bytes 65877.098848 1300958239.111966 0.001 fps Captured 1 frames in 0.000062 seconds (16129.032258 fps, 11643870967.741936 B/s).
1 buffers released.

And the output when putting the sensor in snapshot mode:

root@overo:~/yavta# ./yavta -f SGRBG10 -s 752x480 -n 1 --capture=1 -F
/dev/video2
Quoted 8 lines

Device /dev/video2 opened: OMAP3 ISP CCDC output (media). Video format set: width: 752 height: 480 buffer size: 721920 Video format: BA10 (30314142) 752x480
1 buffers requested.
length: 721920 offset: 0
Buffer 0 mapped at address 0x4014d000.

And it freezes. I can stop yavta with CTRL+C.

Have you tried to trigger the sensor multiple times in a row ?

Quoted 74 lines

To put the sensor in snapshot/shutter mode I set the ext_trig = 1 in the platform_data structure in my board file.

struct mt9v034_platform_data {
	unsigned int clk_pol:1;
	unsigned int ext_trig:1;

	void (*set_clock)(struct v4l2_subdev *subdev, unsigned int rate);
};

And in the s_stream I set the chip_control register for the MT9V034 sensor to:

static int mt9v034_s_stream(struct v4l2_subdev *subdev, int enable) {
struct mt9v034 *mt9v034 = to_mt9v034(subdev);
const u16 chip_clear = mt9v034->pdata->ext_trig? 0x0100 : 0; const u16 chip_set = mt9v034->pdata->ext_trig? 0x18 :
MT9V034_CHIP_CONTROL_MASTER_MODE | MT9V034_CHIP_CONTROL_DOUT_ENABLE | MT9V034_CHIP_CONTROL_SEQUENTIAL;
struct i2c_client *client = v4l2_get_subdevdata(subdev); struct v4l2_mbus_framefmt *format = &mt9v034->format; struct v4l2_rect *crop = &mt9v034->crop;
unsigned int hratio;
unsigned int vratio;
int ret;

  if (!enable) {
    ret = mt9v034_set_chip_control(mt9v034, chip_clear, chip_set);
    if (ret < 0)
      return ret;
    return __mt9v034_set_power(mt9v034, 0);

}

  ret = __mt9v034_set_power(mt9v034, 1);
  if (ret < 0)
    return ret;

  /* Configure the window size and row/column bin */
  hratio = DIV_ROUND_CLOSEST(crop->width, format->width);
  vratio = DIV_ROUND_CLOSEST(crop->height, format->height);

ret = mt9v034_write(client, MT9V034_READ_MODE,

        (hratio - 1) << MT9V034_READ_MODE_ROW_BIN_SHIFT |
        (vratio - 1) << MT9V034_READ_MODE_COLUMN_BIN_SHIFT);
  if (ret < 0)
    return ret;
  ret = mt9v034_write(client, MT9V034_COLUMN_START, crop->left);
  if (ret < 0)
    return ret;

  ret = mt9v034_write(client, MT9V034_ROW_START, crop->top);
  if (ret < 0)
    return ret;

  ret = mt9v034_write(client, MT9V034_WINDOW_WIDTH, crop->width);
  if (ret < 0)
    return ret;

  ret = mt9v034_write(client, MT9V034_WINDOW_HEIGHT, crop->height);
  if (ret < 0)
    return ret;

/* Disable the noise correction algorithm and restore the controls. */ ret = mt9v034_write(client, MT9V034_ROW_NOISE_CORR_CONTROL, 0); if (ret < 0)

    return ret;
  v4l2_ctrl_handler_setup(&mt9v034->ctrls);

  ret = mt9v034_set_chip_control(mt9v034, chip_clear, chip_set);
Quoted 5 lines

return ret;
}

I can see on the oscilloscope that the sensor is sending something when I trigger it, but no picture is received..

"something" is a bit vague, can you check the hsync/vsync signals and make sure they're identical in both modes ?

Quoted 4 lines
Quoted 2 lines

As the sensor works in streaming mode, are you sure it outputs the image of correct size in the single shot mode?

The sensor has the same output in streaming and single shot mode.

Signature · 3 lines
Regards,

Laurent Pinchart
#2 lore raw
In reply to Sakari Ailus

Hello Sakari,

Quoted 8 lines
Quoted 1 line · Daniel Lundborg

Hello,

Hi Daniel,

(Cc'ing Laurent.)

Quoted 1 line

I am successfully using the gumstix overo board together with a

camera sensor

Quoted 4 lines
Quoted 2 lines

Aptina MT9V034 with the kernel 2.6.35 and patches from
http://git.linuxtv.org/pinchartl/media.git (isp6).

Which branch did you use?

I am using the media-2.6.35-0006-sensors branch which could be found just a couple of weeks ago. It has the mt9v032 sensor in it. My mt9v034 driver is based on the mt9v032 code.

Quoted 2 lines
Quoted 2 lines

I can use the media-ctl program and yavta to take pictures in

continous

Quoted 3 lines
Quoted 3 lines

streaming mode.

media-ctl -r -l '"mt9034 3-0048":0->"OMAP3 ISP CCDC":0[1], "OMAP3

ISP

Quoted 2 lines
Quoted 2 lines

CCDC":1->"OMAP3 ISP CCDC output":0[1]'
media-ctl -f '"mt9v034 3-0048":0[SGRBG10 752x480], "OMAP3 ISP

CCDC":1[SGRBG10

Quoted 4 lines
Quoted 4 lines

752x480]

and then:

Quoted 9 lines
Quoted 4 lines

yavta -f SGRBG10 -s 752x480 -n 1 --capture=1 -F /dev/video2

Is there a way to set the ISP in single shot mode?

Single shot for the ISP is the same as to queue just one buffer. I assume the single shot mode is something that the sensor supports?

Quoted 1 line

I have tested setting the mt9v034 in snapshot mode and manually

trigger the

Quoted 1 line
Quoted 1 line

camera, but the ISP does not send a picture. Is there a way to solve

this with

Quoted 3 lines
Quoted 1 line

the current OMAP3 isp code?

Do you get any errors, or you just don't get any video buffers?

This is the output from yavta when I put the sensor in streaming mode:

root@overo:~/yavta# ./yavta -f SGRBG10 -s 752x480 -n 1 --capture=1 -F
/dev/video2

Device /dev/video2 opened: OMAP3 ISP CCDC output (media). Video format set: width: 752 height: 480 buffer size: 721920 Video format: BA10 (30314142) 752x480
1 buffers requested.
length: 721920 offset: 0
Buffer 0 mapped at address 0x4014d000.
0 (0) [-] 0 721920 bytes 65877.098848 1300958239.111966 0.001 fps Captured 1 frames in 0.000062 seconds (16129.032258 fps, 11643870967.741936 B/s).
1 buffers released.

And the output when putting the sensor in snapshot mode:

root@overo:~/yavta# ./yavta -f SGRBG10 -s 752x480 -n 1 --capture=1 -F
/dev/video2

Device /dev/video2 opened: OMAP3 ISP CCDC output (media). Video format set: width: 752 height: 480 buffer size: 721920 Video format: BA10 (30314142) 752x480
1 buffers requested.
length: 721920 offset: 0
Buffer 0 mapped at address 0x4014d000.

And it freezes. I can stop yavta with CTRL+C.

To put the sensor in snapshot/shutter mode I set the ext_trig = 1 in the platform_data structure in my board file.

struct mt9v034_platform_data {
	unsigned int clk_pol:1;
	unsigned int ext_trig:1;

	void (*set_clock)(struct v4l2_subdev *subdev, unsigned int

rate);
};

And in the s_stream I set the chip_control register for the MT9V034 sensor to:

static int mt9v034_s_stream(struct v4l2_subdev *subdev, int enable) {
struct mt9v034 *mt9v034 = to_mt9v034(subdev);
const u16 chip_clear = mt9v034->pdata->ext_trig? 0x0100 : 0; const u16 chip_set = mt9v034->pdata->ext_trig? 0x18 :
MT9V034_CHIP_CONTROL_MASTER_MODE | MT9V034_CHIP_CONTROL_DOUT_ENABLE | MT9V034_CHIP_CONTROL_SEQUENTIAL;
struct i2c_client *client = v4l2_get_subdevdata(subdev); struct v4l2_mbus_framefmt *format = &mt9v034->format; struct v4l2_rect *crop = &mt9v034->crop;
unsigned int hratio;
unsigned int vratio;
int ret;

  if (!enable) {
    ret = mt9v034_set_chip_control(mt9v034, chip_clear, chip_set);
    if (ret < 0)
      return ret;
    return __mt9v034_set_power(mt9v034, 0);

}

  ret = __mt9v034_set_power(mt9v034, 1);
  if (ret < 0)
    return ret;

  /* Configure the window size and row/column bin */
  hratio = DIV_ROUND_CLOSEST(crop->width, format->width);
  vratio = DIV_ROUND_CLOSEST(crop->height, format->height);

ret = mt9v034_write(client, MT9V034_READ_MODE,

        (hratio - 1) << MT9V034_READ_MODE_ROW_BIN_SHIFT |
        (vratio - 1) << MT9V034_READ_MODE_COLUMN_BIN_SHIFT);
  if (ret < 0)
    return ret;
  ret = mt9v034_write(client, MT9V034_COLUMN_START, crop->left);
  if (ret < 0)
    return ret;

  ret = mt9v034_write(client, MT9V034_ROW_START, crop->top);
  if (ret < 0)
    return ret;

  ret = mt9v034_write(client, MT9V034_WINDOW_WIDTH, crop->width);
  if (ret < 0)
    return ret;

  ret = mt9v034_write(client, MT9V034_WINDOW_HEIGHT, crop->height);
  if (ret < 0)
    return ret;

/* Disable the noise correction algorithm and restore the controls. */ ret = mt9v034_write(client, MT9V034_ROW_NOISE_CORR_CONTROL, 0); if (ret < 0)

    return ret;
  v4l2_ctrl_handler_setup(&mt9v034->ctrls);
  
  ret = mt9v034_set_chip_control(mt9v034, chip_clear, chip_set);

return ret;
}

I can see on the oscilloscope that the sensor is sending something when I trigger it, but no picture is received..

Quoted 1 line

As the sensor works in streaming mode, are you sure it outputs the

image

Quoted 1 line

of correct size in the single shot mode?

The sensor has the same output in streaming and single shot mode.

Quoted 2 lines
Quoted 2 lines

I have before successfully used the isp parts from the Nokia N900

project..

Quoted 8 lines

This is nice to hear! :-)

Regards,

Signature · 2 lines
Sakari Ailus
[email protected]

Thanks,

Daniel Lundborg
[email protected]

#4 lore raw
In reply to Laurent Pinchart

Hi Laurent,

Quoted 9 lines

Hi Daniel,

Quoted 6 lines · On Thursday 24 March 2011 11:26:01 Daniel Lundborg wrote:
Quoted 6 lines
Quoted 4 lines · Daniel Lundborg

I am successfully using the gumstix overo board together with a camera sensor Aptina MT9V034 with the kernel 2.6.35 and patches from http://git.linuxtv.org/pinchartl/media.git (isp6).

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

Which branch did you use?

I am using the media-2.6.35-0006-sensors branch which could be found

just a couple of weeks ago. It has the mt9v032 sensor in it. My mt9v034 driver is based on the mt9v032 code.

Now that the OMAP3 ISP driver is on its way to mainline, I've

reorganized the repository. You can use the media-2.6.38-0002-sensors branch for 2.6.38.

Ok. I will test that one.

Quoted 3 lines

---

Quoted 2 lines

This is the output from yavta when I put the sensor in streaming

mode:

Quoted 2 lines
Quoted 2 lines
root@overo:~/yavta# ./yavta -f SGRBG10 -s 752x480 -n 1 --capture=1

-F

Quoted 13 lines
Quoted 13 lines

/dev/video2

Device /dev/video2 opened: OMAP3 ISP CCDC output (media). Video format set: width: 752 height: 480 buffer size: 721920 Video
format: BA10 (30314142) 752x480
1 buffers requested.
length: 721920 offset: 0
Buffer 0 mapped at address 0x4014d000.
0 (0) [-] 0 721920 bytes 65877.098848 1300958239.111966 0.001 fps Captured 1 frames in 0.000062 seconds (16129.032258 fps, 11643870967.741936 B/s).
1 buffers released.

Quoted 3 lines
Quoted 3 lines

And the output when putting the sensor in snapshot mode:

root@overo:~/yavta# ./yavta -f SGRBG10 -s 752x480 -n 1 --capture=1

-F

Quoted 9 lines
Quoted 9 lines

/dev/video2

Device /dev/video2 opened: OMAP3 ISP CCDC output (media). Video format set: width: 752 height: 480 buffer size: 721920 Video
format: BA10 (30314142) 752x480
1 buffers requested.
length: 721920 offset: 0
Buffer 0 mapped at address 0x4014d000.

Quoted 3 lines
Quoted 1 line

And it freezes. I can stop yavta with CTRL+C.

Have you tried to trigger the sensor multiple times in a row ?

No. I will test that.

Quoted 6 lines
Quoted 4 lines

I can see on the oscilloscope that the sensor is sending something when I trigger it, but no picture is received..

"something" is a bit vague, can you check the hsync/vsync signals and

make sure they're identical in both modes ?

Ok. Yes this needs more oscilloscope testing.

Quoted 11 lines
Quoted 6 lines
Quoted 4 lines

As the sensor works in streaming mode, are you sure it outputs the

image of correct size in the single shot mode?

The sensor has the same output in streaming and single shot mode.

--
Regards,

Laurent Pinchart

Thanks,

Daniel Lundborg
[email protected]

#5 lore raw
Quoted 1 line · Daniel Lundborg

Hi Laurent,

Hi all,

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

Device /dev/video2 opened: OMAP3 ISP CCDC output (media). Video format set: width: 752 height: 480 buffer size: 721920 Video
format: BA10 (30314142) 752x480
1 buffers requested.
length: 721920 offset: 0
Buffer 0 mapped at address 0x4014d000.

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

And it freezes. I can stop yavta with CTRL+C.

Have you tried to trigger the sensor multiple times in a row ?

No. I will test that.

Besides the two things what were proposed, it'd be good to check which interrupts does the ISP produce.

Signature · 2 lines
Sakari Ailus
[email protected]
#6 lore raw
In reply to Laurent Pinchart

Hi Laurent,

Quoted 6 lines

Hi Daniel,

Quoted 3 lines · On Thursday 24 March 2011 11:26:01 Daniel Lundborg wrote:
Quoted 3 lines
Quoted 2 lines · Daniel Lundborg

I am successfully using the gumstix overo board together with a

camera

Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

sensor Aptina MT9V034 with the kernel 2.6.35 and patches from
http://git.linuxtv.org/pinchartl/media.git (isp6).

Which branch did you use?

I am using the media-2.6.35-0006-sensors branch which could be found just a couple of weeks ago. It has the mt9v032 sensor in it. My

mt9v034

Quoted 3 lines
Quoted 1 line

driver is based on the mt9v032 code.

Now that the OMAP3 ISP driver is on its way to mainline, I've

reorganized the

Quoted 1 line

repository. You can use the media-2.6.38-0002-sensors branch for

2.6.38.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

I can use the media-ctl program and yavta to take pictures in

continous

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

streaming mode.

media-ctl -r -l '"mt9034 3-0048":0->"OMAP3 ISP CCDC":0[1],

"OMAP3 ISP

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 9 lines

CCDC":1->"OMAP3 ISP CCDC output":0[1]'
media-ctl -f '"mt9v034 3-0048":0[SGRBG10 752x480], "OMAP3 ISP CCDC":1[SGRBG10 752x480]

and then:

yavta -f SGRBG10 -s 752x480 -n 1 --capture=1 -F /dev/video2

Is there a way to set the ISP in single shot mode?

Single shot for the ISP is the same as to queue just one buffer. I

assume

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

the single shot mode is something that the sensor supports?

Quoted 1 line

I have tested setting the mt9v034 in snapshot mode and manually

trigger

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

the camera, but the ISP does not send a picture. Is there a way

to solve

Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

this with the current OMAP3 isp code?

Do you get any errors, or you just don't get any video buffers?

This is the output from yavta when I put the sensor in streaming

mode:

Quoted 2 lines
Quoted 2 lines
root@overo:~/yavta# ./yavta -f SGRBG10 -s 752x480 -n 1 --capture=1

-F

Quoted 13 lines
Quoted 13 lines

/dev/video2

Device /dev/video2 opened: OMAP3 ISP CCDC output (media). Video format set: width: 752 height: 480 buffer size: 721920 Video format: BA10 (30314142) 752x480
1 buffers requested.
length: 721920 offset: 0
Buffer 0 mapped at address 0x4014d000.
0 (0) [-] 0 721920 bytes 65877.098848 1300958239.111966 0.001 fps Captured 1 frames in 0.000062 seconds (16129.032258 fps, 11643870967.741936 B/s).
1 buffers released.

Quoted 3 lines
Quoted 3 lines

And the output when putting the sensor in snapshot mode:

root@overo:~/yavta# ./yavta -f SGRBG10 -s 752x480 -n 1 --capture=1

-F

Quoted 9 lines
Quoted 9 lines

/dev/video2

Device /dev/video2 opened: OMAP3 ISP CCDC output (media). Video format set: width: 752 height: 480 buffer size: 721920 Video format: BA10 (30314142) 752x480
1 buffers requested.
length: 721920 offset: 0
Buffer 0 mapped at address 0x4014d000.

Quoted 5 lines
Quoted 1 line

And it freezes. I can stop yavta with CTRL+C.

Have you tried to trigger the sensor multiple times in a row ?

Quoted 1 line

To put the sensor in snapshot/shutter mode I set the ext_trig = 1 in

the

Quoted 7 lines
Quoted 7 lines

platform_data structure in my board file.

struct mt9v034_platform_data {
	unsigned int clk_pol:1;
	unsigned int ext_trig:1;

	void (*set_clock)(struct v4l2_subdev *subdev, unsigned int

rate);

Quoted 11 lines
Quoted 11 lines

};

And in the s_stream I set the chip_control register for the MT9V034 sensor to:

static int mt9v034_s_stream(struct v4l2_subdev *subdev, int enable) {
struct mt9v034 *mt9v034 = to_mt9v034(subdev);
const u16 chip_clear = mt9v034->pdata->ext_trig? 0x0100 : 0; const u16 chip_set = mt9v034->pdata->ext_trig? 0x18 :
MT9V034_CHIP_CONTROL_MASTER_MODE | MT9V034_CHIP_CONTROL_DOUT_ENABLE

|

Quoted 42 lines
Quoted 42 lines

MT9V034_CHIP_CONTROL_SEQUENTIAL;
struct i2c_client *client = v4l2_get_subdevdata(subdev); struct v4l2_mbus_framefmt *format = &mt9v034->format; struct v4l2_rect *crop = &mt9v034->crop; unsigned int hratio;
unsigned int vratio;
int ret;

  if (!enable) {
    ret = mt9v034_set_chip_control(mt9v034, chip_clear, chip_set);
    if (ret < 0)
      return ret;
    return __mt9v034_set_power(mt9v034, 0);

}

  ret = __mt9v034_set_power(mt9v034, 1);
  if (ret < 0)
    return ret;

  /* Configure the window size and row/column bin */
  hratio = DIV_ROUND_CLOSEST(crop->width, format->width);
  vratio = DIV_ROUND_CLOSEST(crop->height, format->height);

ret = mt9v034_write(client, MT9V034_READ_MODE,

        (hratio - 1) << MT9V034_READ_MODE_ROW_BIN_SHIFT |
        (vratio - 1) << MT9V034_READ_MODE_COLUMN_BIN_SHIFT);
  if (ret < 0)
    return ret;
  ret = mt9v034_write(client, MT9V034_COLUMN_START, crop->left);
  if (ret < 0)
    return ret;

  ret = mt9v034_write(client, MT9V034_ROW_START, crop->top);
  if (ret < 0)
    return ret;

  ret = mt9v034_write(client, MT9V034_WINDOW_WIDTH, crop->width);
  if (ret < 0)
    return ret;
Quoted 5 lines
Quoted 5 lines
  ret = mt9v034_write(client, MT9V034_WINDOW_HEIGHT, crop->height);
  if (ret < 0)
    return ret;

/* Disable the noise correction algorithm and restore the

controls. */

Quoted 4 lines
Quoted 4 lines
  ret  = mt9v034_write(client, MT9V034_ROW_NOISE_CORR_CONTROL, 0);
  if (ret < 0)
    return ret;
Quoted 8 lines
Quoted 8 lines
  v4l2_ctrl_handler_setup(&mt9v034->ctrls);

  ret = mt9v034_set_chip_control(mt9v034, chip_clear, chip_set);

return ret;
}

I can see on the oscilloscope that the sensor is sending something

when

Quoted 3 lines
Quoted 1 line

I trigger it, but no picture is received..

"something" is a bit vague, can you check the hsync/vsync signals and

make

Quoted 1 line

sure they're identical in both modes ?

I have now tested this and I can say that I am having problems triggering the sensor. I wrongly thought I was triggering the sensor with my other driver correctly, but that was not the case.

What I want is to put the Omap ISP to generate a signal (CAM_WEN) to make the camera sensor take a picture.

In my working mt9v034 driver which is using kernel 2.6.31-rc7 with the patches from <http://gitorious.org/omap3camera/mainline/commits/slave> I set the ISP to this on power on:

isp_reg_and_or(vdev->cam->isp, OMAP3_ISP_IOMEM_MAIN, ISP_TCTRL_CTRL,
0x9a1b63ff, 0x98036000); // Set CAM_GLOBAL_RESET pin as output, enable shutter, set DIVC = 216
isp_reg_and(vdev->cam->isp, OMAP3_ISP_IOMEM_MAIN,
ISP_TCTRL_SHUT_DELAY, 0xfe000000); // Set no shutter delay
isp_reg_and_or(vdev->cam->isp, OMAP3_ISP_IOMEM_MAIN,
ISP_TCTRL_SHUT_LENGTH, 0xfe000000, 0x000003e8); // Set shutter signal length to 1000 (=> 1000 * 1/216MHz * 216 = 1 ms)
isp_reg_and_or(vdev->cam->isp, OMAP3_ISP_IOMEM_MAIN,
ISP_TCTRL_GRESET_LENGTH, 0xfe000000, 0x000003e8); // Set shutter signal length to 1000 (=> 1000 * 1/216MHz * 216 = 1 ms)
isp_reg_and(isp_ccdc_dev, OMAP3_ISP_IOMEM_CCDC, ISPCCDC_LSC_CONFIG,
~ISPCCDC_LSC_ENABLE); // Make sure you disable LSC

And when I want to take a picture I do:

isp_reg_or(vdev->cam->isp, OMAP3_ISP_IOMEM_MAIN, ISP_TCTRL_CTRL,
0x00e00000); // Enable shutter (SHUTEN bit = 1)
isp_reg_or(vdev->cam->isp, OMAP3_ISP_IOMEM_MAIN, ISP_TCTRL_CTRL,
0x20000000); // Start generation of CAM_GLOBAL_RESET signal (GRESETEN bit = 1)

When I try to do this in the newer driver I manage to generate a pulse on the CAM_WEN pin, but no VSYNC, HSYNC or data is transmitted.

Am I missing something?

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

As the sensor works in streaming mode, are you sure it outputs the

image

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

of correct size in the single shot mode?

The sensor has the same output in streaming and single shot mode.

Regards,

Daniel Lundborg

#7 lore raw

Hi Daniel,

Quoted 1 line · On Friday 25 March 2011 14:10:28 Daniel Lundborg wrote:
Quoted 1 line · On Thursday 24 March 2011 11:26:01 Daniel Lundborg wrote:

[snip]

Quoted 6 lines
Quoted 5 lines
Quoted 2 lines

I can see on the oscilloscope that the sensor is sending something when I trigger it, but no picture is received..

"something" is a bit vague, can you check the hsync/vsync signals and make sure they're identical in both modes ?

Quoted 6 lines

I have now tested this and I can say that I am having problems triggering the sensor. I wrongly thought I was triggering the sensor with my other driver correctly, but that was not the case.

What I want is to put the Omap ISP to generate a signal (CAM_WEN) to make the camera sensor take a picture.

That's not possible. The cam_wen signal is an input to the ISP. The ISP Timing Control module can generate pulses on the cam_shutter, cam_strobe and cam_global_reset signals only.

What you could do is configure the cam_wen pin as a GPIO and control it using the GPIO framework (either in kernelspace or userspace).

Quoted 7 lines

In my working mt9v034 driver which is using kernel 2.6.31-rc7 with the patches from <http://gitorious.org/omap3camera/mainline/commits/slave> I set the ISP to this on power on:

isp_reg_and_or(vdev->cam->isp, OMAP3_ISP_IOMEM_MAIN, ISP_TCTRL_CTRL,
0x9a1b63ff, 0x98036000); // Set CAM_GLOBAL_RESET pin as output, enable shutter, set DIVC = 216

What ISP driver version are you using ? isp_reg_and_or has been replaced by isp_reg_clr_set a very long time ago. You should really upgrade.

Quoted 13 lines

isp_reg_and(vdev->cam->isp, OMAP3_ISP_IOMEM_MAIN,
ISP_TCTRL_SHUT_DELAY, 0xfe000000); // Set no shutter delay
isp_reg_and_or(vdev->cam->isp, OMAP3_ISP_IOMEM_MAIN,
ISP_TCTRL_SHUT_LENGTH, 0xfe000000, 0x000003e8); // Set shutter signal length to 1000 (=> 1000 * 1/216MHz * 216 = 1 ms)
isp_reg_and_or(vdev->cam->isp, OMAP3_ISP_IOMEM_MAIN,
ISP_TCTRL_GRESET_LENGTH, 0xfe000000, 0x000003e8); // Set shutter signal length to 1000 (=> 1000 * 1/216MHz * 216 = 1 ms)
isp_reg_and(isp_ccdc_dev, OMAP3_ISP_IOMEM_CCDC, ISPCCDC_LSC_CONFIG,
~ISPCCDC_LSC_ENABLE); // Make sure you disable LSC

And when I want to take a picture I do:

Quoted 8 lines

isp_reg_or(vdev->cam->isp, OMAP3_ISP_IOMEM_MAIN, ISP_TCTRL_CTRL,
0x00e00000); // Enable shutter (SHUTEN bit = 1)
isp_reg_or(vdev->cam->isp, OMAP3_ISP_IOMEM_MAIN, ISP_TCTRL_CTRL,
0x20000000); // Start generation of CAM_GLOBAL_RESET signal (GRESETEN bit = 1)

When I try to do this in the newer driver I manage to generate a pulse on the CAM_WEN pin, but no VSYNC, HSYNC or data is transmitted.

I fail to see how that code can generate a pulse on the cam_wen signal. It should only control the cam_shutter, cam_strobe and cam_global_shutter pins.

Quoted 1 line

Am I missing something?

Is your sensor correctly configured ? Is there a publicly available datasheet for the MT9V034 ?

Signature · 3 lines
Regards,

Laurent Pinchart
#8 lore raw

Hi Laurent,

Quoted 6 lines · On Friday 25 March 2011 14:10:28 Daniel Lundborg wrote:
Quoted 1 line
Quoted 1 line · On Thursday 24 March 2011 11:26:01 Daniel Lundborg wrote:

[snip]

Quoted 1 line
Quoted 1 line
Quoted 1 line

I can see on the oscilloscope that the sensor is sending

something

Quoted 8 lines
Quoted 7 lines
Quoted 4 lines
Quoted 1 line

when I trigger it, but no picture is received..

"something" is a bit vague, can you check the hsync/vsync signals and make sure they're identical in both modes ?

I have now tested this and I can say that I am having problems triggering the sensor. I wrongly thought I was triggering the sensor

Quoted 7 lines
Quoted 5 lines

with my other driver correctly, but that was not the case.

What I want is to put the Omap ISP to generate a signal (CAM_WEN) to

make the camera sensor take a picture.

That's not possible. The cam_wen signal is an input to the ISP. The

ISP Timing Control module can generate pulses on the cam_shutter, cam_strobe and cam_global_reset signals only.

I meant the CAM_WEN pin that should be set as CAM_SHUTTER.. :)

Quoted 2 lines

What you could do is configure the cam_wen pin as a GPIO and control

it using the GPIO framework (either in kernelspace or userspace).

Quoted 2 lines
Quoted 2 lines

In my working mt9v034 driver which is using kernel 2.6.31-rc7 with

the

Quoted 1 line
Quoted 1 line

patches from

<http://gitorious.org/omap3camera/mainline/commits/slave>

Quoted 3 lines
Quoted 3 lines

I set the ISP to this on power on:

isp_reg_and_or(vdev->cam->isp, OMAP3_ISP_IOMEM_MAIN,

ISP_TCTRL_CTRL,

Quoted 4 lines
Quoted 2 lines

0x9a1b63ff, 0x98036000); // Set CAM_GLOBAL_RESET pin as output, enable shutter, set DIVC = 216

What ISP driver version are you using ? isp_reg_and_or has been

replaced by isp_reg_clr_set a very long time ago. You should really upgrade.

That's what I was trying to do :)

Quoted 5 lines
Quoted 5 lines

isp_reg_and(vdev->cam->isp, OMAP3_ISP_IOMEM_MAIN,
ISP_TCTRL_SHUT_DELAY, 0xfe000000); // Set no shutter delay
isp_reg_and_or(vdev->cam->isp, OMAP3_ISP_IOMEM_MAIN,
ISP_TCTRL_SHUT_LENGTH, 0xfe000000, 0x000003e8); // Set shutter

signal

Quoted 5 lines
Quoted 5 lines

length to 1000 (=> 1000 * 1/216MHz * 216 = 1 ms)
isp_reg_and_or(vdev->cam->isp, OMAP3_ISP_IOMEM_MAIN,
ISP_TCTRL_GRESET_LENGTH, 0xfe000000, 0x000003e8); // Set shutter signal length to 1000 (=> 1000 * 1/216MHz * 216 = 1 ms)
isp_reg_and(isp_ccdc_dev, OMAP3_ISP_IOMEM_CCDC,

ISPCCDC_LSC_CONFIG,

Quoted 8 lines
Quoted 8 lines

~ISPCCDC_LSC_ENABLE); // Make sure you disable LSC

And when I want to take a picture I do:

isp_reg_or(vdev->cam->isp, OMAP3_ISP_IOMEM_MAIN, ISP_TCTRL_CTRL,
0x00e00000); // Enable shutter (SHUTEN bit = 1)
isp_reg_or(vdev->cam->isp, OMAP3_ISP_IOMEM_MAIN, ISP_TCTRL_CTRL,
0x20000000); // Start generation of CAM_GLOBAL_RESET signal

(GRESETEN

Quoted 3 lines
Quoted 3 lines

bit = 1)

When I try to do this in the newer driver I manage to generate a

pulse

Quoted 3 lines
Quoted 1 line

on the CAM_WEN pin, but no VSYNC, HSYNC or data is transmitted.

I fail to see how that code can generate a pulse on the cam_wen

signal. It should only control the cam_shutter, cam_strobe and cam_global_shutter pins.

Quoted 4 lines
Quoted 2 lines

Am I missing something?

Is your sensor correctly configured ? Is there a publicly available

datasheet for the MT9V034 ?

I found where I was misconfiguring the sensor. I missed setting a bit in the CHIP_CONTROL register. So now my driver is running. :)

This is how I set the sensor in shutter mode now:

  // Set chip to shutter mode  
  temp = mt9v034_read(client, MT9V034_CHIP_CONTROL);
  temp = 0x0198 | (temp & 0xfeff);
  ret = mt9v034_write(client, MT9V034_CHIP_CONTROL, temp);

Thank you,

/Daniel

#9 lore raw

omap3isp - H3A auto white balance

In reply to Daniel Lundborg

Hello,

I am developing a camera sensor driver for the Aptina MT9V034. I am only using it in snapshot mode and I can successfully trigger the sensor and receive pictures using the latest omap3isp driver from
git://linuxtv.org/pinchartl/media.git branch omap3isp-next-sensors with kernel 2.6.38.

I configure the sensor with media-ctl:

media-ctl -r -l '"mt9v034 3-0048":0->"OMAP3 ISP CCDC":0[1], "OMAP3 ISP CCDC":1->"OMAP3 ISP CCDC output":0[1]'
media-ctl -f '"mt9v034 3-0048":0[SGRBG10 752x480], "OMAP3 ISP CCDC":1[SGRBG10 752x480]'

And take pictures with yavta:

./yavta -f SGRBG10 -s 752x480 -n 6 --capture=6 -F /dev/video2

My trouble is that I am always receiving whiter pictures when I wait a moment before triggering the sensor to take a picture. If I take several pictures in a row with for instance 20 ms between them, they all look ok. But if I wait for 100 ms the picture will get much whiter.

I have turned off auto exposure and auto gain in the sensor and the LED_OUT signal always have the same length (in this case 8 msec).

Why would the pictures become whiter if I wait a moment before taking a picture?

If I set the sensor in streaming mode all pictures look like they should.

Could there be something with the H3A auto white balance or auto exposure?

Regards,

Daniel Lundborg