Allwinner V3s + ov2640 + SPR5801

最近在调试荔枝派Zero Allwinner V3s + ov2640 + SPR5801

1. uboot,正常修改,增加zImage 8k 地址 dd烧录。

首先获取u-boot源码: git clone https://github.com/Lichee-Pi/u-boot.git -b v3s-current
修改 include/configs/sun8i.h, 使u-boot可以直接从tf卡启动:

/*
 * (C) Copyright 2014 Chen-Yu Tsai <wens@csie.org>
 *
 * Configuration settings for the Allwinner A23 (sun8i) CPU
 *
 * SPDX-License-Identifier:	GPL-2.0+
 */

#ifndef __CONFIG_H
#define __CONFIG_H

/*
 * A23 specific configuration
 */

#ifdef CONFIG_USB_EHCI
#define CONFIG_USB_EHCI_SUNXI
#endif

#ifdef CONFIG_MACH_SUN8I_H3
	#define CONFIG_SUNXI_USB_PHYS	4
#elif defined CONFIG_MACH_SUN8I_A83T
	#define CONFIG_SUNXI_USB_PHYS	3
#elif defined CONFIG_MACH_SUN8I_V3S
	#define CONFIG_SUNXI_USB_PHYS	1
#else
	#define CONFIG_SUNXI_USB_PHYS	2
#endif

/*
 * Include common sunxi configuration where most the settings are
 */



#define CONFIG_BOOTCOMMAND   "setenv bootm_boot_mode sec; " \
                        "load mmc 0:1 0x41000000 zImage; "  \
                        "load mmc 0:1 0x41800000 sun8i-v3s-licheepi-zero-dock.dtb; " \
                        "bootz 0x41000000 - 0x41800000;"

#define CONFIG_BOOTARGS      "console=ttyS0,115200 panic=5 rootwait root=/dev/mmcblk0p2 earlyprintk rw  vt.global_cursor_default=0"


#include <configs/sunxi-common.h>

#endif /* __CONFIG_H */

2. kernel

