element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Raspberry Pi
  • Products
  • More
Raspberry Pi
Raspberry Pi Forum Connecting a camera.
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Raspberry Pi to participate - click to join for free!
Featured Articles
Announcing Pi
Technical Specifications
Raspberry Pi FAQs
Win a Pi
Raspberry Pi Wishlist
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 7 replies
  • Subscribers 664 subscribers
  • Views 839 views
  • Users 0 members are here
  • raspberry_pi
Related

Connecting a camera.

rew
rew over 13 years ago

My 'pi is still "on the way".

 

One of the things I'd like to do is to connect a cheap camera. I've bought a few Iphone 3GS 3Mpixel cameras.

 

I think these are CSI-2 cameras. I think there is a connector on the board with these pins, right?

 

The Raspberry Pi Foundation has said that getting good quality images out of such a sensor is tricky, but I'm not interested at first in perfect images. As long as I get the data out, I'm confident we'll be able to see what's going on "outside"....

 

Does anybody have any experience with such cameras? Do they start spitting out image data the moment you power them up?

 

Or do you have to do much configuring (I2C) before they do something useful?

 

Does anybody know how the data ends up in the RPI? Is there a kernel driver for the camera interface? Or does that still need to be written?

 

-- update: Found the edit button. Thanks coder27! --

  • Sign in to reply
  • Cancel
  • rew
    rew over 13 years ago

    I forgot to add: I have the connectors on order that should fit on the cameras. I will need to make a flexible flat cable to connect the 'pi to the connector.

     

    (Why can I edit replies, but not the top post?)

     

    --- Update ---

     

    Terasic has a DM5 module http://www.terasic.com.tw/cgi-bin/page/archive.pl?Language=English&No=281  that allows connecting a 5Mpixel camera to an FPGA board. The source code there has:

     

        case(LUT_INDEX)
        0   :   LUT_DATA    <=  24'h000000;
        1   :   LUT_DATA    <=  24'h20c000;                         //  Mirror Row and Columns
        2   :   LUT_DATA    <=  {8'h09,senosr_exposure};//  Exposure
        3   :   LUT_DATA    <=  24'h050000;                         //  H_Blanking
        4   :   LUT_DATA    <=  24'h060019;                         //  V_Blanking
        5   :   LUT_DATA    <=  24'h0A8000;                         //  change latch
        6   :   LUT_DATA    <=  24'h2B000b;                         //  Green 1 Gain
        7   :   LUT_DATA    <=  24'h2C000f;                         //  Blue Gain
        8   :   LUT_DATA    <=  24'h2D000f;                         //  Red Gain
        9   :   LUT_DATA    <=  24'h2E000b;                         //  Green 2 Gain
        10  :   LUT_DATA    <=  24'h100051;                         //  set up PLL power on
        11  :   LUT_DATA    <=  24'h111807;                         //  PLL_m_Factor<<8+PLL_n_Divider
        12  :   LUT_DATA    <=  24'h120002;                         //  PLL_p1_Divider
        13  :   LUT_DATA    <=  24'h100053;                         //  set USE PLL
        14  :   LUT_DATA    <=  24'h980000;                         //  disble calibration

    `ifdef ENABLE_TEST_PATTERN

        15  :   LUT_DATA    <=  24'hA00001;                         //  Test pattern control

      

        16  :   LUT_DATA    <=  24'hA10123;                         //  Test green pattern value
        17  :   LUT_DATA    <=  24'hA20456;                         //  Test red pattern value

    `else

        15  :   LUT_DATA    <=  24'hA00000;                         //  Test pattern control
        16  :   LUT_DATA    <=  24'hA10000;                         //  Test green pattern value
        17  :   LUT_DATA    <=  24'hA20FFF;                         //  Test red pattern value

    `endif

        18  :   LUT_DATA    <=  sensor_start_row    ;   //  set start row  
        19  :   LUT_DATA    <=  sensor_start_column ;   //  set start column  

     

        20  :   LUT_DATA    <=  sensor_row_size;            //  set row size   
        21  :   LUT_DATA    <=  sensor_column_size;         //  set column size
        22  :   LUT_DATA    <=  sensor_row_mode;            //  set row mode in bin mode
        23  :   LUT_DATA    <=  sensor_column_mode;         //  set column mode  in bin mode
        24  :   LUT_DATA    <=  24'h4901A8;                         //  row black target
              
        default:LUT_DATA    <=  24'h000000;
        endcase

     

    I suspect that each 24 bit number is a "register number, 16-bit value" that needs to be written to the camera using I2C.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Former Member
    Former Member over 13 years ago in reply to rew

    there's no kernel driver.  It requires access to the GPU, and that requires Broadcom,

    so only they can do it.

     

    You can in fact edit the top post, using the "actions" box in the upper right corner of the screen.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • rew
    rew over 13 years ago in reply to Former Member

    Wasn't that to be able to decode the image into a nice picture with hardware accelleration?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Former Member
    Former Member over 13 years ago in reply to rew

    my understanding is that simply reading the CSI port requires Broadcom.

    and I believe the GPIO no longer includes all the I2C pins in the production board,

    although the alpha board had them.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Former Member
    Former Member over 13 years ago in reply to Former Member

    I thought it was the I2S that was missing, not I2C. Yea, here it is...http://www.raspberrypi.org/forum/features-and-requests/sad-about-removal-of-i2s-why-was-this-change-made

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Former Member
    Former Member over 13 years ago in reply to Former Member

    yes, sorry my mistake.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • rew
    rew over 13 years ago in reply to Former Member

    And I2S is serial high quality audio.

     

    The datasheet for the BCM2835 SOC (http://www.element14.com/community/servlet/JiveServlet/downloadBody/43016-102-1-231518/Broadcom.Datasheet.pdf ) states on page 28 that there are 3 BSC controllers, each supporting I2C. One of them is brought out to the GPIO port. I strongly suspect that one of the others is connected to the CSI port. Or else a GPIO will do: I2C or SPI are protocols that are easily implemented in software.

     

    I've been rereading the "ARM peripherals" datasheet again, and indeed nothing about CSI. So indeed, it seems that the CSI is directly connected to the GPU and not the ARM. Then we might have to wait for some intelligent youngster to reverse engineer the GPU machine language and architecture....

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube