Fixed syntax bug in OV5640

Implemented OV5640 configurations which work for sure without HREF (tested on PP7 with DCMI)
Adjusted clocking for camera
Develop
Sven Steudte 2017-09-13 06:25:06 +02:00
rodzic d1ac86b8aa
commit 28eb8bcf1d
6 zmienionych plików z 366 dodań i 437 usunięć

Wyświetl plik

@ -463,7 +463,7 @@ void start_user_modules(void)
config[4].ssdv_conf.ram_size = sizeof(ssdv_buffer); // Buffer size
config[4].ssdv_conf.res = RES_VGA; // Resolution VGA
config[4].ssdv_conf.quality = 4; // Image quality
start_image_thread(&config[4]);
//start_image_thread(&config[4]);
// Module IMAGE, SSDV 2m 2FSK
config[5].power = 127; // Transmission Power

Wyświetl plik

@ -21,7 +21,7 @@ struct regval_list {
static const struct regval_list OV5640YUV_Sensor_Dvp_Init[] =
{
{ 0x4740, 0x04 },
{ 0x4740, 0x24 },
{ 0x4050, 0x6e },
{ 0x4051, 0x8f },
@ -31,7 +31,7 @@ static const struct regval_list OV5640YUV_Sensor_Dvp_Init[] =
{ 0x3017, 0x7f },
{ 0x3018, 0xff },
{ 0x302c, 0x02 },
{ 0x3108, 0x21 }, // PCLK root divider [5:4]
{ 0x3108, 0x31 },
{ 0x3630, 0x2e },//2e
{ 0x3632, 0xe2 },
{ 0x3633, 0x23 },//23
@ -69,7 +69,7 @@ static const struct regval_list OV5640YUV_Sensor_Dvp_Init[] =
{ 0x3c0a, 0x9c },
{ 0x3c0b, 0x40 },
{ 0x3820, 0x46 },
{ 0x3820, 0x41 },
{ 0x3821, 0x01 }, //07
//windows setup
@ -92,12 +92,12 @@ static const struct regval_list OV5640YUV_Sensor_Dvp_Init[] =
{ 0x3814, 0x31 },
{ 0x3815, 0x31 },
{ 0x3034, 0x1a }, // PLL charge pump control [7:4]
{ 0x3035, 0x11 }, // System clock divider [7:4]
{ 0x3036, 0x46 }, // PLL multiplier [7:0]
{ 0x3037, 0x14 }, // PLL root divider [4], PLL pre-divider [3:0]
{ 0x3038, 0x00 }, // System control registers (changing not recommended)
{ 0x3039, 0x00 }, // PLL bypass [7]
{ 0x3034, 0x1a },
{ 0x3035, 0x21 }, //15fps
{ 0x3036, 0x46 },
{ 0x3037, 0x03 },
{ 0x3038, 0x00 },
{ 0x3039, 0x00 },
{ 0x380c, 0x07 },
{ 0x380d, 0x68 },
@ -136,7 +136,6 @@ static const struct regval_list OV5640YUV_Sensor_Dvp_Init[] =
{ 0x4300, 0x30 },
{ 0x501f, 0x00 },
{ 0x4713, 0x03 },
{ 0x4404, 0x34 },
{ 0x4407, 0x04 },
{ 0x460b, 0x35 },
{ 0x460c, 0x22 },//add by bright
@ -324,81 +323,11 @@ static const struct regval_list OV5640YUV_Sensor_Dvp_Init[] =
static const struct regval_list ov5640_vga_preview[] =
{
// YUV VGA 30fps, night mode 5fps
// Input Clock = 24Mhz, PCLK = 56MHz
{ 0x3035, 0x11 }, // PLL
{ 0x3036, 0x46 }, // PLL
{ 0x3c07, 0x08 }, // light meter 1 threshold [7:0]
{ 0x3820, 0x46 }, // Sensor flip off, ISP flip on
{ 0x3821, 0x01 }, // Sensor mirror on, ISP mirror on, H binning on
{ 0x3814, 0x31 }, // X INC
{ 0x3815, 0x31 }, // Y INC
{ 0x3800, 0x00 }, // HS
{ 0x3801, 0x00 }, // HS
{ 0x3802, 0x00 }, // VS
{ 0x3803, 0x04 }, // VS
{ 0x3804, 0x0a }, // HW (HE)
{ 0x3805, 0x3f }, // HW (HE)
{ 0x3806, 0x07 }, // VH (VE)
{ 0x3807, 0x9b }, // VH (VE)
{ 0x3808, 0x02 }, // DVPHO
{ 0x3809, 0x80 }, // DVPHO
{ 0x380a, 0x01 }, // DVPVO
{ 0x380b, 0xe0 }, // DVPVO
{ 0x380c, 0x07 }, // HTS
{ 0x380d, 0x68 }, // HTS
{ 0x380e, 0x03 }, // VTS
{ 0x380f, 0xd8 }, // VTS
{ 0x3813, 0x06 }, // Timing Voffset
{ 0x3618, 0x00 },
{ 0x3612, 0x29 },
{ 0x3709, 0x52 },
{ 0x370c, 0x03 },
{ 0x3a02, 0x17 }, // 60Hz max exposure, night mode 5fps
{ 0x3a03, 0x10 }, // 60Hz max exposure
// banding filters are calculated automatically in camera driver
//{ 0x3a08, 0x01 }, // B50 step
//{ 0x3a09, 0x27 }, // B50 step
//{ 0x3a0a, 0x00 }, // B60 step
//{ 0x3a0b, 0xf6 }, // B60 step
//{ 0x3a0e, 0x03 }, // 50Hz max band
//{ 0x3a0d, 0x04 }, // 60Hz max band
{ 0x3a14, 0x17 }, // 50Hz max exposure, night mode 5fps
{ 0x3a15, 0x10 }, // 50Hz max exposure
{ 0x4004, 0x02 }, // BLC 2 lines
{ 0x3002, 0x1c }, // reset JFIFO, SFIFO, JPEG
{ 0x3006, 0xc3 }, // disable clock of JPEG2x, JPEG
{ 0x4713, 0x03 }, // JPEG mode 3
{ 0x4407, 0x04 }, // Quantization scale
{ 0x460b, 0x35 },
{ 0x460c, 0x22 },
{ 0x4837, 0x22 }, // DVP CLK divider
{ 0x3824, 0x02 }, // DVP CLK divider
{ 0x5001, 0xa3 }, // SDE on, scale on, UV average off, color matrix on, AWB on
{ 0x3503, 0x00 }, // AEC/AGC on
};
static const struct regval_list OV5640_RGB_QVGA[] =
{
{0x3008, 0x02},
{0x3035, 0x11},
{0x4740, 0x21},
{0x4300, 0x61},
{0x3808, 0x01},
{0x3809, 0x40},
{0x380a, 0x00},
{0x380b, 0xf0},
{0x501f, 0x01},
{0xffff, 0xff},
};
//2592x1944 QSXGA
static const struct regval_list OV5640_JPEG_QSXGA[] =
{
{0x3820 ,0x46},
{0x3821 ,0x20},
{0x3820 ,0x40},
{0x3821 ,0x26},
{0x3814 ,0x11},
{0x3815 ,0x11},
{0x3803 ,0x00},
@ -430,7 +359,7 @@ static const struct regval_list OV5640_JPEG_QSXGA[] =
{0x3824 ,0x04},
{0x5001 ,0x83},
{0x3036 ,0x69},
{0x3035 ,0x12},
{0x3035 ,0x31},
{0x4005 ,0x1A},
{0xffff, 0xff},
};
@ -1015,7 +944,7 @@ static void dma_interrupt(void *p, uint32_t flags) {
dma_flags = flags;
dmaStreamClearInterrupt(dmastp);
if (flags & (STM32_DMA_ISR_FEIF | STM32_DMA_ISR_TEIF } STM32_DMA_ISR_DMEIF)) {
if (flags & (STM32_DMA_ISR_FEIF | STM32_DMA_ISR_TEIF | STM32_DMA_ISR_DMEIF)) {
/*
* DMA transfer error, FIFO error or Direct mode error.
* See 9.34.19 of RM0430.
@ -1144,7 +1073,7 @@ bool OV5640_Capture(uint8_t* buffer, uint32_t size)
/* Setup DMA for transfer on TIM1_TRIG - DMA2 stream 0, channel 6 */
dmastp = STM32_DMA_STREAM(STM32_DMA_STREAM_ID(2, 0));
uint32_t dmamode = STM32_DMA_CR_CHSEL(6) |
STM32_DMA_CR_PL(3) |
STM32_DMA_CR_PL(1) |
STM32_DMA_CR_DIR_P2M |
STM32_DMA_CR_MSIZE_WORD |
STM32_DMA_CR_MBURST_INCR4 |
@ -1158,7 +1087,7 @@ bool OV5640_Capture(uint8_t* buffer, uint32_t size)
#endif
STM32_DMA_CR_TCIE;
dmaStreamAllocate(dmastp, 2, (stm32_dmaisr_t)dma_interrupt, NULL);
dmaStreamAllocate(dmastp, 1, (stm32_dmaisr_t)dma_interrupt, NULL);
dmaStreamSetPeripheral(dmastp, &GPIOA->IDR); // We want to read the data from here

Wyświetl plik

@ -9,7 +9,7 @@
#include "hal.h"
#include "types.h"
#define OV5640_USE_DMA_DBM TRUE
#define OV5640_USE_DMA_DBM FALSE
uint32_t OV5640_Snapshot2RAM(uint8_t* buffer, uint32_t size, resolution_t resolution, bool enableJpegValidation);
bool OV5640_Capture(uint8_t* buffer, uint32_t size);

Wyświetl plik

@ -152,7 +152,7 @@ void pac1720_init(void)
I2C_write8(PAC1720_ADDRESS, PAC1720_CH2_VSENSE_SAMP_CONFIG, 0x5F);
I2C_write8(PAC1720_ADDRESS, PAC1720_V_SOURCE_SAMP_CONFIG, 0xFF);
//TRACE_INFO("PAC > Init PAC1720 continuous measurement");
TRACE_INFO("PAC > Init PAC1720 continuous measurement");
chThdCreateFromHeap(NULL, THD_WORKING_AREA_SIZE(512), "PAC1720", NORMALPRIO, pac1720_thd, NULL);
}

Wyświetl plik

@ -60,7 +60,7 @@
#define STM32_RTCSEL STM32_RTCSEL_LSI
#define STM32_RTCPRE_VALUE 8
#define STM32_MCO1SEL STM32_MCO1SEL_PLL
#define STM32_MCO1PRE STM32_MCO1PRE_DIV4
#define STM32_MCO1PRE STM32_MCO1PRE_DIV2
#define STM32_MCO2SEL STM32_MCO2SEL_SYSCLK
#define STM32_MCO2PRE STM32_MCO2PRE_DIV5
#define STM32_I2SSRC STM32_I2SSRC_CKIN

Wyświetl plik

@ -218,7 +218,7 @@ void start_position_thread(module_conf_t *conf)
// Start position thread
TRACE_INFO("POS > Startup position thread");
chsnprintf(conf->name, sizeof(conf->name), "POS");
thread_t *th = chThdCreateFromHeap(NULL, THD_WORKING_AREA_SIZE(10*1024), "POS", NORMALPRIO, posThread, conf);
thread_t *th = chThdCreateFromHeap(NULL, THD_WORKING_AREA_SIZE(20*1024), "POS", NORMALPRIO, posThread, conf);
if(!th) {
// Print startup error, do not start watchdog for this thread
TRACE_ERROR("POS > Could not startup thread (not enough memory available)");