Difficulty with the interrupt pin on the Nano V3 Ethernet Shield - W5500 (V2)

I have setup a TCP/IP connection between my desktop computer and an Arduino Nano Every over my home network. The Nano Every is using the Nano V3 Ethernet Shield - W5500 (V2) to connect to my home network.

I am able to send information from my desktop to the Nano Every, and from the Nano Every to my desktop. I would like to put the Nano Every into Power-Down Sleep mode and then wake it upon receiving a certain message (in this case the character ‘w’).

The problem is that I cannot seem to detect the interrupt when a message is sent from my desktop to the Nano Every. The I/O diagram (found on the website above under the ‘Documents’ tab) of the Nano V3 Ethernet Shield - W5500 (V2) states that the interrupt pin is pin 8 (it doesn’t say anything about when the interrupt is triggered, I am just assuming it would be upon receiving data). Furthermore, on the back of the ethernet shield you can solder a connection between INT and D8. I have tried my experiment without the connection, and with the connection, as shown in the images below, yet neither time I was able to pick up the interrupt when receiving data on the Nano Every. I tried all the interrupt modes (LOW, CHANGE, RISING, FALLING) but still could not pick up the interrupt.

I looked into the chip on the ethernet shield, the Wiznet W5500. The datasheet states that the chip “Supports Wake on LAN over UDP”. Does this mean that interrupts on the D8 pin will only be triggered if the protocol being used between my desktop and the Nano Every is UDP? Would there be a way to make this work with TCP?

Images:

Code for the Desktop Server (Python)

from twisted.internet import reactor, protocol
from twisted.internet.endpoints import TCP4ServerEndpoint

PORT_NUM = 8002

class ClientProtocol(protocol.Protocol):
    
    initial_communication = True

    def dataReceived(self, data):
        """ Print the data received from the client. """

        if self.initial_communication:
            self.initial_communication = False

            print("[i] Client connected")
            print("[i] Data received from client: {}".format(data))

            # Provide the factory with access to this client
            self.factory.microcontroller_client = self
            self.factory.message_client()

        else:
            print("[i] Data received from client: {}".format(data))
            
    def connectionLost(self, reason):
        """ Called when the connection with the client is shut down. """
        
        print("[i] Connection with client lost")


class ClientFactory(protocol.Factory):

    microcontroller_client = None

    def buildProtocol(self, addr):
        """ Constructs and returns an instance of the client protocol for communication with the clients. """

        # Return protocol for communicating with clients
        p = ClientProtocol()
        p.factory = self
        return p

    def message_after_delay(self, msg):
        if self.microcontroller_client is not None:
            self.microcontroller_client.transport.write(msg.encode("ascii"))

    def message_client(self):

        # Message the client to sleep
        if self.microcontroller_client is not None:
            self.microcontroller_client.transport.write('s'.encode("ascii"))

        # Message the client to wake up
        reactor.callLater(4, self.message_after_delay, msg='w')

        # Message the client the 'final' message
        reactor.callLater(8, self.message_after_delay, msg='f')


if __name__ == "__main__":

    # Start server and begin listening for display clients (using TCP/IP).
    print("[i] Server starting")
    endpoint = TCP4ServerEndpoint(reactor, PORT_NUM, interface="192.168.1.13")
    endpoint.listen(ClientFactory())
    reactor.run()

Code for the Arduino Client

The Boolean “interrupt_occured” is never set to true in the following code.

/* Nano V3 Ethernet Shield (W5500) Ethernet Interrupt Pin Check
 * 
 * Filename: ethernet_int_check.ino
 * Microcontroller: Arduino Nano Every 
 */

#include <Ethernet.h>
#include <SPI.h>
#include <avr/sleep.h>

// Network variables
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xEE };
byte ip[] = { 192, 168, 1, 100 };
byte server_ip[] = { 192, 168, 1, 13 };
int port = 8002;
EthernetClient client;

// Interrupt variables
const int ETHERNET_INT_PIN = 8;
volatile bool interrupt_occured;


void check_interrupt() {
  /* D8 interrupt callback function */
  
  interrupt_occured = true;
  // sleep_disable();
}


void setup() {
  Serial.begin(9600);
  
  // Setup interrupt
  interrupt_occured = false;
  attachInterrupt(digitalPinToInterrupt(ETHERNET_INT_PIN), check_interrupt, FALLING);

  // Setup network connection
  Ethernet.begin(mac, ip);
  
  delay(1000);
  
  Serial.println("Connecting to server...");
  int connection_status = client.connect(server_ip, port);
  Serial.println("Connection status:");
  Serial.println(connection_status);

  // Write an initial message to the server
  if (client.connected()){
    client.write('h');
  }
}


void loop() {
  
  if (client.available()) {
    char c = client.read();
    Serial.println("Character received:");
    Serial.println(c);

    // Sleep command
    if (c == 's') {
//      set_sleep_mode(SLEEP_MODE_PWR_DOWN);
//      sleep_enable();
//      sleep_cpu();
    }

    // Wake up command
    if (c == 'w') {
      Serial.println("Woke up");
    }

    Serial.println("Interrupt status:");
    Serial.println(interrupt_occured);
  }
}

Recently someone posted a "Getting interrupts from Ethernet shield" guide

As for the wakeup, just prefix your TCP communication with a UDP wakeup packet.

Ethernet chips in general are power hungry so putting the Nano into sleep mode might not give you the power saving you are hoping for.

mikb55:
As for the wakeup, just prefix your TCP communication with a UDP wakeup packet.

Okay awesome!
Well I might leave it for now and then see if the power saving is really worth it with the ethernet sheild.
Thank you for the information!