Discussion in "Project Doubts" started by    bianchi    Apr 17, 2012.
Tue Apr 17 2012, 03:32 pm
#1
Friends,

Do you know init code for 2MPix camera module MT9D111 ?
Any informations will be very appreciated,

thanks
Wed Apr 18 2012, 09:51 pm
#2
can you share datasheet?
Thu Apr 19 2012, 02:44 am
#3
Download this file
www.brandsite.nl/mt9d111/MT9D111_dev_guide.pdf
and check the section called
"Initializing the MT9D131"
Thu Apr 19 2012, 07:13 am
#4


Download this file
www.brandsite.nl/mt9d111/MT9D111_dev_guide.pdf
and check the section called
"Initializing the MT9D131"

ExperimenterUK


do you have reference on code example ?
thanks
Fri Apr 20 2012, 12:15 am
#5
I think you should try looking at Micron's website for code
Tue May 08 2012, 12:44 am
#6
Hi,

This is my init code for the MT9D111 module available from ebay

  /* soft reset 
   1. Bypass the PLL, R0x65:0 = 0xA000, if it is currently used.
    2. Perform MCU reset by setting R0xC3:1 = 0x0501.
    3. Enable soft reset by setting R0x0D:0 = 0x0021. Bit 0 is used for the sensor core reset
    while bit 5 refers to SOC reset.
    4. Disable soft reset by setting R0x0D:0 = 0x0000.
    5. Wait 24 clock cycles before using the two-wire serial interface.
    */
    writeRegister(0,0x65,0xA000);
    writeRegister(1,0xC3,0x0501);
    writeRegister(0,0x0D, 0x0021);
    writeRegister(0,0x0D, 0x0000);
    wait(0.01);    
   pc.printf("Init: Set mode parameters\n\r"); 

//This file was generated by: MT9D111 (SOC2010) Register Wizard
//  Version: 4.3.2.30322    Build Date: 01/11/2012
//
//[MODE A PARAMETERS]
//
//Max Frame Time: n/a
//Max Frame Clocks: 150000000.0 clocks (3 MHz)
//No. of ADCs: 2
//Skip Mode: 1x cols, 1x rows, Bin Mode: Yes
//Active Sensor Columns: 808 pixels
//Active Sensor Rows: 608 rows
//Horiz Blanking: 8019 pixels
//Vert Blanking: 16384 rows
//Extra Delay: 11616 clocks
//
//Actual Frame Clocks: 150000000 clocks
//Row Time: 2942.333 usec / 8827 clocks
//Frame time: 50000 msec
//Frames per Sec: 0.020 fps
//
//Max Shutter Delay: 7508
//50Hz Flicker Period: 3.40 lines
//60Hz Flicker Period: 2.83 lines
//
//[MODE B PARAMETERS]
//
//Max Frame Time: 9803.92 msec
//Max Frame Clocks: 29411764.7 clocks (3 MHz)
//No. of ADCs: 1
//Skip Mode: 2x cols, 2x rows, Bin Mode: No
//Active Sensor Columns: 408 pixels / 816 clocks
//Active Sensor Rows: 308 rows
//Horiz Blanking: 4005 pixels / 8011 clocks
//Vert Blanking: 3024 rows
//Extra Delay: 100 clocks
//
//Actual Frame Clocks: 29411764 clocks
//Row Time: 2942.333 usec / 8827 clocks
//Frame time: 9803.921333 msec
//Frames per Sec: 0.102 fps
//
//Max Shutter Delay: 7962
//50Hz Flicker Period: 3.40 lines
//60Hz Flicker Period: 2.83 lines
//
//

writeRegister(0, 0x05, 0x0FA5);        //HBLANK (B) = 4005
writeRegister(0, 0x06, 0x0BD0);        //VBLANK (B) = 3024
writeRegister(0, 0x07, 0x1F53);        //HBLANK (A) = 8019
writeRegister(0, 0x08, 0x4000);        //VBLANK (A) = 16384
writeRegister(0, 0x20, 0x0790);        //Read Mode (B) = 1936
writeRegister(0, 0x21, 0x8000);        //Read Mode (A) = 32768
writeRegister(0, 0x66, 0x1400);        //PLL Control 1 = 5120
writeRegister(0, 0x67, 0x509);         //PLL Control 2 = 1289
writeRegister(0, 0x65, 0xA000);        //Clock CNTRL: PLL ON = 40960
writeRegister(0, 0x65, 0x2000);        //Clock CNTRL: USE PLL = 8192

