This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

zephyr HCI-UART on PCA10040 with Linux controller

Hi,

what are the minimal required steps to get the zephyr HCI-UART on a PCA10040 working with Linux BlueZ?

The steps I have so far [My host is Ubuntu 17.04]:

Physically connect a TTL-232R-3V3 serial cable to the PCA10040 board. Connecting the following:

Cable [GND]  -  PCA10040[GND]
Cable [Rx]  -  PCA10040[P0.D4]
Cable [Tx]  -  PCA10040[P0.08]

Building the hci-uart example for PCA10040:

git clone github.com/.../zephyr
cd zephyr
git checkout tags/v1.9.0
sudo apt-get install git make gcc g++ ncurses-dev gperf ccache\
      doxygen dfu-util device-tree-compiler python3-ply python3-pip
pip3 install --user -r scripts/requirements.txt
cd ..
wget github.com/.../zephyr-sdk-0.9.1-setup.run
chmod 755 zephyr-sdk-0.9.1-setup.run
sudo ./zephyr-sdk-0.9.1-setup.run
export ZEPHYR_GCC_VARIANT=zephyr
export ZEPHYR_SDK_INSTALL_DIR=/opt/zephyr-sdk/
cd zephyr
source zephyr/zephyr-env.sh
cd zephyr/samples/bluetooth/hci_uart
make BOARD=nrf52_pca10040
# Flash your board with outdir/nrf52_pca10040/zephyr.hex

Get the latest BlueZ version. Needs to be 5.44 or higher. Read here:

sudo apt-get install -y libusb-dev libdbus-1-dev libglib2.0-dev libudev-dev libical-dev libreadline-dev
wget www.kernel.org/.../bluez-5.47.tar.xz
tar xf bluez-5.47.tar.xz
cd bluez-5.47/
./configure
make
sudo make install

If all the previous steps were correct, the only thing left is to attach BlueZ to the UART device.

sudo hciattach -s 115200 ttyUSB0 any 115200 flow
sudo hciconfig hci1 up

Error (dmesg output on the host after the last commands):

[ 2304.948745] Bluetooth: hci1 command 0x1003 tx timeout
[ 2306.964639] Bluetooth: hci1 command 0x1001 tx timeout
[ 2308.980488] Bluetooth: hci1 command 0x1009 tx timeout
[ 2315.188214] Bluetooth: hci1 command 0x1003 tx timeout
[ 2317.268046] Bluetooth: hci1 command 0x1001 tx timeout
[ 2319.316040] Bluetooth: hci1 command 0x1009 tx timeout
Related