This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Blend Micro Arduino Timeout problem

This is the second part of the problem firstly exposed in this question.

I have the problem that, with a Blend Micro Arduino board from Red Bear Lab after a while (randomly changes from 20 sec to 6 minutes more or less) the connection of the arduino with my computer or my android device close due to a timeout. The problem occurs with nothing attached to the board (no sensors, no I2C, no led, nothing, only the board).

In the arduino IDE serial monitor I have this error:

Evt Disconnected/Advertising timed out
Advertising started

I'm using the arduino to send data, and a Mac Book Pro with Mac OS/X 10.8.5, or a Motorola Moto-G Android 4.4.4 to receive data.

In the mac I'm using the echo.js example of blend micro module of node.js language.

In the Android I'm using the official BLE Controller from ReadBearLab.com, SimpleChat example.

In each cases (both with mac book pro and android) when the timeout occurs, if I close and restart the application, connection restart for few time (before the next timeout). During some tests, the longest duration of a stable connection was 10 minutes.

In Arduino side I'm using a HelloWorld.ino example:

//"services.h/spi.h/boards.h" is needed in every new project
#include <SPI.h>
#include <boards.h>
#include <RBL_nRF8001.h>

void setup()
{
  //ble_begin();
  ble_begin_debug();
  
  Serial.begin(57600);
}

unsigned char buf[16] = {0};
unsigned char len = 0;

void loop()
{
  if ( ble_connected() )
  {
    ble_write('H');
    ble_write('e');
    ble_write('l');
    ble_write('l');
    ble_write('o');
    ble_write(' ');
    ble_write('W');
    ble_write('o');
    ble_write('r');
    ble_write('l');
    ble_write('d');
    ble_write('!');
  }

  ble_do_events();
   
  delay(100);  
}

In this example I have added a new method for debug (thanks to Star Destroyer advice to have more information) copying the ble_begin() method into the void ble_begin_debug(); adding true in lib_aci_init(&aci_state, true); in the file RBL_nRF8001.cpp as suggested.

The result is this one (Arduino IDE Serial Monitor output tail lines)

data transmmit success!  Length: 12    Data Credit available: 1
 E3 :3, 86, 3, 8, 
Evt Disconnected/Advertising timed out
C5 :5, F, 1E, 0, 50, 0, 
Advertising started
 E3 :3, 84, F, 0, 
 E3 :3, 86, 93, 0, 
Evt Disconnected/Advertising timed out
C5 :5, F, 1E, 0, 50, 0, 
Advertising started
 E3 :3, 84, F, 0, 
 E3 :3, 86, 93, 0, 
Evt Disconnected/Advertising timed out
C5 :5, F, 1E, 0, 50, 0, 
Advertising started
 E3 :3, 84, F, 0, 
 E3 :3, 86, 93, 0, 
Evt Disconnected/Advertising timed out
C5 :5, F, 1E, 0, 50, 0, 
Advertising started
 E3 :3, 84, F, 0, 
 E3 :3, 86, 93, 0, 
Evt Disconnected/Advertising timed out
C5 :5, F, 1E, 0, 50, 0, 
Advertising started
 E3 :3, 84, F, 0,

You can see all the Arduino output for echo.js here and the Arduino output for Android BLE Controller Simple chat here. Just for sake of clarity here is the output of echo.js node application.

Let me know if there are some other debug information that I can provide.

  • Thanks for posting the trace. The first event that you see E3 :3, 86, 3, 8, is interpreted as a DisConnected Event with the BTLE reason code as 0x08 which means timed out. See Section 24 for the Disconnected Event. Then you start the advertising and it looks as if the advertising is started sucessfully based on the command response event E3 :3, 84, F, 0, with SUCCESS as the result code. Then looking at the next event I see E3 :3, 86, 93, 0,, I see another Disconnected Event, but this has a reason code of 0x93 which means that there was no BTLE central that connected back to this device of the time the device was advertising. I would have liked a timestamp with each of the messages when they are printed out on the PC so I can be certain that the advertisement was done for the commanded time. However at this point I can see that the phone or application that you have is not re-connecting back and that is one of the issues.

    Action: Ensure that your application re-connects when there is a link loss.

    The other issue is to see why did you get a E3 :3, 86, 3, 8, in the first place. This can happen if there you have moved too far away from the phone or there is other noise on the air which resulted in a disconnect. It may be interesting to see the messages that happen before the first Disconnected Event was received along with timestamps for the Serial messages.

Related