writeRegister(1, 0xC6, 0xA122);        //Enter Preview: Auto Exposure
writeRegister(1, 0xC8, 0x01);        //      = 1
writeRegister(1, 0xC6, 0xA123);        //Enter Preview: Flicker Detection
writeRegister(1, 0xC8, 0x00);        //      = 0
writeRegister(1, 0xC6, 0xA124);        //Enter Preview: Auto White Balance
writeRegister(1, 0xC8, 0x01);        //      = 1
writeRegister(1, 0xC6, 0xA125);        //Enter Preview: Auto Focus
writeRegister(1, 0xC8, 0x00);        //      = 0
writeRegister(1, 0xC6, 0xA126);        //Enter Preview: Histogram
writeRegister(1, 0xC8, 0x01);        //      = 1
writeRegister(1, 0xC6, 0xA127);        //Enter Preview: Strobe Control
writeRegister(1, 0xC8, 0x00);        //      = 0
writeRegister(1, 0xC6, 0xA128);        //Enter Preview: Skip Control
writeRegister(1, 0xC8, 0x00);        //      = 0
writeRegister(1, 0xC6, 0xA129);        //In Preview: Auto Exposure
writeRegister(1, 0xC8, 0x03);        //      = 3
writeRegister(1, 0xC6, 0xA12A);        //In Preview: Flicker Detection
writeRegister(1, 0xC8, 0x02);        //      = 2
writeRegister(1, 0xC6, 0xA12B);        //In Preview: Auto White Balance
writeRegister(1, 0xC8, 0x03);        //      = 3
writeRegister(1, 0xC6, 0xA12C);        //In Preview: Auto Focus
writeRegister(1, 0xC8, 0x00);        //      = 0
writeRegister(1, 0xC6, 0xA12D);        //In Preview: Histogram
writeRegister(1, 0xC8, 0x03);        //      = 3
writeRegister(1, 0xC6, 0xA12E);        //In Preview: Strobe Control
writeRegister(1, 0xC8, 0x00);        //      = 0
writeRegister(1, 0xC6, 0xA12F);        //In Preview: Skip Control
writeRegister(1, 0xC8, 0x00);        //      = 0
writeRegister(1, 0xC6, 0xA130);        //Exit Preview: Auto Exposure
writeRegister(1, 0xC8, 0x00);        //      = 0
writeRegister(1, 0xC6, 0xA131);        //Exit Preview: Flicker Detection
writeRegister(1, 0xC8, 0x00);        //      = 0
writeRegister(1, 0xC6, 0xA132);        //Exit Preview: Auto White Balance
writeRegister(1, 0xC8, 0x00);        //      = 0
writeRegister(1, 0xC6, 0xA133);        //Exit Preview: Auto Focus
writeRegister(1, 0xC8, 0x00);        //      = 0
writeRegister(1, 0xC6, 0xA134);        //Exit Preview: Histogram
writeRegister(1, 0xC8, 0x00);        //      = 0
writeRegister(1, 0xC6, 0xA135);        //Exit Preview: Strobe Control
writeRegister(1, 0xC8, 0x00);        //      = 0
writeRegister(1, 0xC6, 0xA136);        //Exit Preview: Skip Control
writeRegister(1, 0xC8, 0x00);        //      = 0
writeRegister(1, 0xC6, 0xA137);        //Capture: Auto Exposure
writeRegister(1, 0xC8, 0x00);        //      = 0
writeRegister(1, 0xC6, 0xA138);        //Capture: Flicker Detection
writeRegister(1, 0xC8, 0x00);        //      = 0
writeRegister(1, 0xC6, 0xA139);        //Capture: Auto White Balance
writeRegister(1, 0xC8, 0x00);        //      = 0
writeRegister(1, 0xC6, 0xA13A);        //Capture: Auto Focus
writeRegister(1, 0xC8, 0x00);        //      = 0
writeRegister(1, 0xC6, 0xA13B);        //Capture: Histogram
writeRegister(1, 0xC8, 0x00);        //      = 0
writeRegister(1, 0xC6, 0xA13C);        //Capture: Strobe Control
writeRegister(1, 0xC8, 0x00);        //      = 0
writeRegister(1, 0xC6, 0xA13D);        //Capture: Skip Control
writeRegister(1, 0xC8, 0x00);        //      = 0


