DVP initialization in ov5642

At the moment, I’m trying to get the OV5642 camera working with its DVP (Digital Video Port) output.
For testing, I’m using VGA output to a monitor, which I previously set up and debugged using the OV7670 camera.
In other words, I’m trying to make the OV5642 output the same kind of data via DVP as the OV7670 does.

My goal is to get the simplest working result possible, or to conclude that the camera is defective.

For I2C initialization, I’m using this document:
OV5642_camera_module_software_application_notes_1.1.pdf
and datasheet
OV5642_DS.book

However, I’m not getting any valid signals from the camera outputs—just unsynchronized noise on the HREF and VSYNC lines.
I find it strange that the initialization script in the application notes contains a huge number of register writes. Some registers are written multiple times, and some I can’t even find in the documentation.
Can I test DVP in VGA resolution in a simpler way than checking half a thousand registers?

Has anyone had any experience with this camera? Is there a known, reliable I2C initialization sequence for DVP mode that would allow me to determine if the camera is functional or not?

Wiring diagram and code in code tags will allow everyone to see what you are talking about.

Here is the i2c initialization code, the data is written to the camera (I even read it).
I think it's pointless to send the code for the vga monitor, it's too big. But it worked fine with the HREF and VSYNC signals that came from the ov7670 camera as shown in the picture. The ov5642 camera can't give me these signals. I don't know why.
image


#include <Wire.h>
#include <util/twi.h>
#include <util/delay.h>
#include <avr/pgmspace.h>


#define F_CPU 8000000UL
#define camAddr_WR  0x78

