Hello everyone,
I'm currently working on enabling UART communication on a custom i.MX93 board. The UART interface (UART-B) is connected via an M.2 E-Key connector to an EAR00411 Bluetooth/WiFi card, which uses the NXP 88W9098 chipset.
For SDIO (USDHC3) and UART (LPUART6), I configured the devicetree as follows:
USDHC3:
&usdhc3 { /* SDIO B */
pinctrl-names = "default", "state_100mhz", "state_200mhz", "sleep";
pinctrl-0 = <&pinctrl_usdhc3>, <&pinctrl_usdhc3_wlan>;
pinctrl-1 = <&pinctrl_usdhc3_100mhz>, <&pinctrl_usdhc3_wlan>;
pinctrl-2 = <&pinctrl_usdhc3_200mhz>, <&pinctrl_usdhc3_wlan>;
pinctrl-3 = <&pinctrl_usdhc3_sleep>, <&pinctrl_usdhc3_wlan>;
mmc-pwrseq = <&usdhc3_pwrseq>;
vmmc-supply = <®_usdhc3_vmmc>;
bus-width = <4>;
pm-ignore-notify;
keep-power-in-suspend;
non-removable;
status = "okay";
};
&iomuxc {
/* need to config the SION for data and cmd pad, refer to ERR052021 */
pinctrl_usdhc3: usdhc3grp {
fsl,pins = <
MX93_PAD_SD3_CLK__USDHC3_CLK 0x1582
MX93_PAD_SD3_CMD__USDHC3_CMD 0x40001382
MX93_PAD_SD3_DATA0__USDHC3_DATA0 0x40001382
MX93_PAD_SD3_DATA1__USDHC3_DATA1 0x40001382
MX93_PAD_SD3_DATA2__USDHC3_DATA2 0x40001382
MX93_PAD_SD3_DATA3__USDHC3_DATA3 0x40001382
>;
};
/* need to config the SION for data and cmd pad, refer to ERR052021 */
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
>;
};
/* need to config the SION for data and cmd pad, refer to ERR052021 */
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_usdhc3_sleep: usdhc3grpsleep {
fsl,pins = <
MX93_PAD_SD3_CLK__GPIO3_IO20 0x31e
MX93_PAD_SD3_CMD__GPIO3_IO21 0x31e
MX93_PAD_SD3_DATA0__GPIO3_IO22 0x31e
MX93_PAD_SD3_DATA1__GPIO3_IO23 0x31e
MX93_PAD_SD3_DATA2__GPIO3_IO24 0x31e
MX93_PAD_SD3_DATA3__GPIO3_IO25 0x31e
>;
};
pinctrl_usdhc3_wlan: usdhc3wlangrp {
fsl,pins = <
MX93_PAD_CCM_CLKO1__GPIO3_IO26 0x31e
>;
};
};
/{
reg_usdhc3_vmmc: regulator-usdhc3 {
compatible = "regulator-fixed";
regulator-name = "WLAN_EN";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
startup-delay-us = <100>;
off-on-delay-us = <20000>;
enable-active-high;
};
usdhc3_pwrseq: usdhc3_pwrseq {
compatible = "mmc-pwrseq-simple";
};
};
UART:
&lpuart6 { /* UART B */
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_uart6>;
status = "okay";
cts-gpios = <&gpio2 6 GPIO_ACTIVE_LOW>;
rts-gpios = <&gpio2 7 GPIO_ACTIVE_LOW>;
uart-has-rtscts;
};
&iomuxc {
pinctrl_uart6: uart6grp {
fsl,pins = <
MX93_PAD_GPIO_IO04__LPUART6_TX 0x11e
MX93_PAD_GPIO_IO05__LPUART6_RX 0x11e
MX93_PAD_GPIO_IO06__LPUART6_CTS_B 0x11e
MX93_PAD_GPIO_IO07__LPUART6_RTS_B 0x11e
>;
};
};
In my machine.conf I've added this:
MACHINE_FEATURES:append = " nxp9098-sdio"
KERNEL_MODULE_AUTOLOAD += "moal"
KERNEL_MODULE_PROBECONF += "moal"
module_conf_moal = "options moal mod_para=nxp/wifi_mod_para.conf"
The Bluetooth/WiFi card is correctly detected, and I can see that the nxp9098-sdio driver is loaded in the kernel logs.
The issue arises when I attempt to bring up the Bluetooth interface. Using hciattach /dev/ttyLP5 any <baud-rate> flow, I am only able to use a baud rate of up to 115200. Any higher baud rate (e.g., 150000) results in errors such as:
root@imx93:~# hciattach /dev/ttyLP5 any 150000 flow
Device setup complete
[ 95.671295] kauditd_printk_skb: 8 callbacks suppressed
[ 95.671306] audit: type=1334 audit(1726824428.940:20): prog-id=19 op=LOAD
[ 95.683907] audit: type=1334 audit(1726824428.944:21): prog-id=20 op=LOAD
[ 95.691189] audit: type=1334 audit(1726824428.952:22): prog-id=21 op=LOAD
[ 97.541600] Bluetooth: hci0: command 0x1003 tx timeout
[ 97.541602] Bluetooth: hci0: Opcode 0x1003 failed: -110
When using a baud rate of 115200, Bluetooth works correctly:
root@imx93:~# hciattach /dev/ttyLP5 any 115200 flow
Device setup complete
[ 212.854117] Bluetooth: MGMT ver 1.22
[ 212.945243] NET: Registered PF_ALG protocol Family
root@imx93:~# hciconfig hci0 up
root@imx93:~# hciconfig
hci0: Type: Primary Bus: UART
BD Address: 24:CD:8D:DA:B7:6E ACL MTU: 1021:7 SCO MTU: 120:6
UP RUNNING
RX bytes:1496 acl:0 sco:0 events:91 errors:0
TX bytes:1269 acl:0 sco:0 commands:91 errors:0
I understand from the hciattach documentation that "Baudrates higher than 115200bps require vendor-specific initializations that are not implemented for all devices." Could this issue be related to missing initialization for higher baud rates in the driver or configuration? Are there any specific patches or settings I might be missing in my device tree or driver setup for the NXP 88W9098 chipset?
Any help or insights would be greatly appreciated!
Best regards,
Elia
已解决! 转到解答。
To change Bluetooth UART baudrate, please help to try with below commands after you load BT with 115200 and bring up with hciconfig hci0 up
//Example: Change to 3M baud rate, I assume that your Bluetooth device interface is hci0
root@imx8mqevk:~# hcitool -i hci0 cmd 0x3f 0x0009 0xc0 0xc6 0x2d 0x0
< HCI Command: ogf 0x3f, ocf 0x0009, plen 4
C0 C6 2D 00
> HCI Event: 0x0e plen 4
01 09 FC 00
root@imx8mqevk:~# killall hciattach
root@imx8mqevk:~# [ 524.177184] Bluetooth: hci0: sending frame failed (-49)
root@imx8mqevk:~# killall hciattach
hciattach: no process found
root@imx8mqevk:~#
root@imx8mqevk:~#
root@imx8mqevk:~#
root@imx8mqevk:~# hciattach /dev/ttyLP5 any -s 3000000 3000000 flow
Setting TTY to N_HCI line discipline
Device setup complete
And below commands are reference for you:
hcitool -i hci0 cmd 0x3f 0x0009 0x00 0x30 0x2a 0x00 ---> set to 2764800 hcitool -i hci0 cmd 0x3f 0x0009 0x20 0x0b 0x20 0x00 |
---> set to 2100000 |
To change Bluetooth UART baudrate, please help to try with below commands after you load BT with 115200 and bring up with hciconfig hci0 up
//Example: Change to 3M baud rate, I assume that your Bluetooth device interface is hci0
root@imx8mqevk:~# hcitool -i hci0 cmd 0x3f 0x0009 0xc0 0xc6 0x2d 0x0
< HCI Command: ogf 0x3f, ocf 0x0009, plen 4
C0 C6 2D 00
> HCI Event: 0x0e plen 4
01 09 FC 00
root@imx8mqevk:~# killall hciattach
root@imx8mqevk:~# [ 524.177184] Bluetooth: hci0: sending frame failed (-49)
root@imx8mqevk:~# killall hciattach
hciattach: no process found
root@imx8mqevk:~#
root@imx8mqevk:~#
root@imx8mqevk:~#
root@imx8mqevk:~# hciattach /dev/ttyLP5 any -s 3000000 3000000 flow
Setting TTY to N_HCI line discipline
Device setup complete
And below commands are reference for you:
hcitool -i hci0 cmd 0x3f 0x0009 0x00 0x30 0x2a 0x00 ---> set to 2764800 hcitool -i hci0 cmd 0x3f 0x0009 0x20 0x0b 0x20 0x00 |
---> set to 2100000 |