全志平台 ov2718 sensor调试

free-jdx 2021-01-22 16:07:20 9516
1. 前言

全志V66平台调试ov2718 sensor;
修改sensor驱动、初始化列表、isp参数、图像参数等;
硬件调试等;

这里主要描述遇到的问题和一些需求问题

2. I2C 无信号问题
(1)检测IO电压

描述:

由于在主板上IODD只能给3.0v电压,而sensor需要1.8V电压,测量sensor端发现电平转换出现问题发现是2.6V;

原厂那边说如果是2.6v的话,芯片可能会被打坏

解决办法:
换了个LDO之后,能出1.8V电,但I2C还是没信号

(2)检测 SDA,SCK,RESET,PWDN

测量电压都正常

(3)测量MCLK

主控端给的24MHZ没问题

(4)修改vfe gpio的高组态改为高低电平

这是原厂提供的方法,有些sensor有这个需求

       case PWDN:
            gpio = dev->gpio->pwdn_io;
    //      force_value_flag = 0;
            force_value_flag = 1;
            break;
        case RESET:
            gpio = dev->gpio->reset_io;
    //      force_value_flag = 0;
            force_value_flag = 1;

还是不行

(5)去掉I2C两根线的mos管

去掉I2C两根线的mos管,直接将2,3脚短路可以点亮模组,
这样I2C电压是2.8V

注:
(后面发现其实是之前模组的mos管物料有问题,贴错了)

3. 添加ISP配置参数

添加驱动后,图像可以采集出来;
但是是绿色图像,因为没有添加isp配置参数表

(1)修改isp_cfg.c

#include <linux/kernel.h>
#include <linux/string.h>
#include "isp_cfg.h"
#include "SENSOR_H/ov2718_mipi_default_v3.h"
#define ISP_CFG_ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))

struct isp_cfg_item isp_cfg_array[] = 
{
    {   "ov2718_mipi",            &ov2718_mipi_default_v3,      },      
};

int get_isp_cfg(char *isp_cfg_name, struct isp_cfg_item *isp_cfg_info)
{
    int i;
    for(i = 0; i < ISP_CFG_ARRAY_SIZE(isp_cfg_array); i++)
    {
        if(strcmp(isp_cfg_name,isp_cfg_array[i].isp_cfg_name) == 0)
        {
            *isp_cfg_info = isp_cfg_array[i];
            return 0;
        }
    }
    printk("[VFE_WARN]NOT found this item:  %s, you can add this ISP Config in the isp_cfg_array!\n", isp_cfg_name);
    return -1;
}
(2)集成文件

将isp_cfg.c
和ov2718_mipi_default_v3.h
放在linux-3.4\drivers\media\video\sunxi-vfe\isp_cfg和
linux-3.4\drivers\media\video\sunxi-vfe\isp_cfg\SENSOR_H

按照上面修改后;
出图正常

4. 添加480P和360P分辨率支持
(1)修改驱动
            /* VGA */
    {
        .width      = VGA_WIDTH,
        .height     = VGA_HEIGHT,
        .hoffset    = 240,
        .voffset    = 0,
        .hts        = 2200,
        .vts        = 1136,
        .pclk       = 75000000,
        .mipi_bps   = 600*1000*1000,
        .fps_fixed  = 30,
        .bin_factor = 1,
        .intg_min   = 1<<4,
        .intg_max   = 1132<<4,
        .gain_min   = 1<<4,
        .gain_max   = 32<<4,
        .width_input      = 1440,
        .height_input     = 1080,
        .regs       = sensor_1080p_regs,//
        .regs_size  = ARRAY_SIZE(sensor_1080p_regs),//
        .set_size       = NULL,
    },

            /* 480*360 */
    {
        .width      = 480,
        .height     = 360,
        .hoffset    = 0,
        .voffset    = 0,
        .hts        = 2200,
        .vts        = 1136,
        .pclk       = 75000000,
        .mipi_bps   = 600*1000*1000,
        .fps_fixed  = 30,
        .bin_factor = 1,
        .intg_min   = 1<<4,
        .intg_max   = 1132<<4,
        .gain_min   = 1<<4,
        .gain_max   = 32<<4,    
        .regs       = sensor_1080p_regs,//
        .regs_size  = ARRAY_SIZE(sensor_1080p_regs),//
        .set_size       = NULL,
    },

驱动中添加如上配置

(2)测试方法

a. 需要app_basic 测试demo

b. 修改vfe.c中将这行调试信息单独拿出来用于测试

printk("video buffer fps = %ld\n",100000000/(buf->vb.ts.tv_sec1000000+buf->vb.ts.tv_usec - (dev->sec1000000+dev->usec)));
或者是加这个(倒数关系)
printk("video buffer frame interval = %ld\n",buf->vb.ts.tv_sec1000000+buf->vb.ts.tv_usec - (dev->sec1000000+dev->usec));

c. 测试命令

