1.ap6212
功能:wifi station、softap、wifi direct、bt、
接口類型:sdio、uart
調(diào)試方案:octopus-f1,下面以A83T平臺(tái)android4.4為例說明ap6212的移植過程
2、軟硬件設(shè)計(jì)部份差異說明
(1) ap6212采用的是26M晶振,A框去掉,即不需要反相器;
(2) ap6212硬件上第29腳懸空,與ap6210不同;
(3)ap6212必須采用bcmhd新驅(qū)動(dòng)1.201.34.x版本,如附件;
(4)ap6212 firmware部分如附件請(qǐng)覆蓋至\hardware\broadcom\wlan\bcmdhd\firmware。
3內(nèi)核配置
3.1 .config
.config中需要配置如下選項(xiàng),將wifi driver編譯進(jìn)內(nèi)核
CONFIG_BCMDHD = y
CONFIG_BCMDHD_OOB = y
同時(shí)把ap6212驅(qū)動(dòng)代碼加到/android/hardware/broadcom/wlan/bcmdhd/firmware路徑下。
3.2 BoardConfig.mk
BoardConfig.mk文件決定android要加載哪一款wifi模組、是否開啟藍(lán)牙和使用哪一款藍(lán)牙模組,要配置成使用ap6212模組并啟用wifi和藍(lán)牙功能需要把BoardConfig.mk文件的相關(guān)代碼修改成如下。
# wifi and bt configuration
# 1. Wifi Configuration
#BOARD_WIFI_VENDOR := realtek
BOARD_WIFI_VENDOR := broadcom
# 1.1 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"
BOARD_USR_WIFI := ap6212
include hardware/broadcom/wlan/bcmdhd/firmware/$(BOARD_USR_WIFI)/device-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
#BOARD_HAVE_BLUETOOTH_RTK := true
#BLUETOOTH_HCI_USE_RTK_H5 := true
BOARD_HAVE_BLUETOOTH_NAME := ap6212
BOARD_BLUETOOTH_BDROID_BUILDCFG_INCLUDE_DIR := device/softwinner/tulip-t1/bluetooth/
|
說明:
1、“#”符號(hào)起注釋作用;
2、“BOARD_USR_WIFI := AP6210”宏指明wifi選用ap6212;
3、“BOARD_HAVE_BLUETOOTH := true”宏指明使用藍(lán)牙;
4、“BOARD_HAVE_BLUETOOTH_BCM := true”宏指定藍(lán)牙廠商為Broadcom;
5、“BOARD_HAVE_BLUETOOTH_NAME := ap6212”宏指明藍(lán)牙模組名字;
6、“BOARD_BLUETOOTH_BDROID_BUILDCFG_INCLUDE_DIR := device/softwinner/tulip-t1/bluetooth/”宏指明配置文件bdroid_buildcfg.h路徑;
注意:
1、需注釋掉#BOARD_HAVE_BLUETOOTH_RTK := true
2、若不需要藍(lán)牙功能只需要把相關(guān)宏注釋掉就可以。
3、OARD_USR_WIFI的大小寫根據(jù)你在3.1中命名規(guī)則來寫。
3.3 init.sun8i.rc
這部分只要注意兩點(diǎn):
注意:
1、若init.sun50iw1p1.rc文件無修改后代碼,可手動(dòng)添加;
2、需注釋掉realtek wifi和bluetooth相關(guān)內(nèi)容。
3.3 octopus-f1
octopus-f1.mk文件會(huì)在編譯時(shí)拷貝指定文件到特定目錄下,使用ap6212需要確認(rèn)如下修改:
DEVICE_PACKAGE_OVERLAYS := device/softwinner/octopus-perf/overlay \
$(DEVICE_PACKAGE_OVERLAYS)
PRODUCT_PACKAGES += gatord
PRODUCT_PACKAGES += \
ESFileExplorer \
VideoPlayer \
Bluetooth
PRODUCT_PACKAGES += \
gps.exdroid \
PRODUCT_COPY_FILES += \
device/softwinner/octopus-perf/configs/gps.conf:system/etc/gps.conf
PRODUCT_COPY_FILES += \
device/softwinner/octopus-perf/kernel:kernel \
device/softwinner/octopus-perf/fstab.sun8i:root/fstab.sun8i \
device/softwinner/octopus-perf/init.sun8i.rc:root/init.sun8i.rc \
device/softwinner/octopus-perf/init.recovery.sun8i.rc:root/init.recovery.sun8i.rc \
device/softwinner/octopus-perf/ueventd.sun8i.rc:root/ueventd.sun8i.rc \
device/softwinner/octopus-perf/recovery.fstab:recovery.fstab \
device/softwinner/octopus-perf/modules/modules/nand.ko:root/nand.ko \
device/softwinner/octopus-perf/modules/modules/sunxi_tr.ko:root/sunxi_tr.ko \
device/softwinner/octopus-perf/modules/modules/disp.ko:root/disp.ko \
device/softwinner/octopus-perf/modules/modules/sw-device.ko:obj/sw-device.ko \
PRODUCT_COPY_FILES += \
device/softwinner/octopus-perf/configs/tablet_core_hardware.xml:system/etc/permissions/tablet_core_hardware.xml
PRODUCT_COPY_FILES += \
device/softwinner/octopus-perf/configs/camera.cfg:system/etc/camera.cfg \
device/softwinner/octopus-perf/configs/cfg-Gallery2.xml:system/etc/cfg-Gallery2.xml \
device/softwinner/octopus-perf/configs/gsensor.cfg:system/usr/gsensor.cfg \
device/softwinner/octopus-perf/configs/media_profiles.xml:system/etc/media_profiles.xml \
device/softwinner/octopus-perf/configs/sunxi-keyboard.kl:system/usr/keylayout/sunxi-keyboard.kl \
device/softwinner/octopus-perf/configs/sunxi-ir.kl:system/usr/keylayout/sunxi-ir.kl \
device/softwinner/octopus-perf/configs/tp.idc:system/usr/idc/tp.idc
PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.hardware.touchscreen.multitouch.xml:system/etc/permissions/android.hardware.touchscreen.multitouch.xml \
frameworks/native/data/etc/android.hardware.location.gps.xml:system/etc/permissions/android.hardware.location.gps.xml \
frameworks/native/data/etc/android.hardware.ethernet.xml:system/etc/permissions/android.hardware.ethernet.xml
PRODUCT_COPY_FILES += \
device/softwinner/octopus-perf/bluetooth/bt_vendor.conf:system/etc/bluetooth/bt_vendor.conf
PRODUCT_COPY_FILES += \
device/softwinner/octopus-perf/bluetooth/bt_vendor.conf:system/etc/bluetooth/bt_vendor.conf
PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.hardware.camera.xml:system/etc/permissions/android.hardware.camera.xml \
frameworks/native/data/etc/android.hardware.usb.accessory.xml:system/etc/permissions/android.hardware.usb.accessory.xml
# Low mem(memory <= 512M) device should not copy android.software.managed_users.xml
PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.software.managed_users.xml:system/etc/permissions/android.software.managed_users.xml
PRODUCT_COPY_FILES += \
device/softwinner/octopus-perf/media/bootanimation.zip:system/media/bootanimation.zip \
#camera config for camera detector
PRODUCT_COPY_FILES += \
device/softwinner/octopus-perf/hawkview/sensor_list_cfg.ini:system/etc/hawkview/sensor_list_cfg.ini
# Radio Packages and Configuration Flie
$(call inherit-product, device/softwinner/common/rild/radio_common.mk)
#$(call inherit-product, device/softwinner/common/ril_modem/huawei/mu509/huawei_mu509.mk)
#$(call inherit-product, device/softwinner/common/ril_modem/Oviphone/em55/oviphone_em55.mk)
#sensor
PRODUCT_COPY_FILES += \
device/softwinner/octopus-perf/sensor.sh:system/bin/sensor.sh
|
注意:
1、android.hardware.wifi.xml拷貝到指定目錄,以使設(shè)置界面顯示wifi
2、android.hardware.wifi.direct.xml是在wifi設(shè)備中顯示wifi direct選項(xiàng)
3、android.hardware.bluetooth.xml是在setting界面中顯示藍(lán)牙
4、“PRODUCT_PACKAGES += Bluetooth”指定去編譯Bluetooth.apk
3.4config.xml
config.xml文件路徑:\android5.1\device\softwinner\tulip-t1\overlay\frameworks\base\core\res\res
\values\config.xml
要打開藍(lán)牙功能,需要在config.xml中把藍(lán)牙的bt-pan網(wǎng)口打開,修改的部分代碼如下。
<!-- List of regexpressions describing the interface (if any) that represent tetherable
Wifi interfaces. If the device doesn't want to support tethering over Wifi this
should be empty. An example would be "softap.*" -->
<!-- default: disable Softap feature -->
<string-array translatable="false" name="config_tether_wifi_regexs">
<item>"wlan0"</item>
</string-array>
-->
<!-- List of regexpressions describing the interface (if any) that represent tetherable
bluetooth interfaces. If the device doesn't want to support tethering over bluetooth this
should be empty. -->
<!-- default: disable Bluetooth PAN feature -->
<string-array translatable="false" name="config_tether_bluetooth_regexs">
<item>"bt-pan"</item>
</string-array>
<!-- List of regexpressions describing the interface (if any) that represent tetherable
|
注:若相應(yīng)平臺(tái)該目錄下沒config.xml文件,可到其他相應(yīng)平臺(tái)對(duì)應(yīng)目錄下拷貝一份。
3.5 vnd_<product>.txt
藍(lán)牙配置文件 設(shè)置波特率,uart設(shè)備文件和firmware路徑(初始值),調(diào)試信息配置
文件路徑: device\softwinner\tulip-t1\bluetooth
創(chuàng)建vnd_$( product).txt文件,如vnd_tulip-t1.txt
#Set baudrate to 1500000
UART_TARGET_BAUD_RATE=1500000
BLUETOOTH_UART_DEVICE_PORT = "/dev/ttyS1"
FW_PATCHFILE_LOCATION = "/system/vendor/modules/"
LPM_IDLE_TIMEOUT_MULTIPLE = 5
#LPM_SLEEP_MODE = FALSE
BT_WAKE_VIA_PROC = TRUE
BTVND_DBG = TRUE
BTHW_DBG = TRUE
VNDUSERIAL_DBG = TRUE
UPIO_DBG = TRUE
|
3.6 bt_vendor.conf
文件路徑:device\softwinner\tulip-t1\bluetooth
# UART device port where Bluetooth controller is attached
UartPort = /dev/ttyS1
# Firmware patch file location
FwPatchFilePath = /system/vendor/modules/
#Firmware name
FwPatchFileName = bcm20710a1.hcd
|
3.7 bdroid_buildcfg.h
android5.1\device\softwinner\tulip-t1\bluetooth\bdroid_buildcfg.h主要配置打開藍(lán)牙時(shí)顯示的本機(jī)名字。
#ifndef _BDROID_BUILDCFG_H
#define _BDROID_BUILDCFG_H
#define BTM_DEF_LOCAL_NAME "tulip-t1"
#define BTA_DM_COD {0x1A, 0x01, 0x14}
#define BTIF_HF_SERVICES (BTA_HSP_SERVICE_MASK)
#define BTIF_HF_SERVICE_NAMES { BTIF_HSAG_SERVICE_NAME }
#endif
|
3.8 引腳配置
ap6212引腳在lichee\tools\pack\chips\sun8iw6p1\configs\ f1\sys_config.fex中定義,需根據(jù)具體的原理圖做相應(yīng)的配置,需要配置的選項(xiàng)有:
;wifi/bt/fm/gps/nfc modules configuration
;module_num:
; 1- ap6181(wifi) 2- ap6210(wifi+bt) 3- rtl8188eu(wifi)
; 4- rtl8723au(wifi+bt) 5- rtl8723bs(wifi+bt) 6- esp8089(wifi)
; 7- ap6476(wifi+bt+fm+gps)
; 8- ap6330(wifi+bt+fm) gb9663(wifi+bt+fm) ap6212(wifi+bt+fm)
;module_power1: ""- bat, "axp_dldo1"- axp dldo1
;module_power1_vol: power1 voltage, mv; not used for module_power1 is ""
;module_power2: ""- bat, "axp_dldo2"- axp dldo2
;module_power2_vol: power2 voltage, mv; not used for module_power2 is ""
;module_power3: ""- bat, "axp_dldo2"- axp dldo2
;module_power3_vol: power3 voltage, mv; not used for module_power3 is ""
;power_switch: module power switch io when bat supply
;chip_en: enable chip io
;lpo_use_apclk: ""- not use, "losc_out"- a23/33, "ac10032k1"、"ac10032k2"、"ac10032k3"- a80/a83
;--------------------------------------------------------------------------------
[rf_para]
module_num = 2
module_power1 = "vcc-wifi-io"
module_power1_vol = 3300000
module_power2 = ""
module_power2_vol =
module_power3 = ""
module_power3_vol =
power_switch =
chip_en =
lpo_use_apclk = "ac10032k2"
|
說明:
1、“;”符號(hào)起注釋作用
2、“module_num” 宏表示選用哪一款wifi模組;
3、“module_power1”宏表示給模組供電的是axp的哪路ldo,一般選vcc-wifi-io(參見[pmu1_regu]);
4、“module_power1_vol”宏設(shè)置ldo的供電電壓,ap6212供電電壓為3.3V;
5、“lpo_use_apclk”選擇32k時(shí)鐘源,根據(jù)原理圖配置,一般選ac10032k2。
Wifi部分
;wifi configuration
;wifi_used: 0-not use, 1- use
;wifi_sdc_id: 0- SDC0, 1- SDC1, 2- SDC2, 3- SDC3
;wifi_usbc_id: 0- USB0, 1- USB1, 2- USB2
;wifi_usbc_type: 1- EHCI(speed 2.0), 2- OHCI(speed 1.0)
;wl_reg_on: wifi function enable io
;wl_host_wake: wifi device wake-up host
;wl_host_wake_invert: whether wl_host_wake use inverter between ap and module
; 0: not used, 1: used
;--------------------------------------------------------------------------------
[wifi_para]
wifi_used = 1
wifi_sdc_id = 1
wifi_usbc_id = 1
wifi_usbc_type = 1
wl_reg_on = port:PL02<1><default><default><0>
wl_host_wake = port:PL03<4><default><default><0>
wl_host_wake_invert = 0
|
說明:
1、“;”符號(hào)起注釋作用
2、“wifi_used”宏賦值為1表示使用wifi,為0表示不使用;
3、“wifi_sdc_id”宏表示SDIO接口wifi使用哪個(gè)MMC 控制器 ;
4、“wl_reg_on”宏表示wifi使能腳,打開wifi的過程,會(huì)拉高,根據(jù)原理圖配置;
5、“wl_host_wake”宏表示wifi喚醒主控功能(WL-WAKE-AP),根據(jù)實(shí)際原理圖配置。
藍(lán)牙部份
;bluetooth configuration
;bt_used: 0- no used, 1- used
;bt_uard_id: 0- uart0, 1- uart1, 2- uart2
;bt_rst_n: bt function enable io
;bt_wake: host wake-up bluetooth device
;bt_wak_host: bt device wake-up host
;bt_host_wake_invert: whether bt_host_wake use inverter between ap and module
; 0: not used, 1: used
;--------------------------------------------------------------------------------
[bt_para]
bt_used = 1
bt_uart_id = 1
bt_rst_n = port:PL04<1><default><default><0>
bt_wake = port:PH10<1><default><default><0>
bt_host_wake = port:PL05<4><default><default><0>
bt_host_wake_invert = 0
|
說明:
1、“bt_used”宏賦值為1表示使用藍(lán)牙,為0表示不使用;
2、“bt_uart_id”宏表示藍(lán)牙所使用的是哪個(gè)uart;
3、“bt_rst_n”宏表示藍(lán)牙使能腳,藍(lán)牙打開時(shí)會(huì)拉高,根據(jù)實(shí)際原理圖配置;
4、“bt_wake”宏表示主控喚醒藍(lán)牙(AP-WAKE-BT),根據(jù)實(shí)際原理圖配置;
5、“bt_host_wake”宏表示藍(lán)牙喚醒主控(BT-WAKE-AP),根據(jù)實(shí)際原理圖配置。
4. 常見問題
硬件checklist:
1. 26M晶振電路不需要接反相器,XTAL_IN/XTAL_OUT直接接模塊Pin 10 /Pin 11;
2. 32K時(shí)鐘波形正常輸出;
3. Pin 22 VDDIO 電壓(3.3V);
4. Pin 9 VBAT接電池有電壓;
5. Pin 29 VDD_TCXO需要懸空;
軟件checklist:
1. Wifi和藍(lán)牙都打不開?
請(qǐng)確認(rèn)確認(rèn)/system/vendor/modules/是否有以下文件,名字是否正確?
bcmhd.ko
fw_bcm43438a0.bin
fw_bcm43438a0_apsta.bin
fw_bcm43438a0_p2p.bin
nvram.txt
如果沒有這些文件,說明編譯的時(shí)候沒有編到,請(qǐng)檢查是否BoardConfig.mk大小寫以及hardware\broadcom\wlan\bcmdhd\firmware\firmware-bcm.mk是否有加ap6212。
2. 藍(lán)牙打不開?
先確認(rèn)4.1.5有加,再確認(rèn)4.1.7波特率是否設(shè)置正確,另外改了Boardconfig.mk需要make clean;
3. 藍(lán)牙打開后搜不到設(shè)備?
先確認(rèn)是否加天線,再確認(rèn)確認(rèn)4.1.5的FwPatchFileName是否正確;
其他:
1. 搜不到5G 信號(hào)? 搜不到某些藍(lán)牙設(shè)備?某些路由器連接不上?
晶振存在頻偏,請(qǐng)嘗試從小到大更換26M晶振起振電路上的兩個(gè)諧振電容。
|