Bluefruit LE nRF8001 Breakout Not Receiving

For other supported Arduino products from Adafruit: Shields, accessories, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
jialee
 
Posts: 64
Joined: Wed Nov 19, 2014 4:12 pm

Bluefruit LE nRF8001 Breakout Not Receiving

Post by jialee »

Hi,

I got this breakout and it was working just fine. I wanted to do something else with this good product so I wrote an Arduino program for it. This program takes the input which is the NFC UID and sends it out through thisbreakout. The program also read a series of characters from an app (similar to the Bluefruit LE app). It worked fine until I had a bug in the program that made the Bluefruit keep sending out the same UID in an endless loop. After this, I tried to reconnect Bluefruit with the app. The problem was that it couldn't receive and send anything anymore. I could neither send anything from my app to Bluefruit nor send anything from Bluefruit to my app. I suspect the receiving buffer of this breakout is full. I tried resetting Arduino by pressing the hardware reset button. Reran the program several times. The problem was still the same. I wish I could provide more information like screenshots and source code but I lost the source code when Arduino IDE crashed on me. Can you please troubleshoot it with me?

Let me add something some more details here.
ble_serial1.png
ble_serial1.png (38.81 KiB) Viewed 677 times
As you can see, it got connected with Bluefruit app for a while then it's timeout.
IMG_0012[1].PNG
IMG_0012[1].PNG (38.43 KiB) Viewed 677 times
John

User avatar
adafruit_support_mike
 
Posts: 67454
Joined: Thu Feb 11, 2010 2:51 pm

Re: Bluefruit LE nRF8001 Breakout Not Receiving

Post by adafruit_support_mike »

Try shutting down the iPad app completely.. double-click the Home button to get the panning display of all programs active in memory, and swipe upwards on the Adafruit BLE app. That will flush all memory associated with the app and start it from scratch next time.

User avatar
jialee
 
Posts: 64
Joined: Wed Nov 19, 2014 4:12 pm

Re: Bluefruit LE nRF8001 Breakout Not Receiving

Post by jialee »

Hi Mike, thanks for your reply. I think I'd tried that. Is there any other fix? Just in case it doesn't work even after closing the app. Regardless, I'll try doing that again just to make sure. Thanks.

User avatar
jialee
 
Posts: 64
Joined: Wed Nov 19, 2014 4:12 pm

Re: Bluefruit LE nRF8001 Breakout Not Receiving

Post by jialee »

Hi Mike,

I tried closing the app as per your instructions but it didn't solve the problem. Here's more information while I was trying to troubleshoot. I'm checking the receiving buffer availability in a loop. The result was always 0. Here's the code and the screenshot.

Code: Select all

/*********************************************************************
 * This is an example for our nRF8001 Bluetooth Low Energy Breakout
 * 
 * Pick one up today in the adafruit shop!
 * ------> http://www.adafruit.com/products/1697
 * 
 * Adafruit invests time and resources providing this open source code, 
 * please support Adafruit and open-source hardware by purchasing 
 * products from Adafruit!
 * 
 * Written by Kevin Townsend/KTOWN  for Adafruit Industries.
 * MIT license, check LICENSE for more information
 * All text above, and the splash screen below must be included in any redistribution
 *********************************************************************/

// This version uses call-backs on the event and RX so there's no data handling in the main loop!

#include <SPI.h>
#include "Adafruit_BLE_UART.h"
#include <MemoryFree.h>

#define ADAFRUITBLE_REQ 10
#define ADAFRUITBLE_RDY 2
#define ADAFRUITBLE_RST 9

Adafruit_BLE_UART uart = Adafruit_BLE_UART(ADAFRUITBLE_REQ, ADAFRUITBLE_RDY, ADAFRUITBLE_RST);

/**************************************************************************/
/*!
 This function is called whenever select ACI events happen
 */
/**************************************************************************/
void aciCallback(aci_evt_opcode_t event)
{
  switch(event)
  {
  case ACI_EVT_DEVICE_STARTED:
    Serial.println(F("Advertising started"));
    Serial.print(F("RAM:")); 
    Serial.println(freeMemory(), DEC);
    Serial.print(F("available: ")); 
    Serial.println(uart.available());
    uart.read();
    Serial.print(F("available: ")); 
    Serial.println(uart.available());
    break;
  case ACI_EVT_CONNECTED:
    Serial.println(F("Connected!"));
    Serial.print(F("RAM:")); 
    Serial.println(freeMemory(), DEC);
    Serial.print(F("available: ")); 
    Serial.println(uart.available());
    break;
  case ACI_EVT_DISCONNECTED:
    Serial.println(F("Disconnected or advertising timed out"));
    Serial.print(F("RAM:")); 
    Serial.println(freeMemory(), DEC);
    Serial.print(F("available: ")); 
    Serial.println(uart.available());
    break;
  default:
    break;
  }
}

/**************************************************************************/
/*!
 This function is called whenever data arrives on the RX channel
 */
/**************************************************************************/
void rxCallback(uint8_t *buffer, uint8_t len)
{
  Serial.print(F("Received "));
  Serial.print(len);
  Serial.print(F(" bytes: "));
  for(int i=0; i<len; i++)
    Serial.print((char)buffer[i]); 

  Serial.print(F(" ["));

  for(int i=0; i<len; i++)
  {
    Serial.print(" 0x"); 
    Serial.print((char)buffer[i], HEX); 
  }
  Serial.println(F(" ]"));

  /* Echo the same data back! */
  uart.write(buffer, len);
}

