Author Topic: RFduinoGZLL_onReceive never called  (Read 2269 times)

Per

  • RFduino Newbie
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
RFduinoGZLL_onReceive never called
« on: April 30, 2016, 03:13:15 AM »
Hello,
I'm a newbie to RFduino and trying a very simple device/host communication using the Gazelle stack.
The device is a RFD22301 stand-alone powered from a CR2032 battery, and the host is RFD22102/RFD22121 (USB) connected to the laptop.

Common code:
Code: [Select]
#include <RFduinoGZLL.h>
#include <RFduinoBLE.h>
#define ULP_TIME_OUT  (SECONDS(1))
unsigned char counter = 0;
void setup()
{
  RFduinoGZLL.txPowerLevel = 0;
  (void)RFduinoGZLL.begin(role);
  Serial.begin(9600);
}

Device code:
Code: [Select]
device_t role = DEVICE0;
void loop()
{
  RFduino_ULPDelay(ULP_TIME_OUT);
  (void)RFduinoGZLL.sendToHost((char *)&counter, sizeof(counter));
  Serial.printf("%d\n", counter);
  counter++;
}

Host code:
Code: [Select]
device_t role = HOST;
void loop()
{
  RFduino_ULPDelay(ULP_TIME_OUT);
  Serial.printf("%d\n", counter);
}
void RFduinoGZLL_onReceive(device_t device, int rssi, char *data, int len)
{
  counter = (unsigned char)data[0];
}

The problem is that the callback function RFduinoGZLL_onReceive on the host is never called.  :-\

The device seems to be working when programmed via the RFD22121 (USB). Then it's detached from the programmer and connected to the battery.

Please give me some advise on testing and/or coding examples.

Best regards, Per

Note: I'm using Arduino 1.6.5 on a MacBook Air (OS X 10.9.5) and RFduino library version 2.3.1.


tolson

  • Global Moderator
  • *****
  • Posts: 866
  • Karma: +20/-0
    • View Profile
    • Thomas Olson Consulting
Re: RFduinoGZLL_onReceive never called
« Reply #1 on: April 30, 2016, 11:38:37 PM »
Quote
Please give me some advise on testing and/or coding examples.
Have you tried the Gazell examples in the IDE?

Per

  • RFduino Newbie
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: RFduinoGZLL_onReceive never called
« Reply #2 on: May 01, 2016, 01:58:27 AM »
Yes, I've tried the Gazelle examples but those don't work neither.
When I'm using the device in BLE mode sending data to an IOS unit, it works like a dream.
But something seems to be wrong when I'm trying to use the Gazelle stack.  :(


tolson

  • Global Moderator
  • *****
  • Posts: 866
  • Karma: +20/-0
    • View Profile
    • Thomas Olson Consulting
Re: RFduinoGZLL_onReceive never called
« Reply #3 on: May 01, 2016, 07:54:16 AM »
The examples should just work. But, on your code, why are you putting (void) in front of the calls .
(void)RFduinoGZLL.begin(role);
(void)RFduinoGZLL.sendToHost((char *)&counter, sizeof(counter));
 Do not do that.
« Last Edit: May 01, 2016, 08:02:04 AM by tolson »

Per

  • RFduino Newbie
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: RFduinoGZLL_onReceive never called
« Reply #4 on: May 03, 2016, 04:38:04 AM »
While testing, the "(void)" just reminds me that these functions actually returns values that might be useful information.
I removed them, and also removed the RFduino_ULPDelay(ULP_TIME_OUT) in case mixing Gazelle and BLE is the problem here.
It didn't help...

Maybe, a clean installation on a Windows computer with latest Arduino version is the solution...


tolson

  • Global Moderator
  • *****
  • Posts: 866
  • Karma: +20/-0
    • View Profile
    • Thomas Olson Consulting
Re: RFduinoGZLL_onReceive never called
« Reply #5 on: May 03, 2016, 10:36:34 AM »
While testing, the "(void)" just reminds me that these functions actually returns values that might be useful information.
I removed them, and also removed the RFduino_ULPDelay(ULP_TIME_OUT) in case mixing Gazelle and BLE is the problem here.
It didn't help...

Maybe, a clean installation on a Windows computer with latest Arduino version is the solution...

Putting "(void)" in front of a variable or call return is a cast and makes the value returned void. So then whatever value would have been returned is not returned. So if something else is expecting a valid value returned it won't get it.


Per

  • RFduino Newbie
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: RFduinoGZLL_onReceive never called
« Reply #6 on: May 04, 2016, 11:08:30 AM »
Thank you, tolson.

I'm totally stuck on this.
I will abandon Mac OS and get my hands on a Windows laptop.

If that doesn't work then the RFduino has to be defect. :'(

mark_pdx

  • RFduino Newbie
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Re: RFduinoGZLL_onReceive never called
« Reply #7 on: May 05, 2016, 05:40:52 PM »
Neither Gazelle nor SimbleeCOM examples are working for me either on my Simblee's. Never have seen a packet received.

ralf12

  • RFduino Newbie
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: RFduinoGZLL_onReceive never called
« Reply #8 on: June 02, 2016, 10:41:38 AM »
recognised the same problem, no receive while in ULP,
for me, this workaround does. ;D

void loop()
{
  RFduinoGZLL.end();
  RFduino_ULPDelay(500); // 500 milliseconds
  RFduinoGZLL.begin(role);
  delay(50);
}

 

anything