Author Topic: Using ListenMode as Wakeup timer  (Read 18320 times)

joelucid

  • Hero Member
  • *****
  • Posts: 869
Re: Using ListenMode as Wakeup timer
« Reply #30 on: September 29, 2015, 11:47:07 AM »
Quote
That's a bug in the RFM69, right?

I don't think so. The listen mode graphic in the datasheet shows that RX is first, followed by IDLE. In my view that also makes sense - I want to specify the duty cycle not a delay.

Quote
And if it works, there are no other tricks/circumventions needed.

You'll certainly also get two interrupts if it works.

kobuki

  • Sr. Member
  • ****
  • Posts: 282
Re: Using ListenMode as Wakeup timer
« Reply #31 on: September 29, 2015, 12:15:44 PM »
@Kobuki There's no waiting for a byte.  The RSSI is remapped to DIO0, and is thus directly connected to D2.  As soon as RSSI goes HIGH (which you would expect to be immediately given the deliberately oversensitive settings), the ATMEGA328P is woken up.  What could be faster than that? [ Sorry in advance for jumping in if you were referring to something else.]

Yeah, I know how it works. But I think in order to get around the bogus interrupt, we'd need to busy-wait it and only then enter power down mode - or find another mode of the RFM69 that's somehow not issuing bogus interrupts. IF the bogus int. is somehow triggered at the end of the first RX period, then it's certainly not a solution, since the RX period can be as long as 260 ms. (Yes, it's only baseless assumption without further testing.) And why I think busy-waiting would be better than simply entering powerdown multiple times is that it might be better for the coin cell, not dragging it up and down in a very short period. Plus, the multiple startups might take more power than waiting for a few dozen micros fully powered. And IF we busy-wait, we can try other solutions that take the same amount of cycles but are guaranteed to work without furher tricks.

To make sense of these assumptions, a good uA-meter would be required and a good DSO, neither of which I possess right now.

kobuki

  • Sr. Member
  • ****
  • Posts: 282
Re: Using ListenMode as Wakeup timer
« Reply #32 on: September 29, 2015, 12:24:14 PM »
Quote
That's a bug in the RFM69, right?

I don't think so. The listen mode graphic in the datasheet shows that RX is first, followed by IDLE. In my view that also makes sense - I want to specify the duty cycle not a delay.

Quote
And if it works, there are no other tricks/circumventions needed.

You'll certainly also get two interrupts if it works.

The associated drawings are a bit controversial (there are multiple ones), and it's not explicitly stated what starts the listen mode duty cycle. I tend to seek explicit statements in a technical document... But of course, your idea is very reasonable and supported by your experience. Based on that, 2 ints would be just fine. But we don't know why the 3rd one comes and exactly when. I'll also test it out later.

kobuki

  • Sr. Member
  • ****
  • Posts: 282
Re: Using ListenMode as Wakeup timer
« Reply #33 on: October 11, 2015, 03:45:05 PM »
@Joe: did you bring the idea any further in the meantime? Unfortunately I didn't have the time.

A little offtopic, but is your Tino project progressing, generally? It's been a long time you reported something :)

joelucid

  • Hero Member
  • *****
  • Posts: 869
Re: Using ListenMode as Wakeup timer
« Reply #34 on: October 12, 2015, 07:11:56 AM »
Kobuki, further than working code?  :)

kobuki

  • Sr. Member
  • ****
  • Posts: 282
Re: Using ListenMode as Wakeup timer
« Reply #35 on: October 12, 2015, 07:36:09 AM »
Kobuki, further than working code?  :)

Sorry, I don't understand your question.

I was meaning to ask if you've made perhaps a configurable lib based on this idea for periodic wakeups, integrated the idea in your Tino succesfully and it's under testing, things like that. Since you haven't written anything about this cool little thing.

Did it help you in clarifying my original question?

EDIT: oh, and if you maybe found a solution to the multiple wake-up triggers solution.

joelucid

  • Hero Member
  • *****
  • Posts: 869
Re: Using ListenMode as Wakeup timer
« Reply #36 on: October 12, 2015, 09:09:42 AM »
Quote
I was meaning to ask if you've made perhaps a configurable lib based on this idea for periodic wakeups, integrated the idea in your Tino succesfully and it's under testing, things like that. Since you haven't written anything about this cool little thing.

Yeah I had posted the code and it worked. I had it running on a Tino for some time. Haven't done much more than that though.

Rg Tino I'm still thinking about it. I've assembled a few and it's a pain. I think it would be best to start a Kickstarter campaign, see if one can get more than say 1k orders and then have them professionally assembled in China. I've been pretty busy with other stuff though so really not much progress recently.

WhiteHare

  • Hero Member
  • *****
  • Posts: 1297
  • Country: us
