Git Product home page Git Product logo

adafruit_nrf8001's Introduction

Adafruit_nRF8001

Driver and example code for Adafruit's nRF8001 Bluetooth Low Energy Breakout.

PINOUT

The pin locations are defined in ble_system.h, the supported systems are defined in hal_aci_tl.cpp. The following pinout is used by default for the Arduino Uno:

  • SCK -> Pin 13
  • MISO -> Pin 12
  • MOSI -> Pin 11
  • REQ -> Pin 10
  • RDY -> Pin 2 (HW interrupt)
  • ACT -> Not connected
  • RST -> Pin 9
  • 3V0 - > Not connected
  • GND -> GND
  • VIN -> 5V

RDY must be on pin 2 since this pin requires a HW interrupt.

3V0 is an optional pin that exposes the output of the on-board 3.3V regulator. You can use this to supply 3.3V to other peripherals, but normally it will be left unconnected.

ACT is not currently used in any of the existing examples, and can be left unconnected if necessary.

Examples

The following examples are included for the Adafruit nRF8001 Breakout

UART

This example creates a UART-style bridge between the Arduino and any BLE capable device.

You can send and receive up to 20 bytes at a time between your BLE-enabled phone or tablet and the Arduino.

Any data sent to the Arduino will be displayed in the Serial Monitor output, and echo'ed back to the phone or tablet on the mobile device's RX channel.

This demo creates a custom UART service, with one characteristic for TX and one for RX using the following UUIDs:

  • 6E400001-B5A3-F393-E0A9-E50E24DCCA9E for the Service
  • 6E400002-B5A3-F393-E0A9-E50E24DCCA9E for the TX Characteristic (Property = Notify)
  • 6E400003-B5A3-F393-E0A9-E50E24DCCA9E for the RX Characteristic (Property = Write without response)

You can test the UART service with the free nRF UART apps from Nordic Semiconductors, available for both iOS and Android:

adafruit_nrf8001's People

Contributors

berry120 avatar driverblock avatar ladyada avatar marcoschwartz avatar microbuilder avatar paintyourdragon avatar paulstoffregen avatar quartzjer avatar tdicola avatar teslafly avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

adafruit_nrf8001's Issues

Having SPIClass' has no member named 'endTransaction' problem

I only got one code file in my library

screen shot 2015-05-05 at 11 38 50 pm

  This report would have more information with
  "Show verbose output during compilation"
  enabled in File > Preferences.
Arduino: 1.0.6 (Mac OS X), Board: "Arduino Uno"
/Users/teejiahen/Documents/Arduino/libraries/Adafruit_BLE_UART/utility/hal_aci_tl.cpp: In function 'void hal_aci_tl_init()':
/Users/teejiahen/Documents/Arduino/libraries/Adafruit_BLE_UART/utility/hal_aci_tl.cpp:317: error: 'class SPIClass' has no member named 'usingInterrupt'
/Users/teejiahen/Documents/Arduino/libraries/Adafruit_BLE_UART/utility/hal_aci_tl.cpp: In function 'hal_aci_data_t* hal_aci_tl_poll_get()':
/Users/teejiahen/Documents/Arduino/libraries/Adafruit_BLE_UART/utility/hal_aci_tl.cpp:360: error: 'class SPIClass' has no member named 'beginTransaction'
/Users/teejiahen/Documents/Arduino/libraries/Adafruit_BLE_UART/utility/hal_aci_tl.cpp:360: error: 'SPISettings' was not declared in this scope
/Users/teejiahen/Documents/Arduino/libraries/Adafruit_BLE_UART/utility/hal_aci_tl.cpp:401: error: 'class SPIClass' has no member named 'endTransaction'

Multiple BTLEserial.write() inside an Arduino Loop

Hi everyone,
i'm having a problem using multiple write() inside a loop void with Arduino Mega.
I need to send data over BLE to external devices and the limit of 20 char is a problem for my project.
To avoid this i thought to split my data in multiple messages and sending them inside the same loop but after 5-6 loop the write doesn't work anymore.
Can you help me?
Thanks in advance!

Multiple connection not available when module advertising!

