khoih-prog / EthernetWebServer_SSL

Simple TLS/SSL Ethernet WebServer, HTTP Client and WebSocket Client library for for AVR, Portenta_H7, Teensy, SAM DUE, SAMD21, SAMD51, STM32F/L/H/G/WB/MP1, nRF52 and RASPBERRY_PI_PICO boards using Ethernet shields W5100, W5200, W5500, ENC28J60 or Teensy 4.1 NativeEthernet/QNEthernet. It now supports Ethernet TLS/SSL Client. The library supports HTTP/HTTPS GET and POST requests, provides argument parsing, handles one client at a time. It supports Arduino boards (SAM DUE, Atmel SAM3X8E ARM Cortex-M3, SAMD21, SAMD51, ESP8266, ESP32, Adafruit nRF52, Teensy boards) using Wiznet W5x00 or ENC28J60 network shields. Ethernet_Generic library is used as default for W5x00 with custom SPI
GNU General Public License v3.0
46 stars 10 forks source link

Problem with ESP32 (Wemos D1 R32) SPI? #1

Closed 1simone0 closed 3 years ago

1simone0 commented 3 years ago

I have a Wemos D1 R32 (basically an ESP32 with UNO layout) and I'm trying to make it work with an Original Arduino Ethernet Shield 2. Here a link with a Wemos D1 R32 pinout description: https://www.botnroll.com/en/esp/3639-wemos-d1-r32-w-esp32-uno-r3-pinout.html

I started from a simple example: "simpleHTTPExample" but with no good results. I checked the pin used from the library in case of ESP32 (18-19-23-5) that are ok with that shield but I don't see any signal with scope on them. Not sure about SS pin really used (5 or 22) but reading the serial monitor it seems it takes pin 5 at the end. Anyway for sure on 18-19-23 there are no signals.

From original sketch I modified first row of MAC adress in defines.h. Also tried to change the ethernet library managing trues and falses in define.h file. Am I missing something more to manage?

Here my Serial monitor:

Starting SimpleHTTPExample on ESP32 with W5x00 using Ethernet Library EthernetWebServer_SSL v1.3.1 [ETHERNET_WEBSERVER] =========== USE_ETHERNET =========== [ETHERNET_WEBSERVER] Default SPI pinout: [ETHERNET_WEBSERVER] MOSI: 23 [ETHERNET_WEBSERVER] MISO: 19 [ETHERNET_WEBSERVER] SCK: 18 [ETHERNET_WEBSERVER] SS: 5 [ETHERNET_WEBSERVER] ========================= [ETHERNET_WEBSERVER] ESP32 setCsPin: 22

Currently Used SPI pinout: MOSI:23 MISO:19 SCK:18 SS:5

Using mac index = 17 Connected! IP address: 0.0.0.0 Connect failed: -1

Any suggestions?

khoih-prog commented 3 years ago

The Arduino Ethernet Shield is designed for Arduino (Mega, UNO, SAM DUE) boards, and using ICSP connector for SPI signals (MOSI, MISO, SCK, CS).

Selection_652

ICSP_connector

You have to connect the SPI signal from ICSP connector into corresponding pins to use it.

Also remember the GPIO 23, 19, 18, 5 (MOSI, MISO, SCK, CS) are already connected to pins 11,12,13, 10 of the connector.

1simone0 commented 3 years ago

In fact, I'm saying that from those pins (23,19,18,5) there are no signals!!! It seems ESP32 is not well driven. I'm wondering if someone else used this library with an ESP32 chip first and with wich kind of board to figure out if I'm making a mistake or missing something or if it's a library problem.

khoih-prog commented 3 years ago

I just used the similar to Wemos D1 ESP32 + W5500 yesterday with the twin library EthernetWebServer and the combination are working perfectly. The Ethernet shield is W5500, not the Arduino W5500 Ethernet shield 2, but they are very similar. You have to connect the wire manually. That's it.

WemosD1-ESP32-W5500

Have a look at the result:

ESP32_FS_EthernetWebServer on ESP32 using LittleFS with W5x00 using Ethernet Library