const uint32_t i2c_settings [] PROGMEM  = {
  0x310393, 0x300882, 0x30177f, 0x3018fc, 0x3810c2, 0x3615f0, 0x300000, 0x300100,
  0x30025c, 0x300300, 0x3004ff, 0x3005ff, 0x300643, 0x300737, 0x301108, 0x301010,
  0x460c22, 0x381504, 0x370ca0, 0x3602fc, 0x3612ff, 0x3634c0, 0x361300, 0x36057c,
  0x362109, 0x362260, 0x360440, 0x3603a7, 0x360327, 0x400021, 0x401d22, 0x360054,
  0x360504, 0x36063f, 0x3c0180, 0x50004f, 0x502004, 0x518179, 0x518200, 0x518522,
  0x519701, 0x5001ff, 0x55000a, 0x550400, 0x55057f, 0x508008, 0x300e18, 0x461000,
  0x471d05, 0x470806, 0x380802, 0x380980, 0x380a01, 0x380be0, 0x380e07, 0x380fd0,
  0x501f00, 0x50004f, 0x430030, 0x350307, 0x350173, 0x350280, 0x350b00, 0x350307,
  0x382411, 0x35011e, 0x350280, 0x350b7f, 0x380c0c, 0x380d80, 0x380e03, 0x380fe8,
  0x3a0d04, 0x3a0e03, 0x3818c1, 0x3705db, 0x370a81, 0x380180, 0x362187, 0x380150,
  0x380308, 0x382708, 0x381040, 0x380405, 0x380500, 0x568205, 0x568300, 0x380603,
  0x3807c0, 0x568603, 0x5687bc, 0x3a0078, 0x3a1a05, 0x3a1330, 0x3a1800, 0x3a197c,
  0x3a0812, 0x3a09c0, 0x3a0a0f, 0x3a0ba0, 0x350c07, 0x350dd0, 0x350000, 0x350100,
  0x350200, 0x350a00, 0x350b00, 0x350300, 0x528a02, 0x528b04, 0x528c08, 0x528d08,
  0x528e08, 0x528f10, 0x529010, 0x529200, 0x529302, 0x529400, 0x529502, 0x529600,
  0x529702, 0x529800, 0x529902, 0x529a00, 0x529b02, 0x529c00, 0x529d02, 0x529e00,
  0x529f02, 0x30302b, 0x3a0200, 0x3a037d, 0x3a0400, 0x3a1400, 0x3a157d, 0x3a1600,
  0x3a0078, 0x3a0809, 0x3a0960, 0x3a0a07, 0x3a0bd0, 0x3a0d08, 0x3a0e06, 0x519370,
  0x589b04, 0x589ac5, 0x401e20, 0x400142, 0x401c04, 0x528a01, 0x528b04, 0x528c08,
  0x528d10, 0x528e20, 0x528f28, 0x529030, 0x529200, 0x529301, 0x529400, 0x529504,
  0x529600, 0x529708, 0x529800, 0x529910, 0x529a00, 0x529b20, 0x529c00, 0x529d28,
  0x529e00, 0x529f30, 0x528200, 0x530000, 0x530120, 0x530200, 0x53037c, 0x530c00,
  0x530d0c, 0x530e20, 0x530f80, 0x531020, 0x531180, 0x530820, 0x530940, 0x530400,
  0x530530, 0x530600, 0x530780, 0x531408, 0x531520, 0x531930, 0x531610, 0x531700,
  0x531802, 0x54023f, 0x540300, 0x340600, 0x5180ff, 0x518152, 0x518211, 0x518314,
  0x518425, 0x518524, 0x518606, 0x518708, 0x518808, 0x51897c, 0x518a60, 0x518bb2,
  0x518cb2, 0x518d44, 0x518e3d, 0x518f58, 0x519046, 0x5191f8, 0x519204, 0x519370,
  0x5194f0, 0x5195f0, 0x519603, 0x519701, 0x519804, 0x519912, 0x519a04, 0x519b00,
  0x519c06, 0x519d82, 0x519e00, 0x502580, 0x558340,

 0x558440, 0x558002, 0x5000cf, 0x371010, 0x363251, 0x370210, 0x3703b2, 0x370418,
  0x370b40, 0x370d03, 0x363101, 0x363252, 0x360624, 0x362096, 0x578507, 0x3a1330,
  0x360052, 0x360448, 0x36061b, 0x370d0b, 0x370fc0, 0x370901, 0x382300, 0x500700,
  0x500900, 0x501100, 0x501300, 0x519e00, 0x508600, 0x508700, 0x508800, 0x508900,
  0x302b00, 0x5001ff, 0x558350, 0x558450, 0x558002, 0x3c0180, 0x3c0004,

  // LENS
  0x580048, 0x580131, 0x580221, 0x58031b, 0x58041a, 0x58051e, 0x580629, 0x580738,
  0x580826, 0x580917, 0x580a11, 0x580b0e, 0x580c0d, 0x580d0e, 0x580e13, 0x580f1a,
  0x581015, 0x58110d, 0x581208, 0x581305, 0x581404, 0x581505, 0x581609, 0x58170d,
  0x581811, 0x58190a, 0x581a04, 0x581b00, 0x581c00, 0x581d01, 0x581e06, 0x581f09,
  0x582012, 0x58210b, 0x582204, 0x582300, 0x582400, 0x582501, 0x582606, 0x58270a,
  0x582817, 0x58290f, 0x582a09, 0x582b06, 0x582c05, 0x582d06, 0x582e0a, 0x582f0e,
  0x583028, 0x58311a, 0x583211, 0x58330e, 0x58340e, 0x58350f, 0x583615, 0x58371d,
  0x58386e, 0x583939, 0x583a27, 0x583b1f, 0x583c1e, 0x583d23, 0x583e2f, 0x583f41,
  0x58400e, 0x58410c, 0x58420d, 0x58430c, 0x58440c, 0x58450c, 0x58460c, 0x58470c,
  0x58480d, 0x58490e, 0x584a0e, 0x584b0a, 0x584c0e, 0x584d0e, 0x584e10, 0x584f10,
  0x585011, 0x58510a, 0x58520f, 0x58530e, 0x585410, 0x585510, 0x585610, 0x58570a,
  0x58580e, 0x58590e, 0x585a0f, 0x585b0f, 0x585c0f, 0x585d0a, 0x585e09, 0x585f0d,
  0x58600c, 0x58610b, 0x58620d, 0x586307, 0x586417, 0x586514, 0x586618, 0x586718,
  0x586816, 0x586912, 0x586a1b, 0x586b1a, 0x586c16, 0x586d16, 0x586e18, 0x586f1f,
  0x58701c, 0x587116, 0x587210, 0x58730f, 0x587413, 0x58751c, 0x58761e, 0x587717,
  0x587811, 0x587911, 0x587a14, 0x587b1e, 0x587c1c, 0x587d1c, 0x587e1a, 0x587f1a,
  0x58801b, 0x58811f, 0x588214, 0x58831a, 0x58841d, 0x58851e, 0x58861a, 0x58871a,

  // AWB
  0x5180ff, 0x518152, 0x518211, 0x518314, 0x518425, 0x518524, 0x518614, 0x518714,
  0x518814, 0x518969, 0x518a60, 0x518ba2, 0x518c9c, 0x518d36, 0x518e34, 0x518f54,
  0x51904c, 0x5191f8, 0x519204, 0x519370, 0x5194f0, 0x5195f0, 0x519603, 0x519701,
  0x519805, 0x51992f, 0x519a04, 0x519b00, 0x519c06, 0x519da0, 0x519ea0,

  // D/S
  0x528a00, 0x528b01, 0x528c04, 0x528d08, 0x528e10, 0x528f20, 0x529030, 0x529200,
  0x529300, 0x529400, 0x529501, 0x529600, 0x529704, 0x529800, 0x529908, 0x529a00,
  0x529b10, 0x529c00, 0x529d20, 0x529e00, 0x529f30, 0x528200, 0x530000, 0x530120,
  0x530200, 0x53037c, 0x530c00, 0x530d10, 0x530e20, 0x530f80, 0x531020,

   0x531180, 0x530820, 0x530940, 0x530400, 0x530530, 0x530600, 0x530780,
    0x531408, 0x531520, 0x531930, 0x531610, 0x531700, 0x531802,
    // CMX
    0x538001, 0x538100, 0x538200, 0x53831F, 0x538400, 0x538506, 0x538600, 0x538700,
    0x538800, 0x5389E1, 0x538A00, 0x538B2B, 0x538C00, 0x538D00, 0x538E00, 0x538F10,
    0x539000, 0x5391B3, 0x539200, 0x5393A6, 0x539408,
    // Дополнительные настройки
    0x54800C, 0x548118, 0x54822F, 0x548355, 0x548464, 0x548571, 0x54867D, 0x548787,
    0x548891, 0x54899A, 0x548AAA, 0x548BB8, 0x548CCD, 0x548DDD, 0x548EEA, 0x548F1D,
    0x549005, 0x549100, 0x549204, 0x549320, 0x549403, 0x549560, 0x549602, 0x5497B8,
    0x549802, 0x549986, 0x549A02, 0x549B5B, 0x549C02, 0x549D3B, 0x549E02, 0x549F1C,
    0x54A002, 0x54A104, 0x54A201, 0x54A3ED, 0x54A401, 0x54A5C5, 0x54A601, 0x54A7A5,
    0x54A801, 0x54A96C, 0x54AA01, 0x54AB41, 0x54AC01, 0x54AD20, 0x54AE00, 0x54AF16,
    0x54B001, 0x54B120, 0x54B200, 0x54B310, 0x54B400, 0x54B5F0, 0x54B600, 0x54B7DF,
    0x54023F, 0x540300,
    // UV ADJUST
    0x550010, 0x550200, 0x550306, 0x550400, 0x55057F,
    // AE
    0x502580, 0x3A0F30, 0x3A1028, 0x3A1B30, 0x3A1E28, 0x3A1161, 0x3A1F10,
    0x5688FD, 0x5689DF, 0x568AFE, 0x568BEF, 0x568CFE, 0x568DEF, 0x568EAA, 0x568FAA
};




