Bluetooth Low Energy (BLE) with NB1600 and Bluegiga Bluetooth Smart Dongle

This article shows you how to use Bluegiga's BLE Dongle BLED112 with NB1600.

Prerequisites

Since BLED communicates with the NB1600 host system over Abstract Control Model (ACM), a Subclass Specification of PSTN Devices, in the USB Communications Device Class specification, we require the cdc_acm kernel driver installed and loaded. The cdc_acm driver is present in NRSW since version 3.8. You can check it like this:

~ $ ls /lib/modules/2.6.36/cdc-acm*
/lib/modules/2.6.36/cdc-acm.ko 
 
~ $ lsmod | grep cdc_acm
cdc_acm                15221  0

If the kernel module is not loaded, we need to load it and check again.

~ $ insmod /lib/modules/2.6.36/cdc-acm.ko 
~ $ lsmod | grep cdc_acm

After plugging in the BLE USB dongle you should see some sign of life in the kernel messages.

dmesg | grep acm
cdc_acm 1-1.2:1.0: ttyACM0: USB ACM device
usbcore: registered new interface driver cdc_acm
cdc_acm: v0.26:USB Abstract Control Model driver for USB modems and ISDN adapters

Executing usb-devices will also confirm that the USB device is present and the cdc_acm driver for the device is loaded

usb-devices
B:  1-1.2
T:  Bus=01 Lev=02 Prnt=02 Port=01 Cnt=02 Dev#=  6 Spd=12  MxCh= 0
D:  Ver= 2.00 Cls=02(commc) Sub=00 Prot=00 MxPS=32 #Cfgs=  1
P:  Vendor=2458 ProdID=0001 Rev=00.01
S:  Manufacturer=Bluegiga
S:  Product=Low Energy Dongle
S:  SerialNumber=1
C:  #Ifs= 2 Cfg#= 1 Atr=80 MxPwr=74mA
I:  If#= 0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=02 Prot=01 Driver=cdc_acm
I:  If#= 1 Alt= 0 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_acm

You should now see a serial device named ttyACM0

~ $ ls /dev/ttyACM*
/dev/ttyACM0

You will now be able to talk with the dongle via this interface. The protocol to talk will be BGAPI For a simple scanning test, there is a python script available on https://raw.githubusercontent.com/jrowberg/bglib/master/Python/Examples/bled112_scanner.py

Since Python is not on the box by default, we need to install it, see here.

Let us run it and detect for example the TI CC2541 SensorTag.

~ $ curl -k https://raw.githubusercontent.com/jrowberg/bglib/master/Python/Examples/bled112_scanner.py -o bled112_scanner.py
~ $ chmod a+x bled112_scanner.py
~ $ ./bled112_scanner.py
================================================================
BLED112 Scanner for Python v2013-04-07
================================================================
Serial port:    /dev/ttyACM0
Baud rate:      115200
Scan interval:  200 (250.00 ms)
Scan window:    200 (250.00 ms)
Scan type:      Passive
UUID filters:   None
MAC filter(s):  None
RSSI filter:    None
Display fields: - Time
                - RSSI
                - Packet type
                - Sender MAC
                - Address type
                - Bond status
                - Payload data
Friendly mode:  Disabled
----------------------------------------------------------------
Starting scan for BLE advertisements...
1426759308.658 -50 0 BC6A29AB6203 0 255 020105
1426759308.765 -43 0 BC6A29AB6203 0 255 020105
1426759308.873 -47 0 BC6A29AB6203 0 255 020105
1426759308.981 -51 0 BC6A29AB6203 0 255 020105
1426759309.078 -44 0 BC6A29AB6203 0 255 020105
1426759309.186 -43 0 BC6A29AB6203 0 255 020105

A python package for communicating with BlueGiga modules through their proprietary API can be found on github.