2011-04-20 05:36:08     read the ov7725 camera's registor value

Document created by Aaronwu Employee on Aug 26, 2013
Version 1Show Document
  • View in full screen mode

2011-04-20 05:36:08     read the ov7725 camera's registor value

Chong Huang (CHINA)

Message: 100036   

 

Hi,

 

I am currently writing the OV7725 camera driver on a custom board(processor is bf525) based on 2010R1. I used the i2ctools to check whether that the sensor be detected on the i2c bus. Reading its MSB product ID on 0x0A, the correct value should be 0x77, but my result is 0xff. The i2cdump result is all 0xff.

 

~ #  i2cget -f 0 0x21 0x0a

WARNING! This program can confuse your I2C bus, cause data loss and worse!

I will read from device file /dev/i2c-0, chip address 0x21, data address

0x0a, using read byte data.

Continue? [Y/n] y

0xff

 

 

~ # i2cdump -f 0 0x21 b

WARNING! This program can confuse your I2C bus, cause data loss and worse!

I will probe file /dev/i2c-0, address 0x21, mode byte

Continue? [Y/n] y

     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f    0123456789abcdef

00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................

10: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................

20: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................

30: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................

40: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................

50: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................

60: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................

70: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................

80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................

90: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................

a0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................

b0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................

c0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................

d0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................

e0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................

f0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................

 

 

My code is based on the ov9655.* under driver/media/video/blackfin/, I change I2C_SENSOR_ID from (0x30 << 1) to  (0x21 << 1) in the header file, i also enable SCCB mode by changing i2c-bfin-twi.c

 

Why the camera's registor value is all 0xff? Very much appreciate your advices

QuoteReplyEditDelete

 

 

2011-04-20 06:52:53     Re: read the ov7725 camera's registor value

Aaron Wu (CHINA)

Message: 100037   

 

Assume the hardware connection is correct you may use i2cdetect first to see which I2C device/address is available on the I2C bus.If detect none you may need to check your hardware connection, like if the cam device is properly powered up, if the SDA SCL lines are pulled up.

QuoteReplyEditDelete

 

 

2011-04-20 15:13:39     Re: read the ov7725 camera's registor value

Mike Frysinger (UNITED STATES)

Message: 100045   

 

you'll probably want to search the forums for SCCB posts as that tends to be a sticking point with people when working with OV sensors

QuoteReplyEditDelete

 

 

2011-04-20 22:27:49     Re: read the ov7725 camera's registor value

Chong Huang (CHINA)

Message: 100051   

 

Hi, Wu:

 

I think the hardware connection is fine, here is the i2cdetect result. A bare-metal system once ran succesfully on this board, proved that the camera is connectted correctly.

 

~ # i2cdetect -l

i2c-0   i2c             i2c-bfin-twi                            I2C adapter

 

~ # i2cdetect -F 0

Functionalities implemented by /dev/i2c-0:

I2C                              yes

SMBus Quick Command              yes

SMBus Send Byte                  yes

SMBus Receive Byte               yes

SMBus Write Byte                 yes

SMBus Read Byte                  yes

SMBus Write Word                 yes

SMBus Read Word                  yes

SMBus Process Call               yes

SMBus Block Write                yes

SMBus Block Read                 yes

SMBus Block Process Call         no

SMBus PEC                        no

I2C Block Write                  yes

I2C Block Read                   yes

 

 

~ # i2cdetect -a 0

WARNING! This program can confuse your I2C bus, cause data loss and worse!

I will probe file /dev/i2c-0.

I will probe address range 0x00-0x7f.

Continue? [Y/n] y

     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f

00: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f

10: 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f

20: 20 UU 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f

30: 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f

40: 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f

50: 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f

60: 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f

70: 70 71 72 73 74 75 76 77 78 79 7a 7b 7c 7d 7e 7f

QuoteReplyEditDelete

 

 

2011-04-20 22:34:38     Re: read the ov7725 camera's registor value

Chong Huang (CHINA)

Message: 100052   

 

Hi, vapier:

 

I searched the forum and only find the modification to the i2c-bfin-twi.c is

 

diff -Nur linux-2.6.x-orig/drivers/i2c/busses/i2c-bfin-twi.c linux-2.6.x-new/drivers/i2c/busses/i2c-bfin-twi.c

--- linux-2.6.x-orig/drivers/i2c/busses/i2c-bfin-twi.c  2009-06-15 11:25:48.000000000 +0100

+++ linux-2.6.x-new/drivers/i2c/busses/i2c-bfin-twi.c   2009-09-04 23:01:13.261261354 +0100

@@ -698,6 +698,11 @@

        /* Set Twi interface clock as specified */

        write_CLKDIV(iface, (clkhilow << 8) | clkhilow);

 

+#define SCCB   0x0200

+       /*** Enable SCCB mode ***/

+       write_CONTROL(iface, read_CONTROL(iface) | SCCB);

+       SSYNC();

+

        /* Enable TWI */

        write_CONTROL(iface, read_CONTROL(iface) | TWI_ENA);

        SSYNC();

Attachments

    Outcomes