bl-m3438 ap6212 CYW43438 SDIO驱动移植

平台:3519av100

kernel:linux-4.9.37

20210527release驱动链接:https://download.csdn.net/download/gpio_01/88240258

内核编译:

WIFI:

1.cp arch/arm/configs/hi3519av100_smp_emmc_defconfig .config

2.make ARCH=arm CROSS_COMPILE=arm-himix200-linux- menuconfig

3.配置cfg80211如下

4.配置X.509

 5.Cryptographic Api菜单里面的选项都需要配置为*编译进内核,我的内核默认是模块选项,导致我这边加载cfg80211.ko驱动总是段错误

6.make ARCH=arm CROSS_COMPILE=arm-himix200-linux- uImage

等待内核编译完成

编译驱动compat.ko  cfg80211.ko brcmfmac.ko brcmutil.ko

1.MY_KERNEL=./linux-4.9.y/
2.make KLIB=$MY_KERNEL KLIB_BUILD=$MY_KERNEL defconfig-brcmfmac
3.make ARCH=arm CROSS_COMPILE=arm-himix200-linux- KLIB=$MY_KERNEL KLIB_BUILD=$MY_KERNEL modules

4.编译好文件系统按照上面排列顺序insmod就可以了。

 蓝牙:

内核添加配置:

1.make ARCH=arm CROSS_COMPILE=arm-himix200-linux- menuconfig

2.配置[Networking support >Bluetooth subsystem support]如下图所示,

3. 配置[Networking support >Bluetooth subsystem support->Bluetooth device drivers]如下图所示,

 4.配置[Device Drivers > Input device support > Miscellaneous devices]如下图所示,

 5.配置[Device Drivers > HID support]如下图所示,

6.make ARCH=arm CROSS_COMPILE=arm-himix200-linux- uImage

7.make ARCH=arm CROSS_COMPILE=arm-himix200-linux- modules

将会生成rfcomm.ko、bnep.ko、uhid.ko、hci_uart.ko、hidp.ko这几个主要驱动,重新下载内核后按照上面顺序加载驱动

8.brcm_patchram_plus -d --patchram /etc/firmware/bcm43438a0.hcd --baudra
te 115200 --enable_lpm --enable_hci --no2bytes /dev/ttyAMA3

brcm_patchram_plus命令在驱动包中有是一个源码直接编译为应用程序就可以了。

9加载正常的打印

 一键编译各种蓝牙工具:

所有工具连接:https://download.csdn.net/download/gpio_01/88244007

下载bluetooth_tool解压后在根目录

./autobuild.sh

brcm_patchram_plus工具单独生成解压brcm_patchram_plus.tar.bz2后修改Makefile的交叉编译链就可以了

将生成的bin文件夹下的工具拷贝的板子bin文件夹,

将生成的lib文件夹下的库拷贝到板子lib文件夹

将libs目录下的除了bin和lib文件夹的环境按照相同的绝对路径拷贝到板子。

将brcm_patchram_plus工具和BCM4343B0.hcd bcm43438a0.hcd bcm43438a1.hcd三个固件都拷贝到板子备用

 板子工具使用

dbus-daemon[412]: Failed to start message bus: Could not get UID and GID for username "messagebus"

修改

/opt/bluetooth_tool/arm_build/libs/share/dbus-1/system.conf为root用户

 /opt/bluetooth_tool/arm_build/libs/etc/bluetooth/hcid.conf

insmod rfcomm.ko
insmod bnep.ko
insmod uhid.ko
insmod hci_uart.ko
insmod hidp.ko

brcm_patchram_plus -d --enable_hci --no2bytes --tosleep 200000 --baudrate 115200 --patchram /etc/firmware/bcm43438a1.hcd --bd_addr 11:22:33:44:55:66 /dev/ttyAMA3 &

hciconfig hci0 up
hciconfig hci0 piscan
rm -rf /opt/bluetooth_tool/arm_build/dbus-1.12.16/../libs/var/run/dbus/pid

dbus-daemon --system
hcid -f /opt/bluetooth_tool/arm_build/libs/etc/bluetooth/hcid.conf  -n -d &

一些问题解决参考

然后用命令dbus-daemon --system 打开dbus进程,这样才能用后续的hcid启动hcid.conf配置文件,蓝牙就打开了。
在执行dbus-daemon --system过程中会出现Failed to start message bus: Failed to open "/home/xiang/IMX6/bluetooth/imx_bluez/share/dbus-1/system.conf": No such file or directory 这样的错误信息

这是因为在PC机上交叉编译库的时候是建立在/home/xiang/IMX6/bluetooth/imx_bluez/etc/dbus-1这样一个目录路径下的,所以开发板没有这个路径,要在文件系统里面模拟出PC这个路径,用mkdir创建。

然后将/etc/dbus-1整个文件拷贝到/home/xiang/IMX6/bluetooth/imx_bluez/etc/下面,最好在做文件系统的时候就直接做进去

再执行dbus-daemon --system 这个的时候又会出现Failed to start message bus: Failed to bind socket "/home/xiang/IMX6/bluetooth/imx_bluez/var/run/dbus/system_bus_socket": No such file or directory

system_bus_socket 这个文件不是创建的是dbus-daemon --system自动生成的,但是前提是你得在路径里面把前面的目录创建好/home/xiang/IMX6/bluetooth/imx_bluez/var/run/dbus

然后再执行hcid -f /usr/etc/bluetooth/hcid.conf -n -d & 的时候,会报出Parsing /home/xiang/IMX6/bluetooth/imx_bluez/etc/bluetooth/main.conf failed: No such file or directory 这个错误
这个main.conf是一个空文件,/home/xiang/IMX6/bluetooth/imx_bluez/etc/bluetooth/所以要在该路径下面创建一个main.conf的空文件,
然后再执行hcid -f /usr/etc/bluetooth/hcid.conf -n -d & 就可以了


dbus-daemon --system这个命令在第二次开机的时候会执行错误,因为上一次执行后在文件系统/home/xiang/IMX6/bluetooth/imx_bluez/var/run/dbus/上已经保存了pid和system_bus_socket
所以开机后要先删除pid和system_bus_socket
再执行dbus-daemon --system 这样在文件系统里面有从新启动了dbus服务

hcid -f /usr/etc/bluetooth/hcid.conf -n -d & 这个命令也不能用上一次开机保存的pid和system_bus_socket

必须执行dbus-daemon --system  从新创建的pid和system_bus_socket
然后再hcid -f /usr/etc/bluetooth/hcid.conf -n -d & 才有效


一般我在文件系统里面就设置了开发板启动后先删除pid和system_bus_socket
然后打开蓝牙
执行dbus-daemon --system
hcid -f /usr/etc/bluetooth/hcid.conf -n -d &

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值