-
Notifications
You must be signed in to change notification settings - Fork 18
Software and Hardware
##Configuration Tools
In this section, we're mainly discussing two toolchains, from Texas Instruments and from Nordic Semiconductor, the two largest vendors of Bluetooth LE chipsets at the moment. One general caveat about the difference between the Nordic and TI toolchains: The Nordic toolchain stops you from doing things that break the BLE standards, but the TI toolchain doesn't.
Nordic Semiconductor's toolchain for radio firmware development is called nRFGo Studio. It runw on Windows, but can run on OSX and Linux using Wine. Instructions for running it on OSX can be found here
The nRF8001 radio does not let you define services and characteristics directly from your Arduino code. Instead, they must be defined in nRFgo Studio.
Use File -> New -> nRF8001 to start working on a new configuration.
Before creating your own custom services, you may want to try creating a configuration using standard services. First of all, in the "Device" dropdown at the top, choose the version of nRF8001 on your module. This will probably be DX/D, but it may be CX/C for older boards.
In the "GATT Services" tab, you can drag in service templates from the right-hand side. That will launch a wizard with a step for each characteristic in that service. In the Properties section, you will have a number of checkboxes, to indicate how that characteristic will be used. We have also ticked "Notify", which is mandatory for Heart Rate Measurement, so we can stream heart rate data from peripheral to central.
Texas Instruments offers BLE SoC called CC2540,CC2541. Windows-based IAR toolchain is used to link against proprietary radio library and build the user application projects. The blestack SDK can be downloaded from TI's website, and the actual implementation of the BLE radio software comes in the form of precompiled library. This BLE library can only be linked using IAR, and already uses up ~50kBytes of flash. There are lots useful example projects that come with TI's blestack download. Most user projects are derivatives of these examples. The software stack largely consists of 3 layers: 1) HAL : Hardware Abstraction Layer 2) OSAL : Operating System Abstraction Layer 3) User Application. The ble functions are exposed via GAP and GATT functions and users are responsible for calling proper initialization routines as well as implementing callbacks to customize behavior of the radio.
You can use evaluation version of IAR for 30 days, but once the free trial expires, it limits you to 32KBytes of flash programming which makes it impossible to work with TI blestack afterwards. Obviously, this is a crippling limitation for developers considering CC2540/1 based BLE product.
CC Debugger is the programmer kit - it is akin to avrispmk-2 for Arduino. The software that communicates with CC Debugger to flash CC2540 (in general CC-chips), is called SmartRF Studio (http://www.ti.com/tool/flash-programmer). Three IO pins are required to program CC2540/1. They are DD (data), DC (clock), RESET. In addition, the programmer requires GND and 3.0V Sense. You need to externally power the target device. 3.0V Sense port is used to detect the voltage level on the target device.
With an NDA and jumping through various hoops, it is feasible to setup gcc-based toolchain for CC2540. There isn't any publicly available information about this setup.
In general, you will see the following types of BLE boards:
Just the radio: These boards will typically have Nordic's nRF8001 BLE chip, some radio circuitry, and a way to connect to your Arduino, sometimes including level shifting circuitry. It will have two pins for power (ground and 3.3V), and 5 or 6 additional pins that connect to your Arduino. Example: Adafruit's Bluefruit LE board, Nordic's nRF8001 development kit.
Radio with microcontroller: These boards will have a chip such as Nordic nRF51822 (ARM Cortex-M0 microcontroller) or TI CC2540 or CC2541 (8051 microcontroller). These are characterized by having a microcontroller built in that could run all your code, so you don't even need an Arduino.
Radio with microcontroller + more: Known in the trade as "modules," these boards have a radio with microcontroller that runs some firmware. These can often run either standalone or together with an external microcontroller. For example, Laird's BL600 module has an nRF51822 and executes a special version of the BASIC programming language. You could either save and run your code, written in BASIC, directly on the module, or you could talk to it with an Arduino, and have the BASIC code sent from Arduino to BL600 over a UART serial connection. XBee is similar in that it can operate both standalone and connected to something else.
Via Upverter
In the following, we will assume that you have a board that has just the radio.
The Serial Peripheral Interface, or SPI, is the way that nRF8001 and most other BLE modules connect to your Arduino. The basic pins are MOSI (data from Arduino to BLE), MISO (data from BLE to Arduino), SCK (clock). The two additional pins are REQN and RDYN. REQN is analogous to what many SPI devices call Slave Select or SS. Sometimes you will also have access to RESET.
If you have other SPI devices, it may be possible to share the MOSI, MISO and SCK pins with the other devices, and have a separate SS pin for the other devices. Sharing the SPI lines is easiest to do when all the devices run the same SPI mode. nRF8001 uses SPI mode 0, which is fairly common, but it has the least significant bit of each byte first, which is uncommon.
CC2540 was arguably the first BLE SoC on the market. They contain 8 bit 8051 core with bluetooth radio. It contains various useful peripherals, and supports upto 256kbytes of flash with 16kbytes of ram. There are two popular development kits available from TI that uses CC2540/1.
- http://www.ti.com/tool/cc2540keyfob-rd
- http://www.ti.com/tool/cc2541dk-sensor These development kits are useful to understand the concepts of BLE within the constraints of the devkit hardware. However, creating a customized firmware for these devices is challenging endeavor without IAR toolchain.
Beware that the nRF8001 operates at voltages between 1.8V and 3.6V, and will not work properly with a regular Arduino. Adafruit's Bluefruit board and their Bluetooth LE breakout board have the level shifters necessary to get the correct voltages.
Nordic's System-On-Chip implementation. It contains ARM-M0 microcontroller with BLE radio in single chip. The operating voltage is 1.8V-3.6V, contains lots of peripherals with 256kBytes of programmable flash. Lots of new devices are moving towards this chip due to gcc toolchain.