Image sensor driver for MT9T001

Go To Last Post
3 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am in the process of creating an AVR32 Linux module for the MT9T001 camera. The MT9T001 is offered by Micron, and it is one of the very few cameras that does not require a Non-Disclosure Agreement before the datasheet can be obtained:

http://download.micron.com/pdf/d...

I am running into a few challenges that prevent me from getting this module up and running. I have already written code to start camera over I2C, and I am able to successfully load the kernel module from userspace (i.e. the I2C bus is reserved). To get started, I am trying to adapt the example posted here for the ISI:

http://www.avr32linux.org/twiki/...

(1) I am using the MT9T001 headboard for prototyping. The headboard is essentially a PCB with the image sensor already soldered down, and it also incorporates a lens assembly, linear regulators (5.0->3.3V), and a clock running at 48 MHz. Thus, the AP7001 on my custom board does not have to produce an input clock for the sensor. I can set the clock divisor by I2C communications with my sensor.

Does this still mean that I need to set up the clock for the image sensor in the code? (i.e. "gclk0")

(2) In the module code file for my driver (mt9t001.c),

static int mt9t001_get_format(struct atmel_isi_camera *cam,
			   struct atmel_isi_format *fmt)
{
	struct mt9t001 *is = to_mt9t001(cam);
	int ret = 0;

	fmt->pix.colorspace = V4L2_COLORSPACE_SMPTE170M;
	fmt->input_format = ATMEL_ISI_PIXFMT_RGB16;

The colorspace and image format is being set. The MT9T001 image sensor is of Bayer format, and the output is in sequential RGB, which should mean that the data shifted out on the 10-bit parallel port should follow the pattern:

GRGRGR...
BGBGBG...
GRGRGR...
BGBGBG...

and so on. Is this in V4L2_COLORSPACE_SMPTE170M and ATMEL_ISI_PIXFMT_RGB16 format? Do I need to change the colorspace and format? What else would I have to change?

In my userspace program to open the image sensor, I am trying to open the Video 4 Linux driver with the pixelformat:

#define MT9T001_FMT v4l2_fourcc('B','A','8','1') /*Bayer Imaging Sensor Format*/ 

fmt.fmt.pix.pixelformat = MT9T001_FMT;



	if (ioctl(fd, VIDIOC_S_FMT, &fmt))

		perror_exit("VIDIOC_S_FMT failed");

But is this the right format? And does the AVR32 ISI interface support this format?

(3) As far as I know, the MT9T001 camera needs to have the VSYNC and HSYNC lines available. I believe that the example driver disables these lines. How do I ensure that the lines are switched on?

(4) The MT9T001 camera can be set up in snapshot mode, and to take a picture, all that I need to do is to change a bit in a register (0 -> 1). The camera takes the picture, shifts out the data on the parallel bus, and then drops the bit down low (1->0). Do I still need to have something placed in the at76_stop_capture function in the driver code?

Currently, my driver freezes up when I try to read to /dev/video0 in my userspace program. I can open /dev/video0, but I cannot read from it.

It would be nice to have something like this in the Linux kernel code for the AVR32.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

nkinar wrote:
(3) As far as I know, the MT9T001 camera needs to have the VSYNC and HSYNC lines available. I believe that the example driver disables these lines. How do I ensure that the lines are switched on?

My knowledge is from the MT9M001C12STM datasheet, the MT9T001 might be little different.

AFAIK the image sensor doesn't need VSYNC and HSYNC, it outputs them. In MT9T001 parleance they should be LINE_VALID and FRAME_VALID and they are outputs. This might be one of the reasons why your driver freezes...

nkinar wrote:
It would be nice to have something like this in the Linux kernel code for the AVR32.

Definitely it is nice to see image sensor support coming :) Keep up good work!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for your kind remarks, andreie. I am going to try and debug my driver using plenty of printk(), and I'll try to see where I need to work on next.

Thank you for your reply! :D