void error_led(void){
  DDRB |= 32;//make sure led is output
  while (1){//wait for reset
    PORTB ^= 32;// toggle led
    _delay_ms(1000);
  }
}

void twiStart(void){
  TWCR = _BV(TWINT) | _BV(TWSTA) | _BV(TWEN);//send start
  while (!(TWCR & (1 << TWINT)));//wait for start to be transmitted
   if ((TWSR & 0xF8) != TW_START)
    error_led();
}
    
void twiWriteByte(uint8_t DATA, uint8_t type){
  TWDR = DATA;
  TWCR = _BV(TWINT) | _BV(TWEN);
  while (!(TWCR & (1 << TWINT))) {}
 if ((TWSR & 0xF8) != type)
    error_led();
   
}
 
void twiAddr(uint8_t addr, uint8_t typeTWI){
  TWDR = addr;//send address
  TWCR = _BV(TWINT) | _BV(TWEN);    /* clear interrupt to start transmission */
  while ((TWCR & _BV(TWINT)) == 0); /* wait for transmission */
  if ((TWSR & 0xF8) != typeTWI)
    error_led();
   
}

 //для ov5642 
void writeReg(uint8_t reg0, uint8_t reg1, uint8_t dat){

  twiStart();
  twiAddr(camAddr_WR, TW_MT_SLA_ACK);
  twiWriteByte(reg0, TW_MT_DATA_ACK);
  twiWriteByte(reg1, TW_MT_DATA_ACK);
  twiWriteByte(dat, TW_MT_DATA_ACK);
  TWCR = (1 << TWINT) | (1 << TWEN) | (1 << TWSTO); 
  _delay_ms(1);
}



