Bluetooth on i.MX93 EVK

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Bluetooth on i.MX93 EVK

ソリューションへジャンプ
2,430件の閲覧回数
hmk
Contributor II

Hi, I'm trying to bring up bluetooth on the i.MX93 EVK with the included Embedded Artists 2EL M.2 card (IW612 chipset).  I have already verified that wifi works OK.

According to UM11483.pdf, btnxpuart is supported in BSP version L6.1.22 or later.  I took binaries for the latest version (6.1.36_2.1.0), which seem to have a broken bootloader but I can at least use the pre-installed bootloader on the eMMC and load the new BSP's kernel & rootfs from SD card:

=> fatload mmc 1:1 $kernel_addr_r Image
32262656 bytes read in 344 ms (89.4 MiB/s)
=> fatload mmc 1:1 $fdt_addr_r imx93-11x11-evk.dtb
45307 bytes read in 3 ms (14.4 MiB/s)
=> setenv bootargs console=ttyLP0,115200 earlycon root=/dev/mmcblk1p2 rootwait
=> booti $kernel_addr_r - $fdt_addr_r
...
[ 0.000000] Booting Linux on physical CPU 0x0000000000 [0x412fd050]
[ 0.000000] Linux version 6.1.36+g04b05c5527e9 (oe-user@oe-host) (aarch64-poky-linux-gcc (GCC) 12.3.0, GNU ld (GNU Binutils) 2.40.0.20230620) #1 SMP PREEMPT Mon Sep 4 21:11:15 UTC 2023
[ 0.000000] Machine model: NXP i.MX93 11X11 EVK board
...
root@imx93evk:~# uname -a
Linux imx93evk 6.1.36+g04b05c5527e9 #1 SMP PREEMPT Mon Sep 4 21:11:15 UTC 2023 aarch64 GNU/Linux

As per the linked pdf, wi-fi driver should be loaded first, followed by btnxpuart.  When I do this, I get frame reassembly failed (-84/EILSEQ) followed by a bunch of timeouts from the driver.  As one might expect, hciconfig will not be able to bring the device interface up:

root@imx93evk:~# modprobe moal mod_para=nxp/wifi_mod_para.conf
[ 42.099651] mlan: loading out-of-tree module taints kernel.
[ 42.147544] wlan: Loading MWLAN driver
[ 42.151671] wlan: Register to Bus Driver...
[ 42.156724] vendor=0x0471 device=0x0205 class=0 function=1
[ 42.162590] Attach moal handle ops, card interface type: 0x109
[ 42.168659] rps set to 0 from module param
[ 42.173052] SDIW612: init module param from usr cfg
[ 42.178200] card_type: SDIW612, config block: 0
[ 42.182926] cfg80211_wext=0xf
[ 42.186072] wfd_name=p2p
[ 42.188782] max_vir_bss=1
[ 42.191403] cal_data_cfg=none
[ 42.194559] drv_mode = 7
[ 42.197180] fw_name=nxp/sduart_nw61x_v1.bin.se
[ 42.201661] SDIO: max_segs=128 max_seg_size=65535
[ 42.206378] rx_work=1 cpu_num=2
[ 42.209551] Attach mlan adapter operations.card_type is 0x109.
[ 42.215707] wlan: Enable TX SG mode
[ 42.219259] wlan: Enable RX SG mode
[ 42.223891] Request firmware: nxp/sduart_nw61x_v1.bin.se
[ 42.487524] Wlan: FW download over, firmwarelen=918016 downloaded 841816
[ 43.889960] WLAN FW is active
[ 43.892953] on_time is 43717192478
[ 43.915789] VDLL image: len=76200
[ 43.919410] fw_cap_info=0x487cff03, dev_cap_mask=0xffffffff
[ 43.925333] uuid: b6b4c3fb4ea35a899434ef9a6df047eb
[ 43.930146] max_p2p_conn = 8, max_sta_conn = 16
[ 43.951901] Register NXP 802.11 Adapter mlan0
[ 43.957093] wlan: uap%d set max_mtu 2000
[ 43.966116] Register NXP 802.11 Adapter uap0
[ 43.989283] Register NXP 802.11 Adapter p2p0
[ 43.993801] wlan: version = SDIW612---18.99.2.p19.15-MM6X18408.p2-GPL-(FP92)
[ 44.012424] wlan: Register to Bus Driver Done
[ 44.017445] wlan: Driver loaded successfully

