Home arrow Forum arrow Archived Forum
FreakLabs Forum
Welcome, Guest
Please Login or Register.    Lost Password?
Re:Problem with timing for chibiSleepRadio? (1 viewing) (1) Guest
Go to bottom Post Reply Favoured: 0
TOPIC: Re:Problem with timing for chibiSleepRadio?
#2678
Peter Loron (User)
Apprentice Freak
Posts: 7
graphgraph
User Offline Click here to see the profile of this user
Problem with timing for chibiSleepRadio? 3 Years, 12 Months ago Karma: 0  
While doing some initial poking around, I ran into a problem. Using the code below, if I make the wake up call [ chibiSleepRadio(false) ] and then immediately try to transmit, the board hangs. If I add a small delay like 500 microseconds, it works. Delaying for 100 microseconds was not enough.

If this is a general issue, perhaps the chibi library should block on waking up the radio for a bit to allow it to be functional? Maybe an internal "are you awake yet?" check?

Suggestions?

Thanks!

-Pete

[code]#include <chibi.h>
byte buf[1];
unsigned long time_begin;
unsigned long time_end;

void setup()
{
Serial.begin(57600);
randomSeed(analogRead(0));

// Init the chibi wireless stack
chibiInit();
chibiSetChannel(20);
}

void loop()
{
//pick a random number of flashes
buf[0] = random(9) + 1;

time_begin = micros();
chibiSleepRadio(false);
delayMicroseconds(500);
chibiTx(BROADCAST_ADDR, buf, sizeof(buf));
chibiSleepRadio(true);
time_end = micros();hile doing some initial poking around, I ran into a problem. Using the code below, if I make the wake up call [ chibiSleepRadio(false) ] and then immediately try to transmit, the board hangs. If I add a small delay like 500 microseconds, it works. Delaying for 100 microseconds was not enough.

If this is a general issue, perhaps the chibi library should block on waking up the radio for a bit to allow it to be functional? Maybe an internal "are you awake yet?" check?

Suggestions?

Thanks!

-Pete

Code:

#include <chibi.h> byte buf[1]; unsigned long time_begin; unsigned long time_end; void setup() { Serial.begin(57600); randomSeed(analogRead(0)); // Init the chibi wireless stack chibiInit(); chibiSetChannel(20); } void loop() { //pick a random number of flashes buf[0] = random(9) + 1; time_begin = micros(); chibiSleepRadio(false); delayMicroseconds(500); chibiTx(BROADCAST_ADDR, buf, sizeof(buf)); chibiSleepRadio(true); time_end = micros(); Serial.println(time_end - time_begin); // delay between transmissions delay(5000); }
 
Report to moderator   Logged Logged  
 
Last Edit: 2010/12/25 04:36 By peterloron.
  The administrator has disabled public write access.
#2679
Akiba (Admin)
Admin
Posts: 1245
graph
User Online Now Click here to see the profile of this user
Re:Problem with timing for chibiSleepRadio? 3 Years, 12 Months ago Karma: 25  
Yeah, just checked the datasheet and there needs to be a delay of approximately 1 msec from sleep to transmitting due to the PLL locking time. When I was testing, it seems like I didn't do an immediate transmission on wakeup. I'll add a blocking statement into the library for the required time. I should be doing a release soon since I've made some other changes as well.
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
Go to top Post Reply
get the latest posts directly to your desktop