A quick note to Aptina and to any developers experiencing odd-looking “streaks” in very low light with the Aptina MT9P031.
It turns out that these are caused (I’m pretty sure) by the analog offset sampling underflowing: if any of the four offset registers (R0x060, R0x061, R0x063, and R0x064) end up getting set to the minimum value (0x101, i.e. -255), then you get these odd-looking streaks. If you then disable the analog calibration (by setting bit 1 of R0x062), the streaks disappear: but unfortunately you also get a huge colour flash whenevr you do (bizarrely, this can look like a pink tartan pattern overlaying the sensor image), so this isn’t apparently a register you can practically change in real time.
After a couple of days of determined register poking, the least-worst fix to ameliorate (if not exactly ‘fix’) these low light streaks therefore seems to me to be to permanently disable both fast sample mode (by setting bit 15 of R0x062) and binary search mode (by setting bit 11 of R0x062). OK, it doesn’t make the problem go away completely, but it does seem to help a lot. Something Linux driver writers might want to know about! 😉
Incidentally, I presume this holds true for the MT9P001 as well because all its black level conditioning registers seem to be identical. So, Nick’s top tip for understanding the MT9P031 is to read the MT9P001 datasheet as well, basically for the bits Aptina left out. 🙂
PS: my next stop is trying out the same thing for the MT9M131 (which appears to have an earlier, slightly less sophisticated version of the same IP block), either by disabling the “rapid sweep” mode [by setting bit 15 of R0x060] or forcing the rapid step size to 1 [by setting bit 4 of R0x060]. Fingers crossed that will help…