Pages: [1]   Go Down
Author Topic: Using Wire Library for Interfacing a camera-module  (Read 1363 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 12
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi together,

i want to interface this camera-module with the arduino:
http://www.sparkfun.com/datasheets/Sensors/Imaging/TCM8230MD.pdf
I don't want to read out the pictures with the Arduino, just want to communicate via I²C and set up the camera, so it sends out its pictures.
But now i'm a bit confused about how to adress the camera. The datasheet tells me the internal addresses of the registers, where i can set up the settings like frame rate etc...
But don't i have to addrres the camera as a slave first? I am very confused on how to address an internal register of the cam with the Wire Library...

Thank you very much,
Max
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 224
Posts: 13917
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

step 1: Google I2Cscanner Arduino and you will find an app to retrieve the device ID.
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

0
Offline Offline
Newbie
*
Karma: 0
Posts: 12
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi robtillaart,

thanks for that! i scanned and found address 60, which corresponds quite well to the datasheet of the camera, saying 0b0111000 is the address!
So, how can i go on? I now used the following code, but the return value is 3, which is "received NACK on transmit of data":
Code:
Wire.beginTransmission(60); 
    Wire.send(0x03);                // sends one byte 
    Wire.send(0x00);                // sends one byte 
    Wire.endTransmission();      // stop transmitting

Cheers,
Max
« Last Edit: April 09, 2011, 10:38:33 am by maxwellMuc » Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 12
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Now i also tried the i2cmaster-library of peter fleury, using this code:
Code:
#include <i2cmaster.h>

void setup()
{
   i2c_init();
   Serial.begin(9600);
   //digitalWrite(13,1);
   byte ret = i2c_start(120);     // set device address and write mode
   Serial.write(ret); 
   //digitalWrite(13,0);
   ret = i2c_write(3);                        // write address = 5
   Serial.write(ret);
   ret = i2c_rep_start(120);
   Serial.write(ret);
   ret = i2c_write(0x00);                        // write address = 5
   Serial.write(ret);
   ret = i2c_write(0x02);                        // write address = 5
   Serial.write(ret);
   ret = i2c_write(0x00);                        // write address = 5
   Serial.write(ret);
   i2c_stop();
}

void loop()
{
 
}

And the message i receive is "010111", so that means the start-functions work and the write-functions don't?! How could that be?
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 224
Posts: 13917
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

the number 120 and 60 comes from the fact that the device number is seven bit and the Arduino wants to send eight. The trick used is to shift the device number one bit (effectively a factor 2)

Quote
i2cmaster-library of peter fleury
Don't know that one
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

0
Offline Offline
Newbie
*
Karma: 0
Posts: 12
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

yes, i already noticed that, so i guess the adressing of the slave-adress is no problem any more. But why does the sending of data do not work?! Could it be a hardware-problem?
Logged

Pages: [1]   Go Up
Jump to: