Datasheet
Common settings:
You can set up how much RAM to set aside for a communication buffer and whether you want to have full debug output. Debug output is 'noisy' on
the serial console but is handy since you can see all communication between the micro and the BLE
// ----------------------------------------------------------------------------------------------
// These settings are used in both SW UART, HW UART and SPI mode
// ----------------------------------------------------------------------------------------------
#define BUFSIZE 128 // Size of the read buffer for incoming data
#define VERBOSE_MODE true // If set to 'true' enables debug output
Software UART
If you are using Software UART, you can set up which pins are going to be used for RX, TX, and CTS flow control. Some microcontrollers are
limited on which pins can be used! Check the SoftwareSerial library documentation for more details
// SOFTWARE UART SETTINGS
#define BLUEFRUIT_SWUART_RXD_PIN 9 // Required for software serial!
#define BLUEFRUIT_SWUART_TXD_PIN 10 // Required for software serial!
#define BLUEFRUIT_UART_CTS_PIN 11 // Required for software serial!
#define BLUEFRUIT_UART_RTS_PIN -1 // Optional, set to -1 if unused
Hardware UART
If you have Hardware Serial, there's a 'name' for it, usually Serial1 - you can set that up here:
// HARDWARE UART SETTINGS
#ifdef Serial1 // this makes it not complain on compilation if there's no Serial1
#define BLUEFRUIT_HWSERIAL_NAME Serial1
#endif
Mode Pin
For both hardware and software serial, you will likely want to define the MODE pin. There's a few sketches that dont use it, instead depending on
commands to set/unset the mode. Its best to use the MODE pin if you have a GPIO to spare!
#define BLUEFRUIT_UART_MODE_PIN 12 // Set to -1 if unused
SPI Pins
For both Hardware and Software SPI, you'll want to set the CS (chip select) line, IRQ (interrupt request) line and if you have a pin to spare, RST
(Reset)
// SHARED SPI SETTINGS
#define BLUEFRUIT_SPI_CS 8
#define BLUEFRUIT_SPI_IRQ 7
#define BLUEFRUIT_SPI_RST 4 // Optional but recommended, set to -1 if unused
Software SPI Pins
If you don't have a hardware SPI port available, you can use any three pins...its a tad slower but very flexible
// SOFTWARE SPI SETTINGS
#define BLUEFRUIT_SPI_SCK 13
#define BLUEFRUIT_SPI_MISO 12
#define BLUEFRUIT_SPI_MOSI 11
Refer to the table above to determine whether you have SPI or UART controlled Bluefruits!
Select the Serial Bus
Once you've configured your pin setup in the BluefruitConfig.h file, you can now check and adapt the example sketch.
The Adafruit_BluefruitLE_nRF51 library supports four different serial bus options, depending on the HW you are using: SPI both hardware and
software type, and UART both hardware and software type.
UART Based Boards (Bluefruit LE UART Friend & Flora BLE)
This is for Bluefruit LE UART Friend & Flora BLE boards. You can use either software serial or hardware serial. Hardware serial is higher quality,
and less risky with respect to losing data. However, you may not have hardware serial available! Software serial does work just fine with flow-
© Adafruit Industries
https://learn.adafruit.com/introducing-the-adafruit-bluefruit-le-uart-
friend
Page 27 of 115