I nkow RFM's module IRQ pin is attached to D2 (INT0) on Moteinos. But how can I use it to wake up moteino when it receives signal? I tried attachinterrupt function, but I think it conflicts with RFM library...
Just put everything to sleep except the radio, leave it in RX mode. That will generate an interrupt on D2 and wake the Moteino, similar to how the MotionMote code wakes it.
Quote from: Felix on December 27, 2014, 10:02:37 PM
Just put everything to sleep except the radio, leave it in RX mode. That will generate an interrupt on D2 and wake the Moteino, similar to how the MotionMote code wakes it.
Ah I see! Thank you! :) I've been putting radio to sleep, cause it draws too much current...
Quote from: Felix on December 27, 2014, 10:02:37 PM
Just put everything to sleep except the radio, leave it in RX mode. That will generate an interrupt on D2 and wake the Moteino, similar to how the MotionMote code wakes it.
Is that the whole purpose of D2, to wake up the radio?
Not exactly, it is an interrupt from the radio to the host (atmega328). It could actually wake the mega, but not the radio.
I finally had chance to experiment, and it doesn't seem to be working :(
If I put AVR to sleep LowPower.powerDown(SLEEP_FOREVER, ADC_OFF, BOD_OFF);
It's never woken by RFM69...
If I attach interrupt to INT0, I think it conflicts with RFM69 library as everything freezes after first receipt of data...
attachInterrupt(0, myISR, RISING);
Does any have example code of this working? :)
You can't share interrupts, I think that is common sense. Use another interrupt, INT1 or something else.
Quote from: Felix on January 19, 2015, 02:35:53 PM
You can't share interrupts, I think that is common sense. Use another interrupt, INT1 or something else.
But RFM69 is hardwired to INT0 (D2) on Moteino... I wanted Radio to wake up AVR chip :)
So then what are you trying to by doing this:
attachInterrupt(0, myISR, RISING);
Quote from: Felix on January 19, 2015, 02:43:00 PM
So then what are you trying to by doing this:
attachInterrupt(0, myISR, RISING);
I figured I have nothing to lose and tried it just in case. As expected it didn't work... :P
So how do you wake up AVR with radio signal?
You have to leave the radio in RX mode (call receiveDone() before sleeping the mega).
Then sleep the mega chip and wait for the INT0 interrupt to trigger when the packet is received, simple as Pi.
Quote from: Felix on January 19, 2015, 09:36:55 PM
You have to leave the radio in RX mode (call receiveDone() before sleeping the mega).
Then sleep the mega chip and wait for the INT0 interrupt to trigger when the packet is received, simple as Pi.
Ah I see, i thought it was always in recieve mode. Thanks, I'll give it a go :)
Yes, and make sure you don't mix other interrupts with INT0!
It worked! Thanks again! :)
Although I didn't realize that since RFM69 uses a lot of current (15mA), power savings were so negligent...
If anyone interested here are 2 test sketches.