How to set sc16is752 device tree for IW416

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to set sc16is752 device tree for IW416

Jump to solution
1,588 Views
Leo-Yang
Contributor I

Hello,

We want to use the SC16IS752IPW,128 (I2C to UART) to drive the LBEE5CJ1XK-687 Bluetooth module (based on NXP IW416). We can see /dev/ttySC0 and /dev/ttySC1, but after running "modprobe btnxpuart", there is no response. Using "hciattach /dev/ttySC0 any 115200 flow" results in the following error.

螢幕擷取畫面 2024-07-30 143634.png

What could be the reason for this? Below is our modified dts. Is there any mistake in our setup?

&i2c4 {
    clock-frequency = <400000>;
    pinctrl-names = "default";
    pinctrl-0 = <&pinctrl_i2c4>;
    status = "okay";
 
    sc16is752@48
            compatible = "nxp,sc16is752";
            clocks = <&sc16is752_clk>;
            gpio-controller;
            status = "okay";
            i2c-max-frequency = <0x61a80>;                  // 400kHz
            pinctrl-names = "default";
            pinctrl-0 = <&pinctrl_sc16is752>;
            interrupt-parent = <&gpio4>;
            interrupts = <15 IRQ_TYPE_LEVEL_LOW>;
            reset-gpios = <&gpio4 14 GPIO_ACTIVE_LOW>;
            reg = <0x48>;
            #gpio-cells = <2>;

            sc16is752_clk: sc16is752_clk {
                compatible = "fixed-clock";
                #clock-cells = <0x0>;
                clock-frequency = <0xe10000>;               // 15MHz
            };
 
            bluetooth@0 {
                compatible = "nxp,88w8987-bt";

                device-wakeup-gpios = <&gpio4 23 GPIO_ACTIVE_LOW>; 
                reset-gpios = <&gpio3 21 GPIO_ACTIVE_HIGH>; 
            };


    };
};
 
Thank you!
0 Kudos
Reply
1 Solution
1,155 Views
Christine_Li
NXP TechSupport
NXP TechSupport

Hi, @Leo-Yang 

After discussed internally, for you, because you are using sc16is752's I2C to UART, there is no UART node default in the device tree. And at the same time, sc16is752 generates 2 tty devices: ttySC0 and ttySC1. So it is difficult to indicate and bind which tty UART device to Bluetooth. That is why when using modprobe command, could not load Bluetooth driver successfully.

So for you using case, we suggest you use hciattach command to load, not modprobe command. 

And for your information, if you feel this command is too complex or not convenient, you can write a load script together with Wi-Fi's driver when your host platform whole device boot-up.

Please let me know if you have any other concerns on this case.

If no other questions or concerns, please help to mark it as solution, so that we can close this case. Thanks.

 

Best regards,

Christine.

View solution in original post

Tags (1)
0 Kudos
Reply
18 Replies
1,568 Views
Christine_Li
NXP TechSupport
NXP TechSupport

Hi, @Leo-Yang 

I will check this issue and reply to you ASAP.

 

Best regards,

Christine.

Tags (1)
0 Kudos
Reply
1,546 Views
Christine_Li
NXP TechSupport
NXP TechSupport

Hi, @Leo-Yang 

May I know your Linux kernel version?

Our Bluetooth driver has been change to btnxpuart after Linux 6.1.22. You can refer to this link:

https://community.nxp.com/t5/i-MX-Processors-Knowledge-Base/Bluetooth-NXP-UART-Driver-Linux-BSP-6-1-...

And also can you please provide me the list of /dev/tty* on your device?

At the same time, I will also check the detailed dts you shared.

 

Best regards,

Christine.

Tags (1)
0 Kudos
Reply
1,542 Views
Leo-Yang
Contributor I

Hi @Christine_Li,

Thank you for your reply. We are using the i.MX Linux Yocto Project BSP 6.6.3_1.0.0 Release.

Below is the list of /dev/tty* devices you requested:

螢幕擷取畫面 2024-08-01 184503.png

Best regards,

Leo

0 Kudos
Reply
1,513 Views
Christine_Li
NXP TechSupport
NXP TechSupport

Hi, @Leo-Yang 

Are you sure the ttySC0 or ttySC1 is for Bluetooth?

