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
hciconfigwe 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