Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Troubleshooting
  3. define MY_RF69_IRQ_PIN has no affect

define MY_RF69_IRQ_PIN has no affect

Scheduled Pinned Locked Moved Troubleshooting
3 Posts 2 Posters 1.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • korttomaK Offline
    korttomaK Offline
    korttoma
    Hero Member
    wrote on last edited by korttoma
    #1
    #define MY_RF69_IRQ_PIN 4
    

    Does not seem to work for RFM69 nodes or Serial GW based on ATmega328.

    Adding IRQ pin definition to a sketch for a RFM69 node or the serial GW does not seem to have any affect. I still have to have DIO0 connected to pin 2 for the node to communicate at all.

    Is this because it has to be connected to an interrupt pin and for a ATmega328 it is hard coded to be pin 2?

    Here is a comment I found from the RFM69.h file:

    // INT0 on AVRs should be connected to RFM69's DIO0 (ex on ATmega328 it's D2, on ATmega644/1284 it's D2)
    

    Hare is an example of a sketch where I need to move the IRQ pin to some other pin because I need both interrupt pins for something else (do I need to get some other MCU for the job? Or should I just use NRF24 instead).

    //
    //
    // Enable debug prints to serial monitor
    #define MY_DEBUG
    #define MY_BAUD_RATE 9600
    
    //#define MY_RADIO_NRF24
    #define MY_RF69_IRQ_PIN 4
    #define MY_RFM69_FREQUENCY RF69_433MHZ
    #define MY_RADIO_RFM69
    
    
    #define MY_NODE_ID 101
    #define SN "Wiegand"
    #define SV "1.0"
    
    #include <MySensors.h>
    #include <MyConfig.h>
    #include <SPI.h>
    #include <Wiegand.h>
    
    #define ID 1
    
    MyMessage msg(ID, S_CUSTOM);
    
    #define pinD0 2
    #define pinD1 3
    
    WIEGAND wg;
    
    void setup() {
      //Serial.begin(9600);
    
      sendSketchInfo("Wiegand", "1.0");
      present(ID, S_CUSTOM);
      //wg.begin(3,1,4,2);
      wg.begin(pinD0, digitalPinToInterrupt(pinD0), pinD1, digitalPinToInterrupt(pinD1));
    }
    
    void loop() {
      if (wg.available())
      {
        Serial.print("Wiegand HEX = ");
        Serial.print(wg.getCode(), HEX);
        Serial.print(", DECIMAL = ");
        Serial.print(wg.getCode());
        Serial.print(", Type W");
        Serial.println(wg.getWiegandType());
        send(msg.set(wg.getCode()));
      }
    }
    
    • Tomas
    1 Reply Last reply
    0
    • scalzS Offline
      scalzS Offline
      scalz
      Hardware Contributor
      wrote on last edited by scalz
      #2

      @korttoma
      for 328p, only d2 and d3 pin INTs are well handled as hardware int by Arduino. unfortunately the pin change int is not so friendly to use compared to these. that's why you often see d3/d3 as the ultimate int pins! but there are more, but not handled yet by Mys, nor lowpowerlab lib as you can see.
      That said, this means that even if you change for nrf, that will be the same, no d4 available.

      Finally, if you want to use the well known d3 for you radio int :

      you need to do this in your sketch:

      #define MY_RF69_IRQ_PIN  3   // Arduino pin
      #define MY_RF69_IRQ_NUM  1  // IRQ number
      
      1 Reply Last reply
      0
      • korttomaK Offline
        korttomaK Offline
        korttoma
        Hero Member
        wrote on last edited by
        #3

        Thanks for you answer @scalz but changing from 2 to 3 will not help me because the Wiegand library uses both 2 and 3 interrupt pins and I don't think it can be changed either. Seems like my only remaining solution for this node is to use a gateway without radio attached or an MCU with more then 2 interrupt pins available.

        • Tomas
        1 Reply Last reply
        1
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        23

        Online

        11.7k

        Users

        11.2k

        Topics

        113.1k

        Posts


        Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • MySensors
        • OpenHardware.io
        • Categories
        • Recent
        • Tags
        • Popular