Camera/Lens流程(三)——Sensor Driver Check
创始人
2024-06-03 17:17:43
0

(1)确认能否读取到SensorId

首先向Sensor Vendor确认对应的setting,MTK平台对setting的要求:

  • MCLK为24Mhz(特殊情况下可采用26Mhz);
  • Vblanking=(frame_length- grabwindow_height)*line_length/PCLK
    ISP6s之前的平台要求Vblanking > 1ms
    ISP6s平台要求:
    fps <= 30:VB > 1ms
    30 < fps < 120:VB > 650us
    fps >= 120:VB > 350us
    VB: The interval between the last line of data and the start of next frame

确认好之后做如下测试:

adb root
adb shell sentest

会打印出如下所示的所有sensorlist:

[main]sizeof long : 8
[show_Sensors]sensorNum 3 
[show_Sensors]name:SENSOR_DRVNAME_IMX135_MIPI_RAW type:0 
[show_Sensors]index:0, SensorDevIdx:1 
[show_Sensors]name:SENSOR_DRVNAME_S5K5E8YX_MIPI_RAW type:0 
[show_Sensors]index:1, SensorDevIdx:2 
[show_Sensors]name:SENSOR_DRVNAME_BF2253L_MIPI_RAW type:0 
[show_Sensors]index:2, SensorDevIdx:4 
[main]Param: 1   
[main] : main(1), Sub(2), Main2(4), sub2(8), main3(16)
[main]  : Pre(0), Cap(1), VD(2), slim1(3), slim2(4)

若未打印出来需要porting的sensor name,请自行check上电、i2c等配置。

(2)读取到sensorID但是无法点亮

开启Log的cmd:

adb shell setprop vendor.debug.seninf.log 1

然后执行如下命令:

adb shell sentest arg1 arg2//arg1: 指定sensor
main sensor (arg1 = 1)
sub sensor (arg1 = 2)//arg2:指定sensor mode
preview (arg2 = 0)
capture (arg2 = 1)
video (arg2 = 2)
hs video (arg2 = 3)
slim video (arg2 = 4)

若是针对main camera 的preview mode做测试,如下:

adb shell sentest 1 0
[main]sizeof long : 8
[main]argc num:3
[test_SensorInterface]name:SENSOR_DRVNAME_IMX135_MIPI_RAW type:0 
[test_SensorInterface]index:0, SensorDevIdx:1 
[test_SensorInterface]Sensor index:0, scenarioId:0
[test_SensorInterface]crop w:2096, h:1552
[test_SensorInterface]pHalSensor->powerOn start[test_SensorInterface]main/atv-Continous=1
[test_SensorInterface]main/atv-BypassSensorScenario=0[test_SensorInterface]TgInfo[0] = 1
[test_SensorInterface]pixelMode[0] = 1
[test_SensorInterface]mipi rate = 225000000[test_SensorInterface]---------------------------------------------------
[test_SensorInterface]seninf_mux1 horizontal valid count 0x0, horzontal blanking count 0x0
[test_SensorInterface]blanking valid count 0x0, blanking blanking count 0x0, fps =30[test_SensorInterface]---------------------------------------------------
[test_SensorInterface]seninf_mux1 horizontal valid count 0x817, horzontal blanking count 0x992
[test_SensorInterface]blanking valid count 0x6be78c, blanking blanking count 0x522aa, fps =30
[test_SensorInterface]mipi_pixel_rate = 224.928288Mpps 
[test_SensorInterface]vertical_blanking = 1.514335ms 
[test_SensorInterface]horizontal_blanking = 0.011024ms 
[test_SensorInterface]line time = 0.020342ms [test_SensorInterface]---------------------------------------------------
[test_SensorInterface]seninf_mux1 horizontal valid count 0x816, horzontal blanking count 0x991
[test_SensorInterface]blanking valid count 0x6be78d, blanking blanking count 0x522aa, fps =30
[test_SensorInterface]mipi_pixel_rate = 225.036979Mpps 
[test_SensorInterface]vertical_blanking = 1.514334ms 
[test_SensorInterface]horizontal_blanking = 0.011019ms 
[test_SensorInterface]line time = 0.020333ms [test_SensorInterface]---------------------------------------------------
[test_SensorInterface]seninf_mux1 horizontal valid count 0x817, horzontal blanking count 0x991
[test_SensorInterface]blanking valid count 0x6be78c, blanking blanking count 0x522aa, fps =30
[test_SensorInterface]mipi_pixel_rate = 224.928288Mpps 
[test_SensorInterface]vertical_blanking = 1.514335ms 
[test_SensorInterface]horizontal_blanking = 0.011019ms 
[test_SensorInterface]line time = 0.020338ms 

