This issue is regarding _OV7670_init, an extract from which follows:
...
_OV7670_REG_COM8,
_OV7670_COM8_FASTAEC | _OV7670_COM8_AECSTEP | _OV7670_COM8_BANDING,
_OV7670_REG_GAIN,
0x00,
_OV7670_COM2_SSLEEP, # <--- =0x10. This should be a register.
0x00,
_OV7670_REG_COM4,
0x00,
_OV7670_REG_COM9,
0x20, # Max AGC value
_OV7670_REG_BD50MAX,
...
See how _OV7670_COM2_SSLEEP appears in an even (register) slot. This causes 0x00 to be written to register 0x10 (since _OV7670_COM2_SSLEEP=0x10). 0x10 corresponds to the _OV7670_REG_AECH exposure register with default value 0x40. I'm not sure what the intended behaviour is. I tried removing these two lines and noticed no visual difference in the output image. So its not an urgent problem, just a confusing piece of code that might cause subtle problems.
Also, at some other points in the init sequence it writes to reserved registers like 0x29 and 0x35:
...
0x29,
0x07, # Reserved register?
_OV7670_REG_CHLF,
0x0B,
0x35,
0x0B, # Reserved register?
_OV7670_REG_ADC,
0x1D,
...
I don't understand why. Perhaps the code should explain in a comment unless I am missing something obvious?
It almost looks like this entire init sequence was copied from some documentation or code elsewhere. Hence the questionmarks. If this is the case then perhaps a comment could link to this.
This issue is regarding
_OV7670_init, an extract from which follows:See how
_OV7670_COM2_SSLEEPappears in an even (register) slot. This causes0x00to be written to register0x10(since_OV7670_COM2_SSLEEP=0x10).0x10corresponds to the_OV7670_REG_AECHexposure register with default value0x40. I'm not sure what the intended behaviour is. I tried removing these two lines and noticed no visual difference in the output image. So its not an urgent problem, just a confusing piece of code that might cause subtle problems.Also, at some other points in the init sequence it writes to reserved registers like
0x29and0x35:I don't understand why. Perhaps the code should explain in a comment unless I am missing something obvious?
It almost looks like this entire init sequence was copied from some documentation or code elsewhere. Hence the questionmarks. If this is the case then perhaps a comment could link to this.