./app_basic 0 0 1920 1080 /data  
   ./app_basic 0 0 1280 720 /data  
   ./app_basic 0 0 640 480 /data  
  ./app_basic 0 0 480 360/data 
(3)测试结果

480P

[ 1006.268066] [OV2718 Raw]s_fmt set width = 640, height = 480
[ 1006.274769] [VFE]width_input = 1440, height_input = 1080, width = 640, height = 480
[ 1006.284068] [ISP] full_size width = 640, height = 480, ob_valid = 1440, 1080
[ 1006.292418] [VFE]dev->buf_byte_size = 462848, double_ch_flag = 0
[ 1006.300346] [ISP] VIDEO_MODE!
resolution got from sensor = 640[ 1006.360474] [VFE]buffer_setup, buffer count=8, size=466944
*480
VIDIOC_STREAMON ok
[ 1006.432559] [VFE]capture video mode!
[ 1006.436836] [ISP]: Set Scene, Scene ID is 0. 
[ 1006.441916] [ISP] VIDEO_MODE!
[ 1006.465557] [VFE]capture video first frame done!
[ 1006.470908] video buffer fps = 0
[ 1006.498569] video buffer fps = 3616
[ 1006.531567] video buffer fps = 3030
[ 1006.564575] video buffer fps = 3029
[ 1006.597573] video buffer fps = 3030
[ 1006.630575] video buffer fps = 3029
[ 1006.663580] video buffer fps = 3030
[ 1006.696581] video buffer fps = 3030
[ 1006.729575] video buffer fps = 3030
[ 1006.762584] video buffer fps = 3029
file length = 466944
file start = b6e1c000
file 0 start = 0xb6e1c000
[ 1006.795582] video buffer fps = 3030
[ 1006.828576] video buffer fps = 3030
[ 1006.861584] video buffer fps = 3029

360P


[  382.780354] [OV2718 Raw]s_fmt set width = 480, height = 360
[  382.787110] [VFE]width_input = 480, height_input = 360, width = 480, height = 360
[  382.795876] [ISP] full_size width = 480, height = 360, ob_valid = 480, 360
[  382.804015] [VFE]dev->buf_byte_size = 262144, double_ch_flag = 0
[  382.811475] [ISP] VIDEO_MODE!
resolution got from sensor = 480[  382.876684] [VFE]buffer_setup, buffer count=8, size=266240
*360
VIDIOC_STREAMON ok
[  382.923622] [VFE]capture video mode!
[  382.927787] [ISP]: Set Scene, Scene ID is 0. 
[  382.932958] [ISP] VIDEO_MODE!
[  382.956628] [VFE]capture video first frame done!
[  382.961914] video buffer fps = 5
[  382.989627] video buffer fps = 3609
[  383.022633] video buffer fps = 3030
[  383.055634] video buffer fps = 3030
[  383.088641] video buffer fps = 3030
[  383.121630] video buffer fps = 3030
[  383.154642] video buffer fps = 3029
[  383.187638] video buffer fps = 3030
[  383.220634] video buffer fps = 3030
[  383.253637] video buffer fps = 3030
file length = 266240
声明:本文内容由易百纳平台入驻作者撰写,文章观点仅代表作者本人,不代表易百纳立场。如有内容侵权或者其他问题,请联系本站进行删除。
free-jdx
红包 90 7 评论 打赏
评论
2个
内容存在敏感词
手气红包
  • david 2021-01-27 23:04:01
    回复

    工业场合

  • szkalwa 2021-01-27 08:54:22
    回复

    360P是用在什么场合啊,现在能见到的最少的也就是480P/480I了

相关专栏
置顶时间设置
结束时间
删除原因
  • 广告/SPAM
  • 恶意灌水
  • 违规内容
  • 文不对题
  • 重复发帖
打赏作者
易百纳技术社区
free-jdx
您的支持将鼓励我继续创作!
打赏金额:
¥1易百纳技术社区
¥5易百纳技术社区
¥10易百纳技术社区
¥50易百纳技术社区
¥100易百纳技术社区
支付方式:
微信支付
支付宝支付
易百纳技术社区微信支付
易百纳技术社区
打赏成功!

感谢您的打赏,如若您也想被打赏,可前往 发表专栏 哦~

举报反馈

举报类型

  • 内容涉黄/赌/毒
  • 内容侵权/抄袭
  • 政治相关
  • 涉嫌广告
  • 侮辱谩骂
  • 其他

详细说明

审核成功

发布时间设置
发布时间:
是否关联周任务-专栏模块

审核失败

失败原因
备注
拼手气红包 红包规则
祝福语
恭喜发财,大吉大利!
红包金额
红包最小金额不能低于5元
红包数量
红包数量范围10~50个
余额支付
当前余额:
可前往问答、专栏板块获取收益 去获取
取 消 确 定

小包子的红包

恭喜发财,大吉大利

已领取20/40,共1.6元 红包规则

    易百纳技术社区