Hmm, I see what you mean.
I apologize, I’ve never tested the code by removing all light. It appears the sensor does something else and modifies the behavior.
Since the OV7725 doesn’t really have any more doucmentation than the datasheet which isn’t that detailed I don’t know what’s going on. I’ve tried to turn off the AGC/AWB gains and set them to zero and this doesn’t seem to matter. I’ve also tried turning off night mode (settings register 0x0e to zero and this doesn’t help either).
It appears that these registers 0x35 to 0x3c change their values. I’m not sure why. They aren’t documented in an auto mode.
I’ve also tried dumping all regs, then writing them again and seeing if that forces the sensor to the settings I want - but, it does not.
…
We sell the MT9V034 sensor for this reason. The OV7725 is made for taking pictures. It’s auto control is not well documented. The MT9V034 has a complete datasheet and does actually obey when commanded.
…
If you still want to use the OV7725 I would just continuously modify the register settings until it stabilizes at a value you want. You can use read the AGC gain at register 0, AWB gains at registers 1,2,3, the Y_AVG at register 2F.
…
To be clear, I have no idea what’s causing it to not accept the values provided… our C code sets all registers to the commanded values as we expect. We turn off the auto methods and then set the registers that are required to be set.
I’m thinking though the sensor probably has some hidden register state that is not writable directly unless the auto control modes are on. When the senor turns on from power off the auto methods are enabled by default. The short time window before you turn them off is probably enough for them to change some internal registers that cannot easily be cleared.
I’m guessing this is happening because I noticed that some of the registers controlling dummy line insertion which night mode controls changed when I was doing a dump register diff.
…
Can you describe how your application with the OV7725 works? Maybe there’s a way to use the auto functions to do what you want. For example, you can control the AEC/AGC exposure target which will allow you to make the camera auto functions hit a particular Y_AVG value.