Arduino Nano 33 BLE -- ENC 28J60 -- SPI -- Tiny Machine Learning Kit

Hello, as part of my mechanical engineering studies, I am currently working on a project with the Tiny Machine Learning Kit. First, I wrote codes for the individual functions. In the final step before I can set up the code for the entire function, I encountered a problem where I cannot establish a connection to the ENC28J60 via SPI.

My connections:
VCC == 3.3V
GND == GND
SCK == Pin 13
So == Pin 12
Si == Pin 11
Cs == Pin 10 (as specified in the code)


(I used these two example codes)

Thank you very much for your help in advance,
Schumacher

Have you selected the 33BLE as your board choice ?

(Please refrain from posting images of text.)

the Ethernet library is for Wiznet W5x00 chips.
use EthernetENC library for ENC28J60

1 Like

Thank you very much for your Help!

I have worked with the codes 'Link Status' and 'Advanced ChatServer' from the Ethernet library. I changed the library from "#include <Ethernet.h>" to "#include <EthernetENC.h>" and, of course, selected my CS pin. However, I have not been able to achieve any success yet.

The Arduino Nano 33 BLE was set up immediately after connecting, and the newest board package is also installed.

on the picture it looks like MISO is wired to SI and MOSI to SO

1 Like

That is correct. Thanks for that, I have uploaded the updated version.
However, the hardware is connected according to this status.

VCC == 3.3V
GND == GND
SCK == Pin 13
So == Pin 12
Si == Pin 11
Cs == Pin 10 (as specified in the code)

try the WebCliebt example. it has enhanced diagnostics

1 Like

Thank you, that helped a lot!
I got it running now.

I tried running the "Advanced Chat Server" and the serial monitor printed this:
Chat server address:192.168.1.177

But i did not manage to open the client.

is the module properly connected with a cable to a switch or router?

1 Like

Its running now!

This is my test Code if theres interest.

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

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; // MAC-Adresse des Ethernet-Shields
IPAddress ip(192, 168, 0, 177); // Statische IP-Adresse des Arduinos

EthernetServer server(80); // Ethernet-Server auf Port 80

void setup() {

  digitalWrite(A6, HIGH); // Setze Pin A6 auf HIGH
  delay(1000); // Warte 1000 Millisekunden (1 Sekunde)

  digitalWrite(A6, LOW); // Setze Pin A6 auf LOW
  delay(500); // Warte 500 Millisekunden (0.5 Sekunden)

  digitalWrite(A6, HIGH); // Setze Pin A6 auf HIGH
  delay(1000); // Warte 1000 Millisekunden (1 Sekunde)

  digitalWrite(A6, LOW); // Setze Pin A6 auf LOW
  delay(500); // Warte 500 Millisekunden (0.5 Sekunden)


  Serial.begin(9600); // Initialisierung der seriellen Kommunikation
  while (!Serial) { ; } // Warte auf Verbindung zur seriellen Schnittstelle

  Ethernet.init(10); // Ethernet-Initialisierung mit CS-Pin 10
  if (Ethernet.begin(mac) == 0) { // Versuche DHCP-Konfiguration
    Serial.println("Failed to configure Ethernet using DHCP");
    Ethernet.begin(mac, ip); // Bei Fehler, verwende statische IP
  }

  server.begin(); // Start des Ethernet-Servers
  Serial.print("Server is at ");
  Serial.println(Ethernet.localIP()); // Ausgabe der IP-Adresse des Servers
}

void loop() {

  EthernetClient client = server.available(); // Warte auf Verbindung vom Client
  if (client) {
    Serial.println("New client");
    while (client.connected()) {
      if (client.available()) {
        String request = client.readStringUntil('\r'); // Lese HTTP-Request
        Serial.println(request);

        if (request.indexOf("/A6=HIGH") != -1) {
          digitalWrite(A6, HIGH); // Setze Pin A6 auf HIGH
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          client.println();
          client.println("<html><body><h1>Pin A6 ist jetzt HIGH</h1></body></html>");
          delay(1);
          break;
        } else if (request.indexOf("/A6=LOW") != -1) {
          digitalWrite(A6, LOW); // Setze Pin A6 auf LOW
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          client.println();
          client.println("<html><body><h1>Pin A6 ist jetzt LOW</h1></body></html>");
          delay(1);
          break;
        } else {
          client.println("HTTP/1.1 404 Not Found");
          client.println("Content-Type: text/html");
          client.println();
          client.println("<html><body><h1>404 Not Found</h1></body></html>");
          delay(1);
          break;
        }
      }
    }
    client.stop(); // Schließe Verbindung zum Client
    Serial.println("Client disconnected");
  }
}

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.