Have you tried ttySC1? and how about ttymxc0-3?

And also, I saw your screenshot you are using modprobe hci_uart. When you use modprobe btnxpuart, there is nothing output? Can you please provide me dmesg logs?

In your device, can you find btnxpuart.ko file?

Can you please try with 3M baudrate to see whether it works?

Are you using our I.Mx8MP-EVK? Or your own designed board with  our i.MX8MP chip?

 

Best regards,

Christine.

Tags (1)
0 Kudos
Reply
1,428 Views
Leo-Yang
Contributor I

 

Hi Christine,

Sorry for the late reply. Below are my responses based on your questions.

  • We are using pins 1 to 4 on the SC16IS752IPW.
  • We have tried other UARTs, and the issue persists.
  • Log

 

root@imx8mpevk:~# modprobe moal mod_para=nxp/wifi_mod_para.conf
[  119.352970] mlan: loading out-of-tree module taints kernel.
[  119.382201] wlan: Loading MWLAN driver
[  119.386264] wlan: Register to Bus Driver...
[  119.391061] vendor=0x02DF device=0x9159 class=0 function=1
[  119.396710] Attach moal handle ops, card interface type: 0x108
[  119.402608] rps set to 0 from module param
[  119.408523] SDIW416: init module param from usr cfg
[  119.413493] card_type: SDIW416, config block: 0
[  119.418077] cfg80211_wext=0xf
[  119.421060] max_vir_bss=1
[  119.423685] cal_data_cfg=none
[  119.426665] ps_mode = 1
[  119.429125] auto_ds = 1
[  119.431579] host_mlme=enable
[  119.434472] fw_name=nxp/sdiouartiw416_combo_v0.bin
[  119.439294] SDIO: max_segs=128 max_seg_size=65535
[  119.444012] rx_work=1 cpu_num=4
[  119.447173] Enable moal_recv_amsdu_packet
[  119.451213] Attach mlan adapter operations.card_type is 0x108.
[  119.457452] wlan: Enable TX SG mode
[  119.460980] wlan: Enable RX SG mode
[  119.468934] Request firmware: nxp/sdiouartiw416_combo_v0.bin
[  119.733327] Wlan: FW download over, firmwarelen=583644 downloaded 575272
[  120.996906] WLAN FW is active
[  120.999886] on_time is 120999070000
[  121.033939] VDLL image: len=8372
[  121.037286] FW country code WW does not match with US
[  121.042590] fw_cap_info=0x187ccf03, dev_cap_mask=0xffffffff
[  121.048199] max_p2p_conn = 8, max_sta_conn = 8
[  121.070819] Register NXP 802.11 Adapter mlan0
[  121.078739] Register NXP 802.11 Adapter uap0
[  121.087496] Register NXP 802.11 Adapter wfd0
[  121.092642] wlan: version = SDIW416---16.92.21.p119.2-MM6X16437.p3-GPL-(FP92) 
[  121.107687] wlan: Register to Bus Driver Done
[  121.112385] wlan: Driver loaded successfully
root@imx8mpevk:~# modprobe btnxpuart
root@imx8mpevk:~# hciattach /dev/ttymxc0 any 115200 flow
[  157.912067] Bluetooth: HCI UART driver ver 2.3
[  157.916555] Bluetooth: HCI UART protocol H4 registered
[  157.921726] Bluetooth: HCI UART protocol BCSP registered
[  157.927145] Bluetooth: HCI UART protocol LL registered
[  157.932306] Bluetooth: HCI UART protocol ATH3K registered
[  157.937843] Bluetooth: HCI UART protocol Three-wire (H5) registered
[  157.944216] Bluetooth: HCI UART protocol QCA registered
Device setup complete
root@imx8mpevk:~# [  158.175929] kauditd_printk_skb: 14 callbacks suppressed
[  158.175944] audit: type=1334 audit(1695209461.496:14): prog-id=13 op=LOAD
[  158.188096] audit: type=1334 audit(1695209461.504:15): prog-id=14 op=LOAD
[  159.964849] Bluetooth: hci0: command 0x1003 tx timeout
[  159.964849] Bluetooth: hci0: Opcode 0x1003 failed: -110

