Author Topic: RFduino GZLL Protocol for RFduino to RFduino Communication  (Read 26750 times)

mkay

  • RFduino Team
  • *****
  • Posts: 405
  • Karma: +15/-0
    • View Profile
RFduino GZLL Protocol for RFduino to RFduino Communication
« on: February 04, 2014, 12:35:23 PM »
RFduino GZLL Protocol for RFduino to RFduino Communication

<a href="http://www.youtube.com/v/QcQ6KxWVG20" target="_blank" class="new_win">http://www.youtube.com/v/QcQ6KxWVG20</a>

We have added support for RFduino to RFduino communication using the GZLL protocol in our v1.7 release of RFduino. You can download the latest distribution here:
http://www.rfduino.com/download.html or https://github.com/RFduino/RFduino

There are a number of RFduino GZLL examples included for:
Device to Host
Host to Device
Device to Device
GZLL to BLE

tomega3

  • RFduino Newbie
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: RFduino GZLL Protocol for RFduino to RFduino Communication
« Reply #1 on: February 05, 2014, 10:50:41 AM »
This is Great news. This feature is why I backed the kickstarter project.
From the video it appears I can replace my arduino mega 2560 and xbees now with the rfduino and its bt radio.

Questions:
1. can I designate one Device as a Master Device to communicate with a Host where the Host can relay/rout commands from the Master Device to the other non master devices?

2. can the other non master devices signal the Master Device by sending info to the Host for the Host to send it to the Master Device without the Master Device polling the Host?

Thanks

Timmmm

  • RFduino Jr. Member
  • **
  • Posts: 43
  • Karma: +3/-0
    • View Profile
Re: RFduino GZLL Protocol for RFduino to RFduino Communication
« Reply #2 on: February 10, 2014, 06:48:39 AM »
Great news. For those wondering (i.e. all of us):

GZLL is the "Gazell Link Layer".

Information on it here: https://devzone.nordicsemi.com/documentation/nrf51/4.3.0/html/group__gzll__02__user__guide.html

  • 1 host connects to up to 8 slaves in a star topology.
  • Host must be "always on" (i.e. draws lots of power). Slaves are power-efficient.
  • Host always listens, slave initiates connection
  • Packets sent by slave contain data. They are acked by the host with packets that can also contain data, giving 2-way communication.
  • A host has to wait for a packet from a slave before it can send data to it.
  • One slave can talk to several hosts and devices can switch between host and slave, enabling more complicated networks.
  • Encryption and pairing is performed with pre-shared keys

All looks pretty good. My only doubt is about they requirement for the slave to initiate all communication. What if I want to implement something like a Gazell-controlled light?

Edit: I watched the (very informative) video, and it seems like the slave needs to poll the master, which seems like it would be pretty energy inefficient. Is the same true for BLE?
« Last Edit: February 10, 2014, 06:54:05 AM by Timmmm »

Timmmm

  • RFduino Jr. Member
  • **
  • Posts: 43
  • Karma: +3/-0
    • View Profile
Re: RFduino GZLL Protocol for RFduino to RFduino Communication
« Reply #3 on: February 10, 2014, 08:26:00 AM »
Also, how does one change the network details? The Gazell docs seem to say devices can connect to more than one host - presumably there is some kind of "network address" somewhere but I can't see anywhere to set it in the RFduino code.

ap

  • RFduino Newbie
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Re: RFduino GZLL Protocol for RFduino to RFduino Communication
« Reply #4 on: March 18, 2014, 04:48:04 AM »
Also, how does one change the network details? The Gazell docs seem to say devices can connect to more than one host - presumably there is some kind of "network address" somewhere but I can't see anywhere to set it in the RFduino code.

This I would also like to know

mkay

  • RFduino Team
  • *****
  • Posts: 405
  • Karma: +15/-0
    • View Profile
Re: RFduino GZLL Protocol for RFduino to RFduino Communication
« Reply #5 on: March 19, 2014, 11:21:12 AM »
If you have access to the Nordic SDK, you can use the RFduino GZLL library source code that is provided to rebuild the library. There is a file in the SDK called nrf_gzll_constants.h which contains some radio settings which you can change.

waynek

  • RFduino Newbie
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
    • Cannybots
Re: RFduino GZLL Protocol for RFduino to RFduino Communication
« Reply #6 on: June 08, 2014, 04:25:23 AM »
 I have the SDK but until now I've never looked at GZLL or the source; for those that don't have access and just for ease of use wouldn't this be the way to go:

RFduinoGZLL.begin(role, hostAddress);

or if it has to be a compiule time constant the perhaps supply a number of precompiled libraries (say 8), each with different baked in addresses, that the user would simply have to rename by hand.

all the best
Wayne

floor

  • RFduino Newbie
  • *
  • Posts: 9
  • Karma: +0/-0
    • View Profile
Re: RFduino GZLL Protocol for RFduino to RFduino Communication
« Reply #7 on: July 06, 2014, 11:12:39 AM »
hi @mkay,

I also have the SDK, but I am a complete noob on this.

Only thing I would want is put the gzll date rate to 250kb. How do I do that in Keil?

Do I start a new project with rfduinogzl lib and included files and than build a new file? Sorry for asking this, but maybe there is a small tutorial or something how to do this? It does not seem to complicated but there are a lot of settings in Keil and having no experience in this isn't very helpfull.

Hope someone can walk me through this or maybe create a setting for date rate just like tx level so you can choose later?

Thanks in advance

waynek

  • RFduino Newbie
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
    • Cannybots
