描述使用allwinner SDK 如何支持一款蓝牙模块
2. 模块介绍目前H3 android4.4.2平台上已支持的蓝牙模组有6款,其中包括USB蓝牙,支持列表如表
DOSH:视具体硬件而定,只要是标准的USB蓝牙都支持;
3.修改说明 (1)licheea. 内核配置
命令行进入到linux-3.4目录,如果之前没有编译过lichee,则先要将要使用的defconfig文件拷贝到.config文件,执行命令cp arch\arm\configs\要使用的defconfig文件 .config,然后再输入命令make ARCH=arm menuconfig进入内核配置界面,选上如下选项:
[*] Networking support —> <*> Bluetooth subsystem support —> <*> RFCOMM protocol support [*] RFCOMM TTY support <*> BNEP protocol support [*] Multicast filter support [*] Protocol filter support <*> HIDP protocol support Bluetooth device drivers —> <*> HCI UART driver [*] UART (H4) protocol support [M] Broadcom Bluetooth Low Power Manager Support [M] Realtek Bluesleep driver support <*> RF switch subsystem support —>b. sys_config.fex修改 配置较为简单,bt_uart_baud默认配置为1500000,请不要随意改动,否则会到导致蓝牙打不开。
[bt_para] bt_used = 1 bt_uart_id = 1 bt_uart_baud = 1500000 bt_rst_n = port:PG12<1><default><default><0> bt_wake = port:PG11<1><default><default><0> bt_host_wake = port:PG13<0><default><default><0> bt_host_wake_invert = 0说明如下: bt_used: 0- 不使用蓝牙, 1- 使用蓝牙 bt_uard_id: 蓝牙使用哪一组串口,0-uart0,1-uart1 bt_uart_baud: 串口波特率,单位:bps bt_rst_n: 蓝牙使能脚 bt_wake: 主控唤醒蓝牙引脚 bt_host_wake: 蓝牙唤醒主控引脚 bt_host_wake_invert: 蓝牙唤醒主控引脚到主控之间是否有加反相器,0-没有,1-有
确定蓝牙使用哪一组串口后,需要将对应的串口配置成uart_used=1。
[uart1] uart_used = 1 uart_port = 1 uart_type = 4 uart_tx = port:PG06<2><1><default><default> uart_rx = port:PG07<2><1><default><default> uart_rts = port:PG08<2><1><default><default> uart_cts = port:PG09<2><1><default><default>c. USB蓝牙 上面的移植说明都是针对非USB蓝牙模组的,如果所使用的蓝牙模组不在表1中,则系统会使用USB蓝牙。此时,如果不插入USB蓝牙适配器,那么在原生Setting里是不会显示蓝牙设置选项的。
(2)androida. BoardConfig.mk
# 1. Wifi Configuration #BOARD_WIFI_VENDOR := realtek BOARD_WIFI_VENDOR := broadcom # 1.2 broadcom wifi support ifeq ($(BOARD_WIFI_VENDOR), broadcom) BOARD_WPA_SUPPLICANT_DRIVER := NL80211 WPA_SUPPLICANT_VERSION := VER_0_8_X BOARD_WPA_SUPPLICANT_PRIVATE_LIB := lib_driver_cmd_bcmdhd BOARD_HOSTAPD_DRIVER := NL80211 BOARD_HOSTAPD_PRIVATE_LIB := lib_driver_cmd_bcmdhd BOARD_WLAN_DEVICE := bcmdhd WIFI_DRIVER_FW_PATH_PARAM := “/sys/module/bcmdhd/parameters/firmware_path” SW_BOARD_USR_WIFI := AP6212 include hardware/broadcom/wlan/bcmdhd/firmware/firmware-bcm.mk endif # 2. Bluetooth Configuration # make sure BOARD_HAVE_BLUETOOTH is true for every bt vendor BOARD_HAVE_BLUETOOTH := true BOARD_HAVE_BLUETOOTH_BCM := true #BLUETOOTH_HCI_USE_USB := true #BOARD_HAVE_BLUETOOTH_RTK := true #BLUETOOTH_HCI_USE_RTK_H5 := true SW_BOARD_HAVE_BLUETOOTH_NAME := ap6212 BOARD_BLUETOOTH_BDROID_BUILDCFG_INCLUDE_DIR := device/softwinner/dolphin-fvd-p1/bluetooth/ #BOARD_BLUETOOTH_DOES_NOT_USE_RFKILL := trueb. dolphin_fvd_p1.mk 不使用USB蓝牙,修改如下:
PRODUCT_PACKAGES += \ Bluetooth BLUETOOTH_HCI_USE_USB := false ifeq ($(BLUETOOTH_HCI_USE_USB), true) PRODUCT_PACKAGES += \ USBBT PRODUCT_PACKAGES += \c. init.rc
on boot # insmod network insmod /system/vendor/modules/bcmdhd.ko insmod /system/vendor/modules/bcm_btlpm.ko # bcm bluetooth # uart device chmod 660 /dev/ttyS1 chown bluetooth net_bt_stack /dev/ttyS1 mkdir /data/misc/bluedroid 770 bluetooth net_bt_stack # power up/down interface chmod 0660 /sys/class/rfkill/rfkill0/state chmod 0660 /sys/class/rfkill/rfkill0/type chown bluetooth net_bt_stack /sys/class/rfkill/rfkill0/state chown bluetooth net_bt_stack /sys/class/rfkill/rfkill0/type write /sys/class/rfkill/rfkill0/state 0 # bluetooth MAC address programming chown bluetooth net_bt_stack ro.bt.bdaddr_path chown bluetooth net_bt_stack /system/etc/bluetooth chown bluetooth net_bt_stack /data/misc/bluetooth setprop ro.bt.bdaddr_path “/data/misc/bluetooth/bdaddr” # bluetooth LPM chmod 0220 /proc/bluetooth/sleep/lpm chmod 0220 /proc/bluetooth/sleep/btwrite chown bluetooth net_bt_stack /proc/bluetooth/sleep/lpm chown bluetooth net_bt_stack /proc/bluetooth/sleep/btwrite # broadcom wifi service # 1 broadcom wifi station and softap service wpa_supplicant /system/bin/logwrapper /system/bin/wpa_supplicant \ -iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf \ -I/system/etc/wifi/wpa_supplicant_overlay.conf \ -O/data/misc/wifi/sockets \ -e/data/misc/wifi/entropy.bin -g@android:wpa_wlan0 class main socket wpa_wlan0 dgram 660 wifi wifi disabled oneshot # 2 braodcom wifi sta p2p concurrent service service p2p_supplicant /system/bin/logwrapper /system/bin/wpa_supplicant \ -iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf \ -I/system/etc/wifi/wpa_supplicant_overlay.conf \ -O/data/misc/wifi/sockets -N \ -ip2p0 -Dnl80211 -c/data/misc/wifi/p2p_supplicant.conf \ -I/system/etc/wifi/p2p_supplicant_overlay.conf \ -puse_p2p_group_interface=1 -e/data/misc/wifi/entropy.bin \ -g@android:wpa_wlan0 class main socket wpa_wlan0 dgram 660 wifi wifi disabled oneshot免责声明:文章内容来自互联网,本站不对其真实性负责,也不承担任何法律责任,如有侵权等情况,请与本站联系删除。
转载请注明出处:H3平台蓝牙模块移植说明 https://www.yhzz.com.cn/a/14351.html