Skip to content

ESP32 devkit v1 WiFi.h and Ethernet.h can not be simultaneously compiled #6058

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
1 task done
SergiiSenchurov opened this issue Dec 23, 2021 · 6 comments
Closed
1 task done
Labels
Area: BT&Wifi BT & Wifi related issues Resolution: Expired More info wasn't provided Type: Question Only question

Comments

@SergiiSenchurov
Copy link

Board

esp32 devkit v1

Device Description

ESP32 DEVKIT v1 with W5500 Ethernet shield connected over the SPI

Hardware Configuration

// static const uint8_t SS = 5;
// static const uint8_t MOSI = 19;
// static const uint8_t MISO = 21;
// static const uint8_t SCK = 18;

Version

v1.0.6

IDE Name

Visual Studio Code with Arduino IDE 1.8.6

Operating System

MacOS 12.0.1

Flash frequency

80MHz

PSRAM enabled

no

Upload speed

921600

Description

Simultaneous compilation of Ethernet.h and WiFi.h makes successfull compilation impossible due to the constructors syntax conflict

Workaround is

// 1. Modify "Server.h" file as follows
// class Server: public Print
// {
// public:
// // -- Remove
// // virtual void begin(uint16_t port=0) =0;
// // ++ Add
// virtual void begin() = 0;
// };
//
// 2. Modify "WiFiServer.h"
// // -- Remove void begin(uint16_t port=0);
// // ++ Add
// void begin(void);
// void begin(uint16_t port);
//
// 3. Modify "WiFiServer.cpp"
// // ++ Add
// void WiFiServer::begin(void){
// begin(0, 1);
// }
//

Sketch

void setup(){

  


  Ethernet.init(SS);
  module_state.DHCP_result = Ethernet.begin(ethernet_macaddress); // Dynamic IP setup
  module_state.hardware_status = Ethernet.hardwareStatus();


  if (Ethernet.linkStatus() == LinkON)
  {
    serverEthernet.begin();
  }


  WiFi.hostname(WIFI_HOSTNAME);
  WiFi.begin(ssid, pass);
  uint8_t delays_count = 0;
  while ((WiFi.status() != WL_CONNECTED) && (delays_count < MAX_WIFI_CONNECT_RETRIES))
  {
    delay(500);
    delays_count++;
  }

  serverWiFi.begin();
  serverWiFi.setNoDelay(true);

Debug Message

Debug impossible

Other Steps to Reproduce

No response

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.
@SergiiSenchurov SergiiSenchurov added the Status: Awaiting triage Issue is waiting for triage label Dec 23, 2021
@atanisoft
Copy link
Collaborator

You can use the built-in Ethernet library via "ETH.h". The Ethernet.h file you are using is for AVR and is not guaranteed to work with ESP32.

This appears to also be a duplicate of #2704

@SergiiSenchurov
Copy link
Author

Thank you!

@SergiiSenchurov
Copy link
Author

The issue persists. I cannot find eth.h library

@atanisoft
Copy link
Collaborator

You don't need to "find" the library, it is built-in as part of the Arduino esp32 package you added to the Arduino IDE. You should be able to find a few examples of it's usage in the IDE under the ESP32 examples (look for Ethernet).

In your code you would swap #include <Ethernet.h> with #include <ETH.h> and use the ETH instance (similar to Serial) directly.

@VojtechBartoska VojtechBartoska added Type: Question Only question and removed Status: Awaiting triage Issue is waiting for triage labels Jan 4, 2022
@VojtechBartoska
Copy link
Contributor

Hello, can I consider this as covered?

@VojtechBartoska VojtechBartoska added Area: BT&Wifi BT & Wifi related issues Resolution: Awaiting response Waiting for response of author labels Apr 11, 2022
@VojtechBartoska
Copy link
Contributor

Hello, due to no answer I'm closing this issue as expired.

If you still need help, please reopen it.

Thanks for understanding!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: BT&Wifi BT & Wifi related issues Resolution: Expired More info wasn't provided Type: Question Only question
Projects
None yet
Development

No branches or pull requests

3 participants