导航

    全志在线开发者论坛

    • 注册
    • 登录
    • 搜索
    • 版块
    • 话题
    • 在线文档
    • 社区主页

    XR32 CSI验证发现有点问题,求大佬给个OV7670、GC0308 的demo我抄抄

    Wireless & Analog Series
    2
    6
    2450
    正在加载更多帖子
    • 从旧到新
    • 从新到旧
    • 最多赞同
    回复
    • 在新帖中回复
    登录后回复
    此主题已被删除。只有拥有主题管理权限的用户可以查看。
    • YuzukiTsuru
      柚木 鉉 LV 9 最后由 YuzukiTsuru 编辑

      照着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
      

      硬件

      3413ef8b-b905-4c07-a568-a6aaeef23c03-image.png

      软件

      #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;
      }
      
      1 条回复 最后回复 回复 引用 分享 0
      • YuzukiTsuru
        柚木 鉉 LV 9 最后由 编辑

        换了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;
        }
        
        1 条回复 最后回复 回复 引用 分享 0
        • YuzukiTsuru
          柚木 鉉 LV 9 最后由 编辑

          5ab527c7-75b0-4ac5-8546-7a2cb1fac083-image.png

          G 1 条回复 最后回复 回复 引用 分享 0
          • G
            gregrgr LV 5 @YuzukiTsuru 最后由 编辑

            @yuzukitsuru 电压崩了吧e177bee6-bda6-4009-b72d-fe2bfb330aa4-image.png 326fd371-1680-42ca-bf8f-9ae544779532-image.png

            YuzukiTsuru 1 条回复 最后回复 回复 引用 分享 0
            • YuzukiTsuru
              柚木 鉉 LV 9 @gregrgr 最后由 YuzukiTsuru 编辑

              @gregrgr gc0308的10脚的1.8v我拆了也是一样的

              G 1 条回复 最后回复 回复 引用 分享 0
              • G
                gregrgr LV 5 @YuzukiTsuru 最后由 编辑

                @yuzukitsuru 我也Layout一个试试

                1 条回复 最后回复 回复 引用 分享 0
                • Moved from 爱搞机专区 by  xiaowenge xiaowenge 
                • 1 / 1
                • First post
                  Last post

                Copyright © 2024 深圳全志在线有限公司 粤ICP备2021084185号 粤公网安备44030502007680号

                行为准则 | 用户协议 | 隐私权政策