DESK-MX9-L/Peripherals/Bluetooth

From DAVE Developer's Wiki
Jump to: navigation, search
History
Issue Date Notes
2025/03/17 DESK-MX9-L-5.2.0 release


Peripheral Bluetooth[edit | edit source]

Device tree configuration[edit | edit source]

Here below is an example of the device tree configuration used on DAVE's kit:

From imx93-aura-sbcx.dtsi:

/ {
...
		usdhc3_pwrseq: usdhc3_pwrseq {
			compatible = "mmc-pwrseq-simple";
			pinctrl-names = "default";
			pinctrl-0 = <&pinctrl_usdhc3_pwrseq>;
			reset-gpios = <&gpio2 18 GPIO_ACTIVE_LOW>;
		};
...
		reg_wifi_en: regulator-wifi-en {
			compatible = "regulator-fixed";
			enable-active-high;
			gpio = <&gpio2 6 GPIO_ACTIVE_HIGH>;
			pinctrl-names = "default";
			pinctrl-0 = <&pinctrl_wifi_pwr_en>;
			regulator-max-microvolt = <3300000>;
			regulator-min-microvolt = <3300000>;
			regulator-name = "PDn_AW-CM276NF";
			/*
			 * IW612 wifi chip needs more delay than other wifi chips to complete
			 * the host interface initialization after power up, otherwise the
			 * internal state of IW612 may be unstable, resulting in the failure of
			 * the SDIO3.0 switch voltage.
			 */
			startup-delay-us = <20000>;
		};
...
};

...
...

/*
 * AzureWave SDIO on usdhc3
 */
&usdhc3{
	pinctrl-names = "default", "state_100mhz", "state_200mhz";
	pinctrl-0 = <&pinctrl_usdhc3>;
	pinctrl-1 = <&pinctrl_usdhc3_100mhz>;
	pinctrl-2 = <&pinctrl_usdhc3_200mhz>;
	vmmc-supply = <&reg_wifi_en>;
	mmc-pwrseq = <&usdhc3_pwrseq>;
	bus-width = <4>;
	non-removable;
	no-1-8-v;
	max-frequency = <24000000>;
	status = "okay";
};

...
...

&iomuxc {
...
...
	pinctrl_usdhc3: usdhc3grp {
		fsl,pins = <
			MX93_PAD_SD3_CLK__USDHC3_CLK		0x159e
			MX93_PAD_SD3_CMD__USDHC3_CMD		0x4000138e
			MX93_PAD_SD3_DATA0__USDHC3_DATA0	0x4000138e
			MX93_PAD_SD3_DATA1__USDHC3_DATA1	0x4000138e
			MX93_PAD_SD3_DATA2__USDHC3_DATA2	0x4000138e
			MX93_PAD_SD3_DATA3__USDHC3_DATA3	0x4000138e
		>;
	};

	pinctrl_usdhc3_100mhz: usdhc3-100mhzgrp {
		fsl,pins = <
			MX93_PAD_SD3_CLK__USDHC3_CLK		0x158e
			MX93_PAD_SD3_CMD__USDHC3_CMD		0x4000138e
			MX93_PAD_SD3_DATA0__USDHC3_DATA0	0x4000138e
			MX93_PAD_SD3_DATA1__USDHC3_DATA1	0x4000138e
			MX93_PAD_SD3_DATA2__USDHC3_DATA2	0x4000138e
			MX93_PAD_SD3_DATA3__USDHC3_DATA3	0x4000138e
		>;
	};

	pinctrl_usdhc3_200mhz: usdhc3-200mhzgrp {
		fsl,pins = <
			MX93_PAD_SD3_CLK__USDHC3_CLK		0x15fe
			MX93_PAD_SD3_CMD__USDHC3_CMD		0x400013fe
			MX93_PAD_SD3_DATA0__USDHC3_DATA0	0x400013fe
			MX93_PAD_SD3_DATA1__USDHC3_DATA1	0x400013fe
			MX93_PAD_SD3_DATA2__USDHC3_DATA2	0x400013fe
			MX93_PAD_SD3_DATA3__USDHC3_DATA3	0x400013fe
		>;
	};

	pinctrl_wifi_pwr_en: wifipwrengrp { 		//  SDIO_RESET
		fsl,pins = <
			MX93_PAD_GPIO_IO06__GPIO2_IO06		0x31e
		>;
	};

	pinctrl_usdhc3_pwrseq: usdhc3pwrseqgrp {   	//  W_DISABLE
		fsl,pins = <
			MX93_PAD_GPIO_IO18__GPIO2_IO18		0x31e
		>;
	};
};

Accessing the peripheral[edit | edit source]

  • load the wlan driver