下载 linux-zero-5.2.y 增加对 ov2640 的配置。
linux-zero-5.2.y/arch/arm/boot/dts$ gedit sun8i-v3s.dtsi
...
csi1: csi@1cb4000 {
		compatible = "allwinner,sun8i-v3s-csi";
		reg = <0x01cb4000 0x1000>;
		interrupts = <GIC_SPI 84 IRQ_TYPE_LEVEL_HIGH>;
		clocks = <&ccu CLK_BUS_CSI>,
				<&ccu CLK_CSI1_SCLK>,
				<&ccu CLK_DRAM_CSI>;
		clock-names = "bus", "mod", "ram";
		resets = <&ccu RST_BUS_CSI>;
		status = "disabled";
	};
	pio: pinctrl@1c20800 {
		compatible = "allwinner,sun8i-v3s-pinctrl";
		reg = <0x01c20800 0x400>;
		interrupts = <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>,
			     <GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>;
		clocks = <&ccu CLK_BUS_PIO>, <&osc24M>, <&osc32k>;
		clock-names = "apb", "hosc", "losc";
		gpio-controller;
		#gpio-cells = <3>;
		interrupt-controller;
		#interrupt-cells = <3>;

		emac_rgmii_pins: emac-rgmii-pins {
			pins = "PD0", "PD1", "PD2", "PD3", "PD4",
			       "PD5", "PD7", "PD8", "PD9", "PD10",
			       "PD12", "PD13", "PD15", "PD16", "PD17";
			function = "emac";
                            allwinner,drive = <SUN4I_PINCTRL_40_MA>;
                            allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
			drive-strength = <40>;
		};

		i2c0_pins: i2c0-pins {
			pins = "PB6", "PB7";
			function = "i2c0";
		};

		pwm0_pins: pwm0 {
			pins = "PB4";
			function = "pwm0";
		};

		uart0_pb_pins: uart0-pb-pins {
			pins = "PB8", "PB9";
			function = "uart0";
		};

		lcd_rgb666_pins_a: lcd-rgb666-pe {
			pins = "PE0", "PE1", "PE2", "PE3", "PE4", "PE5",
			       "PE6", "PE7", "PE8", "PE9", "PE10", "PE11",
			       "PE12", "PE13", "PE14", "PE15", "PE16", "PE17",
			       "PE18", "PE19", "PE23", "PE24";
			function = "lcd";
		};

		mmc0_pins: mmc0-pins {
			pins = "PF0", "PF1", "PF2", "PF3",
			       "PF4", "PF5";
			function = "mmc0";
			drive-strength = <30>;
			bias-pull-up;
		};

		mmc1_pins: mmc1-pins {
			pins = "PG0", "PG1", "PG2", "PG3",
			       "PG4", "PG5";
			function = "mmc1";
			drive-strength = <30>;
			bias-pull-up;
		};

		spi0_pins: spi0-pins {
			pins = "PC0", "PC1", "PC2", "PC3";
			function = "spi0";
		};

		csi1_8bit: csi1-8bit@0 {
       			pins 	 = "PE6","PE7","PE8","PE9","PE10","PE11","PE12","PE13","PE14","PE15";
       			bias-disable;
       			function = "csi";
			};

		csi1_clk: csi1-clk@0 {
        		pins = "PE0","PE2","PE3";
        		bias-disable;
        		function = "csi";
			};

			csi1_mclk: csi1-mclk@0 {
        		pins = "PE1";
        		bias-disable;
        		function = "csi";
			};

		i2c1_pins: i2c1 {
			pins = "PE21", "PE22";
			function = "i2c1";
		};


	};

	i2c1: i2c@1c2b000 {
		compatible = "allwinner,sun6i-a31-i2c";
		reg = <0x01c2b000 0x400>;
		interrupts = <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>;
		clocks = <&ccu CLK_BUS_I2C1>;
		resets = <&ccu RST_BUS_I2C1>;
		status = "disabled";
		#address-cells = <1>;
		#size-cells = <0>;
	};

linux-zero-5.2.y/arch/arm/boot/dts$ gedit sun8i-v3s-licheepi-zero.dts

&csi1 {
	status = "okay";
	pinctrl-names = "default";
	pinctrl-0 = <&csi1_clk &csi1_8bit>;

	port {
		csi1_ep: endpoint {
	
		remote-endpoint = <&ov2640_0>;
		hsync-active = <0>;
		vsync-active = <0>;
		bus-width = <10>;
	    	pclk-sample = <1>;
		
		};
	};
 };

&i2c1 {
    	pinctrl-0 = <&i2c1_pins>;
		pinctrl-names = "default";
		status = "okay";

	
	ov2640: camera@30 {
		compatible = "ovti,ov2640";
		reg = <0x30>;
		pinctrl-names = "default";
		pinctrl-0 = <&csi1_mclk>;
		clocks = <&ccu CLK_CSI1_MCLK>;
		clock-names = "xvclk";
		assigned-clocks = <&ccu CLK_CSI1_MCLK>;
		assigned-clock-rates = <24000000>;
		
		port {
			ov2640_0: endpoint {
				remote-endpoint = <&csi1_ep>;
				bus-width = <10>;
			};
		};
	};
};

其他的没有改动
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- licheepi_zero_defconfig
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j8
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- dtbs

sudo cp -r ./arch/arm/boot/dts/sun8i-v3s-licheepi-zero-dock.dtb /media/t/BOOT/
sudo cp -r ./arch/arm/boot/dts/sun8i-v3s-licheepi-zero.dtb /media/t/BOOT/
sudo cp -r arch/arm/boot/zImage /media/t/BOOT/

insmod video、csi 、ov2640 的ko即可。

Ethernet 的支持,内核4.*的版本需是在 linux-zero-5.2.y/drivers/net/ethernet/allwinner/sun8i-emac.c,
开始我看5.2没有这个,我想着增加sun8i-emac.c Kconfig 后来发现在 sun8i-v3s.dtsi

