1

I am trying to Interface a BLE module based on Nordic's nrf52840 to a Yocto based SBC, to which all the BlueZ related packages have been added.

I have flashed Zephyr's sample hci_uart program onto the module. The module seems to run perfectly on my Linux PC (BlueZ version 5.48), whereas on the SBC(BlueZ version 5.54) it fails to get inited. Here's the error that comes when I use

root@rb-imx6:~# hciconfig hci0 up

root@rb-imx6:~# Can't init device hci0: Cannot assign requested address (99)

Can anyone please help me out on this?

Thanks in advance.

Maneesh N
  • 43
  • 6
  • Maybe if you run btmon separately while you try to execute this command, it will print out what the real cause is. – Emil Apr 20 '21 at 19:21
  • Hi Emil, thanks for replying, I'm fairly new to Bluetooth or blueZ on Linux, could you please help me out on how to see the console log on btmon? And also there is only one terminal window available on the board I won't be able to attach and look into the logs of it at the same time.. – Maneesh N Apr 22 '21 at 07:33
  • Just run `btmon &` then, to start it in the background, then execute your command. It should at this point print something. Enter `fg` to bring it back to foreground and then ctrl+c if you want to stop it. – Emil Apr 22 '21 at 08:03
  • I opened btmon in the background and found that the final console message by btmon was = bluetoothd: ../bluez-5.55/src/adapter.c:get_static_addr() Failed to open crypto 106.724919 = bluetoothd: No Bluetooth address for index 0 [hci0] 106.725585 – Maneesh N Apr 22 '21 at 08:15
  • 1
    Thanks Emil for helping me debug the module.. We had to make some crypto related changes in the kernel of our board. CONFIG_CRYPTO_USER CONFIG_CRYPTO_USER_API CONFIG_CRYPTO_USER_API_AEAD CONFIG_CRYPTO_USER_API_HASH CONFIG_CRYPTO_AES CONFIG_CRYPTO_CCM CONFIG_CRYPTO_AEAD CONFIG_CRYPTO_CMAC After enabling these in the kernel the module could be brought up – Maneesh N Apr 22 '21 at 09:09
  • Good to hear that you resolved the problem. I bumped into similar issue recently, and it was very helpful to run bluez daemon in debug mode, with `bluetoothd -d`. Then I was able to find that the crypto API in userspace was missing, just like in your case. – Filip Kubicz Jun 10 '21 at 19:22

1 Answers1

1

The error of assigning an address is caused by missing Linux kernel configuration options:

CONFIG_CRYPTO_USER
CONFIG_CRYPTO_USER_API
CONFIG_CRYPTO_USER_API_AEAD
CONFIG_CRYPTO_USER_API_HASH

CONFIG_CRYPTO_AES
CONFIG_CRYPTO_CCM
CONFIG_CRYPTO_AEAD
CONFIG_CRYPTO_CMAC

This is likely to happen with a self-built Buildroot or Yocto Embedded Linux system. If you run into this error, you should enable above options and recompile the kernel.

See the BlueZ requirements here: https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/README#n64

To see detailed debug output from BlueZ, run it with -d option:

bluetoothd -d
Filip Kubicz
  • 459
  • 1
  • 5
  • 17