adafruit / adafruit/Adafruit_CircuitPython_OV7670
_OV7670_init registers confusion
- Dominant language
- Python
- Stars
- 33
- Forks
- 7
- PR merge metrics
- No merged PRs in 30d
Description
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.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at `_OV7670_init` and inspect the register/value pairs around `_OV7670_COM2_SSLEEP`, `0x29`, and `0x35`. Compare the sequence with the OV7670 documentation or source it may have been copied from; done means resolving whether the register writes are correct and documenting the reason for any reserved-register writes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- embedded-iot
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100