-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Ethernet.begin() will crash the board with interesting debug message. #6393
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
Comments
Right after: #define ETH_PHY_ADDR 1
#define PIN_PHY_POWER 17
#define PIN_SMI_MDC 23
#define PIN_SMI_MDIO 18
ETH.begin(
ETH_PHY_ADDR,
PIN_PHY_POWER,
PIN_SMI_MDC,
PIN_SMI_MDIO,
ETH_PHY_LAN8720,
ETH_CLK_MODE
); |
WiFiType.h: WiFiGeneric.h:
A couple weeks ago I had to update my code to handle the new datatype for WiFi.onEvent(). |
Thank you for your help. I have seen the new event types and changed them. The thing is that if I go with wifi everything works. My sketch runs without problem. If I replace wifi connection with ethernet connection the esp reboots right on ETH.begin () with these error messages. 😤 |
Your defines don't match the defaults in ETH.h. Is it possible one of them is wrong? |
Yeah i know that. It's our hardware design choise. It was working before the update with the exact same defines. :/ |
What Arduino version you have used? Release 2.0.2 or GIT version? |
I am using the upstream version [env:arduino-esp32]
platform = https://github.com/platformio/platform-espressif32.git#feature/arduino-upstream
board = esp32dev
framework = arduino
platform_packages =
> framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32#master But before I used what platformIO gave me. I changed to the upstream because me_no_dev suggested because of another bug, which was related to PS-Ram. |
The ethernet PR is at the moment only in branch
Which is only a few days old, PSRAM is working. |
I will try that. Thank you for your help, i appreciate it. |
I copyed this build but i got a crash when i try to allocate space from PSRAM. Guru Meditation Error: Core 1 panic'ed (StoreProhibited). Exception was unhandled.
Core 1 register dump:
PC : 0x40091ff8 PS : 0x00060933 A0 : 0x80093e34 A1 : 0x3ffcff10
A2 : 0xdf010000 A3 : 0xb33fffff A4 : 0x0000cdcd A5 : 0x00060923
A6 : 0x00060920 A7 : 0x0000abab A8 : 0x0000abab A9 : 0xffffffff
A10 : 0x3ffdb7b8 A11 : 0x00000004 A12 : 0x00000004 A13 : 0x3ffb9270
A14 : 0x9f810000 A15 : 0x003fffff SAR : 0x00000015 EXCCAUSE: 0x0000001d
EXCVADDR: 0xdf010000 LBEG : 0x40101804 LEND : 0x40101848 LCOUNT : 0x0000003c
Backtrace:0x40091ff5:0x3ffcff100x40093e31:0x3ffcff50 0x400940ad:0x3ffcff70 0x4008423a:0x3ffcff90 0x400d3672:0x3ffcffc0 0x400d5d8f:0x3ffcffe0 0x400d6254:0x3ffd0080 0x400d6d1f:0x3ffd00b0
#0 0x40091ff5:0x3ffcff100x40093e31:0x3ffcff50 in compare_and_set_native at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp_hw_support/include/soc/compare_set.h:25
(inlined by) spinlock_acquire at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp_hw_support/include/soc/spinlock.h:103
(inlined by) xPortEnterCriticalTimeout at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/port/xtensa/port.c:288
#1 0x400940ad:0x3ffcff70 in multi_heap_malloc at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/heap/multi_heap_poisoning.c:229
(inlined by) multi_heap_malloc at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/heap/multi_heap_poisoning.c:219
#2 0x4008423a:0x3ffcff90 in heap_caps_malloc at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/heap/heap_caps.c:145
#3 0x400d3672:0x3ffcffc0 in SpiRamAllocator::allocate(unsigned int) at src/utilities/globals.h:8
(inlined by) ArduinoJson6192_F1::AllocatorOwner<SpiRamAllocator>::allocate(unsigned int) at lib/ArduinoJson-6.x/src/ArduinoJson/Document/BasicJsonDocument.hpp:20
(inlined by) ArduinoJson6192_F1::BasicJsonDocument<SpiRamAllocator>::allocPool(unsigned int) at lib/ArduinoJson-6.x/src/ArduinoJson/Document/BasicJsonDocument.hpp:137
(inlined by) ArduinoJson6192_F1::BasicJsonDocument<SpiRamAllocator>::BasicJsonDocument(unsigned int, SpiRamAllocator) at lib/ArduinoJson-6.x/src/ArduinoJson/Document/BasicJsonDocument.hpp:44
#4 0x400d5d8f:0x3ffcffe0 in fSystem::readConfig() at src/utilities/fileSystem.cpp:91
#5 0x400d6254:0x3ffd0080 in fSystem::mount() at src/utilities/fileSystem.cpp:36
(inlined by) fSystem::mount() at src/utilities/fileSystem.cpp:23
#6 0x400d6d1f:0x3ffd00b0 in fsLoopTask(void*) at src/utilities/fileSystem.cpp:694
ELF file SHA256: 0000000000000000
Rebooting... It didn't even get to the ethernet part. I'm using ArduinoJSON and allocating memory from the external ram with this allocator template for the json objects: #include <Arduino.h>
#include <ArduinoJson.h>
struct SpiRamAllocator {
void* allocate(size_t size) {return heap_caps_malloc(size, MALLOC_CAP_SPIRAM);}
void deallocate(void* pointer) {heap_caps_free(pointer);}
void* reallocate(void* ptr, size_t new_size) {return heap_caps_realloc(ptr, new_size, MALLOC_CAP_SPIRAM);}
};
using SpiRamJsonDocument = BasicJsonDocument<SpiRamAllocator>; And with that build ( just like with the old PIO build ) it crashed at this part: SpiRamJsonDocument doc(CONFIG_SIZE); // <-- Like right here
DeserializationError error = deserializeJson(doc, configFile);
if (!error) {} I'm sure the psram is enabled and initialized at this point.
|
With this url: Building in release mode
Replace MKSPIFFSTOOL with mklittlefs.exe
Compiling .pio\build\arduino-esp32\src\main.cpp.o
Compiling .pio\build\arduino-esp32\src\utilities\fileSystem.cpp.o
Compiling .pio\build\arduino-esp32\src\utilities\geolocate.cpp.o
Compiling .pio\build\arduino-esp32\src\utilities\modBus.cpp.o
<command-line>:0:19: warning: ISO C++11 requires whitespace after the macro name
<command-line>:0:19: warning: ISO C++11 requires whitespace after the macro name
Compiling .pio\build\arduino-esp32\src\utilities\networkSystem.cpp.o
<command-line>:0:19: warning: ISO C++11 requires whitespace after the macro name
<command-line>:0:19: warning: ISO C++11 requires whitespace after the macro name
Compiling .pio\build\arduino-esp32\src\utilities\performanceSystem.cpp.o
<command-line>:0:19: warning: ISO C++11 requires whitespace after the macro name
Compiling .pio\build\arduino-esp32\src\utilities\serverSystem.cpp.o
Compiling .pio\build\arduino-esp32\src\utilities\tftDisplay.cpp.o
<command-line>:0:19: warning: ISO C++11 requires whitespace after the macro name
<command-line>:0:19: warning: ISO C++11 requires whitespace after the macro name
<command-line>:0:19: warning: ISO C++11 requires whitespace after the macro name
In file included from src/main.cpp:7:0:
src/utilities/networkSystem.h:12:0: warning: "ETH_PHY_ADDR" redefined
#define ETH_PHY_ADDR 1
^
In file included from src/utilities/networkSystem.h:6:0,
from src/main.cpp:7:
C:/Users/Pc/.platformio/packages/framework-arduinoespressif32/libraries/Ethernet/src/ETH.h:29:0: note: this is the location of the previous definition
#define ETH_PHY_ADDR 0
^
In file included from src/utilities/geolocate.cpp:2:0:
src/utilities/networkSystem.h:12:0: warning: "ETH_PHY_ADDR" redefined
#define ETH_PHY_ADDR 1
^
In file included from src/utilities/networkSystem.h:6:0,
from src/utilities/geolocate.cpp:2:
C:/Users/Pc/.platformio/packages/framework-arduinoespressif32/libraries/Ethernet/src/ETH.h:29:0: note: this is the location of the previous definition
#define ETH_PHY_ADDR 0
^
In file included from src/utilities/networkSystem.cpp:1:0:
src/utilities/networkSystem.h:12:0: warning: "ETH_PHY_ADDR" redefined
#define ETH_PHY_ADDR 1
^
In file included from src/utilities/networkSystem.h:6:0,
from src/utilities/networkSystem.cpp:1:
C:/Users/Pc/.platformio/packages/framework-arduinoespressif32/libraries/Ethernet/src/ETH.h:29:0: note: this is the location of the previous definition
#define ETH_PHY_ADDR 0
^
In file included from src/utilities/tftDisplay.cpp:3:0:
src/utilities/networkSystem.h:12:0: warning: "ETH_PHY_ADDR" redefined
#define ETH_PHY_ADDR 1
^
In file included from src/utilities/networkSystem.h:6:0,
from src/utilities/tftDisplay.cpp:3:
C:/Users/Pc/.platformio/packages/framework-arduinoespressif32/libraries/Ethernet/src/ETH.h:29:0: note: this is the location of the previous definition
#define ETH_PHY_ADDR 0
^
In file included from src/utilities/serverSystem.h:10:0,
from src/utilities/performanceSystem.cpp:3:
src/utilities/networkSystem.h:12:0: warning: "ETH_PHY_ADDR" redefined
#define ETH_PHY_ADDR 1
^
In file included from src/utilities/networkSystem.h:6:0,
from src/utilities/serverSystem.h:10,
from src/utilities/performanceSystem.cpp:3:
C:/Users/Pc/.platformio/packages/framework-arduinoespressif32/libraries/Ethernet/src/ETH.h:29:0: note: this is the location of the previous definition
#define ETH_PHY_ADDR 0
^
In file included from src/utilities/serverSystem.h:10:0,
from src/utilities/serverSystem.cpp:1:
src/utilities/networkSystem.h:12:0: warning: "ETH_PHY_ADDR" redefined
#define ETH_PHY_ADDR 1
^
In file included from src/utilities/networkSystem.h:6:0,
from src/utilities/serverSystem.h:10,
from src/utilities/serverSystem.cpp:1:
C:/Users/Pc/.platformio/packages/framework-arduinoespressif32/libraries/Ethernet/src/ETH.h:29:0: note: this is the location of the previous definition
#define ETH_PHY_ADDR 0
^
cc1plus.exe: warning: unrecognized command line option '-Wno-frame-address'
cc1plus.exe: warning: unrecognized command line option '-Wno-frame-address'
cc1plus.exe: warning: unrecognized command line option '-Wno-frame-address'
Compiling .pio\build\arduino-esp32\src\utilities\timeSystem.cpp.o
Generating partitions .pio\build\arduino-esp32\partitions.bin
<command-line>:0:19: warning: ISO C++11 requires whitespace after the macro name
cc1plus.exe: warning: unrecognized command line option '-Wno-frame-address'
cc1plus.exe: warning: unrecognized command line option '-Wno-frame-address'
cc1plus.exe: warning: unrecognized command line option '-Wno-frame-address'
Compiling .pio\build\arduino-esp32\lib0fc\FS\FS.cpp.o
cc1plus.exe: warning: unrecognized command line option '-Wno-frame-address'
Compiling .pio\build\arduino-esp32\lib0fc\FS\vfs_api.cpp.o
<command-line>:0:19: warning: ISO C++11 requires whitespace after the macro name
<command-line>:0:19: warning: ISO C++11 requires whitespace after the macro name
Compiling .pio\build\arduino-esp32\lib2a0\LittleFS\LittleFS.cpp.o
<command-line>:0:19: warning: ISO C++11 requires whitespace after the macro name
Compiling .pio\build\arduino-esp32\lib6a7\WiFi\WiFi.cpp.o
Compiling .pio\build\arduino-esp32\lib6a7\WiFi\WiFiAP.cpp.o
<command-line>:0:19: warning: ISO C++11 requires whitespace after the macro name
Compiling .pio\build\arduino-esp32\lib6a7\WiFi\WiFiClient.cpp.o
In file included from src/utilities/timeSystem.cpp:2:0:
src/utilities/networkSystem.h:12:0: warning: "ETH_PHY_ADDR" redefined
#define ETH_PHY_ADDR 1
^
In file included from src/utilities/networkSystem.h:6:0,
from src/utilities/timeSystem.cpp:2:
C:/Users/Pc/.platformio/packages/framework-arduinoespressif32/libraries/Ethernet/src/ETH.h:29:0: note: this is the location of the previous definition
#define ETH_PHY_ADDR 0
^
<command-line>:0:19: warning: ISO C++11 requires whitespace after the macro name
<command-line>:0:19: warning: ISO C++11 requires whitespace after the macro name
cc1plus.exe: warning: unrecognized command line option '-Wno-frame-address'
cc1plus.exe: warning: unrecognized command line option '-Wno-frame-address'
Compiling .pio\build\arduino-esp32\lib6a7\WiFi\WiFiGeneric.cpp.o
cc1plus.exe: warning: unrecognized command line option '-Wno-frame-address'
<command-line>:0:19: warning: ISO C++11 requires whitespace after the macro name
Archiving .pio\build\arduino-esp32\lib0fc\libFS.a
cc1plus.exe: warning: unrecognized command line option '-Wno-frame-address'
Compiling .pio\build\arduino-esp32\lib6a7\WiFi\WiFiMulti.cpp.o
cc1plus.exe: warning: unrecognized command line option '-Wno-frame-address'
Compiling .pio\build\arduino-esp32\lib6a7\WiFi\WiFiSTA.cpp.o
<command-line>:0:19: warning: ISO C++11 requires whitespace after the macro name
Compiling .pio\build\arduino-esp32\lib6a7\WiFi\WiFiScan.cpp.o
Archiving .pio\build\arduino-esp32\lib2a0\libLittleFS.a
<command-line>:0:19: warning: ISO C++11 requires whitespace after the macro name
<command-line>:0:19: warning: ISO C++11 requires whitespace after the macro name
Compiling .pio\build\arduino-esp32\lib6a7\WiFi\WiFiServer.cpp.o
<command-line>:0:19: warning: ISO C++11 requires whitespace after the macro name
cc1plus.exe: warning: unrecognized command line option '-Wno-frame-address'
Compiling .pio\build\arduino-esp32\lib6a7\WiFi\WiFiUdp.cpp.o
cc1plus.exe: warning: unrecognized command line option '-Wno-frame-address'
<command-line>:0:19: warning: ISO C++11 requires whitespace after the macro name
cc1plus.exe: warning: unrecognized command line option '-Wno-frame-address'
Compiling .pio\build\arduino-esp32\lib763\WiFiClientSecure\WiFiClientSecure.cpp.o
Compiling .pio\build\arduino-esp32\lib763\WiFiClientSecure\esp_crt_bundle.c.o
<command-line>:0:19: warning: ISO C++11 requires whitespace after the macro name
C:/Users/Pc/.platformio/packages/framework-arduinoespressif32/libraries/WiFi/src/WiFiGeneric.cpp: In static member function 'static bool WiFiGenericClass::setDualAntennaConfig(uint8_t, uint8_t, wifi_rx_ant_t, wifi_tx_ant_t)':
C:/Users/Pc/.platformio/packages/framework-arduinoespressif32/libraries/WiFi/src/WiFiGeneric.cpp:1265:5: sorry, unimplemented: non-trivial designated initializers not supported
};
^
C:/Users/Pc/.platformio/packages/framework-arduinoespressif32/libraries/WiFi/src/WiFiGeneric.cpp:1265:5: sorry, unimplemented: non-trivial designated initializers not supported
C:/Users/Pc/.platformio/packages/framework-arduinoespressif32/libraries/WiFi/src/WiFiGeneric.cpp:1265:5: sorry, unimplemented: non-trivial designated initializers not supported
<command-line>:0:19: warning: ISO C99 requires whitespace after the macro name
At global scope:
cc1plus.exe: warning: unrecognized command line option '-Wno-frame-address'
*** [.pio\build\arduino-esp32\lib6a7\WiFi\WiFiGeneric.cpp.o] Error 1
cc1plus.exe: warning: unrecognized command line option '-Wno-frame-address'
cc1.exe: warning: unrecognized command line option '-Wno-frame-address'
cc1plus.exe: warning: unrecognized command line option '-Wno-frame-address'
cc1plus.exe: warning: unrecognized command line option '-Wno-frame-address'
cc1plus.exe: warning: unrecognized command line option '-Wno-frame-address'
cc1plus.exe: warning: unrecognized command line option '-Wno-frame-address'
cc1plus.exe: warning: unrecognized command line option '-Wno-frame-address'
=================================== [FAILED] Took 15.14 seconds ===================================The terminal process "C:\Users\Pc\.platformio\penv\Scripts\platformio.exe 'run'" terminated with exit code: 1.
Terminal will be reused by tasks, press any key to close it. |
You can NOT use PSRAM and Ethernet with GPIO17. Gpio17 is used for PSRAM. |
How was it worked with pio build before? |
We have a complete design with working code. I'm redesigning the software, changed to the new build and now i can't use that pin? |
If you had used PSRAM ever since and Ethernet worked, then obviously the CLK for Ethernet is either |
#define ETH_PHY_ADDR 1
#define PIN_PHY_POWER 17
#define PIN_SMI_MDC 23
#define PIN_SMI_MDIO 18 These are my defines for the ethernet ( which is currently working with the PIO build ). So what is the correct define for these? Still dont know how can it work with #define PIN_PHY_POWER 17 Thanks for all the help. I'm confused right now. |
Okay so it turns out that the PIO version build does not check for the #define ETH_PHY_ADDR 1
#define PIN_PHY_POWER -1 //17
#define PIN_SMI_MDC 23
#define PIN_SMI_MDIO 18 and it works. Thank you guys, i really appreciate all of your help and sorry for the trouble! |
Board
esp-wrover-kit
Device Description
It is a custom PCB but it can be reproduced with any other.
Hardware Configuration
Ethernet
Version
latest master
IDE Name
Platform IO
Operating System
Windows 10
Flash frequency
80Mhz
PSRAM enabled
yes
Upload speed
115200
Description
Upgraded to the latest arduino-esp32 and suddenly the ethernet callback is crashing my board.
Sketch
Debug Message
Other Steps to Reproduce
Don't know if there is any other way to setup the ethernet.
The version before this, i used other event types like this:
Worked fine. But these now throws compiler warnings:
I have checked existing issues, online documentation and the Troubleshooting Guide
The text was updated successfully, but these errors were encountered: