4

We're trying (unsuccessfully) to attach a UART bluetooth SoC to the Raspberry Pi 3 Compute Module.

The bluetooth SoC is a based off a Nordic nRF51. It's running project Zephyr RTOS hci_uart sample. Only changes made to this sample is: pins used for comms and added a blinking LED to assure CPU is running.

What have been done so far and it works:

  • on raspi-config removed the SSH over UART
  • added to /boot/config.txt dtparam=audio=off start_x=0 enable_uart=1 gpu_mem=16
  • bluez 5.43 compiled from source and installed fine. Check with any of the bluez tools with -v (also tried on bluez 5.44 with same results)
  • monitor the bluetooth sudo btmon
  • attach bluetooth module to system btattach -B /dev/ttyAMA0 -S 115200 -P h4
  • set beacon address, power on and scan for devices sudo btmgmt --index 0 static-addr ... something.... power on find -l
  • calling hciconfig we can see transmitted and received bytes between Pi and BT-SoC without issues.

What is missing: bluetoothctl Any attempt to use bluetoothctl informs that we have no controller.

bluetoothctl
[bluetooth]# list
[bluetooth]# agent on
Agent registered
[bluetooth]# default-agent
Default agent request successful
[bluetooth]# list
[bluetooth]# show
No default controller available

Further digging I've found that hciuart.service does not execute (as it would normally do on a Raspberry Pi 3:

pi@raspberrypi:~ $ systemctl status hciuart.service
● hciuart.service - Configure Bluetooth Modems connected by UART
   Loaded: loaded (/lib/systemd/system/hciuart.service; enabled)
   Active: inactive (dead)
           start condition failed at Tue 2017-05-23 09:44:13 CEST; 1s ago
           ConditionPathIsDirectory=/proc/device-tree/soc/gpio@7e200000/bt_pins was not met
pi@raspberrypi:~ $ cat /lib/systemd/system/hciuart.service
[Unit]
Description=Configure Bluetooth Modems connected by UART
ConditionPathIsDirectory=/proc/device-tree/soc/gpio@7e200000/bt_pins
Before=bluetooth.service
After=dev-serial1.device

[Service]
Type=forking
ExecStart=/usr/bin/btuart

[Install]
WantedBy=multi-user.target

It points that /proc/device-tree/soc/gpio@7e200000/bt_pins doesn't exist, and indeed it doesn't. I've tried to directly execute the binary from the service and got the following error message:

pi@raspberrypi:~ $ sudo /usr/bin/btuart
Can't open serial port: No such file or directory
Can't initialize device: No such file or directory

Doing the same tests using a USB serial connection to my Linux PC it works. Bluetoothctl have controller and it sees/communicates with the BT SoC

So my questions: - Why there is not bluetooth controller? how do I add/enable one? - Is it because of the hciuart.service? How do I enable it? - Is it because of the gpio@7e200000/bt_pins? How do I add, enable them?

Thanks a lot for any help

3
  • did u get a solution to this. I'm stuck at the same situation. Any help would be appreciated. Commented Feb 8, 2019 at 7:27
  • hi @PuruPawar sorry for the late reply. At the end Zephyr is unable to properly read up the chip mac address and reports it as 00:00:00:00 to the host computer. That made Bluetoothctl not want to work. I managed to hack it to work by changing the "read-mac-address" function in Zephyr to always reply '11:22:33:44:55' or something like this. It was not production ready, but gave an idea on where to go. But at the end we switched to Nordic SDK API and just communicate with the PC via serial port. So I can't help you there, but hopefully gives you a direction.
    – Budius
    Commented Feb 15, 2019 at 10:20
  • Thanks. I was able to get through this error eventually. It turned out that the bluetooth on my Pi was disabled by default. Turning it on fixed this issue. I'll add my solution as an answer so that other people can benefit. Commented Feb 15, 2019 at 11:34

1 Answer 1

1

Raspberry Pi 3B has Bluetooth disabled by default. If the Bluetooth is disabled, hcuiart service will fail to start and bluetoothctl will throw an error saying No default controller available

To turn on the Bluetooth, comment following line from

/boot/config.txt

dtoverlay=pi3-disable-bt

Reboot the Pi after saving the changes and the error should be gone.

1
  • 1
    The OP does not use a Raspberry Pi 3B. He is using a Raspberry Pi 3 Compute Module without built-in bluetooth. He attached a bluetooth SoC based off a Nordic nRF51.
    – Ingo
    Commented Feb 15, 2019 at 21:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.