1
完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
1.实验原理 FS-MP1A开发板蓝牙采用AP6236,WIFI蓝牙二合一芯片。蓝牙部分通过usart3与SoC进行数据交互。 蓝牙部分移需要配置usart3的设备树与AP_CK32KO管脚,可参考stm32mp157c-dk2.dts中的相关配置。 查看原理图得出AP6236数据管脚与STM32MP157A的管脚对应关系如下:
参考文档: Documentation/devicetree/bindings/net/broadcom-bluetooth.txt Documentation/devicetree/bindings/serial/st,stm32-usart.txt 内核中ST对STM32MP15x系列芯片的设备树资源了做了定义,可参见: arch/arm/boot/dts/stm32mp151.dtsi stm32mp151中usart3定义如下: usart3: serial@4000f000 { compatible = "st,stm32h7-uart"; reg = <0x4000f000 0x400>; interrupts-extended = <&exti 28 IRQ_TYPE_LEVEL_HIGH>; clocks = <&rcc USART3_K>; resets = <&rcc USART3_R>; wakeup-source; power-domains = <&pd_core>; dmas = <&dmamux1 45 0x400 0x5>, <&dmamux1 46 0x400 0x1>; dma-names = "rx", "tx"; status = "disabled"; }; 上述代码只对usart3做了基本的初始化,并没有针对不同的硬件设计做适配,所以需结合硬件补全设备树节点信息。 参考文档或stm32mp157c-dk2.dts对于usart2设备节点的描述,增加usart3内容如下: &usart3 { pinctrl-names = "default", "sleep", "idle"; pinctrl-0 = <&usart3_pins_bt>; pinctrl-1 = <&usart3_idle_pins_bt>; pinctrl-2 = <&usart3_sleep_pins_bt>; uart-has-rtscts; status = "okay"; bluetooth { shutdown-gpios = <&gpiod 13 GPIO_ACTIVE_HIGH>; compatible = "brcm,bcm43438-bt"; max-speed = <3000000>; vbat-supply = <&v3v3>; vddio-supply = <&v3v3>; }; }; 同时stm32mp15-pinctrl.dtsi对于usart3的描述与FS-MP1A所使用管脚不一致,所以无法直接使用,需参考其增加如下内容: usart3_pins_bt: usart3-bt-0 { pins1 { pinmux = bias-disable; drive-push-pull; slew-rate = <0>; }; pins2 { pinmux = bias-disable; }; }; usart3_idle_pins_bt: usart3-idle-bt-0 { pins1 { pinmux = }; pins2 { pinmux = bias-disable; }; }; usart3_sleep_pins_bt: usart3-sleep-bt-0 { pins { pinmux = }; }; 2)RTC节点 AP6236需要使用一个外部输入的32.768KHz的时钟源,因此我们需要使能RTC的外部32.768KHz功能 参考文档: Documentation/devicetree/bindings/rtc/st,stm32-rtc.txt 内核中ST对STM32MP15x系列芯片的设备树资源了做了定义,可参见: arch/arm/boot/dts/stm32mp151.dtsi stm32mp151中rtc定义如下: rtc: rtc@5c004000 { compatible = "st,stm32mp1-rtc"; reg = <0x5c004000 0x400>; clocks = <&scmi0_clk CK_SCMI0_RTCAPB>, <&scmi0_clk CK_SCMI0_RTC>; clock-names = "pclk", "rtc_ck"; interrupts-extended = <&exti 19 IRQ_TYPE_LEVEL_HIGH>; status = "disabled"; }; 上述代码只对rtc做了基本的初始化,并没有针对不同的硬件设计做适配,所以需结合硬件补全设备树节点信息。 参考stm32mp157f-dk2.dts对于rtc设备节点的描述,需增加内容如下: rtc { st,lsco = pinctrl-0 = <&rtc_out2_rmp_pins_a>; pinctrl-names = "default"; status = "okay"; }; 2.实验目的 熟悉基于Linux操作系统下的蓝牙设备驱动移植配置过程。 3.实验平台 华清远见开发环境,FS-MP1A平台; 4.实验步骤
linux@ubuntu:$ source /opt/st/stm32mp1/3.1-openstlinux-5.4-dunfell-mp1-20-06-24/environment-setup-cortexa7t2hf-neon-vfpv4-ostl-linux-gnueabi
修改arch/arm/boot/dts/stm32mp15xx-fsmp1x.dtsi文件中的rtc节点添加如下内容: rtc { st,lsco = pinctrl-0 = <&rtc_out2_rmp_pins_a>; pinctrl-names = "default"; status = "okay"; }; 其中红色字体部分为要添加的内容。 添加rtc相关头文件。 #include
修改arch/arm/boot/dts/stm32mp15xx-fsmp1x.dtsi文件,在文件末尾添加如下内容: &usart3 { pinctrl-names = "default", "sleep", "idle"; pinctrl-0 = <&usart3_pins_bt>; pinctrl-1 = <&usart3_idle_pins_bt>; pinctrl-2 = <&usart3_sleep_pins_bt>; uart-has-rtscts; status = "okay"; bluetooth { shutdown-gpios = <&gpiod 13 GPIO_ACTIVE_HIGH>; compatible = "brcm,bcm43438-bt"; max-speed = <3000000>; vbat-supply = <&v3v3>; vddio-supply = <&v3v3>; }; };
要添加管脚配置需要有pinctrl节点,如果之前已经做了MIPI LCD移植或者RGB LCD则在arch/arm/boot/dts/stm32mp15xx-fsmp1x.dtsi文件下找到pinctrl节点添加如下配置,如果之前没有做MIPI LCD移植或者RGB LCD那么需要新建一个pinctrl节点,然后添加如下配置。 &pinctrl { ... ... usart3_pins_bt: usart3-bt-0 { pins1 { pinmux = bias-disable; drive-push-pull; slew-rate = <0>; }; pins2 { pinmux = bias-disable; }; }; usart3_idle_pins_bt: usart3-idle-bt-0 { pins1 { pinmux = }; pins2 { pinmux = bias-disable; }; }; usart3_sleep_pins_bt: usart3-sleep-bt-0 { pins { pinmux = }; }; ... ... };
修改arch/arm/dts/stm32mp157a-fsmp1a.dts文件,在aliases节点中添加如下内容: aliases { serial0 = &uart4; serial5 = &usart3; }; 其中红色字体部分为要添加的内容。
由于内核源码默认配置以及支持AP62xx,本节列出主要选项,如下: linux@ubuntu:$ make menuconfig Device Drivers ---> <*> Broadcom specific AMBA --->
|