@lexin531
有个camerademo用于拍照
kw___ 发布的帖子
-
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!
-
回复: mq-r t113 ov5640适配
@mangogeek 在 mq-r t113 ov5640适配 中说:
按理说这个作业也可以完美迁移到MQ-Pro(D1-H)平台上,针对DVP局部的设计和T113,F133是一致的。有人愿意搞一下么?
我出一块板。
大佬,你好,我想搞一下,请问如何能拿到板子 -
mq-r t113 ov5640适配
Mango Pi official website | Tiny and Elegant SBC | mqr
下载 https://pan.baidu.com/s/1wxUeYQZaSgAPGorGOVcJxA?pwd=tina
解压后 git pull 更新下源码
参考大神修改串口方式,将串口0 修改为串口3,或者将串口0 禁用掉
全志芯片Tina Linux 修改 UART 引脚、UART端口 | 全志在线开发者论坛 (aw-ol.com)
我这里直接禁用掉了 \device\config\chips\t113\configs\mq_r\linux-5.4\board.dts + 441
make menuconfig
Kernel modules > Video Support 选中如下
Allwinner 选中camerademo
退出执行 make -j12 && mboot && pack,中间直接回车默认就行,如下相关驱动被编译成ko文件了
烧录系统,进入系统后,通过ADB看到相关ko已经被编译进了,并且拷贝到/lib/modules/5.4.61下
按如下顺序加载驱动
/sbin/insmod /lib/modules/5.4.61/videobuf2-memops.ko /sbin/insmod /lib/modules/5.4.61/videobuf2-dma-contig.ko /sbin/insmod /lib/modules/5.4.61/videobuf2-vmalloc.ko /sbin/insmod /lib/modules/5.4.61/vin_io.ko /sbin/insmod /lib/modules/5.4.61/ov5640.ko /sbin/insmod /lib/modules/5.4.61/vin_v4l2.ko
生成video0节点
adb pull /tmp .\Desktop\
修改如下,添加开机自动加载模块
vim target/allwinner/t113-mq_r/busybox-init-base-files/etc/init.d/rc.modules
![image-20221119145747337](mq-r t113 ov5640适配.assets/image-20221119145747337.png) -
求助,Tina使能一个包后,文件系统没有包含该包的程序
如题:在Tina使能一个包后,如 tinyalsa,然后 make -j24 && mboot && pack,生成新镜像后烧录进去,并没有包含 tinyalsa 的 相关库 和 应用程序,请问这个要怎么修改配置
-
T113在win下进行应用app开发
开发工具 vs code , make,gcc-linaro-4.9.4-2017.01-i686-mingw32_arm-linux-gnueabihf,安装好如上工具,并配好环境变量
配置 Tina 交叉工具为 glibc,(musl,这个gcc工具应该编译出来的不能运行,猜的,没试过)
make menuconfig > Advanced configuration options Select external toolchain C library (Use glibc) --->
以 tinyalsa 为例子,文件系统使能该包后,在 Tina-Linux/out/t113-mq_r/compile_dir/target/tinyalsa-1.1.1 有 ipkg-install 目录,里面存放有头文件和lib文件,但由于该包过于简单,该目录中没有头文件,拷贝 libtinyalsa.so.1.1.1 到 win 下,并命名 libtinyalsa.so。
. └── usr ├── bin │ ├── tinycap │ ├── tinymix │ ├── tinypcminfo │ └── tinyplay ├── lib │ ├── libtinyalsa.a │ ├── libtinyalsa.so -> libtinyalsa.so.1 │ ├── libtinyalsa.so.1 -> libtinyalsa.so.1.1.1 │ └── libtinyalsa.so.1.1.1 └── man └── man1 ├── tinycap.1 ├── tinymix.1 ├── tinypcminfo.1 └── tinyplay.1 5 directories, 12 files
返回上一级,有 include 文件夹。拷贝到 win 下,
再拷贝 example 文件夹到 win 下,
win 下组成如下目录
编写 Makefile 文件
CROSS_COMPILE ?= arm-linux-gnueabihf- CC = $(CROSS_COMPILE)gcc PRO_DIR ?= ${shell chdir} CFLAGS = -Wall -Wextra -Werror -Wfatal-errors -I$(PRO_DIR)/include -std=c99 -L$(PRO_DIR)/lib -ltinyalsa all: $(CC) $(CFLAGS) -o pcm-readi.elf pcm-readi.c $(CC) $(CFLAGS) -o pcm-writei.elf pcm-writei.c adb push .\pcm-readi.elf /tmp adb push .\pcm-writei.elf /tmp adb shell chmod +x /tmp/pcm-readi.elf adb shell chmod +x /tmp/pcm-writei.elf adb shell ./tmp/pcm-readi.elf
打开 vscode 命令行,执行 make,即可看到运行结果
-
回复: T113驱动ov5640 报错
@chengwei_peng
解决了,我是在内核中开启相关功能,然后就会报这个错,直接修改config文件,就能正常编译出模块了
CONFIG_SUNXI_PLATFORM_DRIVERS=y
CONFIG_VIDEO_SUNXI_VIN=y
CONFIG_CSI_VIN=m
之前报错,也没从源码中找到这个函数的定义 -
xr806使用tcp socket与手机通信
参考:基于星辰处理器的全志XR806开源鸿蒙开发板上手体验 - 极术社区 - 连接开发者与智能计算生态 (aijishu.com) 搭建环境。并成功编译。
项目源码 : https://gitee.com/kingwho/smart-home
在同一个局域网中,手机与xr806连接后,手机 APP 每隔 1s,发送按键的值给 xr806,用于控制xr806的led,然后xr806在返回按键,温度,适度(温度,适度为模拟数据)数据给手机app显示。
将 smart_home 放入 device/xradio/xr806/ohosdemo 下的目录,并修改 device/xradio/xr806/ohosdemo/BUILD.gn 为
group("ohosdemo") { deps = [ #"hello_demo:app_hello", #"iot_peripheral:app_peripheral", #"wlan_demo:app_WlanTest", "smart_home:app_smart_home", ] }
目录结构
. ├── BUILD.gn └── src ├── main.c ├── tcp_net_socket.c └── tcp_net_socket.h
使用 WIFI 编译时会报错,进行如下操作即可,在随后的编译中可能还会出现,再次如下操作执行即可。
cd device/xradio/xr806/xr_skylark/project/demo/wlan_ble_demo/image/xr806 cp image_wlan_ble.cfg image_wlan_ble.cfg.bk cat image_auto_cal.cfg > image_wlan_ble.cfg
cjson使用这些宏会报错,建议直接使用 cjson 宏定义后面函数。
#define cJSON_AddNullToObject(object,name) cJSON_AddItemToObject(object, name, cJSON_CreateNull()) #define cJSON_AddTrueToObject(object,name) cJSON_AddItemToObject(object, name, cJSON_CreateTrue()) #define cJSON_AddFalseToObject(object,name) cJSON_AddItemToObject(object, name, cJSON_CreateFalse()) #define cJSON_AddBoolToObject(object,name,b) cJSON_AddItemToObject(object, name, cJSON_CreateBool(b)) #define cJSON_AddNumberToObject(object,name,n) cJSON_AddItemToObject(object, name, cJSON_CreateNumber(n)) #define cJSON_AddStringToObject(object,name,s) cJSON_AddItemToObject(object, name, cJSON_CreateString(s)) #define cJSON_AddRawToObject(object,name,s) cJSON_AddItemToObject(object, name, cJSON_CreateRaw(s))
xr806连接WIFI后 IP地址可由串口输出打印查看
[net INF] msg <wlan scan success> GetScanInfoList Success. AddDeviceConfig Success. [net INF] no need to switch wlan mode 0 en1: Trying to associate with 94:83:c4:0e:70:be (SSID='GL-MT300N-V2-0be' freq=2437 MHz) ConnectTo Success en1: Associated with 94:83:c4:0e:70:be en1: WPA: Key negotiation completed with 94:83:c4:0e:70:be [PTK=CCMP GTK=CCMP] en1: CTRL-EVENT-CONNECTED - Connection to 94:83:c4:0e:70:be completed [id=0 id_str=] [net INF] msg <wlan connected> [net INF] netif is link up [net INF] start DHCP... [net INF] netif (IPv4) is up [net INF] address: 192.168.8.248 [net INF] gateway: 192.168.8.1 [net INF] netmask: 255.255.255.0 [net INF] msg <network IPv6 state> [net INF] IPv6 addr state change: 0x0 --> 0x1 [net INF] msg <>
xr806 的固件更新后,需要使用下载器软件重新加载下固件,否则下载的可能还是上次的固件。
import("//device/xradio/xr806/liteos_m/config.gni") static_library("app_smart_home") { configs = [] sources = [ "src/main.c", "src/tcp_net_socket.c", ] cflags = board_cflags include_dirs = board_include_dirs include_dirs += [ "//kernel/liteos_m/kernel/arch/include", "//base/iot_hardware/peripheral/interfaces/kits", "//utils/native/lite/include", "//foundation/communication/wifi_lite/interfaces/wifiservice", "//third_party/lwip/src/include", "//third_party/cJSON", ] }
tcp_net_socket.c
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "lwip/sockets.h" int tcp_server_init(int port) { int sfd = 0; struct sockaddr_in saddr; sfd = socket(AF_INET,SOCK_STREAM,0); memset(&saddr, 0, sizeof(struct sockaddr)); saddr.sin_family = AF_INET; saddr.sin_port = htons(port); saddr.sin_addr.s_addr = INADDR_ANY; bind(sfd, (struct socket*)&saddr, sizeof(struct sockaddr)); listen(sfd,5); return sfd; } int tcp_server_accept(int sfd) { int cfd = 0; struct sockaddr_in caddr; memset(&caddr, 0, sizeof(struct sockaddr)); int addrl = sizeof(struct sockaddr); cfd = accept(sfd , (struct sockaddr*)&caddr , &addrl); return cfd; }
main.c
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "ohos_init.h" #include "kernel/os/os.h" #include "iot_gpio.h" #include "wifi_device.h" #include "cJSON.h" #include "lwip/sockets.h" #include "tcp_net_socket.h" static void wifi_connect(char *ssid, char *passwd); static OS_Thread_t g_main_thread; static void MainThread(void *arg) { unsigned int led_pin = 21; /* GPIOA_PIN21 */ unsigned int key_pin = 11; /* GPIOA_PIN11 */ IotGpioValue key_value; int led_value = 0; unsigned int tem = 0, hum = 0, s = 0; cJSON* dev_dat = NULL; int sfd = 0; int cfd = 0; char send_buf[512] = {0}; char recv_buf[512] = {0}; wifi_connect("GL-MT300N-V2-0be", "goodlife"); IoTGpioInit(led_pin); IoTGpioSetDir(led_pin, IOT_GPIO_DIR_OUT); IoTGpioInit(key_pin); IoTGpioSetDir(key_pin, IOT_GPIO_DIR_IN); sfd = tcp_server_init(8080); cfd = tcp_server_accept(sfd); while (1) { srand( s++ ); tem = rand()%10 + 20; hum = rand()%20 + 40; IoTGpioGetInputVal(key_pin, &key_value); printf("kw : hello world! key : %d tem : %d hum : %d\r\n", key_value, tem, hum); IoTGpioSetOutputVal(led_pin, led_value); recv(cfd, recv_buf, sizeof(recv_buf), 0); memset(send_buf, 0, sizeof(send_buf)); sprintf(send_buf, "{\"led\":\"%d\",\"key\":\"%d\",\"tem\":\"%d\",\"hum\":\"%d\"}",\ led_value, key_value, tem, hum); send(cfd,send_buf, strlen(send_buf),0); dev_dat = cJSON_Parse(recv_buf); led_value = cJSON_GetObjectItem(dev_dat, "led")->valuestring[0] - '0'; printf("led data : %d\r\n", led_value); cJSON_Delete(dev_dat); } } static void wifi_connect(char *ssid, char *passwd) { char *ssid_want_connect = ssid; char *psk = passwd; if (WIFI_SUCCESS != EnableWifi()) { printf("Error: EnableWifi fail.\n"); return; } printf("EnableWifi Success.\n"); if (WIFI_STA_ACTIVE == IsWifiActive()) printf("Wifi is active.\n"); OS_Sleep(1); if (WIFI_SUCCESS != Scan()) { printf("Error: Scan fail.\n"); return; } printf("Wifi Scan Success.\n"); OS_Sleep(1); WifiScanInfo scan_results[30]; unsigned int scan_num = 30; if (WIFI_SUCCESS != GetScanInfoList(scan_results, &scan_num)) { printf("Error: GetScanInfoList fail.\n"); return; } WifiDeviceConfig config = { 0 }; int netId = 0; int i; for (i = 0; i < scan_num; i++) { if (0 == strcmp(scan_results[i].ssid, ssid_want_connect)) { memcpy(config.ssid, scan_results[i].ssid, WIFI_MAX_SSID_LEN); memcpy(config.bssid, scan_results[i].bssid, WIFI_MAC_LEN); strcpy(config.preSharedKey, psk); config.securityType = scan_results[i].securityType; config.wapiPskType = WIFI_PSK_TYPE_ASCII; config.freq = scan_results[i].frequency; break; } } if (i >= scan_num) { printf("Error: No found ssid in scan_results\n"); return; } printf("GetScanInfoList Success.\n"); if (WIFI_SUCCESS != AddDeviceConfig(&config, &netId)) { printf("Error: AddDeviceConfig Fail\n"); return; } printf("AddDeviceConfig Success.\n"); if (WIFI_SUCCESS != ConnectTo(netId)) { printf("Error: ConnectTo Fail\n"); return; } printf("ConnectTo Success\n"); OS_Sleep(3); WifiLinkedInfo get_linked_res; if (WIFI_SUCCESS != GetLinkedInfo(&get_linked_res)) { printf("Error: GetLinkedInfo Fail\n"); return; } printf("GetLinkedInfo Success.\n"); printf("ssid: %s\n", get_linked_res.ssid); printf("bssid: "); for (int j = 0; j < WIFI_MAC_LEN; j++) { printf("%02X", get_linked_res.bssid[j]); } printf("\n"); printf("rssi: %d\n", get_linked_res.rssi); unsigned char get_mac_res[WIFI_MAC_LEN]; if (WIFI_SUCCESS != GetDeviceMacAddress(get_mac_res)) { printf("Error: GetDeviceMacAddress Fail\n"); return; } printf("GetDeviceMacAddress Success.\n"); for (int j = 0; j < WIFI_MAC_LEN - 1; j++) { printf("%02X:", get_mac_res[j]); } printf("%02X\n", get_mac_res[WIFI_MAC_LEN - 1]); } void SmartHome(void) { if (OS_ThreadCreate(&g_main_thread, "MainThread", MainThread, NULL, OS_THREAD_PRIO_APP, 8 * 1024) != OS_OK) { printf("[ERR] Create MainThread Failed\n"); } } SYS_RUN(SmartHome);
APP 采用 APIClode 开发,使用 html js 进行开发
APICloude Studio 软件下载,以及使用:
https://docs.apicloud.com/apicloud3/#wifi-preview
手机安装 Apploader,可以进行调试
安装Apploader下载 : https://docs.apicloud.com/Download/download
将 SmartHome 导入 APICloude Studio
html/main.html 对应登录界面, 如下可修改默认 IP 和端口号
<div id="bt_log"> <form name="myForm" action="" onsubmit="return validateForm()" method="post"> <div><label>IP地址</label><input type="text" name="ip" value="192.168.8.248"></div> <div><label>端口号</label><input type="text" name="port" value="8080"></div> <div><input type="submit" class="btn" value="登录" onmouseover="this.style.backgroundPosition='left -36px'" onmouseout="this.style.backgroundPosition='left top'"></div> </form> </div>
html/user_app.html 对应应用界面,与 xr806 在同一个局域网中,同进行通信,通信使用的为 json 数据。
-
回复: 基于D1开发板的 微信/支付宝 物联网(MQTT)支付平台
编译了 freetype 能够显示中文了
输出目录 /home/eva/Desktop/d1_pay_client/lirary/freetype-tmp
freetype 目录 /home/eva/Desktop/d1_pay_client/lirary/freetype-2.11.0
交叉工具链 riscv64-unknown-linux-gnu-gcc./configure --host=riscv64-unknown-linux-gnu --enable-shared --enable-static --with-zlib=no --with-bzip2=no --with-png=no --with-harfbuzz=no make make DESTDIR=/home/eva/Desktop/d1_pay_client/lirary/freetype-tmp install
-
基于D1开发板的 微信/支付宝 物联网(MQTT)支付平台
准备工作(支付宝沙盒信息获取)
登录 开发者中心控制台 (alipay.com) 使用支付宝进行登录。
进入沙箱环境 开放平台-沙箱环境 (alipay.com)
如果《RSA2密钥(公钥模式) 》的查看是灰色的,点击启用。点击查看可获取应用公钥,应用私钥和支付宝公钥。
下载并安装沙盒版的支付宝应用。通过提供的账号登录沙盒版支付宝,进行付款。
(微信个人无法申请 APPID 等信息,且没有提供沙盒平台,所以无法进行测试。提供的 JAR 包里面是有晕哥提供的 APPID 等信息,可以进行测试。提供的 java 源码已经将微信的 APPID 等信息删除)
服务器端搭建
linux 平台搭建
sudo apt install openjdk-8-jdk mosquitto
修改 D1PayServer.jar 压缩包中的 zfbinfo.properties 文件,将 appid,public_key(应用公钥),private_key(应用私钥),alipay_public_key(支付宝公钥)替换成自己支付宝沙盒提供的。
然后将 D1PayServer.jar 上传至 linux 平台运行。
java -jar D1PayServer.jar
运行效果:
客户端运行
烧写 tina_d1-nezha_uart0.img 镜像,内核已经修改为默认 HDMI 输出,分辨率为 480P(720x480)。
连接 wifi
wifi_connect_ap_test GL-MT300N-V2-0be goodlife
修改应用配置文件:
vim /bin/D1Pay/D1PayClientConfig.json { "device_id":"kw", "mqtt_server_ip":"192.168.8.108", "mqtt_sub_top":"d1_pay_client", "mqtt_pub_top":"d1_pay_server", "fb":"/dev/fb0", "input":"/dev/input/event2" }
修改 mqtt_server_ip 为自己的 mqtt 服务器的地址,input 修改为自己的触摸设配。
运行应用程序
root@TinaLinux:/# d1_pay_launche
运行效果(使用的HDMI屏幕,拥有触摸,分辨率 800x480),完成支付后将会播报语音以及控制一个 GPIO 输出 5 秒的高电平。
客户端添加一个商品信息
商品信息保存在 /bin/D1Pay/ProductList/ 目录下,每一件商品对应一个文件夹。每一个文件夹都有 Image.png ProductDescribe.txt文件,Image.png为 350x350 像素的商品图片,ProductDescribe.txt为描述文件,包含商品名,价格,付款成功后控制的 GPIO,以及商品详细介绍。
. ├── D1 Board │ ├── Image.png │ └── ProductDescribe.txt ├── D1 IC │ ├── Image.png │ └── ProductDescribe.txt └── XR806 Board ├── Image.png └── ProductDescribe.txt
ProductDescribe.txt 文件第一行为商品名字,第二行为价格(价格必须保留小数两位),第三(商品id)行为付款成功后控制的 GPIO(1-GPIOD11, 2-GPIO12, 3-GPIO13)。余下信息均为商品描述信息。
cat D1 Board/ProductDescribe.txt D1 Board 599.99 1 CPU : C906 64bit RISC-V 32 KB I-cache + 32 KB D-cache DSP : HiFi4 DSP 600MHz 32 KB I-cache + 32 KB D-cache 64 KB I-ram + 64 KB D-ram Memory : DDR2/DDR3, up to 2 GB SD3.0/eMMC 5.0, SPI Nor/Nand Flash
客户端与服务端数据交互格式
通信数据采用 json 数据,定义的数据存在多余的,部分并没有使用到
客户端发送订单信息至服务器
{ "device_id":"kw", 设备id "msg_type":"0", 0客户端发送订单 1服务器返回收款信息至客户端 2支付成功服务器返回至客户端 "product_id":"1", 商品id 用于控制 GPIO "product_name":"D1 IC", 商品名称 "pay_way":"0", 0支付宝 1微信 "price":"34.97" 价格 }
服务器返回生成的支付二维码信息至客户端
{ "device_id":"kw", 设备id "msg_type":"1", 0客户端发送订单 1服务器返回收款信息至客户端 2支付成功服务器返回至客户端 "product_id":"1", 商品id 用于控制 GPIO "pay_way":"0", 0支付宝 1微信 "return":"ok", ok err "price":"34.97", 价格 "out_trade_no":"63827381363", 订单号 "pay_qrcode":"xxxweduwqcfgy3t72" 用于生成二维码 }
支付成功服务器返回至客户端,支付失败则不返回
{ "device_id":"kw", 设备id "msg_type":"2", 0客户端发送订单 1服务器返回收款信息至客户端 2支付成功服务器返回至客户端 "product_id":"1", 商品id 用于控制 GPIO "pay_way":"0", 0支付宝 1微信 "return":"ok", ok err "price":"34.97", 价格 "out_trade_no":"63827381363" 订单号 }
服务器端工程结构
eva@ubuntu:~/Desktop/d1_pay_server_master$ tree . ├── D1PayServer │ ├── pom.xml │ ├── resource │ │ └── zfbinfo.properties │ ├── src │ │ ├── main │ │ │ └── java │ │ │ └── com │ │ │ └── nuist │ │ │ └── kw │ │ │ └── D1PayServer │ │ │ ├── AliPayThread.java │ │ │ ├── App.java │ │ │ ├── CommonUtils.java │ │ │ ├── MyConfig.java │ │ │ ├── OrderInformation.java │ │ │ ├── PaymentInformation.java │ │ │ ├── PayThread.java │ │ │ ├── ResultInformation.java │ │ │ └── WxPayThread.java
zfbinfo.properties 保存支付宝 APPID 等信息
App.java 初始化一个 mqtt 服务器,main 入口
MyConfig.java 微信 APPID 等信息
PayThread.java 当 mqtt 服务器收到一个订单消息,进行判断是支付宝支付,还是微信支付,然后开启相应的支付处理线程
AliPayThread.java 支付宝支付线程,负责请求支付二维码,循环判断订单支付结果,3 分钟未支付,则不再处理。
WxPayThread.java 微信支付线程,负责请求支付二维码,循环判断订单支付结果,3 分钟未支付,则不再处理。
OrderInformation.java PaymentInformation.java ResultInformation.java 负责构造通信数据字符串。
Maven 项目依赖
<!-- 微信sdk --> <dependency> <groupId>com.github.wxpay</groupId> <artifactId>wxpay-sdk</artifactId> <version>0.0.3</version> </dependency> <!-- 支付宝sdk --> <dependency> <groupId>com.alipay.sdk</groupId> <artifactId>alipay-sdk-java</artifactId> <version>4.10.209.ALL</version> </dependency> <!-- mqtt sdk --> <dependency> <groupId>org.eclipse.paho</groupId> <artifactId>org.eclipse.paho.client.mqttv3</artifactId> <version>1.2.5</version> </dependency> <!-- json --> <dependency> <groupId>com.alibaba</groupId> <artifactId>fastjson</artifactId> <version>1.2.47</version> </dependency>
客户端工程结构
客户端代码结构如下,app 存放的是应用代码,build 存放的是编译生成的 .o 文件以及顶层 Makefile(使用的百问网的 lvgl 移植的 Makefile),build.sh 编译脚本,lirary 存放的是库源码,Makefile 硬链接指向 build/Makefile,out 为输出的应用程序目录。
eva@ubuntu:~/Desktop/d1_pay_client$ . ├── app │ ├── app.mk │ ├── include │ ├── launcher_ui.c # UI 界面 │ ├── launcher_ui.h │ ├── lv_drv_init.c # 驱动初始化 │ ├── lv_drv_init.h │ ├── main.c # 程序入口 │ ├── mqtt_client.c # mqtt 客户端初始化 数据处理 │ ├── mqtt_client.h │ ├── pin_control.c # 引脚控制,增加引脚修改该文件 │ ├── pin_control.h │ ├── play_pay_result.c # 语音播报 │ ├── play_pay_result.h │ ├── untilities.c # 提供一些函数 │ └── untilities.h ├── build │ └── Makefile ├── build.sh ├── lirary ├── Makefile └── out ├── bin ├── etc └── lib
build.sh 中指定编译工具链,通过 ./build.sh 进行编译,./build.sh clean 进行清除编译中间文件。
修改引脚修改 pin_control.c 如下部分(计算公式 32*n+i)
mosquitto编译
应用程序使用了 mosquitto 库,build.sh并不会去编译它,所以这个需要单独编译,编译完成后,将库拷贝到 out/lib 目录下。mosquitto 在 lirary 目录下,在 lirary 目录下新建一个 mosquitto-risc 目录,用于保存编译输出文件。
设置交叉编译工具链
vim ~/.bashrc export PATH=$PATH:/home/eva/d1/D1/prebuilt/gcc/linux-x86/riscv/toolchain-thead-glibc/riscv64-glibc-gcc-thead_20200702/bin/ source ~/.bashrc
交叉编译 uuid
tar -vxf libuuid-1.0.3.tar.gz ./configure --prefix=/home/eva/Desktop/d1_pay_client/lirary/mosquitto-risc CC=riscv64-unknown-linux-gnu-gcc --host=riscv64-unknown-linux-gnu make && make install
交叉编译 openssl 库
tar -vxf openssl-1.0.2g.tar.gz ./config no-asm shared --prefix=/home/eva/Desktop/d1_pay_client/lirary/mosquitto-risc #删除Makefile中的-m64(一共有两个),修改Makefile中的 CC= riscv64-unknown-linux-gnu-gcc AR= riscv64-unknown-linux-gnu-ar $(ARFLAGS) r RANLIB= riscv64-unknown-linux-gnu-ranlib NM= riscv64-unknown-linux-gnu-nm make && make install
交叉编译 mosquitto
tar -vxf mosquitto-1.5.tar.gz make WITH_SRV=no CC=riscv64-unknown-linux-gnu-gcc CXX=riscv64-unknown-linux-gnu-g++ CFLAGS="-I /home/eva/Desktop/d1_pay_client/lirary/mosquitto-risc/include -I /home/eva/Desktop/d1_pay_client/lirary/mosquitto-risc/include" LDFLAGS="-L/home/eva/Desktop/d1_pay_client/lirary/mosquitto-risc/lib -L/home/eva/Desktop/d1_pay_client/lirary/mosquitto-risc/lib -lssl -lcrypto -luuid" make DESTDIR=/home/eva/Desktop/d1_pay_client/lirary/mosquitto-risc install
D1 内核配置
配置编译环境
source build/envsetup.sh lunch d1_nezha-tina
开启 nfs
make kernel_menuconfig File systems ---> [*] Network File Systems ---> │ │ <*> NFS client support │ │ │ │ <*> NFS client support for NFS version 2 │ │ │ │ [*] NFS client support for NFS version 3 │ │ │ │ [*] NFS client support for the NFSv3 ACL protocol extension│ │ │ │ [*] NFS client support for NFS version 4 │ │ │ │ [*] NFS client support for NFSv4.1 │ │ │ │ [*] NFS client support for NFSv4.2 │ │ │ │ (kernel.org) NFSv4.1 Implementation ID Domain │ │ │ │ [*] NFSv4.1 client support for migration │ │ │ │ [*] Use the legacy NFS DNS resolver
修改开机默认 HDMI 输出(如果开机不是默认 HDMI 输出,开机后再启动 HDMI 输出,会输出有问题)
修改 uboot 设备树文件
./D1/device/config/chips/d1/configs/nezha/uboot-board.dts 214 行 disp_init_enable = <1>; disp_mode = <0>; - screen0_output_type = <1>; - screen0_output_mode = <4>; - - screen1_output_type = <3>; - screen1_output_mode = <10>; - - screen1_output_format = <0>; - screen1_output_bits = <0>; - screen1_output_eotf = <4>; - screen1_output_cs = <257>; - screen1_output_dvi_hdmi = <2>; - screen1_output_range = <2>; - screen1_output_scan = <0>; - screen1_output_aspect_ratio = <8>; - - dev0_output_type = <1>; - dev0_output_mode = <4>; + screen0_output_type = <3>; + screen0_output_mode = <10>; + + screen0_output_format = <0>; + screen0_output_bits = <0>; + screen0_output_eotf = <4>; + screen0_output_cs = <257>; + screen0_output_dvi_hdmi = <2>; + screen0_output_range = <2>; + screen0_output_scan = <0>; + screen0_output_aspect_ratio = <8>; + + screen1_output_type = <1>; + screen1_output_mode = <4>; + + dev0_output_type = <4>; + dev0_output_mode = <2>; dev0_screen_id = <0>; - dev0_do_hpd = <0>; - - dev1_output_type = <4>; - dev1_output_mode = <10>; - dev1_screen_id = <1>; - dev1_do_hpd = <1>; + dev0_do_hpd = <1>; def_output_dev = <0>; hdmi_mode_check = <1>;
修改 linux 设备树文件
./D1/device/config/chips/d1/configs/nezha/linux-5.4/board.dts 1128 行 disp_init_enable = <1>; disp_mode = <0>; - screen0_output_type = <1>; - screen0_output_mode = <4>; - - screen1_output_type = <3>; - screen1_output_mode = <10>; - - screen1_output_format = <0>; - screen1_output_bits = <0>; - screen1_output_eotf = <4>; - screen1_output_cs = <257>; - screen1_output_dvi_hdmi = <2>; - screen1_output_range = <2>; - screen1_output_scan = <0>; - screen1_output_aspect_ratio = <8>; - - dev0_output_type = <1>; - dev0_output_mode = <4>; + screen0_output_type = <3>; + screen0_output_mode = <10>; + + screen0_output_format = <0>; + screen0_output_bits = <0>; + screen0_output_eotf = <4>; + screen0_output_cs = <257>; + screen0_output_dvi_hdmi = <2>; + screen0_output_range = <2>; + screen0_output_scan = <0>; + screen0_output_aspect_ratio = <8>; + + screen1_output_type = <1>; + screen1_output_mode = <4>; + + dev0_output_type = <4>; + dev0_output_mode = <2>; dev0_screen_id = <0>; - dev0_do_hpd = <0>; - - dev1_output_type = <4>; - dev1_output_mode = <10>; - dev1_screen_id = <1>; - dev1_do_hpd = <1>; + dev0_do_hpd = <1>; def_output_dev = <0>; hdmi_mode_check = <1>;
dev0_output_mode 为分辨率,这里设置为 480P
enum disp_tv_mode { DISP_TV_MOD_480I = 0, DISP_TV_MOD_576I = 1, DISP_TV_MOD_480P = 2, DISP_TV_MOD_576P = 3, DISP_TV_MOD_720P_50HZ = 4, DISP_TV_MOD_720P_60HZ = 5, DISP_TV_MOD_1080I_50HZ = 6, DISP_TV_MOD_1080I_60HZ = 7, DISP_TV_MOD_1080P_24HZ = 8, DISP_TV_MOD_1080P_50HZ = 9, DISP_TV_MOD_1080P_60HZ = 0xa, /***/
编译 uboot
cboot muboot
进入顶层目录,编译其它部分
make -j8 pack
代码,固件下载
D1PayPack.zip演示视频
-
回复: 【走过路过的朋友不要错过】全志在线(bbs.aw-ol.com)做项目赠送哪吒开发板活动
@whycan 在 【走过路过的朋友不要错过】全志在线(bbs.aw-ol.com)做项目赠送哪吒开发板活动 中说:
项目 (二): 基于MQTT的微信或支付宝收款平台
**目标:**基于D1哪吒开发板/联网/HDMI显示收款二维码/扫码付款成功后声光提醒用户并触发IO动作(模拟开锁等)
要求:
① 开源并在本站发帖详细记录过程,其他网友可以仿制实现② 搭建MQTT服务器,搭建微信支付/支付宝支付服务器端。
③ 哪吒D1开发板HDMI显示从服务器推送的付款二维码,扫码付款成功,服务器推送信息给哪吒D1,哪吒通过喇叭播放支付宝/微信到账xxx元,并触发IO动作。
④ 需要微信支付appid等信息可以联系我,需要linux服务器也可以联系我。
⑤⑥⑦⑧⑨ 要求与一楼相同
你好,这个项目还能接收吗,我要报名