@akbennett akbennett released this Jan 4, 2018

Assets 4

Bluetooth Low Energy USB Dongle powered by Zephyr (only LE, not classic).

To use this release

Device Configuration / Programming

  • Program BLE dongle {DAPLink programmer & BLE Nano2} In normal operation, the BLE Nano2 programmer board will open a mount point ‘DAPLINK’ to update the target firmware (nrf52), simply hold button on DAP link programmer board while plugging the device in and it will boot in debug mode and mount point will show up as ‘MAINTENANCE’
  • Drag and Drop DAPLink binary to ‘MAINTENANCE’ mount point, device will automatically reboot [ DAPLink_V1.5_Interface_nRF52_20171213.bin ]
  • Drag and Drop BLE Dongle binary to ‘DAPLINK’ mount point, device will automatically reboot [ nrf52_blenano2-hci_uart-zephyr.bin ]

Host configuration

  • Find the location of the ttyACM device ; i.e. check dmesg when you insert your device
  • Create a bt attach script as root (sudo su - )
# Create bluetooth attach configuration file
cat << EOF > /etc/bluetooth/btattach.conf

# restart btattach service
systemctl restart btattach.service

Compatible Devices

  • Redbear Labs Nano v2 (nRF52)

In reality any nRF51/nRF52 board can be compatible with the setup, as long it provides a UART-USB converter that supports flow control.

Instructions to build from source

Build and Flash

Set up your development environment as described by http://docs.zephyrproject.org/getting_started/getting_started.html

The sample application that provides the raw HCI interface to use Zephyr as a BT Controller can be found at samples/bluetooth/hci_uart (hci_usb or hci_spi could also be used, but out of the scope of this document).

The default application configuration sets a limit of 16 parallel bluetooth connections, to increase simply change CONFIG_BT_MAX_CONN to the desired amount (20 would be a good MAX). Additional RX/TX buffers and larger data length should also used for better performance, if not restricted by RAM (e.g. nRF51).

Build and flash from source code (make sure to use the proper BOARD target (we use BLE Nano 2 in this example):

The following steps were followed to build the ble dongle on OSX:

# get arm toolchain
export ZEPHYR_GCC_VARIANT=gccarmemb
# Get latest prebuilt toolchain 
#  https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads 
export GCCARMEMB_TOOLCHAIN_PATH=~/Downloads/gcc-arm-none-eabi-7-2017-q4-major

#get source code
git clone https://github.com/OpenSourceFoundries/zephyr-ble-dongle.git 

#one-time prep zephyr working directory
cd zephyr-ble-dongle
mkdir -p build && cd build
cmake $ZEPHYR_BASE/scripts
echo "export PATH=$PWD/kconfig:\$PATH" >> $HOME/.zephyrrc
source $ZEPHYR_BASE/zephyr-env.sh

cd $ZEPHYR_BASE/samples/bluetooth/hci_uart
echo "CONFIG_BT_CTLR_RX_BUFFERS=18" >> nrf5.conf
echo "CONFIG_BT_CTLR_TX_BUFFERS=19" >> nrf5.conf
echo "CONFIG_BT_CTLR_TX_BUFFER_SIZE=251" >> nrf5.conf
echo "CONFIG_BT_CTLR_DATA_LENGTH_MAX=251" >> nrf5.conf
echo "CONFIG_BT_HCI_CMD_COUNT=20" >> nrf5.conf
echo "CONFIG_BT_RX_BUF_COUNT=20" >> nrf5.conf
echo "CONFIG_BT_RX_BUF_LEN=264" >> nrf5.conf
mkdir -p build && cd build
cmake -DBOARD=nrf52_blenano2 -DCONF_FILE=nrf5.conf ..
make flash