Merge pull request #1019 from kwagyeman/kwabena/fix_ov5640_ov2640_on_rev_Y

Kwabena/fix ov5640 ov2640 on rev y
This commit is contained in:
Ibrahim Abd Elkader 2020-12-05 01:50:45 +02:00 committed by GitHub
commit e6095533ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 15 additions and 1 deletions

View File

@ -11,5 +11,6 @@
#ifndef __OV2640_H__
#define __OV2640_H__
#include "sensor.h"
#define OV2640_XCLK_FREQ 24000000
int ov2640_init(sensor_t *sensor);
#endif // __OV2640_H__

View File

@ -113,7 +113,7 @@
#define AEC 0x10
#define CLKRC 0x11
#define CLKRC_DOUBLE 0x80
#define CLKRC_DOUBLE 0x82
#define CLKRC_DIVIDER_MASK 0x3F
#define COM10 0x15

View File

@ -389,6 +389,14 @@ static int reset(sensor_t *sensor)
ret |= cambus_writeb2(&sensor->i2c, sensor->slv_addr, (default_regs[i][0] << 8) | (default_regs[i][1] << 0), default_regs[i][2]);
}
#if defined(MCU_SERIES_H7)
// Rev V (480 MHz / 20) -> 24 MHz PCLK / 3 * 100 = 800 MHz / 10 = 80 MHz PCLK.
// Rev Y (400 MHz / 16) -> 25 MHz PCLK / 3 * 84 = 700 MHz / 10 = 70 MHz PCLK.
if (HAL_GetREVID() < 0x2003) { // Is this REV Y?
ret |= cambus_writeb2(&sensor->i2c, sensor->slv_addr, SC_PLL_CONTRL2, 0x54);
}
#endif
// Delay 300 ms
systick_sleep(300);

View File

@ -17,7 +17,9 @@
#define SYSTEM_CTROL0 0x3008
#define SC_PLL_CONTRL1 0x3035
#define SC_PLL_CONTRL2 0x3036
#define SC_PLL_CONTRL3 0x3037
#define SCCB_SYSTEM_CTRL_1 0x3103

View File

@ -389,6 +389,9 @@ int sensor_init()
switch (sensor.chip_id) {
#if (OMV_ENABLE_OV2640 == 1)
case OV2640_ID:
if (extclk_config(OV2640_XCLK_FREQ) != 0) {
return -3;
}
init_ret = ov2640_init(&sensor);
break;
#endif // (OMV_ENABLE_OV2640 == 1)