Re: RFduino GZLL Protocol for RFduino to RFduino Communication
« Reply #8 on: August 19, 2014, 01:30:53 AM »
If you have access to the Nordic SDK, you can use the RFduino GZLL library source code that is provided to rebuild the library. There is a file in the SDK called nrf_gzll_constants.h which contains some radio settings which you can change.

Hi,

In order to change the host or device base address a nordic API called is required.
I have created, and am currently testing, a modified libRFDuinoGZLL.[h|c] and RFduinoGZLL.[h|cpp] library where you can set the host and device addresses before starting GZLL, e.g.:

  RFduinoGZLL.hostBaseAddress=0x0D0A0704;
  RFduinoGZLL.deviceBaseAddress=0x0E0B0805;
  int status = RFduinoGZLL.begin(role);

Doing similar for the datarate would be a trivial task.   (He says, never having peeked this far into GZLL documentation before or written GZLL code...)
It would be good to see this in the official RFduino SDK.

PLease find the current modifications attached.
All the best
Wayne


joshuajnoble

  • RFduino Newbie
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Re: RFduino GZLL Protocol for RFduino to RFduino Communication
« Reply #9 on: September 20, 2014, 09:31:00 AM »
Where are you getting that hardware ID from? Can you set that to a custom ID with RFduinoBLE_custom_uuid?

waynek

  • RFduino Newbie
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
    • Cannybots
Re: RFduino GZLL Protocol for RFduino to RFduino Communication
« Reply #10 on: September 20, 2014, 10:44:38 AM »
Hi,

It's not related to BLE, it's for gazelle mode only.
They are just two 32bit numbers used as Gzll host/device logical addresses, think IP address

The values you see in my post are just the defaults Nordic define in the header, and so are what the any RFDuino sketches using the current in modified RFd SDK will use.

Being able to set just the hostBaseAddress on a 'host' and a 'device' to be the same allows you to have multiple rfduino hosts in the same room when you want multiple hosts/device groups.


joshuajnoble

  • RFduino Newbie
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Re: RFduino GZLL Protocol for RFduino to RFduino Communication
« Reply #11 on: September 21, 2014, 08:04:40 PM »
Excellent, thanks for all your hard work!
« Last Edit: September 21, 2014, 08:09:49 PM by joshuajnoble »

DasBasti

  • RFduino Newbie
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: RFduino GZLL Protocol for RFduino to RFduino Communication
« Reply #12 on: October 15, 2014, 11:43:58 PM »
Hi,

In order to change the host or device base address a nordic API called is required.
I have created, and am currently testing, a modified libRFDuinoGZLL.[h|c] and RFduinoGZLL.[h|cpp] library where you can set the host and device addresses before starting GZLL, e.g.:

  RFduinoGZLL.hostBaseAddress=0x0D0A0704;
  RFduinoGZLL.deviceBaseAddress=0x0E0B0805;
  int status = RFduinoGZLL.begin(role);

Doing similar for the datarate would be a trivial task.   (He says, never having peeked this far into GZLL documentation before or written GZLL code...)
It would be good to see this in the official RFduino SDK.

PLease find the current modifications attached.
All the best
Wayne

changing the files in the corresponding arduino folders does cause an error for me. RFduinoGZLL_host_base_address is undefined

waynek

  • RFduino Newbie
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
    • Cannybots
Re: RFduino GZLL Protocol for RFduino to RFduino Communication
« Reply #13 on: October 16, 2014, 12:51:29 AM »
copy these files from the 'libRFduinoGZLL' folder:

libRFduinoGZLL.h libRFduinoGZLL.a

to: .../hardware/arduino/RFduino/variants/RFduino/

overwriting whats there already.

NielsQ

  • RFduino Newbie
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: RFduino GZLL Protocol for RFduino to RFduino Communication
« Reply #14 on: December 14, 2014, 06:30:51 PM »
I'm running a GZLL network with two devices and one host. Each of the two devices can be triggered with multiple sensors, allowing them to send data to the host who collects and processes the information and sends it back to the devices. It appears that when multiple sensors of one device are triggered at the same time, my Serial.print freezes and I have to restart the devices. I have temporarily fixed this by setting data variables after the sensors are triggered, and when these variables change, the loop() picks these up and sends them through to the host. As a result, only one sendTouchToHost() is called per loop, resolving the issue. But now I will have to build a buffer for the multiple values to get send sequentially, but I was hoping that the RFDuino would take care of this issue automatically. Any advice?

EDIT: the same seems to be happening at the host's end. As soon as two value's from two different devices are received at the same time, it seems to stop working. As the RFduinoGZLL_onReceive() is what it is, I can't make a buffer for it like I did with sending the variables. Here is the code of the host and the send function of the devices:

Code: [Select]
#include <RFduinoBLE.h>
#include <RFduinoGZLL.h>
device_t role = HOST;//DEVICE# or HOST

void setup() {
  Serial.begin(9600);
  RFduinoGZLL.begin(role);
}

void loop(){
  //
}

void RFduinoGZLL_onReceive(device_t device, int rssi, char *data, int len){
  if(len > 1){
    int pinNr = data[0]-1;
    int state = data[1]-1;
    Serial.print("Device ");
    Serial.print(device);
    Serial.print("'s light number ");
    Serial.print(pinNr);
    Serial.print(" is turned to ");
    Serial.println(state);
  }
}

Data send functon in the devices:
Code: [Select]
void sendToHost(int _pinNr, int _value){
  char test[2];
  test[0] = _pinNr+1;
  test[1] = _value+1;
  RFduinoGZLL.sendToHost(test);
}
« Last Edit: December 14, 2014, 06:53:28 PM by NielsQ »