电路如下:
wifi:
按照rk3399 sdk默认配置,修改相应的引脚
sdio_pwrseq: sdio-pwrseq {
compatible = "mmc-pwrseq-simple";
clocks = <&rk808 1>;
clock-names = "ext_clock";
pinctrl-names = "default";
pinctrl-0 = <&wifi_enable_h>;
reset-gpios = <&gpio0 RK_PB2 GPIO_ACTIVE_LOW>; /* GPIO0_B2 */
};
wireless-wlan {
compatible = "wlan-platdata";
rockchip,grf = <&grf>;
wifi_chip_type = "ap6354";
sdio_vref = <1800>;
WIFI,host_wake_irq = <&gpio0 RK_PA3 GPIO_ACTIVE_HIGH>; /* GPIO0_a3 */
status = "okay";
};
蓝牙:
按照rk3399 sdk默认配置,修改相应的引脚
wireless-bluetooth {
compatible = "bluetooth-platdata";
clocks = <&rk808 1>;
clock-names = "ext_clock";
//wifi-bt-power-toggle;
uart_rts_gpios = <&gpio2 RK_PC3 GPIO_ACTIVE_LOW>; /* GPIO2_C3 */
pinctrl-names = "default", "rts_gpio";
pinctrl-0 = <&uart0_rts>, <&bt_reset_gpio>, <&bt_wake_gpio>, <&bt_irq_gpio>;
pinctrl-1 = <&uart0_rts_gpio>;
BT,reset_gpio = <&gpio0 RK_PB1 GPIO_ACTIVE_HIGH>; /* GPIO0_B1 */
BT,wake_gpio = <&gpio2 RK_PD3 GPIO_ACTIVE_HIGH>; /* GPIO0_A4 */
BT,wake_host_irq = <&gpio0 RK_PA4 GPIO_ACTIVE_HIGH>; /* GPIO2_D3 */
status = "okay";
};
应用层蓝牙调试:
1. echo 0 > /sys/class/rfkill/rfkill0/state // 关闭蓝牙模块,确认BT,reset_gpio及BT,wake_gpio对应的引脚为低电平
2. echo 1 > /sys/class/rfkill/rfkill0/state // 打开蓝牙模块,确认BT,reset_gpio及BT,wake_gpio对应的引脚为高电平
3. ps -ef 查看 brcm_patchram_plus进程是否存在,存在则kill
4. 调用串口进行初始化
brcm_patchram_plus1 -d --patchram /system/etc/firmware/BCM4343B0.hcd --baudrate 115200 --enable_hci --no2bytes /dev/ttyS0
5. hciconfig 查看蓝牙是否成功
调试遇到的问题:
蓝牙驱动配置成功后,但是一直识别不到蓝牙模块,最后引脚一个个确认,发现ap6354的UART_RTS_N引脚电平一直是0,导致uart通信,rk3399的tx有波形但是rx一直没波形,最后把R35下拉电阻焊掉,问题解决,硬件设计问题,填了比较久的坑。