emac: ethernet@1c30000 {
			compatible = "allwinner,sun8i-h3-emac";        //  请注意这个sun8i-h3-emac
			syscon = <&syscon>;
			reg = <0x01c30000 0x10000>;
			interrupts = <GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>;
			interrupt-names = "macirq";
			resets = <&ccu RST_BUS_EMAC>;
			reset-names = "stmmaceth";
			clocks = <&ccu CLK_BUS_EMAC>;
			clock-names = "stmmaceth";
			status = "disabled";
			mdio: mdio {
				#address-cells = <1>;
				#size-cells = <0>;
				compatible = "snps,dwmac-mdio";
			};

			mdio-mux {
				compatible = "allwinner,sun8i-h3-mdio-mux";
				#address-cells = <1>;
				#size-cells = <0>;
                
				mdio-parent-bus = <&mdio>;
				/* Only one MDIO is usable at the time */
				internal_mdio: mdio@1 {
					compatible = "allwinner,sun8i-h3-mdio-internal";
					reg = <1>;
					#address-cells = <1>;
					#size-cells = <0>;
                 
					int_mii_phy: ethernet-phy@1 {
						compatible = "ethernet-phy-ieee802.3-c22";
						reg = <1>;
						clocks = <&ccu CLK_BUS_EPHY>;
						resets = <&ccu RST_BUS_EPHY>;
					};
				};
		
				external_mdio: mdio@2 {
					reg = <2>;
					#address-cells = <1>;
					#size-cells = <0>;
				};
			};
		};

然后在kernel 目录下搜索,发现 5.2 对 sun8i-emac.c 的支持换了位置,只需要配置一下即可
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig

在这里插入图片描述按这个路径去找勾选即可。

  1. buildroot-2017.08.1
    选择开发自己需要的一些工具,alsa、ssh、fswebcam等,需要什么自己点

./fswebcam -S 20 -d /dev/video0 -p UYVY -r 800x600 --dumpframe dump.bin fswebcam.jpg

这样就可以抓取到图片了,声卡不用修改可以直接运行。

基于5801实现人脸检测、识别

基于fswebcam修改,不想写代码。
修改fswebcam.c

case SRC_PAL_YUV420P:
			printf("SRC_PAL_YUV420P \n");
			fswc_add_image_yuv420p(&src, abitmap);
			fswc_add_image_yuv420pGTI(&src, rgbbitmap);
			/*
			 * bgrbitmap rgb 800 * 600
			 *
			 * */
			bboxes_nms = (vec *)malloc(sizeof(vec));
			if (!bboxes_nms) {
				printf("malloc error.\n");
				return -1;
			}

			float *feature_vector = (float *)malloc(512*4*2);
			Read_registerData(feature_vector);
			ssdDetectionInit();
			faceRecog_init(recog_convFile, recog_fcFile);
			pModel = GtiCreateModel(detect_modelFile);

			if (pModel == NULL) {
				printf(" ===============\n Failed to load model. detect \n");
				return -1;
			}
			//GtiResize(bgrbitmap, src.height, src.width, gtibitmap, INPUT_IMAGE_H, INPUT_IMAGE_W);
			GtiCvtColor(rgbbitmap, src.height, src.width, Inbitmap);
			printf("src.height = %d , src.width = %d \n", src.height, src.width);
			imageResize(Inbitmap, src.height, src.width, gtibitmap, INPUT_IMAGE_H, INPUT_IMAGE_W);
			
#ifdef _DEBUG
			FILE *f;
			f = fopen("rgb.bin", "wb");
			if (!f)
				ERROR("fopen: %s", strerror(errno));
			else {
				fwrite(rgbbitmap, 1, 800*600*3, f);
				fclose(f);
			}
			printf("abitmap.bin success !\n");
#endif