I use Adafruit Bluefruit LE SPI Friend module in my device, when I create my custom services and characteristics and then advertising the services.
During advertising the services I want to connect via some mobile devices (iOS and Android). but when one device find the service and connect to module (when blue led on module turn on), others cannot find module.
Is it possible to connect to module via more than one devices?

when ever i try to upload or verify the file i keep getting this

home/disappear/sketchbook/libraries/AdafruitnRF8001/utility/hal_aci_tl.cpp: In function ‘void hal_aci_tl_init()’:
/home/disappear/sketchbook/libraries/AdafruitnRF8001/utility/hal_aci_tl.cpp:323:9: error: ‘class SPIClass’ has no member named ‘usingInterrupt’
SPI.usingInterrupt(HAL_IO_RADIO_IRQ); // add checking for spi conflicts
^
/home/disappear/sketchbook/libraries/AdafruitnRF8001/utility/hal_aci_tl.cpp: In function ‘hal_aci_data_t* hal_aci_tl_poll_get()’:
/home/disappear/sketchbook/libraries/AdafruitnRF8001/utility/hal_aci_tl.cpp:366:7: error: ‘class SPIClass’ has no member named ‘beginTransaction’
SPI.beginTransaction(SPISettings(2000000, LSBFIRST, SPI_MODE0)); // gain control of SPI bus
^
/home/disappear/sketchbook/libraries/AdafruitnRF8001/utility/hal_aci_tl.cpp:366:64: error: ‘SPISettings’ was not declared in this scope
SPI.beginTransaction(SPISettings(2000000, LSBFIRST, SPI_MODE0)); // gain control of SPI bus
^
/home/disappear/sketchbook/libraries/AdafruitnRF8001/utility/hal_aci_tl.cpp:407:7: error: ‘class SPIClass’ has no member named ‘endTransaction’
SPI.endTransaction(); // release the SPI bus
^

Code is in Debug mode

the #define BLE_RW_DEBUG macro is set. As far as I can see this shouldn't be defined since this is a debug only configuration.

print() with strings > 20 characters drops data

Sending strings longer than 20 characters causes chunks of the strings to be dropped and ACI errors to be output. I think this is because data_credit_available isn't checked anywhere before sending data. To reproduce, send some strings whose lengths are > 20 characters using print() one after the other. Some of them will be missing parts.

If I modify line 257 of Adafruit_BLE_UART.cpp to include a check that there is at least one data credit:

if(!lib_aci_is_pipe_available(&aci_state, PIPE_UART_OVER_BTLE_UART_TX_TX) || aci_state.data_credit_available == 0)

Then it will remain polling until the pipe is available and it has a data credit. (Line 281 needs a similar change.) The downside is this ends up wasting cycles, waiting for a data credit to become available. I also wrote the following function so I can check the pipe and data credit status, before I call print() or write():

bool Adafruit_BLE_UART::ready(void) {
  return lib_aci_is_pipe_available(&aci_state, PIPE_UART_OVER_BTLE_UART_TX_TX) && aci_state.data_credit_available > 0;
}

Compile fails on Arduino Due

Error thrown:

fatal error: util/delay.h: No such file or directory

Cause:
The Due operates on a ARM chip rather than a AVR chipset while delay.h is specifically for the AVR chipset only

A stray `break` in write(uint8_t * buffer, uint8_t len) prevents any data from sending.

This break on this line in write(uint8_t * buffer, uint8_t len):
https://github.com/adafruit/Adafruit_nRF8001/blob/master/Adafruit_BLE_UART.cpp#L211

It seems to break out of the while loop when it shouldn't, preventing any data from sending.

if(!lib_aci_is_pipe_available(&aci_state, PIPE_UART_OVER_BTLE_UART_TX_TX))
{
  pollACI();
  break; // Breaks universe
}

The implementation of the single byte write(uint8_t buffer) method has no such short circuit and seems to work just fine.

After removing the offending break from the library, my data is actually coming through to my iPhone.

I'm no expert on the libraries used here, but it seems this line should be removed. Whatever it's supposed to be guarding against doesn't seem to be working as intended.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.