writeRegister(1, 0xC6, 0x2703);        //Output Width (A)
writeRegister(1, 0xC8, 0x0320);        //      = 800
writeRegister(1, 0xC6, 0x2705);        //Output Height (A)
writeRegister(1, 0xC8, 0x0258);        //      = 600
writeRegister(1, 0xC6, 0x2707);        //Output Width (B)
writeRegister(1, 0xC8, 0x0190);        //      = 400
writeRegister(1, 0xC6, 0x2709);        //Output Height (B)
writeRegister(1, 0xC8, 0x012C);        //      = 300
writeRegister(1, 0xC6, 0x270B);        //mode_config
writeRegister(1, 0xC8, 0x0030);        //      = 48
writeRegister(1, 0xC6, 0x270F);        //Row Start (A)
writeRegister(1, 0xC8, 0x01C);        //      = 28
writeRegister(1, 0xC6, 0x2711);        //Column Start (A)
writeRegister(1, 0xC8, 0x03C);        //      = 60
writeRegister(1, 0xC6, 0x2713);        //Row Height (A)
writeRegister(1, 0xC8, 0x4B0);        //      = 1200
writeRegister(1, 0xC6, 0x2715);        //Column Width (A)
writeRegister(1, 0xC8, 0x640);        //      = 1600
writeRegister(1, 0xC6, 0x2717);        //Extra Delay (A)
writeRegister(1, 0xC8, 0x560);        //      = 1376
writeRegister(1, 0xC6, 0x2719);        //Row Speed (A)
writeRegister(1, 0xC8, 0x0011);        //      = 17
writeRegister(1, 0xC6, 0x271B);        //Row Start (B)
writeRegister(1, 0xC8, 0x01C);        //      = 28
writeRegister(1, 0xC6, 0x271D);        //Column Start (B)
writeRegister(1, 0xC8, 0x03C);        //      = 60
writeRegister(1, 0xC6, 0x271F);        //Row Height (B)
writeRegister(1, 0xC8, 0x258);        //      = 600
writeRegister(1, 0xC6, 0x2721);        //Column Width (B)
writeRegister(1, 0xC8, 0x320);        //      = 800
writeRegister(1, 0xC6, 0x2723);        //Extra Delay (B)
writeRegister(1, 0xC8, 0x064);        //      = 100
writeRegister(1, 0xC6, 0x2725);        //Row Speed (B)
writeRegister(1, 0xC8, 0x0011);        //      = 17
writeRegister(1, 0xC6, 0x2727);        //Crop_X0 (A)
writeRegister(1, 0xC8, 0x0000);        //      = 0
writeRegister(1, 0xC6, 0x2729);        //Crop_X1 (A)
writeRegister(1, 0xC8, 0x0320);        //      = 800
writeRegister(1, 0xC6, 0x272B);        //Crop_Y0 (A)
writeRegister(1, 0xC8, 0x0000);        //      = 0
writeRegister(1, 0xC6, 0x272D);        //Crop_Y1 (A)
writeRegister(1, 0xC8, 0x0258);        //      = 600
writeRegister(1, 0xC6, 0x2735);        //Crop_X0 (B)
writeRegister(1, 0xC8, 0x0000);        //      = 0
writeRegister(1, 0xC6, 0x2737);        //Crop_X1 (B)
writeRegister(1, 0xC8, 0x0190);        //      = 400
writeRegister(1, 0xC6, 0x2739);        //Crop_Y0 (B)
writeRegister(1, 0xC8, 0x0000);        //      = 0
writeRegister(1, 0xC6, 0x273B);        //Crop_Y1 (B)
writeRegister(1, 0xC8, 0x012C);        //      = 300
writeRegister(1, 0xC6, 0xA743);        //Gamma and Contrast Settings (A)
writeRegister(1, 0xC8, 0x42);        //      = 66
writeRegister(1, 0xC6, 0xA744);        //Gamma and Contrast Settings (B)
writeRegister(1, 0xC8, 0x42);        //      = 66