root@imx93evk:~# modprobe btnxpuart
[ 46.406596] Bluetooth: hci0: Frame reassembly failed (-84)
[ 46.412099] ------------[ cut here ]------------
[ 46.416721] serial serial0: receive_buf returns -84 (count = 135)
[ 46.422839] WARNING: CPU: 1 PID: 40 at drivers/tty/serdev/serdev-ttyport.c:37 ttyport_receive_buf+0xb0/0x100
[ 46.432658] Modules linked in: btnxpuart moal(O) mlan(O) crct10dif_ce polyval_ce polyval_generic snd_soc_fsl_asoc_card snd_soc_imx_card snd_soc_imx_audmux layerscape_edac_mod snd_soc_fsl_micfil snd_soc_wm8962 flexcan can_dev snd_soc_fsl_sai rtc_pcf2131 snd_soc_fsl_utils imx8_media_dev(C) snd_soc_fsl_xcvr fuse
[ 46.460021] CPU: 1 PID: 40 Comm: kworker/u4:1 Tainted: G C O 6.1.36+g04b05c5527e9 #1
[ 46.468962] Hardware name: NXP i.MX93 11X11 EVK board (DT)
[ 46.474432] Workqueue: events_unbound flush_to_ldisc
[ 46.479389] pstate: 60400009 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[ 46.486339] pc : ttyport_receive_buf+0xb0/0x100
[ 46.490854] lr : ttyport_receive_buf+0xb0/0x100
[ 46.495369] sp : ffff80000a2cbd30
[ 46.498671] x29: ffff80000a2cbd30 x28: 0000000000000000 x27: 0000000000000000
[ 46.505795] x26: ffff800009d4f000 x25: ffff000005c96c99 x24: ffff000004009005
[ 46.512919] x23: ffff0000040256e0 x22: ffff000004025708 x21: ffff0000043a2c00
[ 46.520043] x20: 00000000ffffffac x19: 0000000000000087 x18: 0000000000000006
[ 46.527167] x17: 0000000000000000 x16: 00000000000001ff x15: ffff80000a2cb860
[ 46.534291] x14: 0000000000000000 x13: ffff800009d52508 x12: 000000000000067b
[ 46.541415] x11: 0000000000000229 x10: ffff800009daa508 x9 : ffff800009d52508
[ 46.548539] x8 : 00000000ffffefff x7 : ffff800009daa508 x6 : 0000000000000000
[ 46.555663] x5 : ffff00007fbaba18 x4 : ffff00007fbaba18 x3 : ffff00007fbaec20
[ 46.562787] x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffff000004560000
[ 46.569912] Call trace:
[ 46.572348] ttyport_receive_buf+0xb0/0x100
[ 46.576524] flush_to_ldisc+0xb4/0x1c0
[ 46.580259] process_one_work+0x1d4/0x330
[ 46.584263] worker_thread+0x6c/0x430
[ 46.587912] kthread+0x108/0x10c
[ 46.591127] ret_from_fork+0x10/0x20
[ 46.594698] ---[ end trace 0000000000000000 ]---

[ 48.431322] Bluetooth: hci0: Opcode 0x c45 failed: -110
[ 48.431322] Bluetooth: hci0: command 0x0c45 tx timeout
[ 48.441912] Bluetooth: hci0: Setting baudrate failed (-22)
[ 48.447590] Bluetooth: hci0: Setting wake-up method failed (-22)
[ 50.480265] Bluetooth: hci0: command 0xfc53 tx timeout

root@imx93evk:~# hciconfig hci0 up
[ 73.257297] Bluetooth: hci0: Frame reassembly failed (-84)
[ 75.183572] Bluetooth: hci0: Opcode 0x c03 failed: -110
Can't init device hci0: Connection timed out (110)
[ 77.199531] Bluetooth: hci0: Setting baudrate failed (-110)
[ 79.215506] Bluetooth: hci0: Setting wake-up method failed (-110)

I can tell that btnxpuart did not try to download firmware, but maybe this is not necessary if the wifi firmware is combo firmware?  (How would I know, where is this documented?  Is it the *nw* driver?)

I also tested to see what happens if don't load the wifi module.  There is, after all, a bluetooth firmware file (uartspi_n61x_v1.bin.se) referenced by the driver.  The end result is eventual timeout and oops because the driver tries to free an skb when the pointer is an error code.

