全志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; }将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 = 3029360P
[ 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免责声明:文章内容来自互联网,本站不对其真实性负责,也不承担任何法律责任,如有侵权等情况,请与本站联系删除。
转载请注明出处:全志平台 ov2718 sensor调试 https://www.yhzz.com.cn/a/13128.html