New ESP32-Pi Programming

GregT

New member
Hi - I have just received a new ESP32-Pi. I have it connected to my Windows 10 PC. I see it in Device Manager under Other Devices, listed as USB serial. It does not seem to have a driver. Can anyone point me in the right direction? Thanks - GT
 

GregT

New member
Thanks for the help. That got me going.

Now I am trying to run the SM_ESP32Pi ethernet example. I am getting Ethernet cable is not connected. I have a known good cable on a known good switch port. I have also tried a second cable on another port. No link or status LEDs on the port or the switch when the ESP32Pi is connected.

Looking for additional guidance.

Thanks - GT
 

alexburcea

Moderator
Staff member
Hi,

Could you share all the messages received from the arduino serial monitor?
Did you have a router in your network or just the switch and the ESP32-PI?
 

GregT

New member
Sure - seral output below. I have a cable modem connected to the switch. The switch is an unmanaged Netgear 16 port. Everything else on the switch is working properly. I have tried different switch ports / different cables.

The ESP32Pi LED is flashing, so I believe the loop is working.

I also have a BAS card (stack level 0) and an 8 relay card (stack level 1) stacked on the ESP32Pi. I am thinking of removing the IO cards and trying just the ESP32Pi.

Failed to configure Ethernet using DHCP
Ethernet cable is not connected.
STATIC OK!
Local IP : 10.0.0.51
Subnet Mask : 255.255.255.0
Gateway IP : 10.0.0.1
DNS Server : 10.0.0.1
Ethernet Successfully Initialized
connection failed

disconnecting.
Received 0 bytes in 0.0000, rate = 0.00 kbytes/second

DOIT ESP32 DEVKIT V1
on COM5
 

alexburcea

Moderator
Staff member
The questions is that there is someone on the network assigning IP's trough DHCP method? or the IP'S on the network are static?
Do you have an other device connected to the switch that working? How this device get his IP and what is the IP of this device?
 

GregT

New member
There is DHCP on the network. I have 8 other DHCP devices on the switch. The IP address that it is reporting is the one I assigned in the sketch. I unplugged a Raspberry Pi and plugged in the ESP32-Pi to the same network cable. Changed the Static IP, Gateway, and DNS in the sketch. And uploaded to get the result I previously posted.

I have tried two other cables and two other switch ports. I don't get any connection or status LEDs on either the ESP32-Pi or the ethernet switch.

Just to make sure I did not mess up something else, here is the entire sketch.

/*
* This sketch demonstrate the usage of the Ethernet port on the Sequent Microsystems
* ESP32 Raspberry Pi Alternative card.
* Please connect a ethernet cable to the card and
* open the Serial Monitor to see the results
*/
#include "SM_ESP32Pi.h"
#include "Ethernet.h"
char server[] = "httpbin.org";
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
#define MYIPADDR 10,0,0,51
#define MYIPMASK 255,255,255,0
#define MYDNS 10,0,0,1
#define MYGW 10,0,0,1
EthernetClient client;
SM_ESP32Pi esp = SM_ESP32Pi(1);// pin header pin number type
// 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() {
unsigned int i = 0;
Serial.begin(115200);
delay(1000);
esp.begin(1);// debug enable
Ethernet.init(SM_ESP32PI_ETH_CS);
nbDelay(1000);
if (Ethernet.begin(mac)) { // Dynamic IP setup
Serial.println("DHCP OK!");
} else {
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.");
}
IPAddress ip(MYIPADDR);
IPAddress dns(MYDNS);
IPAddress gw(MYGW);
IPAddress sn(MYIPMASK);
Ethernet.begin(mac, ip, dns, gw, sn);
Serial.println("STATIC OK!");
}
nbDelay(5000);

Serial.print("Local IP : ");
Serial.println(Ethernet.localIP());
Serial.print("Subnet Mask : ");
Serial.println(Ethernet.subnetMask());
Serial.print("Gateway IP : ");
Serial.println(Ethernet.gatewayIP());
Serial.print("DNS Server : ");
Serial.println(Ethernet.dnsServerIP());
Serial.println("Ethernet Successfully Initialized");
// if you get a connection, report back via serial:
if (client.connect(server, 80)) {
Serial.println("Connected!");
// Make a HTTP request:
client.println("GET /get HTTP/1.1");
client.println("Host: httpbin.org");
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) {
nbDelay(1);
}
}
}
#define ON_TIME_MS 50
#define PERIOD_MS 1000
void heartBeat()
{
static int period = ON_TIME_MS;
static unsigned long tms = 0;
if ((millis() > (tms + period)) || (millis() < tms))
{
tms = millis();
if (period == ON_TIME_MS)
{
//esp.led(0); //library function
digitalWrite(SM_ESP32PI_LED, LOW);//builtin function with library definition SM_ESP32PI_LED
period = PERIOD_MS - ON_TIME_MS;
}
else
{
//esp.led(1);//library function
digitalWrite(SM_ESP32PI_LED, HIGH);//builtin function with library definition SM_ESP32PI_LED
period = ON_TIME_MS;
}
}
}
void nbDelay(int milliseconds)
{
unsigned long time_now = 0;
time_now = millis();
while (millis() < time_now + milliseconds)
{
heartBeat();
}
}
 

alexburcea

Moderator
Staff member
This is strange, the code detect the hardware (W5500 chip) but is not link to the network..
Could you please send me a picture with the bottom (smd components) side of the card to see if there is something wrong with the card.
 

alexburcea

Moderator
Staff member
We could send you a replacement, but I am not so sure the card is the problem.
Could you check the Raspberry IP, DNS..etc when connected to the network, Disconnect it and use the same for the ESP-PI in the code :
#define MYIPADDR (Raspberry address)
#define MYIPMASK 255,255,255,0
#define MYDNS (Raspberry DNS)
#define MYGW (Raspberry DNS)

Also please change the MAC adress ( byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; ) with something else (highly improbable but you might have a device in the network with the same mac address)
 

GregT

New member
I change the following:

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xE2 }

#define MYIPADDR 10,0,0,50
#define MYIPMASK 255,255,255,0
#define MYDNS 75,75,75,75
#define MYGW 10,0,0,1

I am still getting the Ethernet cable is not connected message. I still don't see any ethernet connection LEDs on the ESP32-PI or the network switch.
 
Top