天天頭條:RK3588-WIF/BT調(diào)試之AP6256
2023-06-11 11:56:08 | 來源:jf_30051736 |
2023-06-11 11:56:08 | 來源:jf_30051736 |
/* SDIO接口Wi-Fi專用配置:SDIO接口節(jié)點 */&sdio {max-frequency = < 150000000 >; /* sdio接口的最大頻率,可調(diào)整 */supports-sdio;bus-width = < 4 >; /* 4線模式,可調(diào)整1線模式 */disable-wp;cap-sd-highspeed;cap-sdio-irq;keep-power-in-suspend;mmc-pwrseq = < &sdio_pwrseq >;non-removable;num-slots = < 1 >;pinctrl-names = "default";pinctrl-0 = < &sdiom0_pins >;sd-uhs-sdr104; /* 支持SDIO3.0 */status = "okay";};
/* SDIO接口Wi-Fi專用配置: WIFI_REG_ON: Wi-Fi的電源使能PIN腳 */sdio_pwrseq: sdio-pwrseq {compatible = "mmc-pwrseq-simple";clocks = < &hym8563 >;clock-names = "ext_clock";pinctrl-names = "default";pinctrl-0 = < &wifi_enable_h >;reset-gpios = < &gpio0 RK_PC4 GPIO_ACTIVE_LOW >; /*跟電源使能狀態(tài)恰好相反:高有效為LOW,低有效則為HIGH。切記:這個配置跟下面的WIFI,poweren_gpio是互斥的,不能同時配置!?。?/ /*特別注意:reset-gpios的GPIO_ACTIVE 配置跟poweren_gpio配置的電源使能狀態(tài)恰好是相反的*/};/* SDIO接口Wi-Fi專用配置:WIFI_REG_ON腳的pinctrl的配置 */&pinctrl {sdio-pwrseq {wifi_enable_h: wifi-enable-h {rockchip,pins = < 0 RK_PC4 RK_FUNC_GPIO &pcfg_pull_none >; /* 對應(yīng)上面的WIFI_REG_ON,關(guān)掉上下拉,防止不能拉高或拉低 */};};}
WIFI節(jié)點配置/* Wi-Fi節(jié)點 */wireless_wlan: wireless-wlan {compatible = "wlan-platdata";wifi_chip_type = "ap6256"; //模塊名稱pinctrl-names = "default";pinctrl-0 = < &wifi_host_wake_irq >;WIFI,host_wake_irq = < &gpio0 RK_PB2 GPIO_ACTIVE_HIGH >; //WIFI模塊喚醒CPU的//WIFI,poweren_gpio = < &gpio0 RK_PC4 GPIO_ACTIVE_HIGH >; //控制WIFI模塊電源的GPIO,配置了sdio_pwrseq就不需要再配置poweren_gpio status = "okay";};
WIFI,host_wake_irq的配置說明:WIFI,host_wake_irq = < &gpio0 RK_PB2 GPIO_ACTIVE_HIGH >; /* WIFI_WAKE_HOST: Wi-Fi中斷通知主控的PIN腳。* 特別注意:確認(rèn)下這個Wi-Fi pin腳跟主控的pin的硬件連接關(guān)系,直連的話就是GPIO_ACTIVE_HIGH;* 如果中間加了一個反向管就要改成低電平GPIO_ACTIVE_LOW觸發(fā)*/
WIFI_WAKE_HOST腳的pinctrl的配置:&pinctrl {wireless-wlan {wifi_host_wake_irq: wifi-host-wake-irq {rockchip,pins = < 0 RK_PB2 RK_FUNC_GPIO &pcfg_pull_down >;};};}/* 注意一般Wi-Fi的wake host pin都是高電平觸發(fā),* 所以默認(rèn)這里要配置為下拉; 如果客戶的硬件設(shè)計* 是反向的則要改為上拉,總之要初始化為與觸發(fā)電平* 相反的狀態(tài)*/
以下UART相關(guān)的都要配置為實際使用的UART口的所對應(yīng)PIN,注意RTS/CTS pin一定要按照SDK設(shè)計
接(具體接法參考7.3章節(jié)的UART描述),很多客戶反饋的異常都是因為這兩個PIN腳沒有接導(dǎo)致初始化
異常,下面假設(shè)藍(lán)牙使用UART4:
(資料圖)
bt_uart6: wireless_bluetooth: wireless-bluetooth {compatible = "bluetooth-platdata";clocks = < &hym8563 >; //外部時鐘clock-names = "ext_clock"; uart_rts_gpios = < &gpio1 RK_PA2 GPIO_ACTIVE_LOW >; //uart的rts腳pinctrl-names = "default", "rts_gpio";pinctrl-0 = < &uart6m1_rtsn >;pinctrl-1 = < &uart6_gpios >;BT,reset_gpio = < &gpio3 RK_PA6 GPIO_ACTIVE_HIGH >; //藍(lán)牙的復(fù)位腳BT,wake_host_irq = < &gpio0 RK_PC5 GPIO_ACTIVE_HIGH >; //藍(lán)牙模塊喚醒CPU的GPIOstatus = "okay";};&pinctrl {wireless-bluetooth {uart6_gpios: uart6-gpios {rockchip,pins = < 1 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none >;};};}
藍(lán)牙對應(yīng)的uart6配置/* 打開對應(yīng)的UART配置 */&uart6 {pinctrl-names = "default";/* 這里配置對應(yīng)主控UART的TX/RX/CTS PIN ,不要配置RTS PIN*/pinctrl-0 = < &uart6m1_xfer &uart6m1_ctsn >;status = "okay";};
# Kernel defconfigexport RK_KERNEL_DEFCONFIG=rockchip_linux_defconfig
cd kernelmake ARCH=arm64 menuconfigmake savedefconfig
選擇:Device Drivers ---> Network device support ---> Wireless LAN ---> Rockchip Wireless LAN support
Wi-Fi驅(qū)動可編譯到內(nèi)核或者ko方式, 切記下面兩個配置必須二選一,否則Wi-Fi無法加載!
KO 配置:[* ] build wifi ko modules
CONFIG_WIFI_BUILD_MODULE=y# CONFIG_WIFI_LOAD_DRIVER_WHEN_KERNEL_BOOTUP is not set
buildin 配置:[* ] Wifi load driver when kernel bootup
CONFIG_WIFI_LOAD_DRIVER_WHEN_KERNEL_BOOTUP=y# CONFIG_WIFI_BUILD_MODULE is not set
buildin 只能選擇一個型號,realtek 模組和 ap6xxx 模組不能同時選擇為y,且realtek的也只能選擇其
中一個;
ap6xxx 和 cypress也是互斥的,只能選擇一個且如果選擇ap6xxx,cypress的配置自動消失,去掉ap
配置,cypress自動出現(xiàn);
ko方式則可以選擇多個Wi-Fi
cd kernelmake ARCH=arm64 menuconfigmake savedefconfig
選擇: Networking support ---> Bluetooth subsystem support ---> Bluetooth device drivers
注意:配置完成后要保存到對應(yīng)的defconfig
external/rkwifibt/firmware/broadcom/AP6256/├── bt│ └── BCM4345C5.hcd└── wifi├── fw_bcm43456c5_ag.bin├── fw_bcm43456c5_ag_mfg.bin└── nvram_ap6256.txt
經(jīng)過編譯規(guī)則編譯后,對應(yīng)的文件被拷貝到工程的output目錄:(kernel4.19內(nèi)核由system變更為vendor目錄)buildroot/output/rockchip_rk3xxxx/target//system(vendor)/lib/modules/bcmdhd.ko #驅(qū)動ko(如果是ko編譯的話)/system(vendor)/etc/firmware/fw_bcm43456c5_ag.bin #驅(qū)動firmware文件存放位置/system(vendor)/etc/firmware/fw_bcm43456c5_ag_mfg.bin #驅(qū)動firmware文件存放位置/system(vendor)/etc/firmware/nvram_ap6256.txt #驅(qū)動nvram文件存放位置/system(vendor)/etc/firmware/BCM4345C5.hcd #藍(lán)牙firmware文件(如果有藍(lán)牙功能)
最終燒錄到機器中后,Wi-Fi運行時所需的文件及存放位置:/system(vendor)/lib/modules/bcmdhd.ko #驅(qū)動ko(如果是ko編譯的話)/system(vendor)/etc/firmware/fw_bcm43456c5_ag.bin #驅(qū)動firmware文件存放位置/system(vendor)/etc/firmware/fw_bcm43456c5_ag_mfg.bin #驅(qū)動firmware文件存放位置/system(vendor)/etc/firmware/nvram_ap6256.txt #驅(qū)動nvram文件存放位置/system(vendor)/etc/firmware/BCM4345C5.hcd #藍(lán)牙firmware文件(如果有藍(lán)牙功能)
# Define WiFi BT chip# Compatible with Realtek and AP6XXX WiFi : RK_WIFIBT_CHIP=ALL_AP# Compatible with Realtek and CYWXXX WiFi : RK_WIFIBT_CHIP=ALL_CY# Single WiFi configuration: AP6256 or CYW43455: RK_WIFIBT_CHIP=AP6256export RK_WIFIBT_CHIP=ALL_AP# Define BT ttySXexport RK_WIFIBT_TTY=ttyS6
審核編輯:湯梓紅