Author Topic: I2C and GZLL together?  (Read 2079 times)

abstractUser

  • RFduino Newbie
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
I2C and GZLL together?
« on: November 19, 2014, 05:00:34 PM »
I am experimenting with "Device->Host" communication using the GZLL library. I am also reading in data from I2C ADC.

1. Communicating with I2C ADC works well alone.
2. GZLL device->host works well alone.
3. When done together, I2C still works (I2C is at the device end), but the host does not receive any data. In fact host starts weird behavior immediately after the call to RFduinoGZLL.begin(role);

Before getting into the detail of the issue, has any one successfully tried GZLL and I2C together? It seems weird but does GZLL have any dependency on GPIO pins, apparently it doesn't seem that GZLL should depend on any GPIO pins. Just curious as I2C is running on the default pins 5,6.

Problem details:
The problem begins much earlier in the setup. Here's a snippet of the setup() function. Before calling RFduinoGZLL.begin(role), the Serial.println produces the correct output i.e. "Before begin()". But after the call, even the Serial.println only writes a partial string i.e. "Aft" and not "After begin()"


void setup()
{
 
  Serial.begin(9600);
  Serial.println("Before begin()") ;
 
  // start the GZLL stack 
  RFduinoGZLL.begin(role);
  Serial.println("After begin()") ;
}

Thanks for the help!!


lsnyman

  • RFduino Sr. Member
  • ****
  • Posts: 141
  • Karma: +1/-0
    • View Profile
Re: I2C and GZLL together?
« Reply #1 on: November 20, 2014, 09:02:04 PM »
I'm not an expert but am using GZLL and I2C together. There are a lot of issues related to GZLL so the way I dd it was to separate"normal functions including I2C and GZLL functions.
Meaning.....perform your I2C functions reading sensors etc then use a separate function to start the GZLL stack, send your data to HOST and STOP the GZLL stack.
Then resume your normal tasks.
\
Unfortunately, GZLL starts some weird internal process that increases the current draw of RFduino and doesn't stop.
Still waiting for a solution for this.

abstractUser

  • RFduino Newbie
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: I2C and GZLL together?
« Reply #2 on: November 21, 2014, 01:25:51 AM »
Thanks for your reply.

I was able to localize the problem in my case. For some strange reason GZLL does not work if you try to send a string that has been formed by concatenation of strings and integers through 'String' constructor. I know for sure that the string is being constructed as intended since I am printing it to Serial output, but somehow GZLL can't handle it.

If I send out my sensor data integer by integer things work fine. Earlier I was packaging data from all sensors into a single string which didn't work.

At this point I am not aware of any additional current drain with GZLL as I havent done any experiment to test it.

Also I'm starting GZLL only once in setup prior to starting I2C, and it works fine. I've to constantly send sensor data, so either way it wont be feasible to start GZLL after every sensor read, then stop it, and restart it upon next read.

tolson

  • Global Moderator
  • *****
  • Posts: 812
  • Karma: +19/-0
    • View Profile
    • Thomas Olson Consulting
Re: I2C and GZLL together?
« Reply #3 on: November 21, 2014, 03:06:09 PM »

I was able to localize the problem in my case. For some strange reason GZLL does not work if you try to send a string that has been formed by concatenation of strings and integers through 'String' constructor. I know for sure that the string is being constructed as intended since I am printing it to Serial output, but somehow GZLL can't handle it.

If I send out my sensor data integer by integer things work fine. Earlier I was packaging data from all sensors into a single string which didn't work.


Sending a structure you can mix integers, chars, floats, and small strings combined in one packet. It is also easier to decode the packet on the receiving end. What ever method you use, you do have to make sure  you do not exceed the maximum allowed packet size.
Here is an example of sending custom packet.

http://forum.rfduino.com/index.php?topic=509.msg3287#msg3287





abstractUser

  • RFduino Newbie
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: I2C and GZLL together?
« Reply #4 on: November 22, 2014, 12:14:15 AM »
Nice. Thank you.

Is the maximum allowable packet size for GZLL 32bytes?

 

anything