Use QN9080 DK as HCI dongle

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

Use QN9080 DK as HCI dongle

2,518件の閲覧回数
emilien_wingert
Contributor I

Hi

I'm currently working on a project involving the QN9080 DevKit, which should behave as a BLE dongle (transceiver). The Host Stack would be running on a Linux based external processing unit, so the firmware to be flashed in the QN9080 only needs to implement the standard HCI transport layer and the Controller tasks.

As far as I know, the demo example "hci_black_box" should behave as expected. Will this example be compatible with the current version of the Linux stack BlueZ ?

All my attempts to attach a QN9080DK flashed with hci_black_box to my Linux bluetooth configuration have failed so far. (I use a USB to UART connector plugged on the FC0_RX and FC0_TX pins of the QN9080DK, and plugged in my PC, device is /dev/ttyUSBx, baudrate 115200)

I might be doing something wrong, or misunderstanding the purpose of this example. If so, please let me know :smileyhappy:

Thanks in advance.

Emilien WINGERT.

ラベル(1)
0 件の賞賛
返信
7 返答(返信)

2,081件の閲覧回数
emilien_wingert
Contributor I

OK I think I know where the problem lies (sorry I'm kind of spamming here).

The HCI command 'Read Class of Device' is not supported by the HCI black box code, which is normal behaviour since the controller is BLE only. I dug in Linux kernel's HCI Core sources and I found out that the commands being sent depends on the results of 'Read Local Supported Commands' (OPCODE = 0x1002) and 'Read Local Supported Features' (OPCODE = 0x1003) commands.

The first command returns the "supported commands" bytes successfully, but the second one (Read Local Supported Features) only returns 8 null bytes.

The problem is that these bytes are used by the kernel to know which controller is attached (BR/EDR only, LE only or dual mode). In fact, the Bluetooth Core Specification Ver. 5.0 Vol. 2, Part C indicates that the bit 37 (in the 4th feature byte) must be set to 1 if the BR/EDR is not supported, and the bit 38 must be set to 1 if LE is supported. Currently both are set to 0, and because of this, the kernel thinks the controller is BR/EDR compatible and only sends BR/EDR commands, some of them not being supported by the hci black box.

I will certainly have to patch my kernel to avoid any error.

I will keep updating until the problem's solved :smileyhappy:

Have a nice day.

Emilien.

0 件の賞賛
返信

2,081件の閲覧回数
estephania_mart
NXP TechSupport
NXP TechSupport

Hello, 

Also, if you want to add some specific functionality that it's not available in the stack or you do not find something useful in the BLE Host Stack FSCI Reference Manual you can check this post https://community.nxp.com/docs/DOC-341764 . 

Maybe that can help you . 

Regards, 

Estephania 

0 件の賞賛
返信

2,081件の閲覧回数
emilien_wingert
Contributor I

Hello,

Thanks for the lead.
I need to add a correct handling of the 'Read Local Supported Features' HCI standard command. The current handling of the command returns wrong values (only zeros), but the sources are not available so I can't fix it directly.

I would need to know which specific Bluetooth Core Features are supported by the QN9080 Controller, in order to implement the handling in a custom HCI command (the features are listed in the Bluetooth Core Specification Ver. 5.0 Vol. 2, Part C) and return the right values.

Have a nice day,

Emilien.

0 件の賞賛
返信

2,081件の閲覧回数
estephania_mart
NXP TechSupport
NXP TechSupport

Hello, 

I believe all the definitions you are looking for are available in the ble_general.h 

Regards, 

Estephania 

0 件の賞賛
返信

2,081件の閲覧回数
estephania_mart
NXP TechSupport
NXP TechSupport

Hello,

Just to confirm, by mentioning you are using the  FC0_RX and FC0_TX pins, are you using the default configuration? or did you change it? 

Which error are you getting? Is there a chance you can test it using the NXP Test Tool just to verify if the issue it's related to the HW or the Linux interface? 

Also,  could you please help me confirm if you have the same behavior when using the USB Dongle of the QN9080 which has by default the HCI software? 

Regards, 

Estephania 

0 件の賞賛
返信

2,081件の閲覧回数
emilien_wingert
Contributor I

Update : When using the DK flashed with the hci_back_box example, I was able to attach it correctly to my Ubuntu host.

The packets do not seem to time out anymore. I can see some TX/RX bytes and a Bluetooth address when running hciconfig.

However, I get a different error when trying to set the attached controller in the UP state, by running the following command :

      '# sudo hciconfig hci0 up'
      Can't init device hci0: Invalid request code (56)

Any ideas ?

Thanks.

Emilien.

EDIT : Added a screenshot of the HCI commands sent/received when running 'sudo hciconfig hci0 up'.
The Bluetooth monitoring command used is 'btmon'

EDIT2 : It looks like the error comes from the handling of the 'Read Class of Device' command in the HCI_SendPacketToController (or any other callee) function in the library 'lib_ble_QN908XC_controller.a'. Unfortunately, the sources of these functions are not available.

0 件の賞賛
返信

2,081件の閲覧回数
emilien_wingert
Contributor I

Hi

Thanks for the reply !

I indeed used the default configuration of the hci black box example (imported as SDK v2.2 example project in the MCUXpresso IDE)

I didn't know that the hci black box was flashed in the QN9080 dongle as default, but I had the same error using it.

I usually do the following :

- Plug the dongle (or the USB-UART cable when using the dev kit) in my host system

- Run this command to attach it to BlueZ (v5.37)

      'sudo hciattach -s 115200 ttyACM0 any 115200'

      which succeeds with 'Device setup complete'

- Run this command to start the device

      'sudo hciconfig hci0 up'

      which fails with 'Can't init device hci0: Connection timed out (110)'

It seems like the host's TX packets time out.

Tried this on a PC with Ubuntu 16.04 and on a Raspberry Pi running a custom linux build.

Using the Test Tool will be complicated as there is no Linux compatible version :/

Have a nice day.

Emilien WINGERT.

0 件の賞賛
返信