#ifdef _DEBUG
			FILE *s;
			s = fopen("gti.bin", "wb");
			if (!s)
				ERROR("fopen: %s", strerror(errno));
			else {
				fwrite(gtibitmap, 1, 224*224*3, s);
				fclose(s);
			}
#endif

			processRGBdata(pModel, gtibitmap, bboxes_nms);
			
			GtiDestroyModel(pModel);

			for (int nI=0; nI<vec_size(bboxes_nms); nI++) {
				if ((vec_get_elem(bboxes_nms, nI).label) != 1)
					continue;
				float tmp_x1 = vec_get_elem(bboxes_nms, nI).x1 < 0 ? 0:vec_get_elem(bboxes_nms, nI).x1*800;
				float tmp_y1 = vec_get_elem(bboxes_nms, nI).y1 < 0 ? 0:vec_get_elem(bboxes_nms, nI).y1*600;
				float tmp_x2 = vec_get_elem(bboxes_nms, nI).x2 < 0 ? 0:vec_get_elem(bboxes_nms, nI).x2*800;
				float tmp_y2 = vec_get_elem(bboxes_nms, nI).y2 < 0 ? 0:vec_get_elem(bboxes_nms, nI).y2*600;
				float tmp_area = (tmp_x2 - tmp_x1) * (tmp_y2 - tmp_y1);
				if (tmp_area > area) {
					area = tmp_area;
					x1 = tmp_x1;
					y1 = tmp_y1;
					x2 = tmp_x2;
					y2 = tmp_y2;
				}
			}
			if (area <= 0) {
				printf("detect no face\n");

				continue;
			}

			printf("Location: ");
			printf("%.3f %.3f / %.3f %.3f.\n", x1, y1, x2, y2);   // x2 W y2 H
//			system("aplay amixer_src/tmp.wav ");
			vec_free(bboxes_nms);

	        unsigned char *Pface_boxes = calloc((x2)*(y2)*3, sizeof(unsigned char));
	        imageCut(Inbitmap, 600, 800, Pface_boxes, x1, y1, y2, x2);

	        unsigned char *inface = calloc(imageLength, sizeof(unsigned char));
	        imageResize(Pface_boxes, y2, x2, inface, 224, 224);
	        if (Pface_boxes) {
	            free(Pface_boxes);
	                Pface_boxes = NULL;
	        }
	        
	        pModel = GtiCreateModel(recog_modelFile);
	        
	        printf("recog CNN time diff %lld\n", getTimeDiff(recTime_s, recTime_e));
			if (pModel == NULL) {
				printf("===============\n Failed to load model. \n");
			}
			float *feature = calloc(512*4, sizeof(float));

			faceRecog_process(pModel, inface, feature);
			
			if (config->registered != NULL) {
				FILE *ptr;
				ptr = fopen("tbs.bin", "wb");
				if (!ptr)
					ERROR("fopen: %s", strerror(errno));
				else {
					fwrite(feature, 1, sizeof(float) * 512, ptr);
					fclose(ptr);
				}

				char buffer[50];
				sprintf(buffer, "arecord -D hw:0,0 -d 5 -f S16_LE -r 16000 %s.wav", config->registered);
				printf("%s \n", buffer);
				//system(src);
				printf("registered success \n");
			}

#ifdef _DEBUG
			FILE *t;
			t = fopen("face.bin", "wb");
			if (!s)
				ERROR("fopen: %s", strerror(errno));
			else {
				fwrite(inface, 1, 224*224*3, t);
				fclose(t);
			}