root@imx93evk:~# modprobe btnxpuart
[ 294.011910] Bluetooth: hci0: FW Download Timeout.
[ 294.016662] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000080
[ 294.025452] Mem abort info:
[ 294.028256] ESR = 0x0000000096000004
[ 294.032002] EC = 0x25: DABT (current EL), IL = 32 bits
[ 294.037313] SET = 0, FnV = 0
[ 294.040364] EA = 0, S1PTW = 0
[ 294.043501] FSC = 0x04: level 0 translation fault
[ 294.048371] Data abort info:
[ 294.051240] ISV = 0, ISS = 0x00000004
[ 294.055070] CM = 0, WnR = 0
[ 294.058035] user pgtable: 4k pages, 48-bit VAs, pgdp=0000000088d9a000
[ 294.064466] [0000000000000080] pgd=0000000000000000, p4d=0000000000000000
[ 294.071253] Internal error: Oops: 0000000096000004 [#1] PREEMPT SMP
[ 294.077511] Modules linked in: btnxpuart crct10dif_ce polyval_ce snd_soc_fsl_asoc_card snd_soc_imx_audmux polyval_generic snd_soc_imx_card layerscape_edac_mod snd_soc_fsl_micfil snd_soc_wm8962 rtc_pcf2131 snd_soc_fsl_xcvr snd_soc_fsl_sai flexcan snd_soc_fsl_utils can_dev imx8_media_dev(C) fuse
[ 294.103478] CPU: 1 PID: 61 Comm: kworker/u5:0 Tainted: G C 6.1.36+g04b05c5527e9 #1
[ 294.103484] Hardware name: NXP i.MX93 11X11 EVK board (DT)
[ 294.103488] Workqueue: hci0 hci_power_on
[ 294.117890] pstate: 60400009 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[ 294.117895] pc : kfree_skb_reason+0x18/0xb0
[ 294.132916] lr : btnxpuart_flush+0x38/0x50 [btnxpuart]
[ 294.132932] sp : ffff80000a3fbc90
[ 294.132934] x29: ffff80000a3fbc90 x28: 0000000000000000 x27: ffff8000095b09f8
[ 294.132942] x26: ffff000008d4c640 x25: ffff000008d4d068 x24: ffff800009937830
[ 294.132949] x23: ffff8000095b0980 x22: ffff000008d4c030 x21: 00000000ffffff92
[ 294.132956] x20: 0000000000000000 x19: ffffffffffffffac x18: 0000000000000006
[ 294.132963] x17: 000000040044ffff x16: 005000f2b5503510 x15: ffff80000a3fb6a0
[ 294.132970] x14: 0000000000000000 x13: ffff800009d52508 x12: 0000000000000642
[ 294.132976] x11: 0000000000000216 x10: ffff800009daa508 x9 : 0000000000000000
[ 294.132983] x8 : ffff80000a3fbc28 x7 : 0000000000000000 x6 : ffff000005bb89f0
[ 294.132989] x5 : 0000000000000000 x4 : 0000000000000000 x3 : 0000000000000000
[ 294.132995] x2 : 0000000000000000 x1 : 0000000000000001 x0 : ffffffffffffffac
[ 294.133002] Call trace:
[ 294.133005] kfree_skb_reason+0x18/0xb0
[ 294.133011] btnxpuart_flush+0x38/0x50 [btnxpuart]
[ 294.133020] hci_dev_open_sync+0x540/0x9f0
[ 294.133027] hci_power_on+0x60/0x2e0
[ 294.133033] process_one_work+0x1d4/0x330
[ 294.133040] worker_thread+0x6c/0x430
[ 294.133045] kthread+0x108/0x10c
[ 294.133050] ret_from_fork+0x10/0x20
[ 294.133059] Code: a9be7bfd 910003fd f9000bf3 aa0003f3 (b940d400)
[ 294.133062] ---[ end trace 0000000000000000 ]---

Now if the sduart_nw61x_v1.bin.se is combo firmware, then there is one more thing I can try: change wifi_mod_para to load sd_w61x_v1.bin.se, then load btnxpuart after wifi.  The end result is the same: FW download for BT seems to start and eventually times out (and we get the same oops which I won't repeat):

root@imx93evk:~# modprobe moal mod_para=nxp/wifi_mod_para.conf
[ 123.282593] mlan: loading out-of-tree module taints kernel.
[ 123.330029] wlan: Loading MWLAN driver
[ 123.334195] wlan: Register to Bus Driver...
[ 123.338601] vendor=0x0471 device=0x0205 class=0 function=1
[ 123.344473] Attach moal handle ops, card interface type: 0x109
[ 123.350340] rps set to 0 from module param
[ 123.354589] SDIW612: init module param from usr cfg
[ 123.359514] card_type: SDIW612, config block: 0
[ 123.364047] cfg80211_wext=0xf
[ 123.367014] wfd_name=p2p
[ 123.369541] max_vir_bss=1
[ 123.372167] cal_data_cfg=none
[ 123.375134] drv_mode = 7
[ 123.377667] fw_name=nxp/sd_w61x_v1.bin.se
[ 123.381698] SDIO: max_segs=128 max_seg_size=65535
[ 123.386403] rx_work=1 cpu_num=2
[ 123.389557] Attach mlan adapter operations.card_type is 0x109.
[ 123.395967] wlan: Enable TX SG mode
[ 123.399512] wlan: Enable RX SG mode
[ 123.406280] Request firmware: nxp/sd_w61x_v1.bin.se
[ 123.551410] Wlan: FW download over, firmwarelen=621088 downloaded 544888
[ 124.947895] WLAN FW is active
[ 124.950885] on_time is 124772628675
[ 124.974045] VDLL image: len=76200
[ 124.977693] fw_cap_info=0x487cff03, dev_cap_mask=0xffffffff
[ 124.983574] uuid: b6b4c3fb4ea35a899434ef9a6df047eb
[ 124.988382] max_p2p_conn = 8, max_sta_conn = 16
[ 125.011843] Register NXP 802.11 Adapter mlan0
[ 125.019436] wlan: uap%d set max_mtu 2000
[ 125.027217] Register NXP 802.11 Adapter uap0
[ 125.047494] Register NXP 802.11 Adapter p2p0
[ 125.051862] wlan: version = SDIW612---18.99.2.p19.15-MM6X18408.p2-GPL-(FP92)
[ 125.074892] wlan: Register to Bus Driver Done
[ 125.080032] wlan: Driver loaded successfully

root@imx93evk:~# modprobe btnxpuart
[ 187.540373] Bluetooth: hci0: FW Download Timeout.
[ 187.545135] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000080

I also tried building latest upstream version of btnxpuart (from 6.6-rc2) and changing fw-init-baudrate to 3000000, but neither helped.  I added some debug prints in the driver just to confirm that it is at least getting the correct chip id before FW download starts and we do indeed get 0x7601, so UART must be working but I'm still missing something... any ideas?

0 件の賞賛
返信
1 解決策
2,416件の閲覧回数
hmk
Contributor II

Looks like the problem really was that my chip is not compatible with the latest BSP.  I've downgraded to 6.1.22 and the BT driver starts up without errors now.

元の投稿で解決策を見る

0 件の賞賛
返信
5 返答(返信)
2,408件の閲覧回数
Sanket_Parekh
NXP TechSupport
NXP TechSupport

Hello @hmk,

I hope you are doing well.

As per the UM11483 document stats, Bluetooth should be brought by running below the given sequence of commands.

Step 1 - Load Wi-Fi SDIO driver with the combo firmware or Wi-Fi standalone firmware.
Step 2 - Load NXP Bluetooth UART driver
modprobe btnxpuart
Step 3 - Confirm the status of HCI interface
hciconfig hci0 up

It should work this way, Although one can try using insmod command to load it externally.

Please check running that command and share the observation.

Thanks & Regards,
Sanket Parekh

0 件の賞賛
返信
2,417件の閲覧回数
hmk
Contributor II

Looks like the problem really was that my chip is not compatible with the latest BSP.  I've downgraded to 6.1.22 and the BT driver starts up without errors now.

0 件の賞賛
返信
2,193件の閲覧回数
sam_yu
Contributor I

hi  hmk

I meet the problem same with you, my linux is 6.1.22 but the bt_uart had not be startup. could you share how you solved it???

0 件の賞賛
返信
1,267件の閲覧回数
gianlucacornacchia
Contributor I

Hi @sam_yu,

I'm facing the same problem, my kernel is 6.1.122, but bt driver cannot communicate with the device. Fw downloading seems to be working.

Did you solved the issue ?

@hmk what kernel revision are you using ?

 

any help appreciated

thanks

0 件の賞賛
返信
1,263件の閲覧回数
hmk
Contributor II

@gianlucacornacchia 

My problem was with pre-production silicon, which isn't compatible with the later BSPs so I had to downgrade to 6.1.22-2.0.0 and that solved my issue.  If you have more recent hardware, you will probably need to do the opposite and grab a more recent BSP.

Now I have a more recent chip, and it runs fine with a linux-imx 6.1.55-2.2.0 based kernel.  Though the current bt/wifi module I'm using is also different (but based on the same chip) and requires `fw-init-baudrate = <3000000>;` in dts under bluetooth.  (The chip and driver automatically switch baud rate during firmware download, but driver resets it afterwards and will not be able to communicate anymore if fw-init-baudrate does not match what the chip expects.)

0 件の賞賛
返信