XR32 CSI验证发现有点问题,求大佬给个OV7670、GC0308 的demo我抄抄
-
照着camera_demo里的改了,砍了wifi部分,然后把gc0308的驱动部分换成了OV7670,结果出现
[os E] OS_SemaphoreWait():110, handle 0
修改后的SDK放到Github上了https://github.com/YuzukiHD/XR32SDK,项目是
project/example/camera
报错
--Cam_Hardware_Reset---54---- [COMPONENT TRACK] Ov7670_Csi_Init():258 end [os E] OS_SemaphoreWait():110, handle 0 [Ov7670] image_size 0 [os E] OS_SemaphoreDelete():89, handle 0 [COMPONENT WARN] Drv_Ov7670_DeInit():627 ov7670 semaphore delete error, -3
硬件
软件
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "driver/chip/hal_csi.h" #include "driver/chip/hal_dma.h" #include "driver/chip/hal_i2c.h" #include "driver/chip/hal_uart.h" #include "kernel/os/os.h" #include "driver/component/csi_camera/camera_csi.h" #include "driver/component/csi_camera/ov7670/drv_ov7670.h" #define IMAGE_BUFFSIZE 153600 #define CAM_POWERDOWN_PIN GPIO_PIN_12 #define CAM_POWERDOWN_PORT GPIO_PORT_A #define CAM_RESET_PIN GPIO_PIN_13 #define CAM_RESET_PORT GPIO_PORT_A uint8_t* image_buff; void Cam_Hardware_Reset(void) { printf("--%s---%d----\n", __func__, __LINE__); Drv_Ov7670_Pwdn_Pin_Ctrl(GPIO_PIN_LOW); Drv_Ov7670_Reset_Pin_Ctrl(GPIO_PIN_LOW); OS_MSleep(3); Drv_Ov7670_Reset_Pin_Ctrl(GPIO_PIN_HIGH); OS_MSleep(100); } void Cam_PowerInit(void) { Cam_PowerCtrlCfg PowerCtrlcfg; PowerCtrlcfg.Cam_Pwdn_Port = CAM_POWERDOWN_PORT; PowerCtrlcfg.Cam_Reset_Port = CAM_RESET_PORT; PowerCtrlcfg.Cam_Pwdn_Pin = CAM_POWERDOWN_PIN; PowerCtrlcfg.Cam_Reset_Pin = CAM_RESET_PIN; Drv_Ov7670_PowerInit(&PowerCtrlcfg); } int Cam_Init(uint8_t* imagebuf) { HAL_CSI_Moudle_Enalbe(CSI_DISABLE); if (Drv_Ov7670_Init() == COMP_ERROR) return COMP_ERROR; else OS_MSleep(500); Drv_Ov7670_Set_SaveImage_Buff(( uint32_t )imagebuf); HAL_CSI_Moudle_Enalbe(CSI_ENABLE); return COMP_OK; } int main(void) { uint32_t image_size = 0; image_buff = ( uint8_t* )malloc(IMAGE_BUFFSIZE); if (image_buff == NULL) { COMPONENT_WARN("image buff malloc error \r\n"); return COMP_ERROR; } memset(image_buff, 0, IMAGE_BUFFSIZE); Cam_PowerInit(); Cam_Hardware_Reset(); if(Cam_Init(image_buff) == COMP_ERROR){ printf("[Ov7670] CAM INIT ERROR\n"); } Drv_Ov7670_Capture_Enable(CSI_STILL_MODE, CSI_ENABLE); image_size = Drv_Ov7670_Capture_Componemt(10000); printf("[Ov7670] image_size %u\n", image_size); Drv_Ov7670_DeInit(); free(image_buff); return COMP_OK; }
-
换了GC0308,也有问题,无法拍摄图像,但是初始化什么的都没问题。。
--Cam_Hardware_Reset---25---- [COMPONENT TRACK] GC0308_Csi_Init():224 end GC0308 chip id = 0x9b GC0308 Init Done [GC0308] image_size 0 [COMPONENT WARN] Drv_GC0308_DeInit():615 GC0308 semaphore delete done, 0 --Cam_Hardware_Reset---25---- [COMPONENT TRACK] GC0308_Csi_Init():224 end GC0308 chip id = 0x9b GC0308 Init Done [GC0308] image_size 0 [COMPONENT WARN] Drv_GC0308_DeInit():615 GC0308 semaphore delete done, 0 --Cam_Hardware_Reset---25---- [COMPONENT TRACK] GC0308_Csi_Init():224 end GC0308 chip id = 0x9b GC0308 Init Done [GC0308] image_size 0 [COMPONENT WARN] Drv_GC0308_DeInit():615 GC0308 semaphore delete done, 0
程序
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "driver/chip/hal_csi.h" #include "driver/chip/hal_dma.h" #include "driver/chip/hal_i2c.h" #include "driver/chip/hal_uart.h" #include "kernel/os/os.h" #include "driver/component/csi_camera/camera_csi.h" #include "driver/component/csi_camera/gc0308/drv_gc0308.h" #define IMAGE_BUFFSIZE 153600 #define CAM_RESET_PIN GPIO_PIN_13 #define CAM_RESET_PORT GPIO_PORT_A #define CAM_POWERDOWN_PIN GPIO_PIN_12 #define CAM_POWERDOWN_PORT GPIO_PORT_A uint8_t* image_buff; void Cam_Hardware_Reset(void) { printf("--%s---%d----\n", __func__, __LINE__); Drv_GC0308_Pwdn_Pin_Ctrl(GPIO_PIN_LOW); Drv_GC0308_Reset_Pin_Ctrl(GPIO_PIN_LOW); OS_MSleep(3); Drv_GC0308_Reset_Pin_Ctrl(GPIO_PIN_HIGH); OS_MSleep(100); } void Cam_PowerInit(void) { Cam_PowerCtrlCfg PowerCtrlcfg; PowerCtrlcfg.Cam_Pwdn_Port = CAM_POWERDOWN_PORT; PowerCtrlcfg.Cam_Reset_Port = CAM_RESET_PORT; PowerCtrlcfg.Cam_Pwdn_Pin = CAM_POWERDOWN_PIN; //开发板 PowerCtrlcfg.Cam_Reset_Pin = CAM_RESET_PIN; Drv_GC0308_PowerInit(&PowerCtrlcfg); Drv_GC0308_EnvironmentInit(); } int Cam_Init(uint8_t* imagebuf) { HAL_CSI_Moudle_Enalbe(CSI_DISABLE); if (Drv_GC0308_Init() == COMP_ERROR) return COMP_ERROR; else OS_MSleep(500); Drv_GC0308_Set_SaveImage_Buff(( uint32_t )imagebuf); HAL_CSI_Moudle_Enalbe(CSI_ENABLE); return COMP_OK; } int main(void) { uint32_t image_size = 0; image_buff = ( uint8_t* )malloc(IMAGE_BUFFSIZE); if (image_buff == NULL) { COMPONENT_WARN("image buff malloc error \r\n"); return COMP_ERROR; } memset(image_buff, 0, IMAGE_BUFFSIZE); while (1) { Cam_PowerInit(); Cam_Hardware_Reset(); Cam_Init(image_buff); Drv_GC0308_Capture_Enable(CSI_STILL_MODE, CSI_ENABLE); image_size = Drv_GC0308_Capture_Componemt(10000); printf("[GC0308] image_size %u\n", image_size); if (image_size == 320 * 240 * 2) { printf("[GC0308] image capture done\n"); break; } else { Drv_GC0308_DeInit(); } } Drv_GC0308_DeInit(); free(image_buff); return COMP_OK; }
-
-
@yuzukitsuru 电压崩了吧
-
@gregrgr gc0308的10脚的1.8v我拆了也是一样的
-
@yuzukitsuru 我也Layout一个试试
-
Copyright © 2024 深圳全志在线有限公司 粤ICP备2021084185号 粤公网安备44030502007680号