Cannot connect to Blynk with Ethernet shield 2

Hi again,
I tried some different sketches and finally I got it to work. Can’t really say why but I think you were on the track with setting other parameters. The solution is maybe not “clean” but it seems to work quite well. Thanks for helping out! Pasting the applicable parts below.

Br Björn


// Ethernet shield 2 MAC
byte mac[] = {0xA8, 0x61, 0x0A, 0xAE, 0xA8, 0xDC};

#include <SPI.h>
#include <Ethernet.h>
#include <BlynkSimpleStream.h>

// Ethernet shield och SD-kort
#define W5100_CS 10
#define SDCARD_CS 4

// Instanser
EthernetClient ethernetClient;
BlynkTimer periodicTimer;

// Koppla upp mot Blynk, TCP
bool connectBlynk()
{
  ethernetClient.stop();
  bool test = ethernetClient.connect(BLYNK_DEFAULT_DOMAIN, BLYNK_DEFAULT_PORT);
  return ethernetClient.connect(BLYNK_DEFAULT_DOMAIN, BLYNK_DEFAULT_PORT);
}

void setup()
{
  // Serieport
  Serial.begin(9600);

  // Deselect the SD card
  pinMode(SDCARD_CS, OUTPUT);
  digitalWrite(SDCARD_CS, HIGH);

  // Initialize Ethernet shield
  Ethernet.begin(mac);

  // Verkar behövas väntan här för fallet att router går igång efter Arduino
  for (byte wait=0;wait<60;wait++)
  {
     delay(1000);
  }
  
  connectBlynk();

  Blynk.begin(ethernetClient, auth);

void loop()
{
  // Om koppling nere, försök koppla upp igen
  if (!ethernetClient.connected()) 
  {
    connectBlynk();
    return;
  }

  Blynk.run();
  
}

I had the same issue.

With an Ethernet 2 shield you should normally use
#include <Ethernet2.h>//5500
#include <BlynkSimpleEthernet2.h>//5500
Does not work for me but using the libraries for a Ethernet 1 shield with the Ethernet 2 shield resolved the issue:
#include <Ethernet.h>//5100
#include <BlynkSimpleEthernet.h>//5100