Re: Using ListenMode as Wakeup timer
« Reply #37 on: November 18, 2016, 11:02:17 AM »
There may be an alternative to the OP that will get the same desired result.  The notion is this: From standby mode, map DIO0 to PlllLock prior to entering ListenMode.  Also, instead of setting the Rssi Threshhold low, set it maximally high.  Because PllLock will go high just once prior to entering RxMode, then by definition, you should receive an interrupt on DIO0 once every period of (TlistenRx + TlistenIdle).

WhiteHare

  • Hero Member
  • *****
  • Posts: 1297
  • Country: us
Re: Using ListenMode as Wakeup timer
« Reply #38 on: January 27, 2017, 12:45:07 PM »
Just an unvetted idea (and this may be going overboard), but if one mapped DIO0 to ModeReady after the RFM69 enters into Stdby mode, as it of course does periodically while in Listen Mode, then DIO0 should go low the instant Stdby mode is left in order to transition into PllLock mode.  So, if one used that as the trigger to wake the atmega328p (which takes ~4uSec), which then immediately reset the RFM69, then perhaps one could avoid expending the energy that would otherwise be consumed in the PllLock phase plus the minimum 64uSec of Rx phase.

[Edit: It would, of course, require access to the RST pin on the RFM69, but that could be bodged on.]
« Last Edit: January 27, 2017, 02:27:57 PM by WhiteHare »

joelucid

  • Hero Member
  • *****
  • Posts: 869
Re: Using ListenMode as Wakeup timer
« Reply #39 on: January 27, 2017, 02:29:59 PM »
Quote
if one mapped DIO0 to ModeReady

You can't. ModeReady is only supported on DIO5 and DIO4. Other than that it's worth a try. BTW, I've found that if you have the RSSIThresh on 0 (never can be triggered) you can safely abort listen mode the instant PLLLock triggers. No need to wait through the entire RX period.

I haven't tried it, but I bet you could also set the RX period so short that it merely covers the time until PLLLock.

Joe

WhiteHare

  • Hero Member
  • *****
  • Posts: 1297
  • Country: us
Re: Using ListenMode as Wakeup timer
« Reply #40 on: January 27, 2017, 04:34:43 PM »
You can't.

Good catch, and thanks for pointing that out.  By accident, I looked at Table 21 instead of Table 22.   ::)

Oh well, make that two bodge wires then instead of only one bodge wire.

Also, that's good info wrt setting RSSIThresh to 0.  With RSSIThresh on 0, maybe Listen Mode can be aborted even  before  PLLLock triggers?  I'm guessing that would be faster than  resetting the entire RFM69.

I'll give it a try.

WhiteHare

  • Hero Member
  • *****
  • Posts: 1297
  • Country: us
Re: Using ListenMode as Wakeup timer
« Reply #41 on: January 29, 2017, 01:26:11 AM »
Well, from the looks of Figures 18, 19, and 21, if it's possible to abort immediately after PLLLock, and  if the figures are drawn more or less to scale (?), then most of the benefit will already be accrued by that alone.  The comparatively little time and energy that will be wasted is just a function of TS_OSC, which the datasheet defines as follows:
Quote
"The crystal oscillator wake-up time, TS_OSC, is directly related to the time for the crystal oscillator to reach its steady state. It depends notably on the crystal characteristics."
« Last Edit: January 29, 2017, 01:31:43 AM by WhiteHare »

WhiteHare

  • Hero Member
  • *****
  • Posts: 1297
  • Country: us
Re: Using ListenMode as Wakeup timer
« Reply #42 on: January 30, 2017, 12:32:24 PM »
I programmed an 8Mhz Moteino to turn-on a pin when Frequency Synthesis starts and another pin when PllLock goes high.  I did this by just having the Moteino read the RFM69 register values, so it's not as accurate as a fully DIO mapped setup, but I expect it's reasonably close enough as a first experiment.  Hooking those two pins to an oscilliscope (see attached scope shot) suggests that the length of time from the onset of Frequency Synthesis until PllLock is about 65uSec.  It is that time interval of wasted energy that the above idea would be targeting.

WhiteHare

  • Hero Member
  • *****
  • Posts: 1297
  • Country: us
Re: Using ListenMode as Wakeup timer
« Reply #43 on: January 30, 2017, 01:29:52 PM »
If I set ListenCoefRx=1 and ListenResolRx=64uSec, then (see attached) Frequency Synthesis seems to run for about 128uSec before turning off.

WhiteHare

  • Hero Member
  • *****
  • Posts: 1297
  • Country: us
Re: Using ListenMode as Wakeup timer
« Reply #44 on: January 30, 2017, 01:43:54 PM »
For completeness, I also tried setting ListenCoefRx=0, just to see what that would do.  See attached scope shot.  It doesn't appear to be useful.