Nano33 IOT + ENC28J60

Hi Guys. I want to use my Nano33 in a location where the wifi is unreliable but I can run an ethernet cable. I have purchased a Wavelength ENC28J60 card (from the PiHut so hopefully good quality) and wired it thus:

I have tried about twenty different programmes/libraries, but none of them seem to bind the ENC28J60 to the Nano33 and the card never appears on the network.

Any recommendations or advice on how to get this working would be appreciated.

You ll need an ethernet shield for this one
images

Is this the one that I need to modify to use with the Nano33?

use my EthernetENC library with the enc28j60 module. the library is in Library Manager. see the examples of the Ethernet library.

the Nano shields are for a 5 V Nano and require a modification to work with a 3.3 V Nano.

pin 13 should go to SCK. pin 10 is CS not INT. you have reset wired to CS on the picture
https://github.com/jandrassy/EthernetENC/wiki/SPI-Wiring

1 Like

ya to get it connect with ethernet cable in a compact way this type of modules are best option . . .

Or this type model you can go with

images


This is what I've got. BTW I can't get it running on my Uno.Wifi either.

use the 2x3 SPI header on Uno WiFi.
pins 11 to 13 are not SPI on Uno WiFi Rev 2.

Ya exactly i agree

a bit changes we need tp make here with a check on programing part too may be . .

https://create.arduino.cc/projecthub/Sourcery/how-to-connect-the-enc28j60-to-an-arduino-efd0dd

Thanks. Are you saying 10 to CS and on the 2*3:
1(copi) ->MOSI
4(cipo) -->MISO
3 -> CLK

yes. and fix the enc module end connections too. at least on the picture you have some of them wrong as I wrote in my first comment.

@King_RAJ_Enters please stop. you are not helping

Strange ! I supported your idea @ #8 and you are behaving like this ???

Is it some kind of competition or debate we are doing here hmm ???????

We are learners and about to discuss & share knowledge here with each other

You are not supposed here to judge people helping or disturbing or arguing

and who said i am not helping ??? check the links i have forwarded . . .

Ok , You you hold very very good knowledge i appreciate that but may be . . . may be his experiment is going through some other kind of issue
So he may solve it with the clips . . it may be possible na ??

So in that sense i hv forwarded . . . .

The pin-out info I have for the Uno Wifi Rev2 does show SPI on pins 11 to 13 but I have rewired as suggested. Sorry the photo is a bit messy.

However I think I am still stalling at Ethernet.begin(mac, myIP);

sorry yes, there is SPI on 11 to 13.
wire MISO to MISO, MOSI to MOSI. it is Master In/Out Slave Out/In.

I think this is the problem I have had all along the Ethernet.begin doesn't bind the enc28j60 to the arduino

add Ethernet.init(10);
the WebClient example of the Ethernet library is the best test sketch

Thanks. I've tried the WebClient test sketch (again).
With #include <Ethernet.h> I get what I'd expect which is:


With #include <EthernetENC.h> I only get

FWIW my switch can see the ENC and is tx to it but gets no rx
image

The whole sketch is here below:

/*
  Web client

 This sketch connects to a website (http://www.google.com)
 using an Arduino Wiznet Ethernet shield.

 Circuit:
 * Ethernet shield attached to pins 10, 11, 12, 13

 created 18 Dec 2009
 by David A. Mellis
 modified 9 Apr 2012
 by Tom Igoe, based on work by Adrian McEwen

 */

#include <SPI.h>
#include <EthernetENC.h>

// Enter a MAC address for your controller below.
// Newer Ethernet shields have a MAC address printed on a sticker on the shield
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };

// if you don't want to use DNS (and reduce your sketch size)
// use the numeric IP instead of the name for the server:
//IPAddress server(74,125,232,128);  // numeric IP for Google (no DNS)
char server[] = "www.google.com";    // name address for Google (using DNS)

// Set the static IP address to use if the DHCP fails to assign
IPAddress ip(192, 168, 2, 201);
IPAddress myDns(192, 168, 2, 1);

// Initialize the Ethernet client library
// with the IP address and port of the server
// that you want to connect to (port 80 is default for HTTP):
EthernetClient client;

// Variables to measure the speed
unsigned long beginMicros, endMicros;
unsigned long byteCount = 0;
bool printWebData = true;  // set to false for better speed measurement

void setup() {
  // You can use Ethernet.init(pin) to configure the CS pin
  Ethernet.init(10);  // Most Arduino shields
  //Ethernet.init(5);   // MKR ETH shield
  //Ethernet.init(0);   // Teensy 2.0
  //Ethernet.init(20);  // Teensy++ 2.0
  //Ethernet.init(15);  // ESP8266 with Adafruit Featherwing Ethernet
  //Ethernet.init(33);  // ESP32 with Adafruit Featherwing Ethernet

  // Open serial communications and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }

  // start the Ethernet connection:
  Serial.println("Initialize Ethernet with DHCP:");
  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    // Check for Ethernet hardware present
    if (Ethernet.hardwareStatus() == EthernetNoHardware) {
      Serial.println("Ethernet shield was not found.  Sorry, can't run without hardware. :(");
      while (true) {
        delay(1); // do nothing, no point running without Ethernet hardware
      }
    }
    if (Ethernet.linkStatus() == LinkOFF) {
      Serial.println("Ethernet cable is not connected.");
    }
    // try to congifure using IP address instead of DHCP:
    Ethernet.begin(mac, ip, myDns);
  } else {
    Serial.print("  DHCP assigned IP ");
    Serial.println(Ethernet.localIP());
  }
  // give the Ethernet shield a second to initialize:
  delay(1000);
  Serial.print("connecting to ");
  Serial.print(server);
  Serial.println("...");

  // if you get a connection, report back via serial:
  if (client.connect(server, 80)) {
    Serial.print("connected to ");
    Serial.println(client.remoteIP());
    // Make a HTTP request:
    client.println("GET /search?q=arduino HTTP/1.1");
    client.println("Host: www.google.com");
    client.println("Connection: close");
    client.println();
  } else {
    // if you didn't get a connection to the server:
    Serial.println("connection failed");
  }
  beginMicros = micros();
}

void loop() {
  // if there are incoming bytes available
  // from the server, read them and print them:
  int len = client.available();
  if (len > 0) {
    byte buffer[80];
    if (len > 80) len = 80;
    client.read(buffer, len);
    if (printWebData) {
      Serial.write(buffer, len); // show in the serial monitor (slows some boards)
    }
    byteCount = byteCount + len;
  }

  // if the server's disconnected, stop the client:
  if (!client.connected()) {
    endMicros = micros();
    Serial.println();
    Serial.println("disconnecting.");
    client.stop();
    Serial.print("Received ");
    Serial.print(byteCount);
    Serial.print(" bytes in ");
    float seconds = (float)(endMicros - beginMicros) / 1000000.0;
    Serial.print(seconds, 4);
    float rate = (float)byteCount / seconds / 1000.0;
    Serial.print(", rate = ");
    Serial.print(rate);
    Serial.print(" kbytes/second");
    Serial.println();

    // do nothing forevermore:
    while (true) {
      delay(1);
    }
  }
}

did you correct the wiring?

I've got:
10 to CS
11 to MOSI
12 to MISO
13 to SCK