IW611 - Bluetooth Driver - HCI interface not up without hciattach

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

IW611 - Bluetooth Driver - HCI interface not up without hciattach

3,193 次查看
Kousik
Contributor I

Hello,

We are using Murata's 2DL using IW611 chipset along with STM32MP Linux (6.1.82). We are able to successfully bring up Wi-Fi over SDIO interface. Now we are trying to bring up Bluetooth  with some difficulties.  We are using combo firmware. 

In reference to this article -( https://community.nxp.com/t5/i-MX-Processors-Knowledge-Base/Bluetooth-NXP-UART-Driver-Linux-BSP-6-1-... ), it is understood that NXP has moved away from TTY interface for Bluetooth devices starting from 6.1.22. And is also mentioned that there is no need for hciattach.

We have followed the document AN14310 (NXP Bluetooth UART Driver integration) to apply the patches (referred section 2.2 Third party ARM-based Linux BSP)  and device tree changes. We are able to successfully load the driver, but Bluetooth interface is not up. 

Case 1: Without hciattach

modprobe btnxpuart
[   59.660632] Bluetooth: Core ver 2.22
[   59.666362] NET: Registered PF_BLUETOOTH protocol family
[   59.670250] Bluetooth: HCI device and connection manager initialized
[   59.677252] Bluetooth: HCI socket layer initialized
[   59.681661] Bluetooth: L2CAP socket layer initialized
[   59.686628] Bluetooth: SCO socket layer initialized
root@stm32mp15-disco:~# hciconfig -a
root@stm32mp15-disco:~# hciconfig hci0 up
Can't get device info: No such device
root@stm32mp15-disco:~# hciconfig -a
root@stm32mp15-disco:~# hciconfig

 

But to our surprise, we are able to bring the Bluetooth up using hciattach as below. 

Case 2: With hciattach

modprobe btnxpuart
[   59.660632] Bluetooth: Core ver 2.22
[   59.666362] NET: Registered PF_BLUETOOTH protocol family
[   59.670250] Bluetooth: HCI device and connection manager initialized
[   59.677252] Bluetooth: HCI socket layer initialized
[   59.681661] Bluetooth: L2CAP socket layer initialized
[   59.686628] Bluetooth: SCO socket layer initialized

hciattach /dev/ttySTM3 any 115200 flow
[  109.248495] Bluetooth: HCI UART driver ver 2.3
[  109.251731] Bluetooth: HCI UART protocol H4 registered
[  109.257331] Bluetooth: HCI UART protocol Broadcom registered
Device setup complete
root@stm32mp15-disco:~# [  109.964906] Bluetooth: MGMT ver 1.22

root@stm32mp15-disco:~# 

 hciconfig hci0 up
root@stm32mp15-disco:~# hciconfig -a
hci0:   Type: Primary  Bus: UART
        BD Address: 10:32:2C:70:A0:7B  ACL MTU: 1021:7  SCO MTU: 120:6
        UP RUNNING 
        RX bytes:1551 acl:0 sco:0 events:96 errors:0
        TX bytes:1295 acl:0 sco:0 commands:96 errors:0
        Features: 0xff 0xfe 0x8f 0xfe 0xdb 0xff 0x7b 0x87
        Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3 
        Link policy: RSWITCH HOLD SNIFF 
        Link mode: PERIPHERAL ACCEPT 
        Name: 'stm32mp15-disco'
        Class: 0x0c0000
        Service Classes: Rendering, Capturing
        Device Class: Miscellaneous, 
        HCI Version:  (0xc)  Revision: 0x8300
        LMP Version:  (0xc)  Subversion: 0x1042
        Manufacturer: NXP Semiconductors (formerly Philips Semiconductors) (37)

root@stm32mp15-disco:~# hciconfig
hci0:   Type: Primary  Bus: UART
        BD Address: 10:32:2C:70:A0:7B  ACL MTU: 1021:7  SCO MTU: 120:6
        UP RUNNING 
        RX bytes:1831 acl:0 sco:0 events:99 errors:0
        TX bytes:1307 acl:0 sco:0 commands:99 errors:0

 

It was mentioned that NXP has moved away from using the tty interface, so the hci0 device should appear without needing to run hciattach. Bluetooth devices are no longer exposed as tty interfaces. However, in my case, the hci0 interface is only visible after executing hciattach.

Could you help to kindly clarify? Thanks for your support. 

IW611 

0 项奖励
回复
16 回复数

3,087 次查看
weidong_sun
NXP TechSupport
NXP TechSupport

Hello @Kousik ,

 

Here is your uart node:

======================================

/* Bluetooth */
&usart2 {
pinctrl-names = "default", "sleep", "idle";
pinctrl-0 = <&usart2_pins_c &bt_pins>;
pinctrl-1 = <&usart2_sleep_pins_c &bt_pins>;
pinctrl-2 = <&usart2_idle_pins_c &bt_pins>;
uart-has-rtscts;
status = "okay";
 
bluetooth {
compatibility = "nxp,88w8987-bt";
fw-init-baudrate = <115200>; 
max-speed = <3000000>;
vbat-supply = <&v3v3>;
vddio-supply = <&v3v3>;
};
};
======================================
I didn't find usart1, usart3, usart4 in your device tree.
 
From tty device node you shared before:
/dev/ttySTM0  /dev/ttySTM3

usart1 -->ttySTM0 

usart2-->ttySTM1 ( it can't be seen in /dev/ path, root cause should be due to bluetooth sub-node)

usart3-->ttySTM2 ( no usart3 node in dts, so there is no the tty device node in /dev/)

usart4-->ttySTM3 ( Bluetooth is actually connected to the interface)

From your test result , run hciattach command on ttySTM3 , hci0 can be created successfully.

 

So the bluetooth sub-node should be added to usart4 node of your device tree.

 

Try it, please!

 

Regards,

weidong

 

0 项奖励
回复

3,084 次查看
adnan_dst
Contributor III

Hello @weidong_sun 

We are using the IW611 chip, and @Kousik raised a query on our behalf.

Below are my responses to your suggestions:

We're currently using the USART2 interface, which is mapped to serial3 in the device tree aliases. This is why it appears as /dev/ttySTM3:



aliases {
serial3 = &usart2;
};


modprobe btnxpuart
[ 46.191435] Bluetooth: Core ver 2.22
[ 46.195135] NET: Registered PF_BLUETOOTH protocol family
[ 46.199046] Bluetooth: HCI device and connection manager initialized
[ 46.208953] Bluetooth: HCI socket layer initialized
[ 46.212696] Bluetooth: L2CAP socket layer initialized
[ 46.217568] Bluetooth: SCO socket layer initialized
root@stm32mp15-disco:~# hciattach /dev/ttySTM3 any 115200 flow
[ 72.553248] Bluetooth: HCI UART driver ver 2.3
[ 72.556516] Bluetooth: HCI UART protocol H4 registered
[ 72.562004] Bluetooth: HCI UART protocol Broadcom registered
Device setup complete
root@stm32mp15-disco:~# [ 73.294813] Bluetooth: MGMT ver 1.22

root@stm32mp15-disco:~# hciconfig hci0 up
root@stm32mp15-disco:~# hciconfig -a
hci0: Type: Primary Bus: UART
BD Address: 10:32:2C:70:A0:7B ACL MTU: 1021:7 SCO MTU: 120:6
UP RUNNING PSCAN
RX bytes:1558 acl:0 sco:0 events:97 errors:0
TX bytes:1300 acl:0 sco:0 commands:97 errors:0
Features: 0xff 0xfe 0x8f 0xfe 0xdb 0xff 0x7b 0x87
Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
Link policy: RSWITCH HOLD SNIFF
Link mode: PERIPHERAL ACCEPT
Name: 'stm32mp15-disco'
Class: 0x0c0000
Service Classes: Rendering, Capturing
Device Class: Miscellaneous,
HCI Version: (0xc) Revision: 0x8300
LMP Version: (0xc) Subversion: 0x1042

Manufacturer: NXP Semiconductors (formerly Philips Semiconductors) (37)

After running hciattach, we are able to scan and connect to Bluetooth devices successfully. However, we are not able to transfer files, and when we try to play audio on the STM32 device, we only hear distorted noise on the Bluetooth headset.

0 项奖励
回复

3,020 次查看
weidong_sun
NXP TechSupport
NXP TechSupport

Hello @adnan_dst ,

 

Let me share a application doc on A2DP.

Please confirm the default baud rate of your IW611 module with provider!

if default baud rate is 3M, don't need to change it again.

if not 3M, you should change it to 3M using hci command.

Then follow the doc to test A2DP feature.

 

Thanks!

Regards,

weidong

 

Regards,

weidong

0 项奖励
回复

2,977 次查看
adnan_dst
Contributor III

Hello@weidong_sun 

Thanks for you input.

our build image was missing pulseaudio after including pulseaudio and following the steps mentioned in document I was able to successfully stream audio from our stm device to Bluetooth headphone and laptop.

there are two things we are looking into now mainly.

1. Low power Bluetooth without using hciattach as mentioned by @Kousik for power saver mode

2. We wanted to transmit files over Bluetooth and then connect some bluetooth mouse or keyboard to our stm board. please share if you any relevant documents for file transfer as currently we are not able to transfer any file over Bluetooth. 

 

Best Regards,
Adnan

0 项奖励
回复

2,902 次查看
weidong_sun
NXP TechSupport
NXP TechSupport

Hi @adnan_dst ,

 

>>1. Low power Bluetooth without using hciattach as mentioned by @Kousik for power saver mode

I am not sure what happened on your side, why btnxpuart can't normally work on your platform even if following steps of documents.

 

>> About file transmission.

you can refer to  my document.

 

Regards,

weidong

 

 

0 项奖励
回复

2,390 次查看
adnan_dst
Contributor III

Hi @weidong_sun 

I tried follwing the steps mentioned in the document and installed obex on my build image
but when i try to run obex command i am not able to run any other commands it's stuck is they any other way or someother comamds which i can use for file transfer

Best Regards,
Adnan

0 项奖励
回复

2,373 次查看
weidong_sun
NXP TechSupport
NXP TechSupport

Hello @adnan_dst ,

 

You have 2 ways to avoid it.

1.. Opening 2 terminals

-- uart console.

-- log in board using SSH

If you are using MobaXterm, easy to get the purpose.

2.. Exit the obexd interactive interface

If you only have uart console, after starting obexd, you can exit interactive interface, obexd is a daemon process, it will continue to running .

 

Thanks!

Regards,

weidong

 

0 项奖励
回复

2,175 次查看
adnan_dst
Contributor III

Hi @weidong_sun 

I tried with uart console and ssh both but still not able to recieve or transmit files over bluetooth.

Best Regards,
Adnan

0 项奖励
回复

2,148 次查看
weidong_sun
NXP TechSupport
NXP TechSupport

Hi @adnan_dst ,

 

Let me arrange time to run it again on linux platform , maybe these 2 days, I will do it,  then share steps with you again.

 

Regards,

weidong

0 项奖励
回复

1,997 次查看
weidong_sun
NXP TechSupport
NXP TechSupport

Hello @adnan_dst ,

 

See attachment, please!

It includes steps from PC to board and board to PC using obex.

 

Regards,

weidong

0 项奖励
回复

1,774 次查看
adnan_dst
Contributor III

Hi @weidong_sun 

Thanks for your input.

I am able to transfer files from my device to a laptop over Bluetooth.

However, when I tried file transfers from my device(board) to  different laptops , I noticed inconsistent behavior:

  • On one laptop, I was able to send files successfully from board to laptop.

  • On another laptop, file transfer did not work.

I have checked the Bluetooth info for both laptops after establishing a connection, but in both cases, my device could not receive files.

When I attempt to send a file from a laptop to the device, it shows an error saying "Please check if the device is connected", even though the Bluetooth connection is active.

Additionally, I sometimes experience connection failures on the same laptop that previously worked. It occasionally fails to connect to the device at all.


V2030 was able to transmit files from device to phone.

Device E4:F1:D4:52:4E:22 (public)
Name: V2030
Alias: V2030
Class: 0x005a020c
Icon: phone
Paired: yes
Bonded: yes
Trusted: yes
Blocked: no
Connected: yes
LegacyPairing: no
UUID: OBEX Object Push (00001105-0000-1000-8000-00805f9b34fb)
UUID: Audio Source (0000110a-0000-1000-8000-00805f9b34fb)
UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
UUID: Advanced Audio Distribu.. (0000110d-0000-1000-8000-00805f9b34fb)
UUID: A/V Remote Control (0000110e-0000-1000-8000-00805f9b34fb)
UUID: Headset AG (00001112-0000-1000-8000-00805f9b34fb)
UUID: PANU (00001115-0000-1000-8000-00805f9b34fb)
UUID: NAP (00001116-0000-1000-8000-00805f9b34fb)
UUID: Handsfree Audio Gateway (0000111f-0000-1000-8000-00805f9b34fb)
UUID: SIM Access (0000112d-0000-1000-8000-00805f9b34fb)
UUID: Phonebook Access Server (0000112f-0000-1000-8000-00805f9b34fb)
UUID: Message Access Server (00001132-0000-1000-8000-00805f9b34fb)
UUID: PnP Information (00001200-0000-1000-8000-00805f9b34fb)
UUID: Generic Access Profile (00001800-0000-1000-8000-00805f9b34fb)
UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)
UUID: Vendor specific (a82efa21-ae5c-3dde-9bbc-f16da7b16c5a)
Modalias: bluetooth:v001Dp1200d1436

DESKTOP-6O6D2G9 not able to transmit


[DESKTOP-6O6D2G9]# info
Device 48:A4:72:CB:F9:07 (public)
Name: DESKTOP-6O6D2G9
Alias: DESKTOP-6O6D2G9
Class: 0x002a010c
Icon: computer
Paired: yes
Bonded: yes
Trusted: yes
Blocked: no
Connected: yes
LegacyPairing: no
UUID: Service Discovery Serve.. (00001000-0000-1000-8000-00805f9b34fb)
UUID: Audio Source (0000110a-0000-1000-8000-00805f9b34fb)
UUID: Audio Sink (0000110b-0000-1000-8000-00805f9b34fb)
UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
UUID: Advanced Audio Distribu.. (0000110d-0000-1000-8000-00805f9b34fb)
UUID: A/V Remote Control (0000110e-0000-1000-8000-00805f9b34fb)
UUID: PANU (00001115-0000-1000-8000-00805f9b34fb)
UUID: Handsfree (0000111e-0000-1000-8000-00805f9b34fb)
UUID: Handsfree Audio Gateway (0000111f-0000-1000-8000-00805f9b34fb)
UUID: PnP Information (00001200-0000-1000-8000-00805f9b34fb)
UUID: Vendor specific (c7f94713-891e-496a-a0e7-983a0946126e)
Modalias: bluetooth:v0006p0001d0A00

Regards,
Adnan

0 项奖励
回复

1,719 次查看
weidong_sun
NXP TechSupport
NXP TechSupport

Dear @adnan_dst ,

 

The issue you encountered is not related to Bluetooth itself, It is related to the usage of Bluetoothctl & obexd/obexctl tool.
See my suggestions, please!
1. Why use Bluetoothctl
--open pariable / discoverable
The purpose is to allow remote device can find board BT and can pair it.
Then your PC Bluetooth can pair the board BT and it can be found Paired device. This is very important, because when sending files on PC side, PC is active party, it must find the board BT in it's paired devices list.
--scan remote Bluetooth devices those switched on
The purpose is to scan remote device you expect and obtain it's BD address.
--Trust your remote device
If setting 'trust' remote device, don't need to input PIN code before transmitting file.

2. obexd & obexctl
obexd is daemon process, obex is client.
--Sending file from board to remote Bluetooth device
(1) In old version of linux bsp
In the old version of linux kernel, like 5.4.x , users can use "/usr/libexec/bluetooth/obexd" to start it. Then run obexctl to enter it's interaction mode.
(2)In the newer linux bsp
like L6.1.x, obex works as a service, it should be started using
# systemctl --user start obex
Then run obexctl
# obexctl
[obexctl]
You can find the operation of "connection to remote device" is done in obexctl .
-- Receiving file (PC sends file to the board)
Due obexd daemon's running, we will have to remove it from memory and re-start it to enter "receive file" status.
# killall obexd
# /usr/libexec/bluetooth/obexd -r /root -n -a &
Then obexd enters "waiting to receive file", PC should connect board actively, then begin to send file.

 

About the question on file transmission using Bluetooth, I can only help you these.

 

Thanks!

Regards,

weidong

 

0 项奖励
回复

3,055 次查看
adnan_dst
Contributor III

Dear @weidong_sun


We have using ttySTM3 port for bluetooth and it's visible even after loadung the modprobe btnxpuart driver. Please find attached device tree and the driver file we are using.

Best Regards,
Adnan

0 项奖励
回复

3,082 次查看
weidong_sun
NXP TechSupport
NXP TechSupport

Dear @Kousik ,

 

After loading btnxpuart driver, /dev/ttySTM3 should not be found.

It means :

If a sub-node is added to uart node of device tree, the uart device will not be registered to tty sub-system.

I tried it on our i.MX8MP-EVK.

# modprobe btnxpuart

# ls /dev/ttymxc*

weidong_sun_0-1748226610588.png

On i.mx8mxp-evk platform, UART1 is used for Bluetooth, it's device node in dev folder is "ttymxc0", But  it can not be seen.

This situation is correct.

Let us go back to your board, After loading btnxpuart, the ttySTM3 can still be seen in /dev/, which is abnormal.

So I feel uart_stm3(maybe another name, assume one here) node doesn't include Bluetooth sub-node in your device tree.

The attachment(dts) you mentioned is not found in the post, would you please check it?

 

Thanks!
Regards,

weidong

 

0 项奖励
回复

3,129 次查看
weidong_sun
NXP TechSupport
NXP TechSupport

Dear @Kousik ,

 

See below, please!

It is traditional & classic method to use hciattach command to create hciX interface on generic linux platform, it is not a must to use btnxpuart driver on 3rd part platform based on ARM.

If you really want to use btnxpuart on your ST platform, please share these information with me!

-- device tree (dts file)

-- tty devices of ST platform in /dev/ folder.

# ls /dev/ttySTM*

 

Thanks!
Regards,

weidong

 

 

0 项奖励
回复

3,099 次查看
Kousik
Contributor I

Yes, we wanted to use btnxpuart for power save feature. Please find the attached device tree and the output of the command., 

ls /dev/ttySTM*:
/dev/ttySTM0  /dev/ttySTM3

 We are using /dev/ttySTM3 for Bluetooth.

@244084  

标记 (1)
0 项奖励
回复