Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - tcollinsworth

Pages: [1]
1
BLE and Low Level Development / Security of uploaded apps RFduino & Simblee
« on: February 20, 2016, 02:24:22 PM »
Is it possible to download the program FLASH OTA? If an RFduino or Simblee is shipped with an encryption key embedded in the code, could that be downloaded OTA using low level NRF51 APIs?

2
The onAdvertisement(bool start) is called with a false when a connection occurs.

It would be far more useful for the onAdvertisement() to be called before and/or after the periodic advertisements. I really wanted to do one or 'n' advertisements and shut down the radio for a long period to extend the battery.
The other obvious useful thing would have been to update data in the advertisement packets between advertisements. But that isn't practical since it isn't being called before and/or after each advertisement.
Is there any easy way to accomplish either of those?

The onAdvertisement() isn't providing usefulness that I can't get with begin(), onConnect(), and onDisconnect().

It's called after begin with true, but we know that is going to happen.
It's called with false during connection, but onConnect is called, so we know that too.
It's called after onDisconnect() with true, but we also know that it's going to start advertising unless the onDisconnect was because we called end().

So basically onAdvertisement() isn't called when it actually starts or stops transmitting an advertisement, it's called after begin(), connect(), and disconnect(). Doesn't seem very useful to us!!!

Please update the documentation to be a little more clear. Is Simblee the same? This cost me way too much time to figure out that I can't use it either of the ways I was expecting from the name and documentation.  >:(

3
Below is a modified AdvertismentContinuous example script that came with the RFduino library. The onAdvertisement(bool start) method is only called after RFduinoBLE.begin() and not again until RFduinoBLE.begin()  is called again. The led never blinks and the counts never increase. If I change it to call RFduinoBLE.begin() and end() in the loop, then the start counts increase, but the end counts don't. Since the example clearly should blink the stock example clearly should blink the LED and it wasn't stopping and starting the BLE, then we can only assume from the documentation that onAdvertisement should be called based on the BLE advertising interval as the radio starts and stops. Clearly that isn't happening. Either I'm missing something or the library is broken. I have tried multiple RFduino's and they all react the same. I just received some Simblee's and I'll try those to see if they react the same.

Output:

Code: [Select]
init
advStartCnt=1,advEndCnt=0
advStartCnt=1,advEndCnt=0
. . .

Code: [Select]
#include <RFduinoBLE.h>

int led = 3;

volatile uint8_t advStartCnt = 0;
volatile uint8_t advEndCnt = 0;

void setup() {
  pinMode(led, OUTPUT);

  RFduinoBLE.advertisementData = "data";
  RFduinoBLE.advertisementInterval = 1000;

  Serial.begin(9600);
  Serial.println("init");
   
  RFduinoBLE.begin();
}

void loop() {
  RFduino_ULPDelay(10000);
  Serial.print("advStartCnt=");
  Serial.print(advStartCnt);
  Serial.print(",advEndCnt=");
  Serial.println(advEndCnt);
}

void RFduinoBLE_onAdvertisement(bool start)
{
  if (start) {
    digitalWrite(led, HIGH);
    ++advStartCnt;
  } else {
    digitalWrite(led, LOW);
    ++advEndCnt;
  }
}

Code: [Select]
init
advStartCnt=0,advEndCnt=0
advStartCnt=1,advEndCnt=0
advStartCnt=2,advEndCnt=0
. . .


Code: [Select]
#include <RFduinoBLE.h>

int led = 3;

volatile uint8_t advStartCnt = 0;
volatile uint8_t advEndCnt = 0;

void setup() {
  pinMode(led, OUTPUT);

  RFduinoBLE.advertisementData = "data";
  RFduinoBLE.advertisementInterval = 1000;

  Serial.begin(9600);
  Serial.println("init");
}

void loop() {
  RFduino_ULPDelay(10000);
  Serial.print("advStartCnt=");
  Serial.print(advStartCnt);
  Serial.print(",advEndCnt=");
  Serial.println(advEndCnt);
  RFduinoBLE.end();
  RFduinoBLE.begin();
}

void RFduinoBLE_onAdvertisement(bool start)
{
  if (start) {
    digitalWrite(led, HIGH);
    ++advStartCnt;
  } else {
    digitalWrite(led, LOW);
    ++advEndCnt;
  }
}

4
The documentation says
- RFduinoBLE_onAdvertisement()
This function allows you to run a piece of code everytime the radio advertises

I'm printing to serial out and toggling an LED and I'm only seeing it called when I call RFduinoBLE.begin and RFduinoBLE.end. It doesn't get called but at begin and end even though the Interval is set to various values.


5
Getting Started / Low Power Mode
« on: August 16, 2014, 01:59:46 PM »
What should the typical rfduino current draw be when in RFduino_ULPDelay(INFINITE) mode? With the RFduino libraries, what can be done to lower the power to the absolute minimum and still wake up on pin change and/or onConnect? The target is to only have to change batteries every few years.

After reading other posts and the Gazell protocol it seems that when RFduinoBLE.begin() is called the Gazell protocol polls every 20-40 mS to see if the host (phone) has a message for the slave. Does the following call set this polling interval RFduinoBLE_update_conn_interval? Yes, setting the RFduinoBLE_update_conn_interval worked and it is now just above 4 uA between polling.

Is it safe to call RFduinoBLE.end() to stop the polling until an pin wakeup event occurs and then turn it back on briefly to transmit the information?

With the rfduino loaded with the stock LedButton sketch, no shields connected, and the iPhone LedButton app running, the rfduino consumes about 260 uA. This isn't very low power relatively speaking. At this current draw, a 3V 2000 mAH lithium battery would last less than 1 year or ~320 days. A CR2032 coin cell battery would last about 1 month.

Pages: [1]