Hi,
I started out with these settings which worked:
Code: Select all image_sensor_twi_write(0x1A,0xFF); // H_COUNT = 0x3FF = 1023
image_sensor_twi_write(0x1B,0xB3); // V_COUNT = 0x21B = 539 // Assuming Register 0x1C is left at the default (0xA1)
image_sensor_twi_write(0x1E,0xC3); // SPCOUNT[7:0]
image_sensor_twi_write(0x1F,0x0B); // SPCOUNT = 0xBC3 = 3011 // Doesn't match formula?
But then i tried to do a dynamic calculation of the H_COUNT, V_COUNT and SPCOUNT variables, and inserting into registers 0x1A, 0x1B and 0x1C, and SPCOUNT in 0x1E and 0x1F, just like the example above. But it didn't work, even though i was using the same values as above! Then i noticed that nobody sets register 0x1C, even though it's the correct thing to do. And i found out that when i write to register 0x1C, i also overwrite bit's D7 and D6, which should be empty. however, these two bits make the picture to go completely black!
Here is my H/V_COUNT + SPCOUNT code that works for FULL resolution.
Code: Select all uint16_t hcount = 713;
uint16_t vcount = 539;
uint16_t spcount = 2*(hcount+183);
image_sensor_twi_write(0x1A, hcount & 0xFF);
image_sensor_twi_write(0x1B, ((vcount & 0x0F) << 4) | ((hcount >> 8) & 0x03));
image_sensor_twi_write(0x1C, (vcount & 0x3F0) >> 4 | 0x80); // And with 0x80 to keep first bit set, otherwise pic will be black
image_sensor_twi_write(0x1E, spcount & 0xFF);
image_sensor_twi_write(0x1F, (spcount & 0xF00) >> 8);
Still for some reason the formula 2*(hcount+183) as described in the app note is not correct, it simply won't work. The value for spcount 3011 worked for us in full mode.
Our images are typically very pink'ish disregarding what resolution we use. When in test mode, there are no problems. A list of test modes are shown below:
Code: Select all //image_sensor_twi_write(0x2D,0x7E); // Grayscale test-pattern
//image_sensor_twi_write(0x2D,0x6E); // Same as 5E but brigt
//image_sensor_twi_write(0x2D,0x5E); // Grayscale horizontal gradient bars
//image_sensor_twi_write(0x2D,0x4E); // Color gradient bars
//image_sensor_twi_write(0x2D,0x3E); // Dimmed Color gradient bars
//image_sensor_twi_write(0x2D,0x2E); // Vertical Bright Color bars on white
//image_sensor_twi_write(0x2D,0x1E); // Vertical Dimmed Color bars on black