Question: We took some readings from the AGC gain registers at addresses 0xA0 and 0xA1 in the ADV7181C. However, these surprisingly always seem to return a value of 0x3FF; which indicates the gain is saturated at maximum even though the video itself looks good. Do you have any idea why we are getting these values?
We also read the values of the Horizontal sync depth on channel A (Green) via registers 0xA7 ad 0xA8. These gave more believable results, ranging from 0x1D9 (473) to 0x1EA(490) dependent on the video channel measured.
Answer: A HSD_CHA value of 0x1D9 (473) corresponds to about 185mV, and a value of 0x1EA (490) corresponds to about 191mV. This sounds reasonable, but it of course depends on the source.
Your script on the other hand sets manual gain. So the AGC is not used. The gain value for A_GAIN, B_GAIN and C_GAIN is set to 0x100, which corresponds to a gain of 0.5.
What is read back in CP_AGC_GAIN is the gain that would be applied to reach the target gain if AGC was used. This gain is auto calculated after the manual gain.
So a 185mV with a 0.5 manual gain will give you 92.5mV.
In your script AGC_TAR_MAN is set to 0 (AGC operates based on HS_NORM) and HS_NORM is set to 0 (AGC target is 300mV). So the gain required would be 300 / 92.5 = ~3.24, which is why the value read back shows the gain would be saturated.