AP6255 蓝牙驱动移植

本文介绍了如何在IMX6平台上配置AP6255蓝牙模块,包括设置UART接口、配置蓝牙驱动及固件路径等步骤。文中详细展示了关键的配置代码段和设置项。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1:平台 imx6

2:蓝牙模块为AP6255

原理图部分:



配置UART4

static iomux_v3_cfg_t mx6sl_uart4_pads[] = {
MX6SL_PAD_KEY_COL6__UART4_RXD,
MX6SL_PAD_KEY_COL7__UART4_RTS,
MX6SL_PAD_KEY_ROW6__UART4_TXD,
MX6SL_PAD_KEY_ROW7__UART4_CTS,

};

然后make menuconfig

CONFIG_BT=y

CONFIG_BT_RFCOMM=y

CONFIG_BT_RFCOMM_TTY=y

CONFIG_BT_BNEP=y

CONFIG_BT_BNEP_MC_FILTER=y

CONFIG_BT_BNEP_PROTO_FILTER=y

CONFIG_BT_HIDP=y

CONFIG_BT_HCIBTUSB=y

CONFIG_BT_HCIUART=y

CONFIG_BT_HCIUART_H4=y

配置

#define MX6_BRD_FEC_BT_REG_ON IMX_GPIO_NR(3, 25)

根据蓝牙模块的上电时序,上电


3:主要修改hal层:

hardware\broadcom\libbt\conf\AP6255:

 

bd_addr.txt 11:22:33:44:55:66

bt_vendor.conf:

# UART device port where Bluetooth controller is attached
UartPort = /dev/ttymxc3
# Firmware patch file location
FwPatchFilePath = /system/etc/firmware/
#
# #Firmware name
FwPatchFileName = BCM4345C0.hcd

#

使用第4个串口,为/dev/ttymxc3, 固件位置FwPatchFilePath = /system/etc/firmware/

固件名字:FwPatchFileName = BCM4345C0.hcd

Android.mk

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := bt_vendor.conf
LOCAL_MODULE_CLASS := ETC
LOCAL_MODULE_PATH := $(TARGET_OUT)/etc/bluetooth
LOCAL_MODULE_TAGS := eng
LOCAL_SRC_FILES := $(LOCAL_MODULE)

include $(BUILD_PREBUILT)


配置:BoardConfig.mk

BOARD_HAVE_BLUETOOTH:True

BOARD_HAVE_BLUETOOTH_BCM:True

修改:hardware/broadcom/libbt/include/bt_vendor_brcm.h

UART_TARGET_BAUD_RATE 3000000

LPM_SLEEP_MODE     0

4:rfkill 主要控制蓝牙的上电与下电

static struct platform_device mxc_bt_rfkill = {
.name = "mxc_bt_rfkill",
};


static struct imx_bt_rfkill_platform_data mxc_bt_rfkill_data = {
.power_change = mx6sl_evk_bt_power_change,
};

mxc_register_device(&mxc_bt_rfkill, &mxc_bt_rfkill_data);

static struct platform_driver mxc_bt_rfkill_driver = {
.driver = {
.name = "mxc_bt_rfkill",
},
.probe = mxc_bt_rfkill_probe,
.remove = __devexit_p(mxc_bt_rfkill_remove),

};

static int mxc_bt_set_block(void *rfkdata, bool blocked)
{
struct imx_bt_rfkill_platform_data *data = rfkdata;
int ret;


/* Bluetooth stack will reset the bluetooth chip during
* resume, since we keep bluetooth's power during suspend,
* don't let rfkill to actually reset the chip. */
if (system_in_suspend)
return 0;
pr_info("rfkill: BT RF going to : %s\n", blocked ? "off" : "on");
if (!blocked)
ret = data->power_change(1);
else
ret = data->power_change(0);


return ret;
}


static const struct rfkill_ops mxc_bt_rfkill_ops = {
.set_block = mxc_bt_set_block,

};

通过power_change,打开关闭蓝牙

int mx6sl_evk_bt_power_change(int status)
{
if (status)
mx6sl_evk_bt_reset();
else
mx6sl_evk_bt_off();
return 0;

}

操作gpio实现,上电与下电。

########################BT FM ########################## Download the image using command: 1 # Flash Image Put the board in Flashing mode. Refer below Appendix - 1 cd <your path>/Nvidia_Demo/android_gb_cardhu_os_image sudo ./nvflash --bct flash.bct --setbct --odmdata 0x40080105 --configfile flash.cfg --create --bl bootloader.bin --go #################################################################################################################################################################################################### Appendix - 1 Nvidia Board in Flashing Mode #################################################################################################################################################################################################### 1. Connect the Debug board to Cardhu board. 2. Connect the power supply and Micro USB to Cardhu 3. On the Debug Board Press S12 (FRC RCV), Keeping this pressed Press and release S7 (RESET), Now Release S12. 4. Now Device is in Flashing mode, We can start nvflash command now. #################################################################################################################################################################################################### Appendix - 2 Nvidia Board Keys (On Debug Board) #################################################################################################################################################################################################### 1. S7 (RESET) --> is the RESET button. 2. S5 (ROW1) --> is the BACK button. 2. S10 (ROW2) --> is the Home button. 4. S6 (ON KEY) --> is Wake up button. #################################################################################################################################################################################################### Appendix - 3 Nvidia Board unavailable Keys workaround #################################################################################################################################################################################################### 1.To execute teh specific keys, provide the key inputs from adb shell. Provide the keyevent for the desired key.Refer teh key list below. Eg: for MENU key run adb shell #input keyevent 82 { "STAR", 17 }, { "POUND", 18 }, { "DPAD_UP", 19 }, { "DPAD_DOWN", 20 }, { "DPAD_LEFT", 21 }, { "DPAD_RIGHT", 22 }, { "DPAD_CENTER", 23 }, { "VOLUME_UP", 24 }, { "VOLUME_DOWN", 25 }, { "POWER", 26 }, { "CAMERA", 27 }, { "CLEAR", 28 }, { "HEADSETHOOK", 79 }, { "FOCUS", 80 }, { "PLUS", 81 }, { "MENU", 82 }, { "NOTIFICATION", 83 }, { "SEARCH", 84 }, { "MEDIA_PLAY_PAUSE", 85 }, { "MEDIA_STOP", 86 }, { "MEDIA_NEXT", 87 },
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值