RK3228开发之gc2145芯片手册分析

本文详述了GC2145摄像头芯片的手册,该芯片是一款用于手机和数码相机的2兆像素CMOS图像传感器。它集成了10位ADC和图像信号处理器,支持自动曝光、自动白平衡等功能,提供多种数据格式。内容涵盖芯片概述、引脚定义、主要时钟和数据传输协议。
摘要由CSDN通过智能技术生成

一、引言

本章来分析一下gc2145 摄像头的芯片手册,顺便了解一下市场上摄像头的规格

二、芯片手册

1、概况

GC2145是一款高品质的2兆CMOS图像传感器,适用于手机摄像头应用和数码相机产品。GC2145集成了1616V x 1232H有源像素阵列、片上10位ADC和图像信号处理器。
根据不同的光照条件,片上ISP提供了非常平滑的AE(自动曝光)和精确的AWB(自动白平衡)控制,并支持插值、去噪、色彩校正、gamma校正等功能,可以更好地还原真实场景。
传感器还提供各种数据格式,如Bayer RGB、RGB565、YCbCr 4:2:2。所有传感器参数和特性均通过标准2线串行接口控制。
内部主时钟可以由片上锁相环&#x

全志R16的android4.4.2平台点亮gc2145(evb30) 版本:V1.1 1、配置ov2640在android层配置的分辨率为vga(预览/拍照/录像) 注意:系统自带的快拍APP就在这里查找分辨率参数发送到camera的HAL层。 这里得分辨率设置为:拍照1600x1200,预览640x480 驱动里面搜索可以设置为:1600x1200, 1280x720(花屏), 800x600(分辨率不能切换到这里), 640x480 提取分辨率的小知识: R:\wyb\gc2145_parrotv1.1_r16m\lichee\linux-3.4\drivers\media\video\sunxi-vfe\device\gc2145.c 搜索:_regs[] static struct regval_list sensor_default_regs[] = { (默认分辨率是VGA分辨率:640x480) /* 1600X1200 UXGA capture */ static struct regval_list sensor_uxga_regs[] ={ /* 800X600 SVGA,30fps*/ static struct regval_list sensor_svga_regs[] = //1280*720---init---/// static struct regval_list gc2145_hd720_regs[] = { R:\wyb\gc2145_parrotv1.1_r16m\android\device\softwinner\astar-evb30\configs\camera.cfg ;------------------------------------------------------------------------------- ; 用于camera的配置 ; ; 采用格式: ; key = key_value ; 注意: 每个key需要顶格写; ; key_value紧跟着key后面的等号后面, 位于同一行中; ; key_value限制大小为256字节以内; ; ;------------------------------------------------------------------------------- ;------------------------------------------------------------------------------- ; exif information of "make" and "model" ;------------------------------------------------------------------------------- key_camera_exif_make = MAKE_A31S key_camera_exif_model = MODEL_A31ST ;------------------------------------------------------------------------------- ; 1 for single camera, 2 for double camera ;------------------------------------------------------------------------------- number_of_camera = 1 ;------------------------------------------------------------------------------- ; CAMERA_FACING_BACK ; gc0307 gc2145 ;------------------------------------------------------------------------------- camera_id = 0 ;------------------------------------------------------------------------------- ; 1 for CAMERA_FACING_FRONT ; 0 for CAMERA_FACING_BACK ;------------------------------------------------------------------------------- camera_facing = 0 ;------------------------------------------------------------------------------- ; 1 for camera without isp(using built-in isp of Axx) ; 0 for camera with isp ;------------------------------------------------------------------------------- use_builtin_isp = 0 ;------------------------------------------------------------------------------- ; camera orientation (0, 90, 180, 270) ;------------------------------------------------------------------------------- camera_orientation = 90 ;------------------------------------------------------------------------------- ; driver device name ;------------------------------------------------------------------------------- camera_device = /dev/video0 ;------------------------------------------------------------------------------- ; device id ; for two camera devices with one CSI ;------------------------------------------------------------------------------- device_id = 0 used_preview_size = 1 key_support_preview_size = 640x480 key_default_preview_size = 640x480 used_picture_size = 1 ;key_support_picture_size = 1600x1200, 1280x720, 800x600, 640x480 key_support_picture_size = 1600x1200, 640x480 key_default_picture_size = 640x480 used_flash_mode = 0 key_support_flash_mode = on,off,auto key_default_flash_mode = on used_color_effect=0 key_support_color_effect = none,mono,negative,sepia,aqua key_default_color_effect = none used_frame_rate = 1 key_support_frame_rate = 10 key_default_frame_rate = 10 used_focus_mode = 0 key_support_focus_mode = auto,infinity,macro,fixed,continuous-video,continuous-picture key_default_focus_mode = auto used_scene_mode = 0 key_support_scene_mode = auto,portrait,landscape,night,night-portrait,theatre,beach,snow,sunset,steadyphoto,fireworks,sports,party,candlelight,barcode key_default_scene_mode = auto used_white_balance = 0 key_support_white_balance = auto,incandescent,fluorescent,warm-fluorescent,daylight,cloudy-daylight key_default_white_balance = auto used_exposure_compensation = 1 key_max_exposure_compensation = 3 key_min_exposure_compensation = -3 key_step_exposure_compensation = 1 key_default_exposure_compensation = 0 2、在init.rc(init.sun8i.rc)中加载gc2145.ko这个驱动模块。 R:\wyb\gc2145_parrotv1.1_r16m\android\device\softwinner\astar-evb30\init.sun8i.rc #csi module insmod /system/vendor/modules/videobuf-core.ko insmod /system/vendor/modules/videobuf-dma-contig.ko insmod /system/vendor/modules/cam_detect.ko #insmod /system/vendor/modules/actuator.ko #insmod /system/vendor/modules/ad5820_act.ko insmod /system/vendor/modules/cci.ko insmod /system/vendor/modules/vfe_os.ko insmod /system/vendor/modules/vfe_subdev.ko #insmod /system/vendor/modules/gc0307.ko #insmod /system/vendor/modules/gc0308.ko #insmod /system/vendor/modules/ov2035.ko #insmod /system/vendor/modules/ov2640.ko #insmod /system/vendor/modules/ov5640.ko insmod /system/vendor/modules/gc2145.ko insmod /system/vendor/modules/vfe_v4l2.ko 启动之后实际加载的摄像头的驱动模块: shell@astar-evb30:/ $ shell@astar-evb30:/ $ lsmod gt82x 9849 0 - Live 0x00000000 sunxi_schw 12559 0 - Live 0x00000000 (O) rtl8150 9023 0 - Live 0x00000000 sunxi_keyboard 3021 0 - Live 0x00000000 sw_device 13916 0 - Live 0x00000000 uvcvideo 61212 0 - Live 0x00000000 videobuf2_vmalloc 2600 1 uvcvideo, Live 0x00000000 videobuf2_memops 2366 1 videobuf2_vmalloc, Live 0x00000000 videobuf2_core 18902 1 uvcvideo, Live 0x00000000 vfe_v4l2 445492 1 - Live 0x00000000 gc2145 12782 0 - Live 0x00000000 vfe_subdev 4523 2 vfe_v4l2,gc2145, Live 0x00000000 vfe_os 3951 2 vfe_v4l2,vfe_subdev, Live 0x00000000 cci 21775 2 vfe_v4l2,gc2145, Live 0x00000000 videobuf_dma_contig 5567 1 vfe_v4l2, Live 0x00000000 videobuf_core 16520 2 vfe_v4l2,videobuf_dma_contig, Live 0x00000000 bcm_btlpm 7442 0 - Live 0x00000000 bcmdhd 629907 0 - Live 0x00000000 mali 210546 20 - Live 0x00000000 (O) lcd 41263 0 - Live 0x00000000 disp 992816 8 mali,lcd, Live 0x00000000 nand 282782 0 - Live 0x00000000 (O) shell@astar-evb30:/ $ 3、(可选操作)没有/dev/video1,只有/dev/video0 R:\wyb\gc2145_parrotv1.1_r16m\android\device\softwinner\astar-evb30\ueventd.sun8i.rc /dev/video0 0666 media media #/dev/video1 0666 media media 4、驱动程序:gc2145.c及其V4L2的适配层。 配置gc2145.c的编译选项,只需要修改device目录中的Makefile打开gc2145即可: R:\wyb\gc2145_parrotv1.1_r16m\lichee\linux-3.4\drivers\media\video\sunxi-vfe\device\gc2145.c (请严重注意,全志R16的parrotv1.1/android4.4.2的SDK里面是没有,只有android6.0下有) R:\wyb\gc2145_parrotv1.1_r16m\lichee\linux-3.4\drivers\media\video\sunxi-vfe\device\Makefile obj-m += gc2145.o obj-m += gc2155.o (这两个不用修改:) R:\wyb\test_ov2640_r16\lichee\linux-3.4\drivers\media\video\sunxi-vfe\Kconfig R:\wyb\test_ov2640_r16\lichee\linux-3.4\drivers\media\video\sunxi-vfe\Makefile R:\wyb\gc2145_parrotv1.1_r16m\lichee\linux-3.4\drivers\media\video\sunxi-vfe\sensor_info.c struct sensor_item sensor_list_t[] = { // name i2c_addr sensor type sensor size sensor max pclk (请参照OV2640/GC2155配置) { "gc2145" , 0x78, SENSOR_YUV , PIXEL_NUM_2M , CORE_CLK_RATE_FOR_2M}, { "ov2640" , 0x60, SENSOR_YUV , PIXEL_NUM_2M , CORE_CLK_RATE_FOR_2M}, …… }; 5、 R:\wyb\gc2145_parrotv1.1_r16m\lichee\tools\pack\chips\sun8iw5p1\configs\evb-30\sys_config.fex [power_sply] dcdc1_vol = 3000 dcdc2_vol = 1100 dcdc3_vol = 1200 dcdc4_vol = 0 dcdc5_vol = 1500 aldo2_vol = 2500 aldo3_vol = 3000 dldo3_vol = 3300 eldo1_vol = 2800 eldo2_vol = 1800 eldo3_vol = 1800 ;gldo1_vol = 3300 ldoio0_vol = 2800 ldoio1_vol = 3300 ;-------------------------------------------------------------------------------- ;vip (video input port) configuration ;vip_used: 0:disable 1:enable ;vip_mode: 0:sample one interface to one buffer 1:sample two interface to one buffer ;vip_dev_qty: The quantity of devices linked to capture bus ; ;vip_define_sensor_list: If you want use sensor detect function, please set vip_define_sensor_list = 1, and ; verify that file /system/etc/hawkview/sensor_list_cfg.ini is properly configured! ; ;vip_dev(x)_pos: sensor position, "rear" or "front", if vip_define_sensor_list = 1,vip_dev(x)_pos must be configured! ; ;vip_dev(x)_isp_used 0:not use isp 1:use isp ;vip_dev(x)_fmt: 0:yuv 1:bayer raw rgb ;vip_dev(x)_stby_mode: 0:not shut down power at standby 1:shut down power at standby ;vip_dev(x)_vflip: flip in vertical direction 0:disable 1:enable ;vip_dev(x)_hflip: flip in horizontal direction 0:disable 1:enable ;vip_dev(x)_iovdd: camera module io power handle string, pmu power supply ;vip_dev(x)_iovdd_vol: camera module io power voltage, pmu power supply ;vip_dev(x)_avdd: camera module analog power handle string, pmu power supply ;vip_dev(x)_avdd_vol: camera module analog power voltage, pmu power supply ;vip_dev(x)_dvdd: camera module core power handle string, pmu power supply ;vip_dev(x)_dvdd_vol: camera module core power voltage, pmu power supply ;vip_dev(x)_afvdd: camera module vcm power handle string, pmu power supply ;vip_dev(x)_afvdd_vol: camera module vcm power voltage, pmu power supply ;x indicates the index of the devices which are linked to the same capture bus ;fill voltage in uV, e.g. iovdd = 2.8V, vip_devx_iovdd_vol = 2800000 ;fill handle string as below: ;axp22_eldo3 ;axp22_dldo4 ;axp22_eldo2 ;fill handle string "" when not using any pmu power supply ;-------------------------------------------------------------------------------- [csi0] vip_used = 1 vip_mode = 0 vip_dev_qty = 1 vip_define_sensor_list = 0 vip_csi_pck = port:PE00<2><default><default><default> vip_csi_mck = port:PE01<2><default><default><default> vip_csi_hsync = port:PE02<2><default><default><default> vip_csi_vsync = port:PE03<2><default><default><default> vip_csi_d0 = port:PE04<2><default><default><default> vip_csi_d1 = port:PE05<2><default><default><default> vip_csi_d2 = port:PE06<2><default><default><default> vip_csi_d3 = port:PE07<2><default><default><default> vip_csi_d4 = port:PE08<2><default><default><default> vip_csi_d5 = port:PE09<2><default><default><default> vip_csi_d6 = port:PE10<2><default><default><default> vip_csi_d7 = port:PE11<2><default><default><default> vip_csi_sck = port:PE12<2><default><default><default> vip_csi_sda = port:PE13<2><default><default><default> vip_dev0_mname = "gc2145" vip_dev0_pos = "rear" vip_dev0_lane = 1 vip_dev0_twi_id = 2 vip_dev0_twi_addr = 0x78 vip_dev0_isp_used = 0 vip_dev0_fmt = 0 vip_dev0_stby_mode = 0 vip_dev0_vflip = 0 vip_dev0_hflip = 0 vip_dev0_iovdd = "" vip_dev0_iovdd_vol = 2800000 vip_dev0_avdd = "axp22_ldoio0" vip_dev0_avdd_vol = 2800000 vip_dev0_dvdd = "axp22_ldoio1" vip_dev0_dvdd_vol = 1800000 vip_dev0_afvdd = "" vip_dev0_afvdd_vol = 2800000 vip_dev0_power_en = vip_dev0_reset = port:PE14<1><default><default><0> vip_dev0_pwdn = port:PE15<1><default><default><1> vip_dev0_flash_en = vip_dev0_flash_mode = vip_dev0_af_pwdn = (可选配置:) ;---------------------------------------------------------------------------------- ;usb configuration ;usb_used: usb controller enable, 0-disable, 1-enable ;usb_port_type: usb mode: 0-device, 1-host, 2-otg ;usb_detect_type: usb hotplug detect mode, 0-none, 1-vbus/id detect, 2-id/dpdm detect ;usb_id_gpio: usb id detect IO ;usb_det_vbus_gpio: usb vbus detect IO, "axp_ctrl" for axp ;usb_drv_vbus_gpio: usb dirve vbus IO ;usb_restrict_gpio: usb current restrict IO ;usb_restric_flag: usb current restrict flag ;---------------------------------------------------------------------------------- [usbc0] usb_used = 1 usb_port_type = 0 power_start = 3 6、开发板上摄像头的I2C挂载在TWI2上面了,逻辑是需要打开的(但是不打开也能够用,很奇怪!): ;---------------------------------------------------------------------------------- ;i2c configuration ; twi_used = twix enable ;---------------------------------------------------------------------------------- [twi0] twi_used = 1 twi_scl = port:PH02<2><default><default><default> twi_sda = port:PH03<2><default><default><default> [twi1] twi_used = 1 twi_scl = port:PH04<2><default><default><default> twi_sda = port:PH05<2><default><default><default> [twi2] twi_used = 0 twi_scl = port:PE12<3><default><default><default> twi_sda = port:PE13<3><default><default><default> 直接配置摄像头的I2C了: vip_csi_sck = port:PE12<2><default><default><default> vip_csi_sda = port:PE13<2><default><default><default> 不过奇怪的是,摄像头并没有向其它平台那样生成设备节点: shell@astar-evb30:/ $ shell@astar-evb30:/ $ cd /sys/class/i2c-adapter shell@astar-evb30:/sys/class/i2c-adapter $ shell@astar-evb30:/sys/class/i2c-adapter $ shell@astar-evb30:/sys/class/i2c-adapter $ ll lrwxrwxrwx root root 1970-01-01 08:00 i2c-0 -> ../../devices/platform/twi.0/i2c-0 lrwxrwxrwx root root 1970-01-01 08:00 i2c-1 -> ../../devices/platform/twi.1/i2c-1 shell@astar-evb30:/sys/class/i2c-adapter $ 可能是全志R16的驱动程序不太规范吧!没有通过i2c_detect来注册2-003C这个节点。 直接在驱动程序中读取I2C,还是对的。0xF0/0xF1 device ID = 0x2145。 #define V4L2_IDENT_SENSOR 0x2145 /* * The gc2145 sits on i2c with ID 0x78 */ #define I2C_ADDR 0x78 #define SENSOR_NAME "gc2145"
UNICODE 全志R16平台TINAV2.1下的CSI接口摄像头ov5640的配置v1.2.txt R16_Camera模块开发说明文档_V1.8.pdf 所有步骤请按照这个说明书执行 1、驱动的编译配置: R:\wyb\gc2145_tinav2.1\lichee\linux-3.4\drivers\media\video\sunxi-vfe\device\gc2145.c R:\wyb\gc2145_tinav2.1\lichee\linux-3.4\drivers\media\video\sunxi-vfe\device\Makefile (可选操作,除了gc2145之外,其它的摄像头驱动都关闭,肯定可以减小最终生成的IMG的大小!) obj-m += ov5640.o obj-m += ov2640.o #obj-m += ov7736.o #obj-m += s5k4ec.o #obj-m += s5k4ec_mipi.o #obj-m += gc2035.o #obj-m += gt2005.o #obj-m += gc0307.o obj-m += gc0308.o #obj-m += gc0328.o #obj-m += gc0328c.o #obj-m += gc0329.o #obj-m += gc0311.o #obj-m += hi253.o #obj-m += sp2518.o #obj-m += sp2519.o #obj-m += sp0718.o #obj-m += sp0838.o #obj-m += ov16825.o #obj-m += ov5650.o #obj-m += ov5647.o #obj-m += ov5647_mipi.o #obj-m += t8et5.o #obj-m += s5k4e1.o #obj-m += s5k4e1_mipi.o #obj-m += sp2518.o #obj-m += sp0718.o #obj-m += gc5004.o #obj-m += gc5004_mipi.o #obj-m += ov5648.o #obj-m += ar0330.o #obj-m += ov5648.o #obj-m += sp5408.o #obj-m += ov12830.o #obj-m += ov8825.o #obj-m += ov8850.o #obj-m += gc2155.o obj-m += gc2145.o obj-m += gc2145d.o #obj-m += ov8858.o #obj-m += ov13850.o #obj-m += imx214.o #obj-m += ov8858_4lane.o #obj-m += sp5409.o #obj-m += s5k5e2yx.o #obj-m += ov2710_mipi.o #obj-m += siv121d.o #obj-m += ov2710_mipi.o #obj-m += bg0703.o #obj-m += gc1014_mipi.o #obj-m += imx219.o #obj-m += imx224.o #obj-m += imx322.o #obj-m += ov8858_r2a_4lane.o #obj-m += ov8865_4lane.o #obj-m += ps1210.o #obj-m += imx291.o 2、R:\wyb\gc2145_tinav2.1\lichee\linux-3.4\drivers\media\video\sunxi-vfe\vfe.c 这里修正之后就一切正常了。不然摄像头在系统启动之后就永远休眠了。 static void probe_work_handle(struct work_struct *work) { …… #ifdef CONFIG_ES dev->early_suspend.level = EARLY_SUSPEND_LEVEL_DISABLE_FB + 1; dev->early_suspend.suspend = vfe_early_suspend; dev->early_suspend.resume = vfe_late_resume; // [hawkview_err]xxxxcan't open /dev/video0(Resource temporarily unavailable) // 2016/10/25 14:33 wenyuanbo cloase suspend. // register_early_suspend(&dev->early_suspend); vfe_print("register_early_suspend @ probe handle!\n"); #endif …… } 3、请严重注意:全志原生提供的cameratest有点错误(和tinav1.0对比得知:保存获取图片的文件名有小错误) R:\wyb\gc2145_tinav2.1\package\allwinner\cameratest\src\common\hawkview.c int fetch_sub_cmd(const char* buf,int buf_len,char** cmd,int* cmd_num,int lenght) { int i = 0,j = 0,n = 0; while(buf[i] != '#'){ //the sub cmd end by '#' while(buf[i] != 'x' && buf[i] != ':' && buf[i] != '#') { if((i+1) > buf_len) return 0; *((char*)cmd + n*lenght + j++) = buf[i++]; …… } R:\wyb\gc2145_tinav2.1\package\allwinner\cameratest\src\common\video.c static int capture_frame(void* capture,int (*set_disp_addr)(int,int,unsigned int*),pthread_mutex_t* mutex) { …… //sync capture info perp x second #define M_SECOND 200 if(is_x_msec(M_SECOND,(long long)(buf.timestamp.tv_sec),(long long)(buf.timestamp.tv_usec))){ getExifInfo(&(cap->frame.exif)); (建议关闭这里) // set_cap_info((void*)cap); } …… } R:\wyb\gc2145_tinav2.1\package\allwinner\cameratest\src\common\video_helper.c int set_cap_info(void* capture) { …… (修改这里) //strcpy(file_path, "dev/info"); sprintf(file_path, "%s/%s.info", PATH, cap->picture.path_name); …… } int do_save_sub_image(void* capture,int buf_index) { …… (增加这里) set_cap_info(capture); set_exif_info(capture); hv_dbg("--------set_exif_info end\n"); …… } 4、配置为在系统启动的时候加载gc2145.ko(SDK默认加载的是gc0308.ko) R:\wyb\gc2145_tinav2.1\target\allwinner\astar-common\modules.mk define KernelPackage/sunxi-vfe SUBMENU:=$(VIDEO_MENU) TITLE:=sunxi-vfe support FILES:=$(LINUX_DIR)/drivers/media/video/videobuf-core.ko FILES+=$(LINUX_DIR)/drivers/media/video/videobuf-dma-contig.ko FILES+=$(LINUX_DIR)/drivers/media/video/sunxi-vfe/csi_cci/cci.ko FILES+=$(LINUX_DIR)/drivers/media/video/sunxi-vfe/vfe_os.ko FILES+=$(LINUX_DIR)/drivers/media/video/sunxi-vfe/vfe_subdev.ko (修改这里) FILES+=$(LINUX_DIR)/drivers/media/video/sunxi-vfe/device/gc2145.ko FILES+=$(LINUX_DIR)/drivers/media/video/sunxi-vfe/vfe_v4l2.ko (修改这里) AUTOLOAD:=$(call AutoLoad,90,videobuf-core videobuf-dma-contig cci vfe_os vfe_subdev gc2145 vfe_v4l2) endef 5、直接使用了tinav1.0上调通ov5640后的sys_config.fex (请注意:这里修改的电源部分,其他没有用到的设备都请关闭掉。请参照您的原理图修改摄像头的供电部分!!!!) R:\wyb\gc2145_tinav2.1\target\allwinner\astar-parrot\configs\sys_config.fex [power_sply] dcdc1_vol = 3000 dcdc2_vol = 1100 dcdc3_vol = 1200 dcdc4_vol = 0 dcdc5_vol = 1500 aldo2_vol = 2500 aldo3_vol = 3000 (这里是增加的电源部分:) dldo3_vol = 2800 ;gpio0_vol = 2800 ldoio0_vol = 2800 [csi0] vip_used = 1 vip_mode = 0 vip_dev_qty = 1 vip_define_sensor_list = 0 vip_csi_pck = port:PE00 vip_csi_mck = port:PE01 vip_csi_hsync = port:PE02 vip_csi_vsync = port:PE03 vip_csi_d0 = port:PE04 vip_csi_d1 = port:PE05 vip_csi_d2 = port:PE06 vip_csi_d3 = port:PE07 vip_csi_d4 = port:PE08 vip_csi_d5 = port:PE09 vip_csi_d6 = port:PE10 vip_csi_d7 = port:PE11 ;vip_csi_sck = port:PE12 ;vip_csi_sda = port:PE13 ;vip_dev0_mname = "gc0308" ;vip_dev0_mname = "ov5640" vip_dev0_mname = "gc2145" vip_dev0_pos = "rear" vip_dev0_lane = 1 vip_dev0_twi_id = 2 ;vip_dev0_twi_addr = 0x42 vip_dev0_twi_addr = 0x78 vip_dev0_isp_used = 0 vip_dev0_fmt = 0 (2017/4/6 11:41 wenyuanbo 调试的时候这里设置为0方便测量摄像头的供电部分^_) ;vip_dev0_stby_mode = 1 vip_dev0_stby_mode = 0 vip_dev0_vflip = 0 vip_dev0_hflip = 0 vip_dev0_iovdd = "axp22_dldo3" vip_dev0_iovdd_vol = 2800000 vip_dev0_avdd = "" vip_dev0_avdd_vol = 2800000 vip_dev0_dvdd = "" vip_dev0_dvdd_vol = 1800000 vip_dev0_afvdd = "" vip_dev0_afvdd_vol = 2800000 vip_dev0_power_en = vip_dev0_reset = port:PE14 vip_dev0_pwdn = port:PE15 vip_dev0_flash_en = vip_dev0_flash_mode = vip_dev0_af_pwdn = (这个可以不改。不需要支持OTG功能。) ;usb_port_type: usb mode: 0-device, 1-host, 2-otg …… [usbc0] usb_used = 1 ;usb_port_type = 2 usb_port_type = 0 (!!!!解决重启的问题) [pmu1_para] …… ;power_start = 0 power_start = 3 pmu_temp_enable = 0 6、第一次编译之后,再次配置: 10、在menuconfig中打开sunxi-vfe support rootroot@rootroot-E400:~/wyb/gc2145_tinav2.1$ pwd /home/rootroot/wyb/gc2145_tinav2.1 rootroot@rootroot-E400:~/wyb/gc2145_tinav2.1$ source build/envsetup.sh including target/allwinner/tulip-d1/vendorsetup.sh including target/allwinner/octopus-dev/vendorsetup.sh including target/allwinner/azalea-perf3/vendorsetup.sh including target/allwinner/octopus-sch/vendorsetup.sh including target/allwinner/azalea-evb/vendorsetup.sh including target/allwinner/azalea-perf2/vendorsetup.sh including target/allwinner/astar-parrot/vendorsetup.sh including target/allwinner/generic/vendorsetup.sh including target/allwinner/astar-spk/vendorsetup.sh including target/allwinner/azalea-perf1/vendorsetup.sh including target/allwinner/astar-evb/vendorsetup.sh rootroot@rootroot-E400:~/wyb/gc2145_tinav2.1$ lunch You're building on Linux Lunch menu... pick a combo: 1. tulip_d1-tina 2. tulip_d1-dragonboard 3. octopus_dev-tina 4. octopus_dev-dragonboard 5. azalea_perf3-tina 6. azalea_perf3-dragonboard 7. octopus_sch-tina 8. octopus_sch-dragonboard 9. azalea_evb-tina 10. azalea_evb-dragonboard 11. azalea_perf2-tina 12. azalea_perf2-dragonboard 13. astar_parrot-tina 14. astar_parrot-dragonboard 15. astar_spk-tina 16. astar_spk-dragonboard 17. azalea_perf1-tina 18. azalea_perf1-dragonboard 19. astar_evb-tina Which would you like?13 ============================================ PLATFORM_VERSION_CODENAME=Neptune PLATFORM_VERSION=2.0.0 TARGET_PRODUCT=astar_parrot TARGET_BUILD_VARIANT=tina TARGET_BUILD_TYPE=release TARGET_BUILD_APPS= TARGET_ARCH=arm TARGET_ARCH_VARIANT=armv7-a-neon TARGET_CPU_VARIANT=cortex-a7 TARGET_2ND_ARCH= TARGET_2ND_ARCH_VARIANT= TARGET_2ND_CPU_VARIANT= HOST_ARCH=x86_64 HOST_OS=linux HOST_OS_EXTRA=Linux-3.13.0-24-generic-x86_64-with-Ubuntu-14.04-trusty HOST_BUILD_TYPE=release BUILD_ID=57513AA3 OUT_DIR= ============================================ rootroot@rootroot-E400:~/wyb/gc2145_tinav2.1$ make -j8 rootroot@rootroot-E400:~/wyb/gc2145_tinav2.1$ make menuconfig Kernel modules ---> Video Support ---> kmod-sunxi-vfe......................................... sunxi-vfe support 7、编译打包刷机之后的串口(debug口的)打印信息:: rootroot@cm-System-Product-Name:/home/rediron/r16/gc2145_tinav2.1$ cp .config bak2_vfe.config rootroot@rootroot-virtual-machine:~/wyb/opencv3.1_r16_tinav2.1$ make -j8 rootroot@rootroot-virtual-machine:~/wyb/opencv3.1_r16_tinav2.1$ pack -d 验证gc2145的驱动是否正常加载: Xshell 5 (Build 0964) Copyright (c) 2002-2016 NetSarang Computer, Inc. All rights reserved. Type `help' to learn how to use Xshell prompt. [c:\~]$ Connecting to COM3... Connected. BusyBox v1.24.1 () built-in shell (ash) _____ _ __ _ |_ _||_| ___ _ _ | | |_| ___ _ _ _ _ | | _ | || | | |__ | || || | ||_'_| | | | || | || _ | |_____||_||_|_||___||_,_| |_| |_||_|_||_|_| Tina is Based on OpenWrt! ---------------------------------------------- Tina Linux (Neptune, 57513AA3) ---------------------------------------------- root@TinaLinux:/# root@TinaLinux:/# cd /dev root@TinaLinux:/dev# ll v* crw-r--r-- 1 root root 7, 0 Jan 2 08:02 vcs crw-r--r-- 1 root root 7, 1 Jan 2 08:02 vcs1 crw-r--r-- 1 root root 7, 128 Jan 2 08:02 vcsa crw-r--r-- 1 root root 7, 129 Jan 2 08:02 vcsa1 crw-r--r-- 1 root root 10, 54 Jan 2 08:02 vhci crw-r--r-- 1 root root 81, 0 Jan 2 08:02 video0 root@TinaLinux:/# lsmod bcmdhd 534841 0 cci 19880 2 gc2145 gc2145 11234 0 snd_mixer_oss 11252 1 snd_pcm_oss snd_pcm_oss 29795 0 snd_seq_device 3927 0 vfe_os 3065 2 vfe_v4l2 vfe_subdev 3941 2 vfe_v4l2 vfe_v4l2 335707 0 videobuf_core 12030 2 vfe_v4l2 videobuf_dma_contig 2553 1 vfe_v4l2 root@TinaLinux:/# root@TinaLinux:/dev# cd /sys/class/i2c-adapter/i2c- i2c-0/ i2c-1/ i2c-2/ root@TinaLinux:/dev# cd /sys/class/i2c-adapter/i2c-2 root@TinaLinux:/sys/devices/platform/twi.2/i2c-2# ll drwxr-xr-x 4 root root 0 Jan 2 08:02 . drwxr-xr-x 4 root root 0 Jan 2 08:02 .. drwxr-xr-x 3 root root 0 Jan 2 08:04 2-003c --w------- 1 root root 4096 Jan 2 08:04 delete_device lrwxrwxrwx 1 root root 0 Jan 2 08:04 device -> ../../twi.2 -r--r--r-- 1 root root 4096 Jan 2 08:04 name --w------- 1 root root 4096 Jan 2 08:04 new_device drwxr-xr-x 2 root root 0 Jan 2 08:04 power lrwxrwxrwx 1 root root 0 Jan 2 08:04 subsystem -> ../../../../bus/i2c -rw-r--r-- 1 root root 4096 Jan 2 08:04 uevent root@TinaLinux:/sys/devices/platform/twi.2/i2c-2# cd 2-003c root@TinaLinux:/sys/devices/platform/twi.2/i2c-2/2-003c# ll drwxr-xr-x 3 root root 0 Jan 2 08:04 . drwxr-xr-x 4 root root 0 Jan 2 08:02 .. lrwxrwxrwx 1 root root 0 Jan 2 08:04 driver -> ../../../../../bus/i2c/drivers/ov5640 -r--r--r-- 1 root root 4096 Jan 2 08:04 modalias -r--r--r-- 1 root root 4096 Jan 2 08:04 name drwxr-xr-x 2 root root 0 Jan 2 08:04 power lrwxrwxrwx 1 root root 0 Jan 2 08:04 subsystem -> ../../../../../bus/i2c -rw-r--r-- 1 root root 4096 Jan 2 08:04 uevent root@TinaLinux:/sys/devices/platform/twi.2/i2c-2/2-003c# cat name gc2145 root@TinaLinux:/sys/devices/platform/twi.2/i2c-2/2-003c# 获取YUV格式的图片: [ 19.184637] dhd_open: Exit ret=0 [ 22.716117] sndpcm_startup,l:1688,pa_vol:40 BusyBox v1.24.1 () built-in shell (ash) _____ _ __ _ |_ _||_| ___ _ _ | | |_| ___ _ _ _ _ | | _ | || | | |__ | || || | ||_'_| | | | || | || _ | |_____||_||_|_||___||_,_| |_| |_||_|_||_|_| Tina is Based on OpenWrt! ---------------------------------------------- Tina Linux (Neptune, 57513AA3) ---------------------------------------------- root@TinaLinux:/# root@TinaLinux:/# root@TinaLinux:/# pwd / root@TinaLinux:/# root@TinaLinux:/# root@TinaLinux:/# root@TinaLinux:/# cameratest [hawkview_dbg]hawkview_init set_w 1280 [hawkview_msg]----sunxi9iw1p1 capture register sucessfully! [hawkview_dbg]hawkview_init 2 [hawkview_dbg]video pthread_create ret:0 [hawkview_dbg]video thread status 0 --> 101 [hawkview_dbg]command pthread_create ret:0 (等待输入需要获取的YUV图片的分辨率:) [hawkview_dbg]read cmd [ 181.303764] [VFE]vfe_open 146:0:1:1600x1200# [hawkview_[ 181.308582] [VFE]..........................vfe clk open!....................... dbg]cmd 0: 146 [hawkview_dbg]cm[ 181.319592] [VFE]vfe_open ok d 1: 0 [hawkview_dbg]cmd 2: 1 [hawkview_dbg]cmd 3: 1600 [hawkview_dbg]cmd 4: 1200 [hawkview_dbg]send command 146 [hawkview_dbg]video thread cmd: 0 --> 146 [hawkview_dbg]reset video capture [hawkview_msg]----open /dev/video0 [hawkview_msg]----get sensor type: 0 [ 182.325602] [VFE_ERR]set input i(1)>dev_qty(1)-1 error! [hawkview_err]xxxxVIDIOC_S_INPUT[ 182.331594] [VFE]Set vfe core clk = 108000000, after Set vfe core clk = 99000000 failed! s_input: 1 [ 182.366903] [VFE]mclk on [ 182.393862] [CSI][GC2145]enable oe! [ 182.398584] [CSI][GC2145]V4L2_IDENT_SENSOR=2145[hawkview_msg]----the tried size [ 182.875861] [VFE]buffer_setup, buffer count=10, size=2884096 is 1600x1200,the supported size is 1600x1200! [hawkview_dbg]map buffer index: 0, mem: b6bc8000, len: 2c0200, offset: 0 [hawkview_dbg]map buffer index: 1, mem: b6907000, len: 2c0200, offset: 2c1000 [hawkview_dbg]map buffer index: 2, mem: b6646000, len: 2c0200, offset: 582000 [hawkview_dbg]map buffer index: 3, mem: b6385000, len: 2c0200, offset: 843000 [hawkview_dbg]map buffer index: 4, mem: b60c4000, len: 2c0200, offset: b04000 [hawkview_dbg]map buffer index: 5, mem: b5e03000, len: 2c0200, offset: dc5000 [hawkview_dbg]map buffer index: 6, mem: b5b42000, len: 2c0200, offset: 1086000 [hawkview_dbg]map buffer index: 7, mem: b5881000, len: 2c0200, offset: 1347000 [hawkview_dbg]map buffer index: 8, mem: b55c0000, len: 2c0200, offset: 1608000 [hawkview_dbg]map buffer index: 9, mem: b52ff000, len: 2c0200, offset: 18c9000 [hawkview_dbg]video thread status 101 --> 102 [hawkview_dbg]capture frame command -1 --> 161 [hawkview_dbg]capture frame status -1 --> 0 [hawkview_dbg]capture start streaming [hawkview_dbg]capture frame command 161 --> 0 [hawkview_dbg]capture frame status 0 --> 1 [ 183.030025] [VFE]capture video mode! [ 183.132659] [VFE]capture video first frame done! (等待输入希望获取的YUV图片的文件名:) [hawkview_dbg]read cmd 149:color1013.yuv# [hawkview_dbg]cmd 0: 149 [hawkview_dbg]cmd 1: color1013.yuv [hawkview_dbg]send command 149 [hawkview_dbg]index: 3 buffers[buf.index].start = 0xb6385000 [hawkview_dbg]image_name: /tmp/color1013.yuv [hawkview_err]xxxxOpen sync file error[hawkview_dbg]image exif info: image_name = color1013.yuv width = 1600 height = 1200 exp_time_num = 0 exp_time_den = 0 sht_speed_num = 0 sht_speed_den = 0 fnumber = 0 exp_bias = 0 foc_length = 0 iso_speed = 0 flash_fire = 0 brightness = 0 # [hawkview_dbg]--------set_exif_info end (全志没有设置结束按键,只有按ctrl+C组合按键结束程序) ^C[ 270.859423] [VFE]vfe_close [ 270.862589] [CSI][GC2145]disalbe oe! [ 270.878791] [VFE]mclk off [ 270.893865] [VFE]..........................vfe clk close!....................... [ 270.902299] [VFE]vfe_close end root@TinaLinux:/# 8、在电脑的命令行中使用adb shell: Microsoft Windows [版本 6.1.7600] 版权所有 (c) 2009 Microsoft Corporation。保留所有权利。 C:\Users\Administrator>adb shell BusyBox v1.24.1 () built-in shell (ash) _____ _ __ _ |_ _||_| ___ _ _ | | |_| ___ _ _ _ _ | | _ | || | | |__ | || || | ||_'_| | | | || | || _ | |_____||_||_|_||___||_,_| |_| |_||_|_||_|_| Tina is Based on OpenWrt! ---------------------------------------------- Tina Linux (Neptune, 57513AA3) ---------------------------------------------- root@TinaLinux:/# cd tmp cd tmp root@TinaLinux:/tmp# ll ll drwxrwxrwt 9 root root 300 Jan 2 20:15 . drwxr-xr-x 1 root root 1024 Jan 2 20:15 .. drwx------ 2 root root 40 Jan 2 20:15 .uci -rw-r--r-- 1 root root 6 Jan 2 20:15 TZ -rw-r--r-- 1 root root 5 Jan 2 20:15 booting_state drwxrwxrwx 2 root root 40 Jan 2 20:15 lock drwxr-xr-x 2 root root 80 Jan 2 20:15 log lrwxrwxrwx 1 root root 21 Jan 2 20:15 resolv.conf -> /tmp/res olv.conf.auto -rw-r--r-- 1 root root 0 Jan 2 20:15 resolv.conf.auto drwxrwxrwx 2 root root 100 Jan 2 20:15 run drwxrwxrwt 2 root root 40 Jan 2 20:15 shm drwxrwxrwx 2 root root 60 Jan 2 20:15 state drwxr-xr-x 2 root root 40 Jan 2 20:15 tmp srwxr-xr-x 1 root root 0 Jan 2 20:15 wpa_ctrl_254-32 srwxr-xr-x 1 root root 0 Jan 2 20:15 wpa_ctrl_254-33 root@TinaLinux:/tmp# root@TinaLinux:/tmp# (1600x1200为您所希望获取的图片的分辨率,请根据您的需要来设置) root@TinaLinux:/tmp# echo "146:0:1:1600x1200#" > command echo "146:0:1:1600x1200#" > command (color1013.yuv为您希望保存yuv图像的文件名) root@TinaLinux:/tmp# echo "149:color1013.yuv#" > command echo "149:color1013.yuv#" > command root@TinaLinux:/tmp# ll ll drwxrwxrwt 9 root root 360 Jan 2 20:19 . drwxr-xr-x 1 root root 1024 Jan 2 20:15 .. drwx------ 2 root root 40 Jan 2 20:15 .uci -rw-r--r-- 1 root root 6 Jan 2 20:15 TZ -rw-r--r-- 1 root root 5 Jan 2 20:15 booting_state -rw-r--r-- 1 root root 1000 Jan 2 20:19 color1013.yuv.exif -rw-rw-rw- 1 root root 19 Jan 2 20:19 command drwxrwxrwx 2 root root 40 Jan 2 20:15 lock drwxr-xr-x 2 root root 80 Jan 2 20:15 log lrwxrwxrwx 1 root root 21 Jan 2 20:15 resolv.conf -> /tmp/res olv.conf.auto -rw-r--r-- 1 root root 0 Jan 2 20:15 resolv.conf.auto drwxrwxrwx 2 root root 100 Jan 2 20:15 run drwxrwxrwt 2 root root 40 Jan 2 20:15 shm drwxrwxrwx 2 root root 60 Jan 2 20:15 state drwxr-xr-x 2 root root 40 Jan 2 20:15 tmp srwxr-xr-x 1 root root 0 Jan 2 20:15 wpa_ctrl_254-32 srwxr-xr-x 1 root root 0 Jan 2 20:15 wpa_ctrl_254-33 -rw-r--r-- 1 root root 2880000 Jan 2 20:19 yuvcolor1013.yuv 可以再开一个adb窗口,adb可以开很多个的^_ Microsoft Windows [版本 6.1.7600] 版权所有 (c) 2009 Microsoft Corporation。保留所有权利。 C:\Users\Administrator>cd C:\tmp_gc2145 C:\tmp_gc2145>dir 驱动器 C 中的卷是 WIN7B64 卷的序列号是 C43E-FFB3 C:\tmp_gc2145 的目录 2017/05/23 17:04 . 2017/05/23 17:04 .. 0 个文件 0 字节 2 个目录 21,963,571,200 可用字节 获取图片:(这里使用了简单粗暴的方法,全部拿出来了。) C:\tmp_gc2145>adb pull /tmp/ . pull: building file list... skipping special file 'wpa_ctrl_254-33' skipping special file 'wpa_ctrl_254-32' skipping special file 'resolv.conf' skipping special file 'ubus.sock' pull: /tmp/log/wtmp -> ./log/wtmp pull: /tmp/log/lastlog -> ./log/lastlog pull: /tmp/state/network -> ./state/network pull: /tmp/run/config.md5 -> ./run/config.md5 pull: /tmp/run/ntpd.pid -> ./run/ntpd.pid pull: /tmp/booting_state -> ./booting_state pull: /tmp/resolv.conf.auto -> ./resolv.conf.auto pull: /tmp/TZ -> ./TZ pull: /tmp/command -> ./command pull: /tmp/color1013.yuv.exif -> ./color1013.yuv.exif pull: /tmp/yuvcolor1013.yuv -> ./yuvcolor1013.yuv 11 files pulled. 0 files skipped. 8820 KB/s (2881342 bytes in 0.319s) C:\tmp_gc2145> (可选操作:) C:\tmp_gc2145>adb pull /tmp/yuvcolor1013.yuv c:\ 现在激动人心的时刻到来了,你可以使用yuv看图工具:yuvplayer.exe 来查看你所获取的YUV格式的图片:yuvtest1013.yuv 请注意需要设置: YUV的格式设置:(NV12) 分辨率设置(1600x1200):请以您的实际分辨率为准。 9、可能会用到的调试命令: dmesg ps -aux ps -e 10、可选的改进(可以不修改的): R:\wyb\gc2145_tinav2.1\target\allwinner\generic\configs\env-3.4.cfg (uboot启动的时候延迟3秒钟) bootdelay=3 (SDK中已经修改了。调低打印等级,以便尽可能多的看到打印信息) loglevel=8
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

文艺小少年

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值