writeRegister(1, 0xC6, 0xA745);        //Gamma Table 0 (A)
writeRegister(1, 0xC8, 0x00);        //      = 0
writeRegister(1, 0xC6, 0xA746);        //Gamma Table 1 (A)
writeRegister(1, 0xC8, 0x14);        //      = 20
writeRegister(1, 0xC6, 0xA747);        //Gamma Table 2 (A)
writeRegister(1, 0xC8, 0x23);        //      = 35
writeRegister(1, 0xC6, 0xA748);        //Gamma Table 3 (A)
writeRegister(1, 0xC8, 0x3A);        //      = 58
writeRegister(1, 0xC6, 0xA749);        //Gamma Table 4 (A)
writeRegister(1, 0xC8, 0x5E);        //      = 94
writeRegister(1, 0xC6, 0xA74A);        //Gamma Table 5 (A)
writeRegister(1, 0xC8, 0x76);        //      = 118
writeRegister(1, 0xC6, 0xA74B);        //Gamma Table 6 (A)
writeRegister(1, 0xC8, 0x88);        //      = 136
writeRegister(1, 0xC6, 0xA74C);        //Gamma Table 7 (A)
writeRegister(1, 0xC8, 0x96);        //      = 150
writeRegister(1, 0xC6, 0xA74D);        //Gamma Table 8 (A)
writeRegister(1, 0xC8, 0xA3);        //      = 163
writeRegister(1, 0xC6, 0xA74E);        //Gamma Table 9 (A)
writeRegister(1, 0xC8, 0xAF);        //      = 175
writeRegister(1, 0xC6, 0xA74F);        //Gamma Table 10 (A)
writeRegister(1, 0xC8, 0xBA);        //      = 186
writeRegister(1, 0xC6, 0xA750);        //Gamma Table 11 (A)
writeRegister(1, 0xC8, 0xC4);        //      = 196
writeRegister(1, 0xC6, 0xA751);        //Gamma Table 12 (A)
writeRegister(1, 0xC8, 0xCE);        //      = 206
writeRegister(1, 0xC6, 0xA752);        //Gamma Table 13 (A)
writeRegister(1, 0xC8, 0xD7);        //      = 215
writeRegister(1, 0xC6, 0xA753);        //Gamma Table 14 (A)
writeRegister(1, 0xC8, 0xE0);        //      = 224
writeRegister(1, 0xC6, 0xA754);        //Gamma Table 15 (A)
writeRegister(1, 0xC8, 0xE8);        //      = 232
writeRegister(1, 0xC6, 0xA755);        //Gamma Table 16 (A)
writeRegister(1, 0xC8, 0xF0);        //      = 240
writeRegister(1, 0xC6, 0xA756);        //Gamma Table 17 (A)
writeRegister(1, 0xC8, 0xF8);        //      = 248
writeRegister(1, 0xC6, 0xA757);        //Gamma Table 18 (A)
writeRegister(1, 0xC8, 0xFF);        //      = 255
writeRegister(1, 0xC6, 0xA758);        //Gamma Table 0 (B)
writeRegister(1, 0xC8, 0x00);        //      = 0
writeRegister(1, 0xC6, 0xA759);        //Gamma Table 1 (B)
writeRegister(1, 0xC8, 0x14);        //      = 20
writeRegister(1, 0xC6, 0xA75A);        //Gamma Table 2 (B)
writeRegister(1, 0xC8, 0x23);        //      = 35
writeRegister(1, 0xC6, 0xA75B);        //Gamma Table 3 (B)
writeRegister(1, 0xC8, 0x3A);        //      = 58
writeRegister(1, 0xC6, 0xA75C);        //Gamma Table 4 (B)
writeRegister(1, 0xC8, 0x5E);        //      = 94
writeRegister(1, 0xC6, 0xA75D);        //Gamma Table 5 (B)
writeRegister(1, 0xC8, 0x76);        //      = 118
writeRegister(1, 0xC6, 0xA75E);        //Gamma Table 6 (B)
writeRegister(1, 0xC8, 0x88);        //      = 136
writeRegister(1, 0xC6, 0xA75F);        //Gamma Table 7 (B)
writeRegister(1, 0xC8, 0x96);        //      = 150
writeRegister(1, 0xC6, 0xA760);        //Gamma Table 8 (B)
writeRegister(1, 0xC8, 0xA3);        //      = 163
writeRegister(1, 0xC6, 0xA761);        //Gamma Table 9 (B)
writeRegister(1, 0xC8, 0xAF);        //      = 175
writeRegister(1, 0xC6, 0xA762);        //Gamma Table 10 (B)
writeRegister(1, 0xC8, 0xBA);        //      = 186
writeRegister(1, 0xC6, 0xA763);        //Gamma Table 11 (B)
writeRegister(1, 0xC8, 0xC4);        //      = 196
writeRegister(1, 0xC6, 0xA764);        //Gamma Table 12 (B)
writeRegister(1, 0xC8, 0xCE);        //      = 206
writeRegister(1, 0xC6, 0xA765);        //Gamma Table 13 (B)
writeRegister(1, 0xC8, 0xD7);        //      = 215
writeRegister(1, 0xC6, 0xA766);        //Gamma Table 14 (B)
writeRegister(1, 0xC8, 0xE0);        //      = 224
writeRegister(1, 0xC6, 0xA767);        //Gamma Table 15 (B)
writeRegister(1, 0xC8, 0xE8);        //      = 232
writeRegister(1, 0xC6, 0xA768);        //Gamma Table 16 (B)
writeRegister(1, 0xC8, 0xF0);        //      = 240
writeRegister(1, 0xC6, 0xA769);        //Gamma Table 17 (B)
writeRegister(1, 0xC8, 0xF8);        //      = 248
writeRegister(1, 0xC6, 0xA76A);        //Gamma Table 18 (B)
writeRegister(1, 0xC8, 0xFF);        //      = 255