#endif
			if (inface) {
				free(inface);
					inface = NULL;
			}
			GtiDestroyModel(pModel);

	        float distbuf[2] = {0};
	        for (int i = 0; i < 2; i++) {

	            distbuf[i] = faceRecog_cosDistance(&feature_vector[512*i], feature, 512);

	            printf("=============dist = %f\n",distbuf[i]);
	        }
	        float maxvalue = distbuf[0];
	        int index = 0;
	        for (int i = 1; i < 2; i++) {
	            if (distbuf[i] > maxvalue) {
	                maxvalue = distbuf[i];
	                index = i;
	            }
	        }
	        if (maxvalue < 0.8) {
	            printf("result: recognize no face\n");
	        } else {
	            printf("result: index = %d \n", index);
	            if (index == 0) {
	            	system("aplay ./feature/0.wav");
	            }
	            if (index == 1) {
	            	system("aplay ./feature/1.wav");
	            }
	        }
	        if (feature) {
	            free(feature);
	                feature = NULL;
	        }
			break;

运行结果:

# ./fswebcam -S 20 -d /dev/video0 -p YUV420P -r 800x600 --dumpframe dump.bin fswebcam.jpg 
--- Opening /dev/video0...
Trying source module v4l2...
/dev/video0 opened.
No input was specified, using the first.
--- Capturing frame...
Skipping 20 frames...
Capturing 1 frames...
Dumping raw frame to 'dump.bin'...
src.length = 720000
SRC_PAL_YUV420P 
cnnW_size = 262144, Bias_size = 512
src.height = 600 , src.width = 800 
Location: 316.259 32.925 / 610.643 408.263.
result: index = 1 
Playing WAVE './feature/1.wav' : Signed 16 bit Little Endian, Rate 16000 Hz, Mono

在这里插入图片描述