root@imx8mpevk:~# hciconfig hci0 up
[  171.196848] Bluetooth: hci0: command 0x1003 tx timeout
[  171.196852] Bluetooth: hci0: Opcode 0x1003 failed: -110
Can't init device hci0: Connection timed out (110)
root@imx8mpevk:~# hciconfig -a
hci0:	Type: Primary  Bus: UART
	BD Address: 00:00:00:00:00:00  ACL MTU: 0:0  SCO MTU: 0:0
	DOWN 
	RX bytes:0 acl:0 sco:0 events:0 errors:0
	TX bytes:8 acl:0 sco:0 commands:2 errors:0
	Features: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
	Packet type: DM1 DH1 HV1 
	Link policy: 
	Link mode: PERIPHERAL ACCEPT 

root@imx8mpevk:~# ​

 

  • Yes.螢幕擷取畫面 2024-08-06 170844.png
  • It still doesn't work. According to the datasheet, the default baud rate is 115200 bps.
  • We are using a custom board.

 

Best regards,

Leo

 

0 Kudos
Reply
1,415 Views
Christine_Li
NXP TechSupport
NXP TechSupport

Hi, @Leo-Yang 

1.Can you please check on your board what is your voltage for UART_RTS, UART_CTS, UART_TXD, and UART_RXD?

I checked our I.MX8MP's schematics it is 1.8V:

Christine_Li_0-1723018803657.png

 

Christine_Li_4-1723021288920.png

 

 

Below is cut from Murata 1XK:

Christine_Li_3-1723019083913.png

 

Christine_Li_2-1723018954342.png

 

Christine_Li_1-1723018916745.png

2. Please confirm your device tree with your designed board HW connections is correctly related, and also the GPIO number. Otherwise, you can send to me your HW schematics, I can check it for you. For security, please send to my private email: christine.li@nxp.com instead of posting here the public community.

3.Please check your UART_RTS, UART_CTS, UART_TXD, and UART_RXD connected correctly.

Best regards,

Christine.

 

 

Tags (1)
0 Kudos
Reply
1,402 Views
Leo-Yang
Contributor I

Hi Christine,

Our hardware engineers believe there are no issues with the wiring. If you have any doubts, I will send you the HW schematics later. Additionally, we are using /dev/ttymxc0 for testing, and the device tree is configured as follows. The same error message appears.

&uart1 {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_uart1>;
	fsl,dte-mode;
	status = "okay";

	assigned-clocks = <&clk IMX8MP_CLK_UART1>;
	assigned-clock-parents = <&clk IMX8MP_SYS_PLL1_80M>;
	uart-has-rtscts;
	bluetooth {
		compatible = "nxp,88w8987-bt";
		fw-init-baudrate = <115200>;
		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_modem_bt>;
		device-wakeup-gpios = <&gpio4 23 GPIO_ACTIVE_HIGH>;		
		reset-gpios = <&gpio3 21 GPIO_ACTIVE_LOW>;				
	};
};
pinctrl_uart1: uart1grp {
	fsl,pins = <
	    MX8MP_IOMUXC_SAI2_RXFS__UART1_DTE_RX	0x140
	    MX8MP_IOMUXC_SAI2_RXC__UART1_DTE_TX		0x140
            MX8MP_IOMUXC_SAI2_TXFS__UART1_DTE_RTS      0x140
            MX8MP_IOMUXC_UART3_TXD__UART1_DTE_CTS      0x140
	>;
};
pinctrl_modem_bt: modem_bt_grp {
	fsl,pins = <
	    MX8MP_IOMUXC_SAI2_RXD0__GPIO4_IO23 0x10			
	    MX8MP_IOMUXC_SAI5_RXD0__GPIO3_IO21 0x10			
	>;
};

 

Best regards,

Leo

0 Kudos
Reply
1,376 Views
Christine_Li
NXP TechSupport
NXP TechSupport

Hi, @Leo-Yang 

Can you please try without setting it into dce-mode?

And also make sure  below part is correct?

I saw there is UART3_TXD keyword.

 

If still faile, I need your schematics of 8MP board to check further.

 

Best regards,

Christine.

