Hello,
I am hoping someone can assist me with the SCCB (I2C?) bus of an
Omnivision OV7640 image sensor.
I am unable to get the OV7640 to respond to commands on the SCCB bus.
Preliminary :
I have connected the OV7640 to a SRAM, and feed VSYNC and HREF to an
Altera 7032S CPLD which controls and address counter and the SRAM. I
can successfully capture an image frame, and transfer it (slowly) over
RS232 to a PC.
If I treat each pixel as a luminance value, I get a good monochrome
photograph, 640 x 480.
I find this surprising, since I was expecting bayer encoded data.
Looking at (on the data sheet) Register COMH, at Address HEX 28, the
default value is HEX 20, so that the device selected (bit 6) is a
colour OV7640, not a monochrome, OV7141.
COMA's default is HEX 14, making bit 3 = 0, so I would expect YUV/YCbCr
data out.
Since the datasheet I have is watermarked "preliminary" I want to read
back the register values in the OV7640 to see what the defaults are.
SCCB Problem :
I am not reading back valid data from the OV7640 on the SCCB bus.
My development board contains a PIC 18F8620, running at 20MHz, 5V power
supply. I use the technique described on the following Philips website
to level shift between 5V and 3.3V :
http://www.semiconductors.philips.com/markets/mms/protocols/i2c/facts/
(the diagram just below the section titled : Level-shifting I²C)
The data rate of the SCCB clock is 100kHz
The data sequence is as follows : (an attempt to READ the contents of
register HEX 0A - the product ID, which according to the datashete
should be HEX 76)
START (of WRITE)
1 (address a7)
0 (address a6)
0 (address a5)
0 (address a4)
0 (address a3)
1 (address a2)
0 (address a1)
0 (R/!W) (=write)
1 (acknowledge) (ie : apparently not acknowledged by OV7640)
0 (d7)
0 (d6)
0 (d5)
0 (d4)
1 (d3)
0 (d2)
1 (d1)
0 (d0)
1 (acknowledge) (ie : apparently not acknowledged by OV7640)
STOP
START (of READ)
1 (address a7)
0 (address a6)
0 (address a5)
0 (address a4)
0 (address a3)
1 (address a2)
1 (address a1)
1 (R/!W) (=read)
1 (acknowledge) (ie : apparently not acknowledged by OV7640)
1 (d7)
1 (d6)
1 (d5)
1 (d4)
1 (d3)
1 (d2)
1 (d1)
1 (d0)
0 (acknowledge) (generated by PIC acting as I2C Master)
STOP
START and STOP refer to I2C conditions.
According to the datasheet, the address to use for writing to the
OV7640 is 42, and for read, 43. It does not explicity say that this is
in HEX, but based on the rest of the datasheet and a remark I saw
somewhere else (can't recall where), I believe it to be HEX 42, HEX 43.
(1) My first question then is, am I correctly using HEX 42 in the first
part of the cycle and HEX 43 in the second?
(2) The Omnivision description of the SCCB
(http://www.ovt.com/pdfs/ds_note.pdf) states the following :
3.2.1.3 2-Phase Read Transmission Cycle
There must be either a 3-phase or a 2-phase write transmission cycle
asserted ahead of a 2-phase
read transmission cycle. The 2-phase read transmission cycle (see
Figure 3-7) has no ability to
identify the sub-address. The 2-phase write transmission cycle contains
read data of 8 bits and a
ninth Don't-Care bit or NA bit. The master must drive the NA bit at
logical 1.
I understand an acknowledge to mean taking the data line to ground.
However, this section of the datasheet suggests that in order to
acknowledge receipt of data from the OV7640 I need to send an
acknowledge of VCC.
Should I be sending 1 or 0 ?
(3) In the above document the following statement is made :
3.2.2.1 Phase 1 - ID Address
[snip]
The master asserts the ID address, but de-asserts the ninth bit
(Don't-Care bit). The master must
mask the input of SIO_D during the period of the Don't-Care bit and
force the input to 0 to avoid
propagating an unknown bus state.
This statement confuses me because, "de-asserting the ninth bit"
suggests to me that the data line should be released, but in the next
sentence it refers to forcing the input to 0. Forcing the input to 0,
does not imply to me that the ninth bit is de-asserted.
By looking at all the rest of the information in the datasheet, I
conclude that for Don't care bits, the master should not assert a value
on the data line.
Is this interpretation correct?
(4) Other potential pitfalls :
Through not paying sufficient attention to the datasheet initially, I
have omitted the conflict protection resistor mentioned in section 4.3
of the datasheet. There does not seem to be a value suggested for this
resistor. No doubt I could estimate a value.
Lastly, my method for viewing the bus on my analogue (non storage
oscilloscope) is to continuously cycle the above write / read cycles.
The datasheet mentions the following parameter, which I do not appear
to be violating :
tBUF Bus free time before new START 1.3 µs
I have checked that the clock and data lines are soldered onto the
device, all seems OK from that point of view.
Any suggestions as to what I might be doing wrong would be very
welcome.
Many thanks,
Paul.
I am hoping someone can assist me with the SCCB (I2C?) bus of an
Omnivision OV7640 image sensor.
I am unable to get the OV7640 to respond to commands on the SCCB bus.
Preliminary :
I have connected the OV7640 to a SRAM, and feed VSYNC and HREF to an
Altera 7032S CPLD which controls and address counter and the SRAM. I
can successfully capture an image frame, and transfer it (slowly) over
RS232 to a PC.
If I treat each pixel as a luminance value, I get a good monochrome
photograph, 640 x 480.
I find this surprising, since I was expecting bayer encoded data.
Looking at (on the data sheet) Register COMH, at Address HEX 28, the
default value is HEX 20, so that the device selected (bit 6) is a
colour OV7640, not a monochrome, OV7141.
COMA's default is HEX 14, making bit 3 = 0, so I would expect YUV/YCbCr
data out.
Since the datasheet I have is watermarked "preliminary" I want to read
back the register values in the OV7640 to see what the defaults are.
SCCB Problem :
I am not reading back valid data from the OV7640 on the SCCB bus.
My development board contains a PIC 18F8620, running at 20MHz, 5V power
supply. I use the technique described on the following Philips website
to level shift between 5V and 3.3V :
http://www.semiconductors.philips.com/markets/mms/protocols/i2c/facts/
(the diagram just below the section titled : Level-shifting I²C)
The data rate of the SCCB clock is 100kHz
The data sequence is as follows : (an attempt to READ the contents of
register HEX 0A - the product ID, which according to the datashete
should be HEX 76)
START (of WRITE)
1 (address a7)
0 (address a6)
0 (address a5)
0 (address a4)
0 (address a3)
1 (address a2)
0 (address a1)
0 (R/!W) (=write)
1 (acknowledge) (ie : apparently not acknowledged by OV7640)
0 (d7)
0 (d6)
0 (d5)
0 (d4)
1 (d3)
0 (d2)
1 (d1)
0 (d0)
1 (acknowledge) (ie : apparently not acknowledged by OV7640)
STOP
START (of READ)
1 (address a7)
0 (address a6)
0 (address a5)
0 (address a4)
0 (address a3)
1 (address a2)
1 (address a1)
1 (R/!W) (=read)
1 (acknowledge) (ie : apparently not acknowledged by OV7640)
1 (d7)
1 (d6)
1 (d5)
1 (d4)
1 (d3)
1 (d2)
1 (d1)
1 (d0)
0 (acknowledge) (generated by PIC acting as I2C Master)
STOP
START and STOP refer to I2C conditions.
According to the datasheet, the address to use for writing to the
OV7640 is 42, and for read, 43. It does not explicity say that this is
in HEX, but based on the rest of the datasheet and a remark I saw
somewhere else (can't recall where), I believe it to be HEX 42, HEX 43.
(1) My first question then is, am I correctly using HEX 42 in the first
part of the cycle and HEX 43 in the second?
(2) The Omnivision description of the SCCB
(http://www.ovt.com/pdfs/ds_note.pdf) states the following :
3.2.1.3 2-Phase Read Transmission Cycle
There must be either a 3-phase or a 2-phase write transmission cycle
asserted ahead of a 2-phase
read transmission cycle. The 2-phase read transmission cycle (see
Figure 3-7) has no ability to
identify the sub-address. The 2-phase write transmission cycle contains
read data of 8 bits and a
ninth Don't-Care bit or NA bit. The master must drive the NA bit at
logical 1.
I understand an acknowledge to mean taking the data line to ground.
However, this section of the datasheet suggests that in order to
acknowledge receipt of data from the OV7640 I need to send an
acknowledge of VCC.
Should I be sending 1 or 0 ?
(3) In the above document the following statement is made :
3.2.2.1 Phase 1 - ID Address
[snip]
The master asserts the ID address, but de-asserts the ninth bit
(Don't-Care bit). The master must
mask the input of SIO_D during the period of the Don't-Care bit and
force the input to 0 to avoid
propagating an unknown bus state.
This statement confuses me because, "de-asserting the ninth bit"
suggests to me that the data line should be released, but in the next
sentence it refers to forcing the input to 0. Forcing the input to 0,
does not imply to me that the ninth bit is de-asserted.
By looking at all the rest of the information in the datasheet, I
conclude that for Don't care bits, the master should not assert a value
on the data line.
Is this interpretation correct?
(4) Other potential pitfalls :
Through not paying sufficient attention to the datasheet initially, I
have omitted the conflict protection resistor mentioned in section 4.3
of the datasheet. There does not seem to be a value suggested for this
resistor. No doubt I could estimate a value.
Lastly, my method for viewing the bus on my analogue (non storage
oscilloscope) is to continuously cycle the above write / read cycles.
The datasheet mentions the following parameter, which I do not appear
to be violating :
tBUF Bus free time before new START 1.3 µs
I have checked that the clock and data lines are soldered onto the
device, all seems OK from that point of view.
Any suggestions as to what I might be doing wrong would be very
welcome.
Many thanks,
Paul.