RFM69: Wireing DIO0
I am currently laying out a first project with an RFM69. The manual suggests to connect DIO0 to D2, while for the NRF24L01, the additional "non SPI" port is connected to D9. Is there any reason to this? I would prefer keeping all the radio pins on port B, such that I have port A free for interrupts. Would this have any disadvantages except for the necessity to explicitly define the port in the sketch?
What is the purpose of DIO0 anyway? If I set an interrupt on port D (PCINT2_vect) in a deep sleep setup, would I have to expect any issues with DIO0 on there, too?
@elcaron I don't understand most of what you are writing, but the DIO0is used for irq and can be moved with the following defines:
#define MY_RF69_IRQ_PIN D1 #define MY_RF69_IRQ_NUM MY_RF69_IRQ_PIN
Hope this is useful. I got the defines from https://www.mysensors.org/build/connect_radio
Which manual are you referring to?
Yes, I was referring to that page. If it is used as an interrupt, then moving it to another pin other than D2 or D3 on an ATMEGA328 is not a good idea, because only those can be used as interrupts (https://www.arduino.cc/en/Reference/attachInterrupt).
In which situation is this used? Is it additional functionality that isn't available on the NRF24 (where IRQ isn't implemented, according to above mentioned page), or is it needed for normal operations?
I am working on a keyfob that is supposed to wake up on key presses on PCINT2_vect, which is D0-D7. It is supposed to be deep sleeping the rest of the time.
@elcaron I think the rfm sends an interrupt when a packet has been sent. Without dio0 connected, the radio driver waits forever, at least in my (limited) experience.
@mfalkvidd Thanks, that is what I feared. Then as far as I understand, it would be a really bad idea to move it away from D2, at least not to anything else than D3. But i guess when the ATMEGA is sleeping, the RFM69 will also be deep asleep, so there is nothing to expect from it to trigger PCINT2_vect. And D3-D7 on the same port is just enough for my 5-button keyfob, so I'll connect it to D2.
DavidZH last edited by DavidZH
If I recall correctly, the RFM is capable of a "listen mode" where the power requirements are very low, and the MCU is in sleep mode. When a message arrives, the RFM can wake the MCU with an interrupt DIO0 to process it further.
For now, the MySensors library does not support this listen mode yet, but I know it is in the works for a future release.
To be clear (to anyone else reading this thread, @DavidZH probably knows this already), the "listen mode" actually switches the radio between receive (16mA power consumption, messages can be received) and idle (1.2uA power consumption, messages can not be received) with configurable intervals, without requiring the mcu to be awake. As DavidZH says, the radio module can then wake up the mcu when a message is received.
Since the radio will be sleeping most of the time, any sender must re-send continuously for an interval that is longer than the receiving node's idle time.
Some details, including battery time calculations:
RFm69 irq is needed by the driver in RX mode, sure, but not only. It is used in different mode, TX send for example. So IRQ signal need to be wired.