MQ-Pro D1-H ov5640适配
-
通过查看原理图发现并无其他外设占用DVP接口,但是在board.dts的wifi占用了PE3接口,后又查看原理图,发现wifi原理图引脚和设备树引脚并没对上。直接下载的源码编译生成的镜像并不能使用wif,并且没有挂在overlay分区,系统并不是可写的。
简单进行wifi引脚修改,修改之后并不能使用wifi,这里只是释放PE3引脚,wifi驱动也不太会开启,就没有去配置。
修改前 vim device/config/chips/d1/configs/mq_pro/board.dts +527
修改后
ov5640设备树默认已经配置好,就不用再设置了
执行
source build/envsetup.sh
lunch 1
make kernel_menuconfig
在 > Device Drivers > Multimedia support 开启:
进入 > Device Drivers > Multimedia support > SUNXI platform devices
进入 > Device Drivers > Multimedia support > Memory-to-memory multimedia devices
在编译前,进入如下目录删除里面的 ko 文件
lichee/linux-5.4/drivers/media/common/videobuf2/ lichee/linux-5.4/drivers/media/platform/sunxi-vin/ lichee/linux-5.4/drivers/media/platform/sunxi-vin/modules/sensor
以下目录没有就不用了
out/d1-mq_pro/compile_dir/target/linux-d1-mq_pro/linux-5.4.61/drivers/media/common/videobuf2/ out/d1-mq_pro/compile_dir/target/linux-d1-mq_pro/linux-5.4.61/drivers/media/platform/sunxi-vin/ out/d1-mq_pro/compile_dir/target/linux-d1-mq_pro/linux-5.4.61/drivers/media/platform/sunxi-vin/modules/sensor
make menuconfig
执行 make -j12 && mboot && pack
中间需要配置,直接回车默认就行
复制 lichee/linux-5.4/drivers/media/common/videobuf2/ 中的 videobuf2-dma-contig.ko videobuf2-memops.ko videobuf2-vmalloc.ko
复制 lichee/linux-5.4/drivers/media/platform/sunxi-vin/ 中的 vin_io.ko vin_v4l2.ko
复制 lichee/linux-5.4/drivers/media/platform/sunxi-vin/modules/sensor 中的 ov5640.ko
到win下的目录,建立ko一块存起来
拷贝out/d1-mq_pro/compile_dir/target/camerademo/中的 camerademo 到 win
烧录编译好的镜像,这里把文件都上传至 tmp 目录
adb push .\ko\ /tmp
adb push .\camerademo /tmp
然后进入 shell
insmod ko/videobuf2-memops.ko
insmod ko/videobuf2-dma-contig.ko
insmod ko/videobuf2-vmalloc.ko
insmod ko/vin_io.ko
insmod ko/ov5640.ko
insmod ko/vin_v4l2.ko
可以看到生成video0节点,执行
chmod +x /tmp/camerademo
. /tmp/camerademo
抓到图片
通过adb pull /tmp .
遇到的问题,暂时无法解决
1 自己编译的镜像没有挂载 overlay
默认的如下配置并不起作用,target/allwinner/d1-mq_pro/base-files/etc/config/fstab
添加 rootfs_data 分区后,再修改如下,仍是只读文件系统,并且 /mnt/UDISK /overlay分区没有挂载
编译出来的镜像没有这个文件,如下为官网下载的
自己编译的
2 参考如下步骤,ko文件并没有编译出来,也没有拷贝到/lib....目录下
mq-r t113 ov5640适配 | 全志在线开发者论坛 (aw-ol.com)
3使用其他镜像加载驱动
芒果派 ( Mango Pi ), 小巧优雅的单板电脑 | mqpro
官网下载的镜像,wifi功能正常且系统可写,默认设备树应该已经配置好了,所以直接拷贝ko到该文件系统中,成功加载了,但是发现PE引脚默认用作了eth外设,并且i2c通信会出了问题,并且i2cdetect检测不到设备
root@TinaLinux:/# insmod ko/vin_v4l2.ko [ 85.301080] sun8iw20-pinctrl 2000000.pinctrl: pin PE2 already requested by 4500000.eth; cannot claim for 5801000.csi [ 85.313003] sun8iw20-pinctrl 2000000.pinctrl: pin-130 (5801000.csi) status -22 [ 85.321138] sun8iw20-pinctrl 2000000.pinctrl: could not request pin 130 (PE2) from group PE2 on device 2000000.pinctrl [ 85.333322] vin_csi 5801000.csi: Error applying setting, reverse things back [ 85.341353] vin_csi: probe of 5801000.csi failed with error -22 [ 85.350729] sunxi-vin-core 5809000.vinc: Adding to iommu group 0 [ 85.357779] sunxi-vin-core 5809200.vinc: Adding to iommu group 0 [ 85.365831] sun8iw20-pinctrl 2000000.pinctrl: pin PE8 already requested by 4500000.eth; cannot claim for 2000000.pinctrl:136 [ 85.378548] sun8iw20-pinctrl 2000000.pinctrl: pin-136 (2000000.pinctrl:136) status -22 [ 85.387479] sun8iw20-pinctrl 2000000.pinctrl: pin PE9 already requested by 4500000.eth; cannot claim for 2000000.pinctrl:137 [ 85.400155] sun8iw20-pinctrl 2000000.pinctrl: pin-137 (2000000.pinctrl:137) status -22 [ 85.409075] sun8iw20-pinctrl 2000000.pinctrl: pin PE6 already requested by 4500000.eth; cannot claim for 2000000.pinctrl:134 [ 85.421765] sun8iw20-pinctrl 2000000.pinctrl: pin-134 (2000000.pinctrl:134) status -22 [ 85.430680] sun8iw20-pinctrl 2000000.pinctrl: pin PE7 already requested by 4500000.eth; cannot claim for 2000000.pinctrl:135 [ 85.443368] sun8iw20-pinctrl 2000000.pinctrl: pin-135 (2000000.pinctrl:135) status -22 [ 85.452565] [VIN_WARN]get csi isp clk fail [ 85.457269] [VIN_WARN]get csi isp src clk fail [ 85.462334] [VIN_WARN]get csi mipi clk fail [ 85.467002] [VIN_WARN]get csi mipi src clk fail [ 85.472286] [VIN_WARN]get csi isp clk fail [ 85.476877] [VIN_WARN]Get isp reset control fail [ 85.483238] [ov5640]PWR_ON! [ 85.487791] sun8iw20-pinctrl 2000000.pinctrl: pin PE3 already requested by 4500000.eth; cannot claim for 5800800.vind [ 85.499814] sun8iw20-pinctrl 2000000.pinctrl: pin-131 (5800800.vind) status -22 [ 85.508069] sun8iw20-pinctrl 2000000.pinctrl: could not request pin 131 (PE3) from group PE3 on device 2000000.pinctrl [ 85.520267] sunxi-vin-media 5800800.vind: Error applying setting, reverse things back [ 85.529119] [VIN_ERR]mclk0 request pin handle failed! [ 85.601103] sunxi-i2c sunxi-i2c2: Bus error [ 85.605840] sunxi-i2c sunxi-i2c2: engine-mode: bus state: 0x0, isn't idle [ 85.613405] sunxi-i2c sunxi-i2c2: STOP failed! [ 85.618529] sunxi-i2c sunxi-i2c2: engine-mode: xfer failed(dev addr:0x3c) [ 85.641848] sunxi-i2c sunxi-i2c2: Bus error [ 85.646584] sunxi-i2c sunxi-i2c2: engine-mode: bus state: 0x0, isn't idle [ 85.654147] sunxi-i2c sunxi-i2c2: STOP failed! [ 85.659277] sunxi-i2c sunxi-i2c2: engine-mode: xfer failed(dev addr:0x3c) [ 85.682693] sunxi-i2c sunxi-i2c2: Bus error [ 85.687429] sunxi-i2c sunxi-i2c2: engine-mode: bus state: 0x0, isn't idle [ 85.694994] sunxi-i2c sunxi-i2c2: STOP failed! [ 85.700111] sunxi-i2c sunxi-i2c2: engine-mode: xfer failed(dev addr:0x3c) [ 85.707760] [VIN_DEV_I2C]ov5640 sensor read retry = 2 [ 85.729112] sunxi-i2c sunxi-i2c2: Bus error [ 85.733846] sunxi-i2c sunxi-i2c2: engine-mode: bus state: 0x0, isn't idle [ 85.741412] sunxi-i2c sunxi-i2c2: STOP failed! [ 85.746592] sunxi-i2c sunxi-i2c2: engine-mode: xfer failed(dev addr:0x3c) [ 85.769901] sunxi-i2c sunxi-i2c2: Bus error [ 85.774637] sunxi-i2c sunxi-i2c2: engine-mode: bus state: 0x0, isn't idle [ 85.782202] sunxi-i2c sunxi-i2c2: STOP failed! [ 85.787328] sunxi-i2c sunxi-i2c2: engine-mode: xfer failed(dev addr:0x3c) [ 85.810536] sunxi-i2c sunxi-i2c2: Bus error [ 85.815271] sunxi-i2c sunxi-i2c2: engine-mode: bus state: 0x0, isn't idle [ 85.822836] sunxi-i2c sunxi-i2c2: STOP failed! [ 85.827850] sunxi-i2c sunxi-i2c2: engine-mode: xfer failed(dev addr:0x3c) [ 85.835583] [VIN_DEV_I2C]ov5640 sensor read retry = 2 [ 85.841280] [ov5640]V4L2_IDENT_SENSOR = 0 [ 85.861472] sunxi-i2c sunxi-i2c2: Bus error [ 85.866208] sunxi-i2c sunxi-i2c2: engine-mode: bus state: 0x0, isn't idle [ 85.873772] sunxi-i2c sunxi-i2c2: STOP failed! [ 85.878929] sunxi-i2c sunxi-i2c2: engine-mode: xfer failed(dev addr:0x3c) [ 85.902115] sunxi-i2c sunxi-i2c2: Bus error [ 85.906851] sunxi-i2c sunxi-i2c2: engine-mode: bus state: 0x0, isn't idle [ 85.914417] sunxi-i2c sunxi-i2c2: STOP failed! [ 85.919537] sunxi-i2c sunxi-i2c2: engine-mode: xfer failed(dev addr:0x3c) [ 85.942931] sunxi-i2c sunxi-i2c2: Bus error [ 85.947665] sunxi-i2c sunxi-i2c2: engine-mode: bus state: 0x0, isn't idle [ 85.955232] sunxi-i2c sunxi-i2c2: STOP failed! [ 85.960353] sunxi-i2c sunxi-i2c2: engine-mode: xfer failed(dev addr:0x3c) [ 85.967995] [VIN_DEV_I2C]ov5640 sensor read retry = 2 [ 85.989449] sunxi-i2c sunxi-i2c2: Bus error [ 85.994185] sunxi-i2c sunxi-i2c2: engine-mode: bus state: 0x0, isn't idle [ 86.001749] sunxi-i2c sunxi-i2c2: STOP failed! [ 86.006912] sunxi-i2c sunxi-i2c2: engine-mode: xfer failed(dev addr:0x3c) [ 86.030119] sunxi-i2c sunxi-i2c2: Bus error [ 86.034854] sunxi-i2c sunxi-i2c2: engine-mode: bus state: 0x0, isn't idle [ 86.042421] sunxi-i2c sunxi-i2c2: STOP failed! [ 86.047547] sunxi-i2c sunxi-i2c2: engine-mode: xfer failed(dev addr:0x3c) [ 86.070848] sunxi-i2c sunxi-i2c2: Bus error [ 86.075582] sunxi-i2c sunxi-i2c2: engine-mode: bus state: 0x0, isn't idle [ 86.083147] sunxi-i2c sunxi-i2c2: STOP failed! [ 86.088276] sunxi-i2c sunxi-i2c2: engine-mode: xfer failed(dev addr:0x3c) [ 86.095922] [VIN_DEV_I2C]ov5640 sensor read retry = 2 [ 86.101724] [ov5640]retry = 0, V4L2_IDENT_SENSOR = 0 [ 86.122866] sunxi-i2c sunxi-i2c2: Bus error [ 86.127600] sunxi-i2c sunxi-i2c2: engine-mode: bus state: 0x0, isn't idle [ 86.135166] sunxi-i2c sunxi-i2c2: STOP failed! [ 86.140314] sunxi-i2c sunxi-i2c2: engine-mode: xfer failed(dev addr:0x3c) [ 86.163538] sunxi-i2c sunxi-i2c2: Bus error [ 86.168272] sunxi-i2c sunxi-i2c2: engine-mode: bus state: 0x0, isn't idle [ 86.175839] sunxi-i2c sunxi-i2c2: STOP failed! [ 86.180967] sunxi-i2c sunxi-i2c2: engine-mode: xfer failed(dev addr:0x3c) [ 86.204122] sunxi-i2c sunxi-i2c2: Bus error [ 86.208858] sunxi-i2c sunxi-i2c2: engine-mode: bus state: 0x0, isn't idle [ 86.216423] sunxi-i2c sunxi-i2c2: STOP failed! [ 86.221553] sunxi-i2c sunxi-i2c2: engine-mode: xfer failed(dev addr:0x3c) [ 86.229130] [VIN_DEV_I2C]ov5640 sensor read retry = 2 [ 86.250542] sunxi-i2c sunxi-i2c2: Bus error [ 86.255279] sunxi-i2c sunxi-i2c2: engine-mode: bus state: 0x0, isn't idle [ 86.262844] sunxi-i2c sunxi-i2c2: STOP failed! [ 86.267864] sunxi-i2c sunxi-i2c2: engine-mode: xfer failed(dev addr:0x3c) [ 86.291268] sunxi-i2c sunxi-i2c2: Bus error [ 86.296006] sunxi-i2c sunxi-i2c2: engine-mode: bus state: 0x0, isn't idle [ 86.303572] sunxi-i2c sunxi-i2c2: STOP failed! [ 86.308684] sunxi-i2c sunxi-i2c2: engine-mode: xfer failed(dev addr:0x3c) [ 86.331961] sunxi-i2c sunxi-i2c2: Bus error [ 86.336695] sunxi-i2c sunxi-i2c2: engine-mode: bus state: 0x0, isn't idle [ 86.344261] sunxi-i2c sunxi-i2c2: STOP failed! [ 86.349377] sunxi-i2c sunxi-i2c2: engine-mode: xfer failed(dev addr:0x3c) [ 86.357030] [VIN_DEV_I2C]ov5640 sensor read retry = 2 [ 86.362810] [ov5640]retry = 1, V4L2_IDENT_SENSOR = 0 [ 86.383968] sunxi-i2c sunxi-i2c2: Bus error [ 86.388703] sunxi-i2c sunxi-i2c2: engine-mode: bus state: 0x0, isn't idle [ 86.396268] sunxi-i2c sunxi-i2c2: STOP failed! [ 86.401436] sunxi-i2c sunxi-i2c2: engine-mode: xfer failed(dev addr:0x3c) [ 86.424547] sunxi-i2c sunxi-i2c2: Bus error [ 86.429282] sunxi-i2c sunxi-i2c2: engine-mode: bus state: 0x0, isn't idle [ 86.436847] sunxi-i2c sunxi-i2c2: STOP failed! [ 86.441975] sunxi-i2c sunxi-i2c2: engine-mode: xfer failed(dev addr:0x3c) [ 86.465126] sunxi-i2c sunxi-i2c2: Bus error [ 86.469861] sunxi-i2c sunxi-i2c2: engine-mode: bus state: 0x0, isn't idle [ 86.477426] sunxi-i2c sunxi-i2c2: STOP failed! [ 86.482556] sunxi-i2c sunxi-i2c2: engine-mode: xfer failed(dev addr:0x3c) [ 86.490134] [VIN_DEV_I2C]ov5640 sensor read retry = 2 [ 86.511539] sunxi-i2c sunxi-i2c2: Bus error [ 86.516277] sunxi-i2c sunxi-i2c2: engine-mode: bus state: 0x0, isn't idle [ 86.523842] sunxi-i2c sunxi-i2c2: STOP failed! [ 86.528963] sunxi-i2c sunxi-i2c2: engine-mode: xfer failed(dev addr:0x3c) [ 86.552272] sunxi-i2c sunxi-i2c2: Bus error [ 86.557008] sunxi-i2c sunxi-i2c2: engine-mode: bus state: 0x0, isn't idle [ 86.564572] sunxi-i2c sunxi-i2c2: STOP failed! [ 86.569724] sunxi-i2c sunxi-i2c2: engine-mode: xfer failed(dev addr:0x3c) [ 86.592955] sunxi-i2c sunxi-i2c2: Bus error [ 86.597691] sunxi-i2c sunxi-i2c2: engine-mode: bus state: 0x0, isn't idle [ 86.605259] sunxi-i2c sunxi-i2c2: STOP failed! [ 86.610380] sunxi-i2c sunxi-i2c2: engine-mode: xfer failed(dev addr:0x3c) [ 86.618021] [VIN_DEV_I2C]ov5640 sensor read retry = 2 [ 86.623808] [ov5640]retry = 2, V4L2_IDENT_SENSOR = 0 [ 86.644976] sunxi-i2c sunxi-i2c2: Bus error [ 86.649710] sunxi-i2c sunxi-i2c2: engine-mode: bus state: 0x0, isn't idle [ 86.657276] sunxi-i2c sunxi-i2c2: STOP failed! [ 86.662434] sunxi-i2c sunxi-i2c2: engine-mode: xfer failed(dev addr:0x3c) [ 86.685552] sunxi-i2c sunxi-i2c2: Bus error [ 86.690286] sunxi-i2c sunxi-i2c2: engine-mode: bus state: 0x0, isn't idle [ 86.697854] sunxi-i2c sunxi-i2c2: STOP failed! [ 86.702984] sunxi-i2c sunxi-i2c2: engine-mode: xfer failed(dev addr:0x3c) [ 86.726262] sunxi-i2c sunxi-i2c2: Bus error [ 86.730996] sunxi-i2c sunxi-i2c2: engine-mode: bus state: 0x0, isn't idle [ 86.738559] sunxi-i2c sunxi-i2c2: STOP failed! [ 86.743702] sunxi-i2c sunxi-i2c2: engine-mode: xfer failed(dev addr:0x3c) [ 86.751347] [VIN_DEV_I2C]ov5640 sensor read retry = 2 [ 86.772703] sunxi-i2c sunxi-i2c2: Bus error [ 86.777436] sunxi-i2c sunxi-i2c2: engine-mode: bus state: 0x0, isn't idle [ 86.785001] sunxi-i2c sunxi-i2c2: STOP failed! [ 86.790123] sunxi-i2c sunxi-i2c2: engine-mode: xfer failed(dev addr:0x3c) [ 86.813414] sunxi-i2c sunxi-i2c2: Bus error [ 86.818149] sunxi-i2c sunxi-i2c2: engine-mode: bus state: 0x0, isn't idle [ 86.825713] sunxi-i2c sunxi-i2c2: STOP failed! [ 86.830852] sunxi-i2c sunxi-i2c2: engine-mode: xfer failed(dev addr:0x3c) [ 86.853952] sunxi-i2c sunxi-i2c2: Bus error [ 86.858686] sunxi-i2c sunxi-i2c2: engine-mode: bus state: 0x0, isn't idle [ 86.866251] sunxi-i2c sunxi-i2c2: STOP failed! [ 86.871374] sunxi-i2c sunxi-i2c2: engine-mode: xfer failed(dev addr:0x3c) [ 86.878951] [VIN_DEV_I2C]ov5640 sensor read retry = 2 [ 86.884736] [ov5640]retry = 3, V4L2_IDENT_SENSOR = 0 [ 86.905886] sunxi-i2c sunxi-i2c2: Bus error [ 86.910621] sunxi-i2c sunxi-i2c2: engine-mode: bus state: 0x0, isn't idle [ 86.918186] sunxi-i2c sunxi-i2c2: STOP failed! [ 86.923360] sunxi-i2c sunxi-i2c2: engine-mode: xfer failed(dev addr:0x3c) [ 86.946552] sunxi-i2c sunxi-i2c2: Bus error [ 86.951285] sunxi-i2c sunxi-i2c2: engine-mode: bus state: 0x0, isn't idle [ 86.958851] sunxi-i2c sunxi-i2c2: STOP failed! [ 86.964073] sunxi-i2c sunxi-i2c2: engine-mode: xfer failed(dev addr:0x3c) [ 86.987346] sunxi-i2c sunxi-i2c2: Bus error [ 86.992082] sunxi-i2c sunxi-i2c2: engine-mode: bus state: 0x0, isn't idle [ 86.999645] sunxi-i2c sunxi-i2c2: STOP failed! [ 87.004773] sunxi-i2c sunxi-i2c2: engine-mode: xfer failed(dev addr:0x3c) [ 87.012434] [VIN_DEV_I2C]ov5640 sensor read retry = 2 [ 87.033714] sunxi-i2c sunxi-i2c2: Bus error [ 87.038448] sunxi-i2c sunxi-i2c2: engine-mode: bus state: 0x0, isn't idle [ 87.046013] sunxi-i2c sunxi-i2c2: STOP failed! [ 87.051170] sunxi-i2c sunxi-i2c2: engine-mode: xfer failed(dev addr:0x3c) [ 87.074365] sunxi-i2c sunxi-i2c2: Bus error [ 87.079099] sunxi-i2c sunxi-i2c2: engine-mode: bus state: 0x0, isn't idle [ 87.086664] sunxi-i2c sunxi-i2c2: STOP failed! [ 87.091795] sunxi-i2c sunxi-i2c2: engine-mode: xfer failed(dev addr:0x3c) [ 87.114941] sunxi-i2c sunxi-i2c2: Bus error [ 87.119676] sunxi-i2c sunxi-i2c2: engine-mode: bus state: 0x0, isn't idle [ 87.127240] sunxi-i2c sunxi-i2c2: STOP failed! [ 87.132375] sunxi-i2c sunxi-i2c2: engine-mode: xfer failed(dev addr:0x3c) [ 87.139952] [VIN_DEV_I2C]ov5640 sensor read retry = 2 [ 87.145740] [ov5640]retry = 4, V4L2_IDENT_SENSOR = 0 [ 87.151343] [ov5640] error, chip found is not an target chip. [ 87.157856] [ov5640]PWR_OFF! [ 87.161307] sun8iw20-pinctrl 2000000.pinctrl: pin PE3 already requested by 4500000.eth; cannot claim for 5800800.vind [ 87.173333] sun8iw20-pinctrl 2000000.pinctrl: pin-131 (5800800.vind) status -22 [ 87.181589] sun8iw20-pinctrl 2000000.pinctrl: could not request pin 131 (PE3) from group PE3 on device 2000000.pinctrl [ 87.193803] sunxi-vin-media 5800800.vind: Error applying setting, reverse things back [ 87.202618] [VIN_ERR]mclk0 request pin handle failed! [ 87.218698] sensor_remove ov5640 sd = (____ptrval____)! [ 87.224674] [VIN_ERR]registering ov5640, No such device! [ 87.230778] [VIN_ERR]ov5647 request i2c3 adapter failed!
-
晚点我研究下,顺便这个sdk也该大更新一下子了
-
我现在在用MQ Pro + OV5640做项目,大佬是否愿意加我QQ?
Copyright © 2024 深圳全志在线有限公司 粤ICP备2021084185号 粤公网安备44030502007680号