cc3200搭配OV7670无法触发帧结束中断
我把OV7670的 VSYNC HS 都设置成高电平了,VS引脚接pin_03,复用成CAM_hS功能了,但是就是不会触发中断,串口也不会打印,代码如下
void CameraIntHandler()
{
MAP_CameraIntClear(CAMERA_BASE, CAM_INT_FE);
g_frame_end = 1;
Report(" goto interrupt \n\r ");
MAP_CameraCaptureStop(CAMERA_BASE, true);
}
void CaptureImage()
{
int val;
//
// Configure DMA in ping-pong mode
//
DMAConfig();
//
// Perform Image Capture
//
MAP_CameraCaptureStart(CAMERA_BASE);
//HWREG(0x44018040)=1<<20;
Report(" before \n\r ");
while(g_frame_end == 0)
{
//一直在这里循环
}
MAP_CameraCaptureStop(CAMERA_BASE, true);
Report(" later \n\r ");
}
void CamControllerInit()
{
int val;
MAP_PRCMPeripheralClkEnable(PRCM_CAMERA, PRCM_RUN_MODE_CLK);
MAP_PRCMPeripheralReset(PRCM_CAMERA);
HWREG(0x44025000) = 0x0000;//不分频
MAP_CameraReset(CAMERA_BASE);
//CAM_HS_POL_HI,HSYNC极性为高电平有效
//CAM_VS_POL_LO,VSYNC低电平有效
//CAM_ORDERCAM_SWAP交换字节顺序,swapping image data in FIFO.
//CAM_NOBT_SYNCHRO,在帧开始时捕捉数据
/* MAP_CameraParamsConfig(CAMERA_BASE, CAM_HS_POL_HI, CAM_VS_POL_LO,
CAM_ORDERCAM_SWAP|CAM_NOBT_SYNCHRO);*/
MAP_CameraParamsConfig(CAMERA_BASE, CAM_HS_POL_HI, CAM_VS_POL_HI,
CAM_NOBT_SYNCHRO|CAM_IF_SYNCHRO);
HWREG(0x44018000 + 0x40) |= 1<<17;//FRAME_TRIG 置1
MAP_CameraIntRegister(CAMERA_BASE, CameraIntHandler);
//MCLK is by-default set to 120MHz, and cannot be modified
MAP_CameraXClkConfig(CAMERA_BASE, 120000000,12000000);
MAP_CameraThresholdSet(CAMERA_BASE, 8);
MAP_CameraIntEnable(CAMERA_BASE, CAM_INT_FE);//帧结束中断,低电平有效
MAP_CameraDMAEnable(CAMERA_BASE);
}
void DMAConfig()
{
memset(g_image_buffer,0xF80F,sizeof(g_image_buffer)); //这个内存大小有待考究,QVGA 50?120?
p_buffer = &g_image_buffer[0];
//
// Initilalize DMA
//
UDMAInit();
//
// Setup ping-pong transfer
//
DMASetupTransfer(UDMA_CH22_CAMERA,UDMA_MODE_PINGPONG,TOTAL_DMA_ELEMENTS,
UDMA_SIZE_32,
UDMA_ARB_8,(void *)CAM_BUFFER_ADDR, UDMA_SRC_INC_32,
(void *)p_buffer, UDMA_DST_INC_32);
//
// Pong Buffer
//
p_buffer += TOTAL_DMA_ELEMENTS;
DMASetupTransfer(UDMA_CH22_CAMERA|UDMA_ALT_SELECT,UDMA_MODE_PINGPONG,
TOTAL_DMA_ELEMENTS,
UDMA_SIZE_32, UDMA_ARB_8,(void *)CAM_BUFFER_ADDR,
UDMA_SRC_INC_32, (void *)p_buffer, UDMA_DST_INC_32);
//
// Ping Buffer
//
p_buffer += TOTAL_DMA_ELEMENTS;
g_dma_txn_done = 0;
g_frame_size_in_bytes = 0;
g_frame_end = 0;
g_total_dma_intrpts = 0;
//
// Clear any pending interrupt
//
HWREG(0x4402609C) |= 1 << 8;
//
// DMA Interrupt unmask from apps config
//
HWREG(0x44026094) |= 1 << 8;
Report(" DMA INIT OK \n\r ");
}
VS 引脚是输入模式,测电平是1.8,这种输入引脚电平应该是0啊
已经知道为什么了,要把VS HS PCLK同时输入CC3200,才能判断是否是帧结束,只是给一个VS信号是没办法判断的
我解决了,要把VS、HS、pclk信号都接上,才能触发帧中断,只依靠VS一个信号是没办法触发的
OV2640的有调试出来么?
你把摄像头输出的VS HS 极性设置成正有效试试
我现在又搞不清怎么从内存中恢复图像了,以前没有接触过,望赐教
没调2640,你遇到什么困难了,我现在遇到存储的问题了,一帧QVGA的图片是150KB,我想放到一个数组中,SRAM_DATA是用来存储变量的空间,只有100KB ,应该怎么办
你是用RGB输出的吧,如果用YUV应该会小一些。
ji Ju 你好~
最近也在调ov7670摄像头,遇到点问题,如果方便能加qq请教您几个问题吗~~
qq 759459067