如上打印的是从sensor driver中query出来的配置信息,sensor index:0代表是main camera,Scenario id:0代表preview mode,grab window size为2096*1552。

其中mipi_pixel_rate代表sensor实际的mipi_pixel_rate,请check是否与sensor driver中配置的一致,同时确认sensor吐data的实际Vertical_blanking是否满足平台要求。

如果打印出来的值大多是0x00,一般原因是sensor没有search到或者sensor吐出的data有问题,平台没有收到任何数据。

(3)sentest源码解析

//vendor/mediatek/proprietary/hardware/mtkcam/drv/src/sensor/common/v1/test/main_sensor.cppvoid show_Sensors()
{IHalSensorList*const pHalSensorList = IHalSensorList::get();if(pHalSensorList) {pHalSensorList->searchSensors();unsigned int const sensorNum = pHalSensorList->queryNumberOfSensors();PRINT_MSG("sensorNum %d \n",sensorNum);for( unsigned int i = 0; i < sensorNum; i++) {int sensorIndexDual = 0;sensorIndexDual = pHalSensorList->querySensorDevIdx(i);int sensorIndex = i;PRINT_MSG("name:%s type:%d \n", pHalSensorList->queryDriverName(sensorIndex), pHalSensorList->queryType(sensorIndex));PRINT_MSG("index:%d, SensorDevIdx:%d \n", sensorIndex, pHalSensorList->querySensorDevIdx(sensorIndex));}}
}void test_SensorInterface(int sendev, int scenario, int input_fps)
{unsigned int i;char const *const szCallerName = "R1";IHalSensor *pHalSensor = NULL;IHalSensor::ConfigParam configParam;SensorStaticInfo sensorStaticInfo;SensorDynamicInfo sensorDynamicInfo;int width  = 0;int height = 0;int fps = 0;IHalSensorList*const pHalSensorList = IHalSensorList::get();pHalSensorList->searchSensors();unsigned int const sensorNum = pHalSensorList->queryNumberOfSensors();for(i = 0; i < sensorNum; i++) {int sensorIndexDual = pHalSensorList->querySensorDevIdx(i);if(sendev & sensorIndexDual) {int sensorIndex = i;PRINT_MSG("name:%s type:%d \n", pHalSensorList->queryDriverName(sensorIndex), pHalSensorList->queryType(sensorIndex));PRINT_MSG("index:%d, SensorDevIdx:%d \n", sensorIndex, pHalSensorList->querySensorDevIdx(sensorIndex));pHalSensorList->querySensorStaticInfo(sensorIndexDual, &sensorStaticInfo);switch(scenario) {case SENSOR_SCENARIO_ID_NORMAL_PREVIEW:width  = sensorStaticInfo.previewWidth;height = sensorStaticInfo.previewHeight;fps = sensorStaticInfo.previewFrameRate;break;case SENSOR_SCENARIO_ID_NORMAL_CAPTURE:width  = sensorStaticInfo.captureWidth;height = sensorStaticInfo.captureHeight;fps = sensorStaticInfo.captureFrameRate;break;case SENSOR_SCENARIO_ID_NORMAL_VIDEO:width  = sensorStaticInfo.videoWidth;height = sensorStaticInfo.videoHeight;fps = sensorStaticInfo.videoFrameRate;break;case SENSOR_SCENARIO_ID_SLIM_VIDEO1:width  = sensorStaticInfo.video1Width;height = sensorStaticInfo.video1Height;fps = sensorStaticInfo.video1FrameRate;break;case SENSOR_SCENARIO_ID_SLIM_VIDEO2:width  = sensorStaticInfo.video2Width;height = sensorStaticInfo.video2Height;fps = sensorStaticInfo.video2FrameRate;break;case SENSOR_SCENARIO_ID_CUSTOM1:width  = sensorStaticInfo.SensorCustom1Width;height = sensorStaticInfo.SensorCustom1Height;fps = sensorStaticInfo.custom1FrameRate;break;case SENSOR_SCENARIO_ID_CUSTOM2:width  = sensorStaticInfo.SensorCustom2Width;height = sensorStaticInfo.SensorCustom2Height;fps = sensorStaticInfo.custom2FrameRate;break;case SENSOR_SCENARIO_ID_CUSTOM3:width  = sensorStaticInfo.SensorCustom3Width;height = sensorStaticInfo.SensorCustom3Height;fps = sensorStaticInfo.custom3FrameRate;break;case SENSOR_SCENARIO_ID_CUSTOM4:width  = sensorStaticInfo.SensorCustom4Width;height = sensorStaticInfo.SensorCustom4Height;fps = sensorStaticInfo.custom4FrameRate;break;case SENSOR_SCENARIO_ID_CUSTOM5:width  = sensorStaticInfo.SensorCustom5Width;height = sensorStaticInfo.SensorCustom5Height;fps = sensorStaticInfo.custom5FrameRate;break;default:break;}PRINT_MSG("Sensor index:%d, scenarioId:%d\n", sensorIndex, scenario);PRINT_MSG("crop w:%d, h:%d\n", width, height);pHalSensor = pHalSensorList->createSensor(szCallerName, sensorIndex);if(!pHalSensor){PRINT_ERR("createSensor fail");return;}PRINT_MSG("pHalSensor->powerOn start\n");pHalSensor->powerOn(szCallerName, 1, (MUINT *)&sensorIndex);configParam ={.index               = (MUINT)sensorIndex,.crop                = MSize(width, height),.scenarioId          = (MUINT)scenario,.isBypassScenario    = 0,.isContinuous        = 1,};if(input_fps != 0) {configParam.framerate = input_fps;fps = input_fps *10;}MUINT32 mipi_rate = 0;pHalSensor->configure(1, &configParam);pHalSensor->sendCommand(sensorIndexDual, SENSOR_CMD_SET_STREAMING_RESUME, 0, 0, 0);pHalSensor->sendCommand(sensorIndexDual, SENSOR_CMD_GET_MIPI_PIXEL_RATE, (MUINTPTR)&scenario,(MUINTPTR)&mipi_rate, (MUINTPTR)&fps);PRINT_MSG("main/atv-Continous=%u\n\n", configParam.isContinuous);PRINT_MSG("main/atv-BypassSensorScenario=%u\n\n", configParam.isBypassScenario);// Only can get current sensor information.pHalSensor->querySensorDynamicInfo(pHalSensorList->querySensorDevIdx(sensorIndex), &sensorDynamicInfo);PRINT_MSG("TgInfo[%d] = %d\n", sensorIndex, sensorDynamicInfo.TgInfo);PRINT_MSG("pixelMode[%d] = %d\n", sensorIndex, sensorDynamicInfo.pixelMode);PRINT_MSG("mipi rate = %d\n", mipi_rate);}}while(1) {unsigned int meter[4]= {0};double d_meter[4]= {0};double d_width = width;double d_fps = fps;if(pHalSensor != NULL)pHalSensor->sendCommand(IMGSENSOR_SENSOR_IDX_MAIN, SENSOR_CMD_DEBUG_GET_SENINF_METER, (MUINTPTR)meter, 0, 0);PRINT_MSG("---------------------------------------------------\n");PRINT_MSG("seninf_mux1 horizontal valid count 0x%x, horzontal blanking count 0x%x\n", meter[0], meter[1]);PRINT_MSG("blanking valid count 0x%x, blanking blanking count 0x%x, fps =%d\n\n", meter[2], meter[3], fps/10);d_meter[0] = meter[0];d_meter[1] = meter[1];d_meter[2] = meter[2];d_meter[3] = meter[3];if(meter[0] && meter[1] && meter[2] && meter[3] && fps) {double mipi_pixel_rate =d_width/((d_meter[0]/(d_meter[2]+d_meter[3]))*(10/d_fps));PRINT_MSG("mipi_pixel_rate = %fMpps \n",mipi_pixel_rate/1000000);double vertical_blanking = (d_meter[3]/(d_meter[2]+d_meter[3]))*(10/d_fps);double horizontal_blanking = (d_meter[1]/(d_meter[2]+d_meter[3]))*(10/d_fps);double line_time =  ((d_meter[1]+d_meter[0])/(d_meter[2]+d_meter[3]))*(10/d_fps);PRINT_MSG("vertical_blanking = %fms \n", vertical_blanking*1000);PRINT_MSG("horizontal_blanking = %fms \n", horizontal_blanking*1000);PRINT_MSG("line time = %fms \n", line_time*1000);}if(fps != 0)usleep((10000000/fps)*10);//update each 10 frames}
}/********************************************************************************  Main Function********************************************************************************/
int main(int argc, char** argv)
{int ret = 0;int sensorDev = 0,scenario =0, fps = 0;PRINT_MSG("sizeof long : %d\n", (int)sizeof(long));if (argc < 2) {show_Sensors();PRINT_MSG("Param: 1   \n");PRINT_MSG(" : main(1), Sub(2), Main2(4), sub2(8), main3(16)\n");PRINT_MSG("  : Pre(%d), Cap(%d), VD(%d), slim1(%d), slim2(%d)\n",\SENSOR_SCENARIO_ID_NORMAL_PREVIEW, SENSOR_SCENARIO_ID_NORMAL_CAPTURE,\SENSOR_SCENARIO_ID_NORMAL_VIDEO, SENSOR_SCENARIO_ID_SLIM_VIDEO1, SENSOR_SCENARIO_ID_SLIM_VIDEO2);return -1;}if(argc > 1)sensorDev = atoi(argv[1]);if(argc > 2)scenario  = atoi(argv[2]);if(argc > 3)fps = atoi(argv[3]);PRINT_MSG("argc num:%d\n",argc);test_SensorInterface(sensorDev, scenario, fps);return ret;
}

相关内容

热门资讯

linux入门---制作进度条 了解缓冲区 我们首先来看看下面的操作: 我们首先创建了一个文件并在这个文件里面添加了...
C++ 机房预约系统(六):学... 8、 学生模块 8.1 学生子菜单、登录和注销 实现步骤: 在Student.cpp的...
JAVA多线程知识整理 Java多线程基础 线程的创建和启动 继承Thread类来创建并启动 自定义Thread类的子类&#...
【洛谷 P1090】[NOIP... [NOIP2004 提高组] 合并果子 / [USACO06NOV] Fence Repair G ...
国民技术LPUART介绍 低功耗通用异步接收器(LPUART) 简介 低功耗通用异步收发器...
城乡供水一体化平台-助力乡村振... 城乡供水一体化管理系统建设方案 城乡供水一体化管理系统是运用云计算、大数据等信息化手段࿰...
程序的循环结构和random库...   第三个参数就是步长     引入文件时记得指明字符格式,否则读入不了 ...
中国版ChatGPT在哪些方面... 目录 一、中国巨大的市场需求 二、中国企业加速创新 三、中国的人工智能发展 四、企业愿景的推进 五、...
报名开启 | 共赴一场 Flu... 2023 年 1 月 25 日,Flutter Forward 大会在肯尼亚首都内罗毕...
汇编00-MASM 和 Vis... Qt源码解析 索引 汇编逆向--- MASM 和 Visual Studio入门 前提知识ÿ...
【简陋Web应用3】实现人脸比... 文章目录🍉 前情提要🌷 效果演示🥝 实现过程1. u...
前缀和与对数器与二分法 1. 前缀和 假设有一个数组,我们想大量频繁的去访问L到R这个区间的和,...
windows安装JDK步骤 一、 下载JDK安装包 下载地址:https://www.oracle.com/jav...
分治法实现合并排序(归并排序)... 🎊【数据结构与算法】专题正在持续更新中,各种数据结构的创建原理与运用✨...
在linux上安装配置node... 目录前言1,关于nodejs2,配置环境变量3,总结 前言...
Linux学习之端口、网络协议... 端口:设备与外界通讯交流的出口 网络协议:   网络协议是指计算机通信网...
Linux内核进程管理并发同步... 并发同步并发 是指在某一时间段内能够处理多个任务的能力,而 并行 是指同一时间能够处理...
opencv学习-HOG LO... 目录1. HOG(Histogram of Oriented Gradients,方向梯度直方图)1...
EEG微状态的功能意义 导读大脑的瞬时全局功能状态反映在其电场结构上。聚类分析方法一致地提取了四种头表面脑电场结构ÿ...
【Unity 手写PBR】Bu... 写在前面 前期积累: GAMES101作业7提高-实现微表面模型你需要了解的知识 【技...