ov7690 SCCB writing data to register

hello: Hello: i am using ov7690 with at91sam usin MCK at 12.3MHz. but for testing purpose i am using I2C at 153KHz from atmega2560 for SCCB. I can read any register from ov7690 but I can't write to any register. the response is correct i.e. status register of TWI of atmega2560 depicts correcr value, meaning it sends data.

but when i read back the value from that register the old valure retains...

what can be the problem??

--------------------------------------- Posted through

formatting link

Reply to
hassanmahmood
Loading thread data ...

the CODE is below.

I use eeprom routine beciase it is also working on I2C. I can read any register. but can not write.

volatile unsigned char pir='a',pir1='a';

void eeprom_write(unsigned char adrr , unsigned char val ) { //init_start TWCR=164; while (!(TWCR & (1

Reply to
hassanmahmood

You obviously never send a write address for data to be written to.

Looks like poorly structured student code.

.....

Write to 0x50 as you do not do any data shifting and adding one for reading on addresses.

Check I2C or SCCB details for addresses

--
Paul Carpenter          | paul@pcserviceselectronics.co.uk
    PC Services
 Timing Diagram Font
  GNU H8 - compiler & Renesas H8/H8S/H8 Tiny
 For those web sites you hate
Reply to
Paul

U can see the eeprom_read function. 0x42 is for write and 0x43 is for read.

i donot have to shift any data. atmega2560 has dedicated module for I2C.

I can read values from registers of ov7690. but can not write using eeprom_write function.

I can read ID from 0x0A, ver from 0x0B and also manfacturer. but can not write R/W able registers. for example 0x51 is gain register. i can read value from it viz 0x9A but can write to it!!!!

--------------------------------------- Posted through

formatting link

Reply to
hassanmahmood

Does the OV7690 support I2C at more than the standard 100kHz? (That is, is it specified to work at 400kHz.)

Are you sure that you don't send any sort of write enable prior to a write?

You could help yourself by simplifying your code, using a common routine for all those:

TWDR=adrr; TWCR = (1

Reply to
Andrew Jackson

It was not obvious from your por code structure and lack of code comments.

That is not what I was refering to. One method people use is an address they pass to I2C functions as a COMMON address and maybe shift by one to I2C space or not, and add the 1 for read in the read function.

Often these methods make for more readable code.

Split your common bits of code into functions, the calling overhead of the functions will be insignificant compared to the overall I2C speed.

Sounds like device is in wrong mode and you have the pins set for a ONE time configuration at startup (RESET), not changeable via I2C/SCCB interface.

Check the datasheet for the device and your ciruit and your soldeer joints

--
Paul Carpenter          | paul@pcserviceselectronics.co.uk
    PC Services
 Timing Diagram Font
  GNU H8 - compiler & Renesas H8/H8S/H8 Tiny
 For those web sites you hate
Reply to
Paul

yes ov7690 SCCB support 400KHZ, 300KHz, and 150Khz depending upon master clock freq.

there is small difference between I2C and SCCB, I2c recieve ACKs where SCCB dont

--------------------------------------- Posted through

formatting link

Reply to
hassanmahmood

CB

Hi,

I know this post is quite old. I however, need some help with a workable re gister setting for the ov7690 camera. Currently working with it on a projec t but the images from the camera doesn't come out quite clear. It is a lot noisy. Have also tried the color bar and there are incorrect colors in-betw een bars.

Thanks in anticipation.

Reply to
blessedone2100

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.