/**************************************************************************/
/*!
 Configure the Arduino and start advertising with the radio
 */
/**************************************************************************/
void setup(void)
{ 
  Serial.begin(9600);
  while(!Serial); // Leonardo/Micro should wait for serial init
  Serial.println(F("Adafruit Bluefruit Low Energy nRF8001 Callback Echo demo"));

  uart.setRXcallback(rxCallback);
  uart.setACIcallback(aciCallback);
  // uart.setDeviceName("NEWNAME"); /* 7 characters max! */
  uart.begin();
}

/**************************************************************************/
/*!
 Constantly checks for new events on the nRF8001
 */
/**************************************************************************/
void loop()
{
  uart.pollACI();
  Serial.print(F("available: ")); 
  Serial.println(uart.available());
  uart.read();
  Serial.print(F("available: ")); 
  Serial.println(uart.available());
}
ble_serial2.png
ble_serial2.png (39.15 KiB) Viewed 647 times
Is this normal? Hope it helps.

John

User avatar
adafruit_support_mike
 
Posts: 67454
Joined: Thu Feb 11, 2010 2:51 pm

Re: Bluefruit LE nRF8001 Breakout Not Receiving

Post by adafruit_support_mike »

Yeah, that would be normal.

If you look at the comments toward the top of the code, you'll see a line saying it uses a type of routine called 'callbacks' and that there's no data handling in loop().

Let's try something a little simpler:

Code: Select all

#include <SPI.h>
#include "Adafruit_BLE_UART.h"

#define ADAFRUITBLE_REQ 10
#define ADAFRUITBLE_RDY 3     // This should be an interrupt pin, on Uno thats #2 or #3
#define ADAFRUITBLE_RST 9

Adafruit_BLE_UART BTLEserial = Adafruit_BLE_UART(ADAFRUITBLE_REQ, ADAFRUITBLE_RDY, ADAFRUITBLE_RST);

void setup(void) { 
  BTLEserial.begin();
}

aci_evt_opcode_t laststatus = ACI_EVT_DISCONNECTED;

void loop()
{
  BTLEserial.pollACI();

  aci_evt_opcode_t status = BTLEserial.getState();
  if (status != laststatus) {
    // print it out!
    if (status == ACI_EVT_DEVICE_STARTED) {
        Serial.println(F("* Advertising started"));
    }
    if (status == ACI_EVT_CONNECTED) {
        Serial.println(F("* Connected!"));
    }
    if (status == ACI_EVT_DISCONNECTED) {
        Serial.println(F("* Disconnected or advertising timed out"));
    }
    laststatus = status;
  }

  if (status == ACI_EVT_CONNECTED) {
      uint8_t sendbuffer[] = "BTLE sending..\n";
      BTLEserial.write(sendbuffer, 15);
      delay( 250 );
  }
}
Load that into the Arduino, and when you run the Bluefruit LE app, swipe down on the screen to make it refresh its list of connections.

If you get an item for the nRF8001 (named UART), tap 'connect' and choose the mode named 'UART'. You should see a column of text stepping down the page with a new line every quarter second.

That will at least tell us whether the device is working.

User avatar
jialee
 
Posts: 64
Joined: Wed Nov 19, 2014 4:12 pm

Re: Bluefruit LE nRF8001 Breakout Not Receiving

Post by jialee »

Hi Mike, I followed the steps you provided. Here is the result.
IMG_0031[1].PNG
IMG_0031[1].PNG (39.08 KiB) Viewed 636 times
ble_serial3.png
ble_serial3.png (38.5 KiB) Viewed 636 times
After the serial terminal showed "Connected", the app showed "Connection timed out" message.

User avatar
adafruit_support_mike
 
Posts: 67454
Joined: Thu Feb 11, 2010 2:51 pm

Re: Bluefruit LE nRF8001 Breakout Not Receiving

Post by adafruit_support_mike »

It looks like something is marginal within the nRF8001 itself.. the radio seems to be good, but the data transmission engine isn't doing its part.

When did you get the breakout?

User avatar
jialee
 
Posts: 64
Joined: Wed Nov 19, 2014 4:12 pm

Re: Bluefruit LE nRF8001 Breakout Not Receiving

Post by jialee »

Hi Mike, I got it on Nov 20 2014. It arrived on Nov 24 2014.

User avatar
adafruit_support_mike
 
Posts: 67454
Joined: Thu Feb 11, 2010 2:51 pm

Re: Bluefruit LE nRF8001 Breakout Not Receiving

Post by adafruit_support_mike »

Thanks.. that's within our 30-day replacement window.

Send a note to [email protected] with a link to this thread and the folks there will get you a new nRF8001 breakout.

User avatar
jialee
 
Posts: 64
Joined: Wed Nov 19, 2014 4:12 pm

Re: Bluefruit LE nRF8001 Breakout Not Receiving

Post by jialee »

Hey Mike, the issue was resolved. I tried turning off the ipad and turning it back on. I opened the app. All of a sudden, it was working again. Something was wrong with my ipad before. Thanks for troubleshooting it with me. :)

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Arduino products from Adafruit”