pinctrl_uart1: uart1grp {
fsl,pins = <
    MX8MP_IOMUXC_SAI2_RXFS__UART1_DCE_RX 0x140
    MX8MP_IOMUXC_SAI2_RXC__UART1_DCE_TX 0x140
            MX8MP_IOMUXC_SAI2_TXFS__UART1_DCE_RTS      0x140
            MX8MP_IOMUXC_UART3_TXD__UART1_DCE_CTS      0x140
>;
};
&uart1 {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_uart1>;
	fsl,dte-mode;
	status = "okay";

	assigned-clocks = <&clk IMX8MP_CLK_UART1>;
	assigned-clock-parents = <&clk IMX8MP_SYS_PLL1_80M>;
	uart-has-rtscts;
	bluetooth {
		compatible = "nxp,88w8987-bt";
		fw-init-baudrate = <115200>;
		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_modem_bt>;
		device-wakeup-gpios = <&gpio4 23 GPIO_ACTIVE_HIGH>;		
		reset-gpios = <&gpio3 21 GPIO_ACTIVE_LOW>;				
	};
};
pinctrl_uart1: uart1grp {
	fsl,pins = <
	    MX8MP_IOMUXC_SAI2_RXFS__UART1_DTE_RX	0x140
	    MX8MP_IOMUXC_SAI2_RXC__UART1_DTE_TX		0x140
            MX8MP_IOMUXC_SAI2_TXFS__UART1_DTE_RTS      0x140
            MX8MP_IOMUXC_UART3_TXD__UART1_DTE_CTS      0x140
	>;
};
pinctrl_modem_bt: modem_bt_grp {
	fsl,pins = <
	    MX8MP_IOMUXC_SAI2_RXD0__GPIO4_IO23 0x10			
	    MX8MP_IOMUXC_SAI5_RXD0__GPIO3_IO21 0x10			
	>;
};
Tags (1)
0 Kudos
Reply
1,267 Views
Christine_Li
NXP TechSupport
NXP TechSupport

Hi, @Leo-Yang 

Please request your HW colleague help to check below connection directions:

Christine_Li_0-1723448232790.png

Christine_Li_1-1723448869969.png

 

 

According to LBEE5CJ1XK datasheet, GPIO_9 reset state is output, but in your schematics, this pin connected to 1.8_BT_UART_TX, and according to SC16IS752 datasheet, TXA signal direction is also outputI think the signal is opposite.  The same issue is on 1.8_BT_UART_RX.

So, please help request your HW colleague to double confirm. If I am wrong, please do not hesitate to correct me.

Best regards,

Christine.

Tags (1)
0 Kudos
Reply
1,262 Views
Leo-Yang
Contributor I

Hi @Christine_Li ,

  1. We encountered the same error in DCE mode. We configured the settings using the config tools as follows:

 

pinctrl_uart1: uart1grp {
	fsl,pins = <
            MX8MP_IOMUXC_SAI2_RXC__UART1_DCE_RX        0x140  //AJ16
            MX8MP_IOMUXC_SAI2_RXFS__UART1_DCE_TX       0x140  //AH17
            MX8MP_IOMUXC_SAI2_TXFS__UART1_DCE_CTS      0x140  //AJ7
            MX8MP_IOMUXC_UART3_TXD__UART1_DCE_RTS      0x140  //AJ4
	>;
};​

 

  • According to the LBEE5CJ1XK datasheet, we should refer to Table 7: Pin Descriptions, so you are probably wrong. 螢幕擷取畫面 2024-08-12 164351.png螢幕擷取畫面 2024-08-12 164408.png

  • We want to confirm whether the setting compatible = "nxp,88w8987-bt"; is correct? As previously mentioned, after we ran modprobe btnxpuart, no messages were output.

Best regards,

Leo

0 Kudos
Reply
1,234 Views
Leo-Yang
Contributor I
I found a typo; it should be "MX8MP_IOMUXC_SAI2_TXFS__UART1_DCE_CTS 0x140 //AJ17."
0 Kudos
Reply
1,227 Views
Christine_Li
NXP TechSupport
NXP TechSupport

Hi, @Leo-Yang 

I double checked  LBEE5CJ1XK 's datasheet, yes, you are right.

GPIO_9(UART_RXD) and GPIO_10(UART_TXD) connection is correct in your schematics according to Table 7. Sorry for the misunderstandings and confusion.