writeRegister(1, 0xC6, 0x276D);        //FIFO_Conf1 (A)
writeRegister(1, 0xC8, 0xE0E1);        //      = 57569
writeRegister(1, 0xC6, 0xA76F);        //FIFO_Conf2 (A)
writeRegister(1, 0xC8, 0xE1);        //      = 225
writeRegister(1, 0xC6, 0x2774);        //FIFO_Conf1 (B)
writeRegister(1, 0xC8, 0xE0E1);        //      = 57569
writeRegister(1, 0xC6, 0xA776);        //FIFO_Conf2 (B)
writeRegister(1, 0xC8, 0xE1);        //      = 225
writeRegister(1, 0xC6, 0x220B);        //Max R12 (B)(Shutter Delay)
writeRegister(1, 0xC8, 0x1D54);        //      = 7508
writeRegister(1, 0xC6, 0xA217);        //IndexTH23
writeRegister(1, 0xC8, 0x08);        //      = 8
writeRegister(1, 0xC6, 0x2228);        //RowTime (msclk per)/4
writeRegister(1, 0xC8, 0x089C);        //      = 2204
writeRegister(1, 0xC6, 0x222F);        //R9 Step
writeRegister(1, 0xC8, 0x0002);        //      = 2
writeRegister(1, 0xC6, 0xA408);        //search_f1_50
writeRegister(1, 0xC8, 0xFF);        //      = 255
writeRegister(1, 0xC6, 0xA409);        //search_f2_50
writeRegister(1, 0xC8, 0x01);        //      = 1
writeRegister(1, 0xC6, 0xA40A);        //search_f1_60
writeRegister(1, 0xC8, 0xFF);        //      = 255
writeRegister(1, 0xC6, 0xA40B);        //search_f2_60
writeRegister(1, 0xC8, 0x01);        //      = 1
writeRegister(1, 0xC6, 0x2411);        //R9_Step_60
writeRegister(1, 0xC8, 0x0002);        //      = 2
writeRegister(1, 0xC6, 0x2413);        //R9_Step_50
writeRegister(1, 0xC8, 0x0003);        //      = 3

wait(0.5);
writeRegister(1, 0xC6, 0xA103);        //Refresh Sequencer Mode
writeRegister(1, 0xC8, 0x06);        //      = 6
wait(0.5);
writeRegister(1, 0xC6, 0xA103);        //Refresh Sequencer
writeRegister(1, 0xC8, 0x05);        //      = 5

Tue May 08 2012, 02:25 am
#7
wow a biggg... code. I think you can also take help from linux kernel check if micron driver is there under "drivers/media/video/"
Tue May 08 2012, 03:50 am
#8
thanks for the init code, any codes example on how to capture image ?
thanks
Tue May 08 2012, 01:38 pm
#9
Hi,

Check the included source code.
I've tried to configure the MT9D111 in such a way that it outputs JPEG data as slow as possible using a adaptive PIXCLK.

This is an initial picture how I connect the MT9D111 to an mbed dev board:


CLK and RST are accidently swapped in this image.

The code provided in the zip is still testcode. When everything is stable, i'll post an update.
 ajay_bhargav like this.
Tags mt9d111 source codemt9d111 jpeg output codemt9d111 connection to lpc1768mt9d111 initialization code
Thu May 10 2012, 02:04 am
#10
I do not understand this circuit... :/

Get Social

Information

Powered by e107 Forum System

Downloads

Comments

Bobbyerilar
Thu Mar 28 2024, 08:08 am
pb58
Thu Mar 28 2024, 05:54 am
Clarazkafup
Thu Mar 28 2024, 02:24 am
Walterkic
Thu Mar 28 2024, 01:19 am
Davidusawn
Wed Mar 27 2024, 08:30 pm
Richardsop
Tue Mar 26 2024, 10:33 pm
Stevencog
Tue Mar 26 2024, 04:26 pm
Bernardwarge
Tue Mar 26 2024, 11:15 am