Odd I2C syntoms (Mr. Kolban please have a look)
Posted: Wed Jul 11, 2018 4:33 pm
Hello I have a Odd Problem with the SCCB Interface of a OV7670 Camera Modul
I can read The Register if I do this in a loop but it is not working if i try it directly
See code
I use the SCCB Library from the RTOS Project
https://github.com/igrr/esp32-cam-demo/ ... era/sccb.c
and try to convert it to a Arduino Project.
I changed the Resistors for the I2C Pullups I altered
the dcount Integer. Without success.
if(freq <= 100000) twi_dcount = 30;//about 100KHz
I can read The Register if I do this in a loop but it is not working if i try it directly
See code
I use the SCCB Library from the RTOS Project
https://github.com/igrr/esp32-cam-demo/ ... era/sccb.c
and try to convert it to a Arduino Project.
I changed the Resistors for the I2C Pullups I altered
the dcount Integer. Without success.
if(freq <= 100000) twi_dcount = 30;//about 100KHz
Code: Select all
printf("Initializing Camera on SDA %d and SCL %d \n", SIOD, SIOC);
SCCB_Init(SIOD, SIOC);
ESP_LOGD(TAG_OV7670, "Reset Camera !! \n ");
digitalWrite(RST, LOW);
delay(10);
digitalWrite(RST, HIGH);
delay(10);
ESP_LOGD(TAG, "Searching for camera address \n");
uint8_t slv_addr = SCCB_Probe();
s_state.slv_addr = slv_addr;
printf("Camera at address=0x%02x \n", slv_addr);
const int REG_PID = 0x0A; /* Product ID Number MSB */
const int REG_VER = 0x0B; /* Product ID Number LSB */
const int REG_MIDH = 0x1C; /* Manufacturer ID Byte – High */
const int REG_MIDL = 0x1D; /* Manufacturer ID Byte – Low */
s_state.config.PID = SCCB_Read(slv_addr, REG_PID); // does not work !!
s_state.config.VER = SCCB_Read(slv_addr, REG_VER); // does not work !!
s_state.config.MIDL = SCCB_Read(slv_addr, REG_MIDL); // does not work !!
s_state.config.MIDH = SCCB_Read(slv_addr, REG_MIDH); // does not work !!
delay(10);
printf("Camera PID=0x%02x VER=0x%02x MIDL=0x%02x MIDH=0x%02x \n",
s_state.config.PID, s_state.config.VER, s_state.config.MIDH, s_state.config.MIDL);
int Array[100];
int dummy;
// This is working
for (int i = 0; i < 99; i++)
{
dummy = SCCB_Read(slv_addr, i);
printf("I @ 0x%2x - PID 0x%2x \n", i, dummy);
Array[i] = dummy;
delay(10);
}
s_state.config.PID = Array[REG_PID]; // is working
s_state.config.VER = Array[REG_VER];
s_state.config.MIDH = Array[REG_MIDH];
s_state.config.MIDL = Array[REG_MIDL];