CMOS camera interface on a USB microcontroller

Discussion in 'Embedded Systems and Microcontrollers' started by giginjose, Jun 25, 2012.

  1. giginjose

    Thread Starter New Member

    Jun 1, 2012
    2
    0
    Hi,

    I would like to interface a CMOS based camera to a USB device microcontroller.
    I need to use the microcontroller for grabbing frames from the CMOS camera and send it to a USB host controller(eg: a PC).
    I have a cmos camera similar (but from different vendor) to the one mentioned in the following link: http://www.sparkfun.com/products/637

    The camera has a resolution of 640x480. It gives 8 parallel data lines, control signals like VSYNC, HSYNC, PCLK. The cmos camera registers are configured through separate I2C clock and data lines.

    What should be the typical parameters of the micro controller to use ? Can I work with a 8bit 8051 based microcontroller, or a 32bit PIC based microcontroller ?
    A typical PIC32 microcontroller has 40MIPS and supports USB 2.0 Ful speed(12Mbps), with a RAM of 16KB.

    As far as my cmos camera sensor is concerned, it has a PCLK frequency of 320ns (data comes in at the interval of 320ns, ie, 3.125MHz speed). The cmos camera sensor scans at the rate of 8fps, which gives a data rate of 2.34MBytes per second.

    What kind of micro controller can I use ? Can I interface with basic 8051/PIC based USB controllers, or should I go for ARM based controllers ?

    I have found a similar thread in http://forum.allaboutcircuits.com/showthread.php?t=14254 link, but it doesn't have any definite conclusion.

    Thank You
     
  2. WBahn

    Moderator

    Mar 31, 2012
    17,750
    4,797
    Look at your basic numbers:

    A full speed USB bus has a baud rate of 12Mbps. Assuming that you can use every bit of that for data (which you can't), how many bytes per second is that?

    Conversely, your stated data rate is 2.34MB/s. How many bits per second do you need to transmit over the USB link?

    Hmm....

    I also don't see where you are getting your numbers from. 640x480 at 8fps would be a raw data rate of ~2.46MB/s. If data is coming off byte-wide at 3.125, then that is 3.125MB/s (meaning that there is some overhead in there).
     
  3. giginjose

    Thread Starter New Member

    Jun 1, 2012
    2
    0
    Hi,

    Can I make use of USB 2.0 HS (480Mbps) for the interface. Some microcontrollers and ICs have USB 2.0 HS supported.

    regarding the data rate, 640*480*8 = 2400 KBytes.
    320ns (3.125MHz) is the PCLK rate and data continuously comes out at this rate, except for the blanking periods (data comes out only for the active period of VSYNC and HSYNC signals). That is why, data rate appears to be low compared with valid data length.


    Thank You.
     
  4. kingArgon

    Member

    Mar 20, 2011
    33
    1
    the Arm Cortex m4 has built in camera interface support. The a STM32F4 Discovery board will set you back $20 but it has on board gyro, microphone, headphone jack, dual headers for gpio and supports cameras out of the box! Also has a built in programmer, debugger and USB OTG(HOST) capability. Its a lttle harder to code than PIC but it does have major advantages over a standard uc.

    did i mention has a clock speed of 168MHZ?!
     
  5. WBahn

    Moderator

    Mar 31, 2012
    17,750
    4,797
    If you consider 1KB to be 1024B (which I usually do for most things), but in this case it is less clear which you really need to do because we are talking about both average data rates and also about clock rates.

    The USB Full Speed is NOT 12Mbps in terms of 12x1024x1024 bits per second, it is 12 million bits per second. This is why I came up with 2.46MB/s, though I should have stated what I was doing more clearly. Even so, tut this is the signalling rate and USB has significant payload overhead. The same issues apply for USB High Speed, though there is sufficient margin for your application (about a factor of ten) that as long as you aren't supporting other bandwidth hogs on the same controller you shouldn't have a bandwidth constraint.

    Which is what I was assuming. The point to keep in mind is that you have to deal with the data as it is coming off the camera at the 3.125MHz and unless you can pipe it across the USB link at that rate, you will have to be able to buffer a large portion of it and then catch up between frames. If you can pipe it out as fast as it comes in, then your buffer doesn't need to be nearly as large.
     
  6. fkento

    New Member

    Jul 9, 2012
    5
    0
    Sorry to dig up an old thread but I'm looking to do the same thing. Giginjose, did you find a USB controller to do the job?

    Thanks
    Kent
     
Loading...