void arduinoUnoInut(void) {
  cli();//disable interrupts
  
    /* Setup the 8mhz PWM clock
  * This will be on pin 11*/
  DDRB |= (1 << 3);//pin 11
  ASSR &= ~(_BV(EXCLK) | _BV(AS2));
  TCCR2A = (1 << COM2A0) | (1 << WGM21) | (1 << WGM20);
  TCCR2B = (1 << WGM22) | (1 << CS20);
  OCR2A = 0;//(F_CPU)/(2*(X+1))
  DDRC &= ~15;//low d0-d3 camera
  DDRD &= ~252;//d7-d4 and interrupt pins
  _delay_ms(3000);
  
    //set up twi for 100khz
  TWSR &= ~3;//disable prescaler for TWI
  TWBR = 72;//set to 100khz
  
    //enable serial
  UBRR0H = 0;
  UBRR0L = 1;//0 = 2M baud rate. 1 = 1M baud. 3 = 0.5M. 7 = 250k 207 is 9600 baud rate.
  UCSR0A |= 2;//double speed aysnc
  UCSR0B = (1 << RXEN0) | (1 << TXEN0);//Enable receiver and transmitter
  UCSR0C = 6;//async 1 stop bit 8bit char no parity bits
}



void setup() {
 arduinoUnoInut();
 //for ov5642
 for (size_t i = 0; i < sizeof(i2c_settings) / sizeof(i2c_settings[0]); i++) {
    uint32_t data = pgm_read_dword_near(&i2c_settings[i]); // Читаем из PROGMEM
    uint8_t reg0 = (data >> 16)  &  0x0000FF ;  
    uint8_t reg1 = (data >> 8)   &  0x0000FF ; 
    uint8_t val = data & 0x0000FF;         
    writeReg(reg0,reg1, val);
   
    delay(100);
  }
  

}

void loop() {


}


Sorry, I am not working at that low level, I am too old (83) to learn it so I will bow out. All the best, I always did want to know if a 7670 could replace a 5642. For now I will just buy camera modules that are already coded.