...
...
root@desk-mx93-rev1:~# killall wpa_supplicant
root@desk-mx93-rev1:~# modprobe moal mod_para=nxp/wifi_mod_para.conf
[   37.997699] mlan: loading out-of-tree module taints kernel.
[   38.085829] wlan: Loading MWLAN driver
[   38.089934] wlan: Register to Bus Driver...
[   38.099910] vendor=0x02DF device=0x9141 class=0 function=1
[   38.105482] Attach moal handle ops, card interface type: 0x104
[   38.111327] rps set to 0 from module param
[   38.117559] SD8997: init module param from usr cfg
[   38.122405] card_type: SD8997, config block: 0
[   38.126865] cfg80211_wext=0xf
[   38.129838] max_vir_bss=1
[   38.132478] cal_data_cfg=none
[   38.135467] ps_mode = 1
[   38.137907] auto_ds = 1
[   38.140365] host_mlme=enable
[   38.143270] fw_name=nxp/sdiouart8997_combo_v4.bin
[   38.148199] SDIO: max_segs=128 max_seg_size=65535
[   38.152939] rx_work=1 cpu_num=2
[   38.156095] Enable moal_recv_amsdu_packet
[   38.160201] Attach mlan adapter operations.card_type is 0x104.
[   38.171634] wlan: Enable TX SG mode
[   38.175123] wlan: Enable RX SG mode
[   38.183326] Request firmware: nxp/sdiouart8997_combo_v4.bin
[   38.996490] Wlan: FW download over, firmwarelen=625948 downloaded 625948
[   39.359391] audit: type=1334 audit(1677843467.344:16): prog-id=10 op=UNLOAD
[   39.366400] audit: type=1334 audit(1677843467.344:17): prog-id=9 op=UNLOAD
[   39.711375] WLAN FW is active
[   39.714350] on_time is 39551146599
[   39.745584] FW country code WW does not match with US
[   39.750949] fw_cap_info=0x587c7fa3, dev_cap_mask=0xffffffff
[   39.756546] max_p2p_conn = 8, max_sta_conn = 8
[   39.787983] Register NXP 802.11 Adapter mlan0
[   39.792614] wlan: uap%d set max_mtu 2000
[   39.798647] Register NXP 802.11 Adapter uap0
[   39.824851] Register NXP 802.11 Adapter wfd0
[   39.829276] wlan: version = SD8997----16.92.21.p84.4-MM6X16423.p6-GPL-(FP92)
[   39.843858] wlan: Register to Bus Driver Done
[   39.851352] remoteproc remoteproc0: releasing imx-rproc
[   39.854157] wlan: Driver loaded successfully
...
...
  • attach the Bluetooth Host Controller Interface (HCI)
root@desk-mx93-rev1:~# hciattach /dev/ttyLP2 any 115200 flow
<flow> option
FLOW_CTL on
Setting TTY to N_HCI line discipline
Device setup complete
root@desk-mx93-rev1:~# [  647.753591] audit: type=1334 audit(1742221920.320:18): prog-id=15 op=LOAD
[  647.763017] audit: type=1334 audit(1742221920.324:19): prog-id=16 op=LOAD
[  647.965936] Bluetooth: MGMT ver 1.22
[  647.984862] NET: Registered PF_ALG protocol family

root@desk-mx93-rev1:~#
  • list the wireless devices status
root@desk-mx93-rev1:~# rfkill list
0: phy0: Wireless LAN
        Soft blocked: no
        Hard blocked: no
1: hci0: Bluetooth
        Soft blocked: no
        Hard blocked: no
  • enable the device with hci0
root@desk-mx93-rev1:~# hciconfig hci0 up
  • scan for Bluetooth devices
root@desk-mx93-rev1:~# bluetoothctl
Agent registered
[CHG] Controller 28:D0:43:3E:A9:36 Pairable: yes
[bluetooth]# scan on
Discovery started
[CHG] Controller 28:D0:43:3E:A9:36 Discovering: yes
...
[NEW] Device 40:EC:99:0B:CB:50 LW10Y20008
...
[bluetooth]# scan off
Discovery stopped
[CHG] Device E4:B0:63:1B:E5:BE RSSI is nil
[CHG] Device 78:CA:CB:6D:CF:33 RSSI is nil
[CHG] Device 78:E0:AD:2C:A1:AC TxPower is nil
[CHG] Device 78:E0:AD:2C:A1:AC RSSI is nil
[CHG] Device E4:B0:63:17:A3:F6 TxPower is nil
[CHG] Device E4:B0:63:17:A3:F6 RSSI is nil
[CHG] Controller 28:D0:43:3E:A9:36 Discovering: no
[bluetooth]# quit
root@desk-mx93-rev1:~#