R58点亮ov2640.txt 开发板:全志公板,全志R58(CPU:Octa-Core Cortex-A7 CPU) http://www.allwinnertech.com/clq/r/R58.html 全志官网R58的简介 android4.4.4/linux3.4.39 2016/6/30 9:36 1、配置ov2640在android层配置的分辨率为vga(预览/拍照/录像) 注意:系统自带的快拍APP就在这里查找分辨率参数发送到camera的HAL层。 cubieboard2开发板使用的是全志A20的CPU,自带两路CSI的摄像头接口。 一般使用CSI1,所有生成的设备节点是/dev/video1。 一般情况下,MIPI为主摄像头(后置摄像头),那设备节点就是/dev/video0。 没有接MIPI摄像头,那就空出来,像全志A20那样配置成为了/dev/video1了。结果被坑了。 后来想起来: insmod /system/vendor/modules/ov2640.ko insmod /system/vendor/modules/vfe_v4l2.ko 手工加载vfe_v4l2.ko驱动模块之后,生成了设备节点/dev/video0。 赶紧修改为/dev/video0。然后使用adb push进去。 修改属性之后,摄像头还是不显示。重启之后正常了。这里折腾了好久!!!! R:\wyb\r58_bmi160_bma250_ov2640_dev\android\device\softwinner\octopus-f1\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_AllWinner key_camera_exif_model = MODEL_f1 ;------------------------------------------------------------------------------- ; 1 for single camera, 2 for double camera ;------------------------------------------------------------------------------- number_of_camera = 1 ;------------------------------------------------------------------------------- ; CAMERA_FACING_BACK ; ov8858 ov2640 ;------------------------------------------------------------------------------- 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 = 640x480 key_default_picture_size = 640x480 used_flash_mode = 0 key_support_flash_mode = on,off,auto,red-eye,torch key_default_flash_mode = off 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 = 25 key_default_frame_rate = 25 used_focus_mode = 1 key_support_focus_mode = auto,infinity,macro,fixed key_default_focus_mode = auto ;used_scene_mode = 0 ;key_support_scene_mode = auto,action,portrait,landscape,night,night-portrait,theatre,beach,snow,sunset,steadyphoto,fireworks,sports,party,candlelight,barcode,hdr ;key_default_scene_mode = auto used_scene_mode = 1 key_support_scene_mode = auto,hdr key_default_scene_mode = auto used_white_balance = 1 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 used_zoom = 1 key_zoom_supported = true key_smooth_zoom_supported = false key_zoom_ratios = 100,120,150,200,230,250,300 key_max_zoom = 30 key_default_zoom = 0 key_horizonal_view_angle = 64 key_vertical_view_angle = 39.4 2、R:\wyb\r58_bmi160_bma250_ov2640_dev\android\device\softwinner\octopus-f1\hawkview\sensor_list_cfg.ini #A80 sensor list configs # ##################bus config###################### # #used: 0: not used, 1: used; #csi_sel: 0: mipi, 1: parallel ; #device_sel: 0: dev0, 1: dev1; #sensor_twi_id: twi id, for example: sensor_twi_id = 0 # ##################power configs################### #power_settings_enable: 0: enable the power settings in sysconfig.fex; 1: enable the power settings in this file. # #iovdd The name of iovdd for this camera; #iovdd_vol The voltage value of iovdd in uV; # ###############detect sensor configs############## # #detect_sensor_num: The number of sensors need be detected in this bus. #sensor_name[x]: The sensor name in sensor driver. #sensor_twi_addr[x]: The i2c address of this sensor. #sensor_type[x]: The sensor type, 0: YUV, 1: RAW; #sensor_stby_mode[x]: Not used; #sensor_hflip[x] Horizontal flip; #sensor_vflip[x] Vertical flip; #act_name[x] The VCM name in vcm driver, only RAW sensor need be configured; #act_twi_addr[x] The i2c address of this VCM; # ################################################## [rear_camera_cfg] #bus configs used = 1 csi_sel = 1 device_sel = 1 sensor_twi_id = 2 #power configs power_settings_enable = 0 iovdd = "axp22_aldo2" iovdd_vol = 2800000 avdd = "axp15_aldo2" avdd_vol = 2800000 dvdd = "axp22_eldo1" dvdd_vol = 1500000 afvdd = "" afvdd_vol = 2800000 #detect sensor configs detect_sensor_num = 1 sensor_name0 = "ov2640" sensor_twi_addr0 = 0x60 sensor_type0 = 0 sensor_stby_mode0 = 0 sensor_hflip0 = 0 sensor_vflip0 = 0 act_name0 = act_twi_addr0 = 3、在init.rc(init.sun8i.rc)中加载ov2640.ko这个驱动模块。 R:\wyb\r58_bmi160_bma250_ov2640_dev\android\device\softwinner\octopus-f1\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/cci.ko #insmod /system/vendor/modules/actuator.ko insmod /system/vendor/modules/vfe_os.ko insmod /system/vendor/modules/vfe_subdev.ko #insmod /system/vendor/modules/actuator.ko #insmod /system/vendor/modules/dw9714_act.ko #insmod /system/vendor/modules/hi253.ko #insmod /system/vendor/modules/ov8858_4lane.ko insmod /system/vendor/modules/ov2640.ko insmod /system/vendor/modules/vfe_v4l2.ko 启动之后实际加载的摄像头的驱动模块: shell@octopus-f1:/ $ shell@octopus-f1:/ $ lsmod cdc_ether 3163 0 - Live 0x00000000 rtl8150 9023 0 - Live 0x00000000 mcs7830 5644 0 - Live 0x00000000 qf9700 5904 0 - Live 0x00000000 asix 13590 0 - Live 0x00000000 usbnet 14128 4 cdc_ether,mcs7830,qf9700,asix, Live 0x00000000 bcm_btlpm 7658 0 - Live 0x00000000 ltr_501als 10649 0 - Live 0x00000000 bma250 7988 0 - Live 0x00000000 sw_device 14680 0 - Live 0x00000000 sunxi_schw 13015 0 - Live 0x00000000 (O) vfe_v4l2 786415 1 - Live 0x00000000 ov2640 14830 0 - Live 0x00000000 vfe_subdev 4695 2 vfe_v4l2,ov2640, Live 0x00000000 vfe_os 4113 2 vfe_v4l2,vfe_subdev, Live 0x00000000 cci 22800 2 vfe_v4l2,ov2640, Live 0x00000000 videobuf_dma_contig 4165 1 vfe_v4l2, Live 0x00000000 videobuf_core 16528 2 vfe_v4l2,videobuf_dma_contig, Live 0x00000000 pvrsrvkm 279691 38 - Live 0x00000000 (O) hdmi 38647 0 - Live 0x00000000 disp 1023342 6 hdmi, Live 0x00000000 sunxi_tr 9348 1 disp, Live 0x00000000 nand 299887 0 - Live 0x00000000 (O) shell@octopus-f1:/ $ 4、驱动程序:ov2640.c及其V4L2的适配层。 配置ov5640.c的编译选项,默认已经配置好,不用修改: R:\wyb\r58_bmi160_bma250_ov2640_dev\lichee\linux-3.4\drivers\media\video\sunxi-vfe\device\ov2640.c R:\wyb\r58_bmi160_bma250_ov2640_dev\lichee\linux-3.4\drivers\media\video\sunxi-vfe\device\Makefile obj-m += ov5640.o R:\wyb\r58_bmi160_bma250_ov2640_dev\lichee\linux-3.4\drivers\media\video\sunxi-vfe\Kconfig 5、 R:\wyb\r58_bmi160_bma250_ov2640_dev\lichee\tools\pack\chips\sun8iw6p1\configs\f1\sys_config.fex ;-------------------------------------------------------------------------------- ;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 vip_csi_mck = port:PE01 vip_csi_hsync = port:PE02 vip_csi_vsync = port:PE03 vip_csi_d0 = vip_csi_d1 = 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_d8 = port:PE12 vip_csi_d9 = port:PE13 vip_csi_sck = port:PE14 vip_csi_sda = port:PE15 vip_dev0_mname = "ov2640" vip_dev0_pos = "rear" vip_dev0_lane = 1 vip_dev0_twi_id = 2 vip_dev0_twi_addr = 0x60 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 = "" vip_dev0_avdd_vol = 2800000 vip_dev0_dvdd = "" vip_dev0_dvdd_vol = 1500000 vip_dev0_afvdd = "" vip_dev0_afvdd_vol = 2800000 vip_dev0_power_en = vip_dev0_reset = port:PE4 vip_dev0_pwdn = port:PE5 vip_dev0_flash_en = vip_dev0_flash_mode = vip_dev0_af_pwdn = 6、开发板上摄像头的I2C挂载在TWI2上面了,注意打开: ;---------------------------------------------------------------------------------- ;i2c configuration ;---------------------------------------------------------------------------------- [twi0] twi_used = 1 twi_scl = port:PH0 twi_sda = port:PH1 [twi1] twi_used = 1 twi_scl = port:PH2 twi_sda = port:PH3 [twi2] twi_used = 1 twi_scl = port:PH4 twi_sda = port:PH5 不过奇怪的是,摄像头并没有向其它平台那样生成这个设备节点: /sys/class/i2c-adapter/i2c-2/2-0030 shell@octopus-f1:/ $ shell@octopus-f1:/ $ cd /sys/class/i2c-adapter/i2c-2/ shell@octopus-f1:/sys/class/i2c-adapter/i2c-2 $ shell@octopus-f1:/sys/class/i2c-adapter/i2c-2 $ ll drwxr-xr-x root root 1970-01-02 08:06 2-003b --w------- root root 4096 1970-01-02 08:06 delete_device lrwxrwxrwx root root 1970-01-02 08:06 device -> ../../twi.2 -r--r--r-- root root 4096 1970-01-02 08:06 name --w------- root root 4096 1970-01-02 08:06 new_device drwxr-xr-x root root 1970-01-02 08:06 power lrwxrwxrwx root root 1970-01-02 08:06 subsystem -> ../../../../bus/i2c -rw-r--r-- root root 4096 1970-01-02 08:06 uevent shell@octopus-f1:/sys/class/i2c-adapter/i2c-2 $ 可能是ov2640的驱动程序不完整,没有通过i2c_detect来注册2-0030这个节点。 直接在驱动程序中读取I2C,还是对的。device ID = 0x2642。
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值