This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

OMAP L138 OV5640 CAMERA

Other Parts Discussed in Thread: OMAP-L138

Hello,

I need to check if my  camera works properly. I'm looking for a code where I may capture data from my camera (vpif) and send it to VGA to display on my monitor. Can somebody guide me? Thank you. My email: osjan1@o2.pl

 

 

  • Hi Mark,

    You may find these links useful.

    http://processors.wiki.ti.com/index.php/Demonstration_of_VPIF_raw_capture_using_MT9T031_sensor_on_AM18X/DA850/OMAP-L138_running_Linux

    http://e2e.ti.com/support/embedded/linux/f/354/t/40151.aspx

    http://e2e.ti.com/support/dsp/omap_applications_processors/f/42/t/180709.aspx

     

     

    Regards,

    Shankari.

     

    ---------------------------------------------------------------------------------
    Please click the Verify Answer button on this post if it answers your question.
    ---------------------------------------------------------------------------------

  • Hello,

    Thank you for reply, but I need example how to implement OV5640 (implementation code). I can't even find proper user guide for this. 

    Regards,

     

     

  •  Okay, I try to implement code for camera, in this code I want to read the camera ID:

    in main():

    I2CPinMuxSetup(0);
     I2COV5640IfInit(SOC_I2C_0_REGS, INT_CHANNEL_I2C,0x5640);
     ov5640_detect(SOC_I2C_0_REGS);//is camera?

     

    static int ov5640_detect(unsigned int baseAddr)
    {
    unsigned short val = 0;
    val = (OV5640RegRead(baseAddr, REG_CHIP_ID_MSB) << 8) + OV5640RegRead(baseAddr, REG_CHIP_ID_LSB);
    if (OV5640_CHIP_ID != val) {return 1;}
    return 0;
    }

    unsigned char OV5640RegRead(unsigned int baseAddr, unsigned int regAddr)
    {
    /* Send the register address */
    slaveDatas[0] = regAddr;
    I2COV5640SendBlocking(baseAddr, 1);
    /* Receive the register contents in slaveData */
    I2COV5640RcvBlocking(baseAddr, 1);
    return (slaveDatas[0]);
    }

    void I2COV5640Isr(void)
    {
    unsigned int intCode = 0;
    unsigned int sysIntNum = 0;
    intCode = 0;
    /* Get interrupt vector code */
    intCode = I2CInterruptVectorGet(SOC_I2C_0_REGS);


    sysIntNum = SYS_INT_I2C0_INT;



    while(intCode!=0)
    {
    IntEventClear(sysIntNum);


    if (intCode == I2C_INTCODE_TX_READY)
    {
    I2CMasterDataPut(SOC_I2C_0_REGS, 0x300A);

    dataIdxx++;
    }

    if(intCode == 4)
    {
    slaveDatas[1] = I2CMasterDataGet(SOC_I2C_0_REGS);
    dataIdxx++;
    }

    if (intCode == 6)
    {

    I2CMasterIntDisableEx(SOC_I2C_0_REGS, I2C_INT_TRANSMIT_READY
    | I2C_INT_DATA_READY);
    txCompFlagg = 0;
    }

    intCode = I2CInterruptVectorGet(SOC_I2C_0_REGS);
    }

    }

    Functions are from codecif.c. When I sent  I2CMasterDataPut(SOC_I2C_0_REGS, 0x300A) in interrupt I got NACK (code 2) and later code 3 and I can't get any data. What I'm doing wrong? Is this problem with the code or with hardware? Thank you.

     

     

     

     

     

     

     

  • Okay, I can communicate with OV5640 (read and write), now I want to capture data from it on VPIF but my code doesn't work. Maybe somebody wants to help me? I can send my whoel project on email.

     

  • Hi Mark,

    From this post and your question in this other one (http://e2e.ti.com/support/dsp/omap_applications_processors/f/42/t/180709.aspx) I think that both of us are facing the same problem.

    I'm trying to capture raw data from a OV7692 sensor and you can see here (http://e2e.ti.com/support/dsp/omap_applications_processors/f/42/p/257714/924817.aspx#924817) that I'm also not able to get any VPIF interrupt.

    While we pray for an answer from TI's support, please check if you might also have the issue with the vertical blanking time in your sensor. I'll keep you informed of any progress on my side and I will be very grateful if you could also inform me on your progress.

    Regards,

    Erik

  • Hello,

    I am also working on raw capture with OMAP-L138 LCDK and LI-M024 DUAL (Aptina sensor). I am having some issues with  i2c communication several days now.More precisely ,I am trying to modify the source code from the project vpif_lcd_loopback.
    The execution stucks int the I2CCodecSendBlocking() function  after I get the interrupt " transmitter ready" ( I2C_INTCODE_TX_READY).

                                           Main Function
    .
    .
    .
    I2C_MT9M024_Init(SOC_I2C_0_REGS,INT_CHANNEL_I2C,I2C_SLAVE_UI_EXPANDER);
    MT9M024_Init(SOC_I2C_0_REGS);
    .
    .
                                     I2C_MT9M024_Init Function

    void I2C_MT9M024_Init(unsigned int baseAddr, unsigned int intCh,
            unsigned int slaveAddr)
    {
        unsigned int sysIntNum = 0;

        /* Put i2c in reset/disabled state */
        I2CMasterDisable(baseAddr);

        /* Configure i2c bus speed to 100Khz */
        I2CMasterInitExpClk(baseAddr, 24000000, 8000000, 100000);

        /* Set i2c slave address */
        I2CMasterSlaveAddrSet(baseAddr, slaveAddr);

        I2CMasterEnable(baseAddr);

        /*
         ** Setup the interrupt in AINTC for the i2c module.
         ** If another instance is to be added, this shall include
         ** checking for the other instance base address also.
         */
        if(SOC_I2C_0_REGS == baseAddr)
        {
    #ifdef _TMS320C6X
            sysIntNum = SYS_INT_I2C0_INT;
    #else
            sysIntNum = SYS_INT_I2CINT0;
    #endif
        }

        I2CCodecIntSetup(sysIntNum, intCh);
        UARTPuts("i2c for mt9 done\n ", -1);
    }

                                     MT9M024_Init Function

    void MT9M024_Init(unsigned int baseAddr)
    {
     CameraRegWrite(baseAddr,0x301A, 0x0059);
          Delay(1000000);
     CameraRegWrite(baseAddr,0x301A, 0x0058);
    }
     

                                      CameraRegWrite Function


    void CameraRegWrite (unsigned int baseAddr,  unsigned int regAddr,  unsigned int regData)
    {

    #ifdef CODEC_INTERFACE_I2C
        /* Send the register address and data
         * MSB is transmitted first */
    //16-bit register address
        slaveData[0] = ((regAddr & 0xFF00 ) >> 8); //msb
        slaveData[1] = (regAddr & 0x00FF);           //lsb

    //16-bot data
        slaveData[2] = ((regData & 0xFF00 ) >> 8);  //msb
        slaveData[3] = (regData & 0x00FF);         //lsb


        I2CCodecSendBlocking(baseAddr, 4);
    #endif
    }

    It seems as if the receiver cannot recieve anything....I would appreciate any suggestions for what I am doing wrong.

  • Hello,

    just an update...The i2c code was fine, the problem was that I was using a non-valid  slave address for the sensor.

  • Hello Katerina,

    we also try to run LI Dual from leopard imagin but we did not success. Do you have working driver for another device? It works only with Leopard modules :-/ We wanted to connect it do a BB-xM and now we are trying to connect it to iMX6. Is it possible to discuss it via email? koutnym [ at ] feec.vutbr.cz

    We would like to use it for dept map computation.

    thank you, Martin

  • Hello Martin,

    I think it would be better to discuss it here in case someone else is interested too.

    My progress so far with the LI-MT9M024DUAL is i2c communication ,but no streaming....

    The i2c code from Staterware works fine ,the thing is that instead of 0x20u you have to use 0x90u  as a slave address for the device.

    I would recommend you to have a look in the following post for information about getting frames from your camera header.

    http://e2e.ti.com/support/dsp/omap_applications_processors/f/42/p/251424/993960.aspx#993960

    In addition ,in this thread I have posted a github link for a driver released from Aptina for BB-xM .The driver is for MT9M034 which has the same registers as  the  two MT9M024 that are interfaced in LI-MT9M024DUAL.

    Kind Regards,

    Katerina Trilyraki

  • Hello Katerina,

    I am sorry for delay. I think, the adress is not problem. In origin driver from Leopard, the address is defined by board you used with:

    #ifdef BOARD_AP_IPNC
    #define IMGS_I2C_ADDR (0x20)//(0x90)
    #endif

    #ifdef BOARD_TI_EVM
    #define IMGS_I2C_ADDR (0xBA)
    #endif

    The original driver from Leopard

    http://goo.gl/Atbvze

    We try to transform the driver for V4L becouse we want to used BB-XM and then iMX6 for communication with the dual camera board.

    http://goo.gl/FEccIz

    At this time, we are able to communicate but we are not able to get video data. We think, there could be problem with 1V8 vs 3V3 data links.

    I am sorry for code from us, it is not good written becouse we are still in developing phase. Hope the source codes helps to run Dual sensor ;-) 

  • Hello Martin,

    I was working with LI-M024DUAL and OMAPL138-LCDK and I was able to communicate with the sensor via I2C with the address 0x90 instead of 0x20....

    I am sure that the communication was established because I have read the chip version from the sensor and  also every register whose value I have altered.

    I remember to have seen in a datasheet (which I can't locate now) from Aptina that the I2C slave address of a sensor is depending on whether the  sensor's Saddr  pin is pulled low or high.

    The  LI-M024DUAL module has Saddr  pin driven low,which I think it mean that the sensor's slave address is  0x90 instead of 0x20.

    Could you please investigated further the I2C part of the communication and inform me about the results.

    Kind Regards,

    Katerina