I found a typo; it should be "MX8MP_IOMUXC_SAI2_TXFS__UART1_DCE_CTS 0x140 //AJ17."

==>

1.Do you meanSAI2_TXFS__UART1, especially the "__" is typo? 

2.After you correct it, does it work well on your side?

 

Best regards,

Christine.

Tags (1)
0 Kudos
Reply
1,223 Views
Leo-Yang
Contributor I

Hi @Christine_Li ,

Sorry, I expressed myself incorrectly. What I meant was that there was a typo in my last post.

MX8MP_IOMUXC_SAI2_TXFS__UART1_DCE_CTS      0x140  //AJ7 -> AJ17

The situation is still the same and has not improved.

 

Best regards,

Leo

0 Kudos
Reply
1,220 Views
Christine_Li
NXP TechSupport
NXP TechSupport

Hi, @Leo-Yang 

Thanks for your explanation.

Can you please check this part:

pinctrl_uart1: uart1grp {
	fsl,pins = <
            MX8MP_IOMUXC_SAI2_RXC__UART1_DCE_RX        0x140  //AJ16
            MX8MP_IOMUXC_SAI2_RXFS__UART1_DCE_TX       0x140  //AH17
            MX8MP_IOMUXC_SAI2_TXFS__UART1_DCE_CTS      0x140  //AJ17
            MX8MP_IOMUXC_UART3_TXD__UART1_DCE_RTS      0x140  //AJ4
	>;
};

Especially the last line?

I saw for other configurations, you are using SAI2, only the last line is UART3. I suggest you to double check this part.

Or if you can share to me your 8MP-board schematics, will check it for further details.

 

Best regards,

Christine.

Tags (1)
0 Kudos
Reply
1,180 Views
Leo-Yang
Contributor I

Hi @Christine_Li ,

Sorry, it seems that there was an internal communication issue on our side. We have modified the sc16is752 interrupts, and it can work now. 

 

interrupts = <15 IRQ_TYPE_LEVEL_LOW>;  //old
interrupts = <18 IRQ_TYPE_LEVEL_HIGH>;  //new

 

Additionally, I would like to ask if the btnxpuart can only be used with the native UART, and whether it cannot be used with an expanded UART? This is because we ended up using hciattach /dev/ttySC0 any 115200 flow to drive Bluetooth.

Thank you very much for your assistance. 

Best regards,

Leo

0 Kudos
Reply
1,169 Views
Christine_Li
NXP TechSupport
NXP TechSupport

Hi, @Leo-Yang 

Thanks for sharing me this good news. Very glad to hear that with hciattach method, Bluetooth can work now.

For btnxpuart driver, in theory, I think if indicate it in device tree, it should also work even with expanded UART interface. 

Have you tried with native uart1 and modprobe btnxpuart can work?

But with sc16is752 expanded UART interface, modprobe btnxpuart doesn't work. Right?

I need to check our btnxpuart driver source code to see what is the relationship between which UART interface and btnxpuart driver.

 

Best regards,

Christine.

Tags (1)
0 Kudos
Reply
1,156 Views
Christine_Li
NXP TechSupport
NXP TechSupport

Hi, @Leo-Yang 

After discussed internally, for you, because you are using sc16is752's I2C to UART, there is no UART node default in the device tree. And at the same time, sc16is752 generates 2 tty devices: ttySC0 and ttySC1. So it is difficult to indicate and bind which tty UART device to Bluetooth. That is why when using modprobe command, could not load Bluetooth driver successfully.

So for you using case, we suggest you use hciattach command to load, not modprobe command. 

And for your information, if you feel this command is too complex or not convenient, you can write a load script together with Wi-Fi's driver when your host platform whole device boot-up.

Please let me know if you have any other concerns on this case.

If no other questions or concerns, please help to mark it as solution, so that we can close this case. Thanks.

 

Best regards,

Christine.

Tags (1)
0 Kudos
Reply
1,151 Views
Leo-Yang
Contributor I

Hi @Christine_Li ,

Thank you for helping me confirm the btnxpuart issue. After successfully setting up the sc16is752 expanded UART interface, we didn't test the native uart1 part anymore. However, previously, we used the EVK with the AW-CM358MA, and modprobe btnxpuart worked.

Thanks again for your assistance.

 

Best regards,

Leo

0 Kudos
Reply