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;
}

相关内容

热门资讯

育碧GDC2018程序化大世界... 1.传统手动绘制森林的问题 采用手动绘制的方法的话,每次迭代地形都要手动再绘制森林。这...
编译原理陈火旺版第三章课后题答... 下面答案仅供参考! 1.编写一个对于 Pascal 源程序的预处理程序。该程序的作用是...
MacBookPro M2芯片... MacBookPro M2芯片下如何搭建React-Native环境目录软件下载环境配置 目录 写在...
Android studio ... 解决 Android studio 出现“The emulator process for AVD ...
pyflink学习笔记(六):... 在pyflink学习笔记(一)中简单介绍了table-sql的窗口函数,下面简单介绍下...
创建deployment 创建deployment服务编排-DeploymentDeployment工作负载均衡器介绍Depl...
gma 1.1.4 (2023... 新增   1、地图工具    a. 增加【GetWorldDEMDataSet】。提供了一套 GEO...
AI专业教您保姆级在暗影精灵8... 目录 一、Stable Diffusion介绍    二、Stable Diffusion环境搭建 ...
vue笔记 第一个Vue应用 Document{{content}}{{...
Unity自带类 --- Ti... 1.在Unity中,自己写的类(脚本)的名字不能与Unit...
托福口语21天——day5 发... 目录 一、连读纠音 二、语料输入+造句输出 三、真题 一、连读纠音 英语中的连读方式有好几种...
五、排序与分页 一、排序 1、语法 ORDER BY 字段 ASC | DESC ASC(ascen...
Linux系统中如何安装软件 文章目录一、rpm包安装方式步骤:二、deb包安装方式步骤:三、tar....
开荒手册4——Related ... 0 写在前面 最早读文献的时候,每每看到related work部分都会选择性的忽略&...
实验01:吃鸡蛋问题 1.实验目的: 通过实验理解算法的概念、算法的表示、算法的时间复杂度和空间复杂度分析&...
8个免费图片/照片压缩工具帮您... 继续查看一些最好的图像压缩工具,以提升用户体验和存储空间以及网站使用支持。 无数图像压...
Spring Cloud Al... 前言 本文小新为大家带来 Sentinel控制台规则配置 相关知识,具体内容包括流控...
多项目同时进行,如何做好进度管... 多项目同时进行,如何做好进度管理? 大多数时候,面对项目进...
ATTCK红队评估实战靶场(二... 前言 第二个靶机来喽,地址:vulunstack 环境配置 大喊一声我...
【MySQL基础】3—多表查询 ⭐⭐⭐⭐⭐⭐ Github主页👉https://github.com/A-BigTr...