Bluetooth Low Energy (BLE) Module

The Intel® Quark™ SE microcontroller C1000 developer board comes with an integrated Nordic* Bluetooth low energy module. Software support is provided by the Zephyr* RTOS that comes with a feature-rich and highly configurable Bluetooth stack optimized for low-powered small memory footprint devices. Refer to the Zephyr* Project page for more information on the Bluetooth low energy stack at https://www.zephyrproject.org/doc/subsystems/bluetooth/bluetooth.html.

The Intel® System Studio for Microcontrollers includes the following sample applications demonstrating the use of the Nordic* Bluetooth module:

Beacon - a simple application demonstrating the BLE Broadcaster role functionality by advertising an Eddystone URL (the Zephyr website).

Peripheral - an application demonstrating the BLE Peripheral role. It has several well-known and vendor-specific GATT services that it exposes.

Peripheral HR - similar to 'Peripheral', except that this application specifically exposes the HR (Heart Rate) GATT Service. Once a device connects, it will generate dummy heart-rate values.

Peripheral CSC - similar to 'Peripheral', except that this application specifically exposes the CSC (Cycling Speed and Cadence) GATT Service.

Peripheral ESP - similar to 'Peripheral', except that this application specifically exposes the ESP (Environmental Sensing Profile) GATT Service.

Central HR - this application specifically looks for heart-rate monitors and reports the heart-rate readings once connected.

Using BLE with Zephyr 1.4

The Arduino 101 board comes with a Nordic Semiconductor nRF51 Bluetooth LE controller. The Arduino 101 factory-installed firmware on this controller is not supported by Zephyr, so a new one needs to be flashed onto it. The best option currently is to use MyNewt (http://mynewt.apache.org) as a basis for this firmware, which makes it possible to use the controller with the native Bluetooth stack of Zephyr.

  1. Set up the newt tool. For Fedora the dependencies are:
    $ sudo dnf install dfu-util libcurl-devel golang arm-none-eabi-gdb \
              arm-none-eabi-newlib arm-none-eabi-gcc-cs \
              arm-none-eabi-binutils-cs arm-none-eabi-gcc-cs-c++
    

    General instructions, as well as Ubuntu/Debian dependencies can be found here: http://mynewt.apache.org/newt/install/newt_linux/.

  2. Once the newt tool is installed create your project:
    $ newt new arduino-mynewt
    Downloading project skeleton from apache/incubator-mynewt-blinky...
    Installing skeleton in arduino-mynewt...
    Project arduino-mynewt successfully created.
    $ cd arduino-mynewt/
    
  3. After that, initialize the project with:
    $ newt install -v
    apache-mynewt-core
    Downloading repository description for apache-mynewt-core... success!
    Downloading repository incubator-mynewt-core (branch: master; commit: mynewt_0_9_0_tag) at https://github.com/apache/incubator-mynewt-core.git
    Cloning into '/tmp/newt-repo072720113'...
    remote: Counting objects: 24003, done.
    remote: Compressing objects: 100% (559/559), done.
    remote: Total 24003 (delta 373), reused 13 (delta 13), pack-reused 23359
    Receiving objects: 100% (24003/24003), 8.53 MiB | 1.82 MiB/s, done.
    Resolving deltas: 100% (14213/14213), done.
    Checking connectivity... done.
    apache-mynewt-core successfully installed version 0.9.0-none
    
  4. Create a target for the bootloader:
    $ newt target create boot
    $ newt target set boot app=@apache-mynewt-core/apps/boot
    $ newt target set boot bsp=@apache-mynewt-core/hw/bsp/nrf51-arduino_101
    $ newt target set boot build_profile=optimized
    
  5. Create a target for the HCI over UART application:
    $ newt target create blehci
    $ newt target set blehci app=@apache-mynewt-core/apps/blehci
    $ newt target set blehci bsp=@apache-mynewt-core/hw/bsp/nrf51-arduino_101
    $ newt target set blehci build_profile=optimized
    
  6. Verify that the targets were properly created:
    $ newt target show
    targets/blehci
        app=@apache-mynewt-core/apps/blehci
        bsp=@apache-mynewt-core/hw/bsp/nrf51-arduino_101
        build_profile=optimized
    targets/boot
        app=@apache-mynewt-core/apps/boot
        bsp=@apache-mynewt-core/hw/bsp/nrf51-arduino_101
        build_profile=optimized
    
  7. Build the bootloader
    $ newt build boot
    Compiling...
    ...
    Linking boot.elf
    App successfully built: <path>/arduino-mynewt/bin/boot/apps/boot/boot.elf
    
  8. Build the HCI over UART application:
    $ newt build blehci
    Compiling...
    ...
    Linking blehci.elf
    App successfully built: <path>/arduino-mynewt/bin/blehci/apps/blehci/blehci.elf
    
    $ newt create-image blehci 0.0.0
    App image succesfully generated: <path>/arduino-mynewt/bin/blehci/apps/blehci/blehci.img
    Build manifest: <path>/arduino-mynewt/bin/blehci/apps/blehci/manifest.json
    
  9. Combine the bootloader and application into a single firmware image (ble_core.img)
    $ cat bin/boot/apps/boot/boot.elf.bin /dev/zero | dd of=ble_core.img bs=1k count=256
    $ dd if=bin/blehci/apps/blehci/blehci.img of=ble_core.img bs=1 seek=32768
    
  10. Reset Arduino 101 with USB plugged and wait a few seconds (you might need several repeated attempts):
    ">$ dfu-util -a ble_core -D ble_core.img
    ...
    Opening DFU capable USB device...
    ID 8087:0aba
    Run-time device DFU version 0011
    Claiming USB DFU Interface...
    Setting Alternate Setting #8 ...
    Determining device status: state = dfuIDLE, status = 0
    dfuIDLE, continuing
    DFU mode device DFU version 0011
    Device returned transfer size 2048
    Copying data from PC to DFU device
    Download  [=========================] 100%        69008 bytes
    Download done.
    state(2) = dfuIDLE, status(0) = No error condition is present
    Done!
    

After successfully completing these steps your Arduino 101 should now have a HCI compatible BLE firmware.

For more complete information about compiler optimizations, see our Optimization Notice.