Giter Site home page Giter Site logo

tobozo / esp32-enc28j60 Goto Github PK

View Code? Open in Web Editor NEW
20.0 20.0 7.0 564 KB

ENC28J60 Ethernet driver for ESP32-Arduino 2.0.5, lwip compliant

License: MIT License

C++ 14.17% C 85.83%
arduino arduino-ethernet arduino-library enc28j60 esp32 ethernet lwip

esp32-enc28j60's People

Contributors

njh avatar tobozo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

esp32-enc28j60's Issues

Save firmware

Hi is it just get firmware on every reset or when it gets once use until another firmware update?
Btw its realy very great job thx for your time and work

Version of Arduino too Old

Hi,

I am hoping you could give me a pointer in regards to this issue.
image
running the program tells me that arduino version is too old, I have tried updating the arduino, but did not change anything.

Some files are unknown

Hi @tobozo i finally have time to test this lib..

I am working under platformio with arduino framework.. framework = arduino

Some of the files you added in the folder src are not present..

image

image

How did you try this repo ?
Under platformio ?

Thanks a lot for your support

Librart working for platform = [email protected]

Hi @tobozo ...

How are you?

I know we have already talked about this and you told me that i have to use a higner version for the platform..
I did it and it worked... Thanks..
But now I am struggling this the PubSubClient lib which is a very used lib for the mqtt purpose.

knolleary/pubsubclient#947

image

It is not clear why that lib is not working with a higher version of the platform and it seems that I am not alone..

So just for my understanding I would like to understand how big is the effort to make the lib works for 3.5.0 or maybe
you have an idea why the pubsubclient lib is not working with 5.0.0..

Thanks a lot for your tips and help

TCP Client and Server.

Hi,

I am sorry for disturbing you again, i am just wondering if you have any example you have done for TCP Server or Client, using the library. I am currently struggling to get the client to connect to a server.

I am looking to implement Modbus TCP. Your pointers will be greatly appreciated.

needs PSRAM => WROVER ?

Hi,

I had some leftovers of older ENC eth shields so I decided to try them out :)

I uploaded your pio_example and have problems running on WROOM:

--- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H 18:07:43.591 > [ 6][D][esp32-hal-cpu.c:244] setCpuFrequencyMhz(): PLL: 480 / 2 = 240 Mhz, APB: 80000000 Hz 18:07:43.591 > E (168) psram: PSRAM ID read error: 0xffffffff 18:07:43.591 > [ 9][W][esp32-hal-psram.c:71] psramInit(): PSRACORRUPT HEAP: Bad tail at 0x3ffafd8a. Expected 0xbaad5678 got 0x07882091 18:07:43.591 > 18:07:43.591 > assert failed: multi_heap_free multi_heap_poisoning.c:253 (head != NULL) 18:07:43.591 > 18:07:43.591 > 18:07:43.591 > Backtrace:0x40083ccd:0x3ffaf4f00x4008e94d:0x3ffaf510 0x4009447d:0x3ffaf530 0x400940c3:0x3ffaf660 0x40084131:0x3ffaf680 0x400944ad:0x3ffaf6a0 0x400ecf38:0x3ffaf6c0 0x400d725e:0x3ffaf6e0 => 0x40083ccd: panic_abort at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/esp_system/panic.c:402 => 0x4008e94d: esp_system_abort at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/esp_system/esp_system.c:128 => 0x4009447d: __assert_func at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/newlib/assert.c:85 => 0x400940c3: multi_heap_free at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/heap/multi_heap_poisoning.c:253 (inlined by) multi_heap_free at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/heap/multi_heap_poisoning.c:245 => 0x40084131: heap_caps_free at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/heap/heap_caps.c:340 => 0x400944ad: free at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/newlib/heap.c:39 => 0x400ecf38: eth_stack_input at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/esp_eth/src/esp_eth.c:97 => 0x400d725e: emac_enc28j60_task at .pio/libdeps/MQTT-Debug/ESP32-ENC28J60/src/extmod/esp_eth_mac_enc28j60.c:770 18:07:43.591 > 18:07:43.591 > 18:07:43.591 > 18:07:43.591 > 18:07:43.591 > ELF file SHA256: 0000000000000000 18:07:43.591 > 18:07:43.591 > Rebooting... 18:07:43.591 > [ 6][D][esp32-hal-cpu.c:244] setCpuFrequencyMhz(): PLL: 480 / 2 = 240 Mhz, APB: 80000000 Hz 18:07:43.591 > E (167) psram: PSRAM ID read error: 0xffffffff 18:07:43.591 > [ 9][W][esp32-hal-psram.c:71] psramInit(): PSRAMCORRUPT HEAP: Bad tail at 0x3ffafd8a. Expected 0xbaad5678 got 0x0688309d 18:07:43.756 > 18:07:43.756 > assert failed: multi_heap_free multi_heap_poisoning.c:253 (head != NULL) 18:07:43.756 > 18:07:43.756 > 18:07:43.756 > Backtrace:0x40083ccd:0x3ffaf4f00x4008e94d:0x3ffaf510 0x4009447d:0x3ffaf530 0x400940c3:0x3ffaf660 0x40084131:0x3ffaf680 0x400944ad:0x3ffaf6a0 0x400ecf38:0x3ffaf6c0 0x400d725e:0x3ffaf6e0 => 0x40083ccd: panic_abort at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/esp_system/panic.c:402 => 0x4008e94d: esp_system_abort at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/esp_system/esp_system.c:128 => 0x4009447d: __assert_func at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/newlib/assert.c:85 => 0x400940c3: multi_heap_free at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/heap/multi_heap_poisoning.c:253 (inlined by) multi_heap_free at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/heap/multi_heap_poisoning.c:245 => 0x40084131: heap_caps_free at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/heap/heap_caps.c:340 => 0x400944ad: free at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/newlib/heap.c:39 => 0x400ecf38: eth_stack_input at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/esp_eth/src/esp_eth.c:97 => 0x400d725e: emac_enc28j60_task at .pio/libdeps/MQTT-Debug/ESP32-ENC28J60/src/extmod/esp_eth_mac_enc28j60.c:770 18:07:43.756 > 18:07:43.756 > 18:07:43.756 > 18:07:43.756 > 18:07:43.756 > ELF file SHA256: 0000000000000000 18:07:43.756 > 18:07:43.756 > Rebooting... 18:07:43.931 > [0;36m[ 6][D][esp32-hal-cpu.c:244] setCpuFrequencyMhz(): PLL: 480 / 2 = 240 Mhz, APB: 80000000 Hz 18:07:43.940 > E (166) psram: PSRAM ID read error: 0xffffffff 18:07:43.946 > [ 9][W][esp32-hal-psram.c:71] psramInit(): PSRACORRUPT HEAP: Bad tail at 0x3ffafd8a. Expected 0xbaad5678 got 0x06882099 18:07:43.980 > 18:07:43.980 > assert failed: multi_heap_free multi_heap_poisoning.c:253 (head != NULL) 18:07:43.986 > 18:07:43.986 > 18:07:43.988 > Backtrace:0x40083ccd:0x3ffaf4f00x4008e94d:0x3ffaf510 0x4009447d:0x3ffaf530 0x400940c3:0x3ffaf660 0x40084131:0x3ffaf680 0x400944ad:0x3ffaf6a0 0x400ecf38:0x3ffaf6c0 0x400d725e:0x3ffaf6e0 18:07:44.003 > 18:07:44.003 > 18:07:44.003 > 18:07:44.003 > 18:07:44.004 > ELF file SHA256: 0000000000000000 18:07:44.007 > 18:07:44.008 > Rebooting... 18:07:44.254 > [0;36m[ 6][D][esp32-hal-cpu.c:244] setCpuFrequencyMhz(): PLL: 480 / 2 = 240 Mhz, APB: 80000000 Hz 18:07:44.263 > E (167) psram: PSRAM ID read error: 0xffffffff 18:07:44.268 > [ 9][W][esp32-hal-psram.c:71] psramInit(): PSRAMCORRUPT HEAP: Bad tail at 0x3ffafd8a. Expected 0xbaad5678 got 0x06882099 18:07:44.710 > 18:07:44.710 > assert failed: multi_heap_free multi_heap_poisoning.c:253 (head != NULL) 18:07:44.716 > 18:07:44.716 > 18:07:44.717 > Backtrace:0x40083ccd:0x3ffaf4f00x4008e94d:0x3ffaf510 0x4009447d:0x3ffaf530 0x400940c3:0x3ffaf660 0x40084131:0x3ffaf680 0x400944ad:0x3ffaf6a0 0x400ecf38:0x3ffaf6c0 0x400d725e:0x3ffaf6e0 => 0x400d725e: emac_enc28j60_task at .pio/libdeps/MQTT-Debug/ESP32-ENC28J60/src/extmod/esp_eth_mac_enc28j60.c:770 18:07:44.733 > 18:07:44.733 > 18:07:44.733 > 18:07:44.733 > 18:07:44.749 > ELF file SHA256: 0000000000000000 18:07:44.749 > 18:07:44.749 > Rebooting... 18:07:44.982 > [0;36m[ 6][D][esp32-hal-cpu.c:244] setCpuFrequencyMhz(): PLL: 480 / 2 = 240 Mhz, APB: 80000000 Hz 18:07:44.993 > E (166) psram: PSRAM ID read error: 0xffffffff 18:07:44.997 > [ 9][W][esp32-hal-psram.c:71] psramInit(): PSRAMCORRUPT HEAP: Bad tail at 0x3ffafd8a. Expected 0xbaad5678 got 0x06883a99 18:07:45.298 > 18:07:45.299 > assert failed: multi_heap_free multi_heap_poisoning.c:253 (head != NULL) 18:07:45.305 > 18:07:45.305 > 18:07:45.305 > Backtrace:0x40083ccd:0x3ffaf4f00x4008e94d:0x3ffaf510 0x4009447d:0x3ffaf530 0x400940c3:0x3ffaf660 0x40084131:0x3ffaf680 0x400944ad:0x3ffaf6a0 0x400ecf38:0x3ffaf6c0 0x400d725e:0x3ffaf6e0

Otherwise thanks for the work you did :)

BR

rebooting ESP32 after Connection started

hi ,
I'm using the ETH_ENC28J60 example , and directly flash to esp32dev module without changing program, I'm using node MCU ESP-32s v1.1 development board. The program always restart after connection started. also use the same 10 pin ethernet module mentioned in this document,

Ethernet LAN module connected with esp32 according to the configuration

#define SPI_HOST 1
#define SPI_CLOCK_MHZ 8
#define INT_GPIO 4

#define MISO_GPIO 12
#define MOSI_GPIO 13
#define SCLK_GPIO 14
#define CS_GPIO 15

Serial monitor always shows like this

mode:DIO, clock div:1
load:0x3fff0030,len:1344
load:0x40078000,len:13864
load:0x40080400,len:3608
entry 0x400805f0
ETH Started
Connecting...
Connecting...
ETH Connected
Guru Meditation Error: Core 1 panic'ed (Unhandled debug exception).
Debug exception reason: Stack canary watchpoint triggered (enc28j60_tsk)
Core 1 register dump:
PC : 0x40083e61 PS : 0x00060f36 A0 : 0x80083f18 A1 : 0x3ffaefa0
A2 : 0x00000054 A3 : 0x00001800 A4 : 0x00001004 A5 : 0x00000000
A6 : 0x00000000 A7 : 0x3ffb0874 A8 : 0x3ffaf0c0 A9 : 0x3ffaf090
A10 : 0x3ffb0874 A11 : 0xffffffff A12 : 0x3ffb8000 A13 : 0x00000000
A14 : 0x3ffb6f84 A15 : 0x00000022 SAR : 0x00000004 EXCCAUSE: 0x00000001
EXCVADDR: 0x00000000 LBEG : 0x4008a855 LEND : 0x4008a865 LCOUNT : 0xfffffffb

Backtrace:0x40083e5e:0x3ffaefa00x40083f15:0x3ffaefd0 0x40083f45:0x3ffaeff0 0x400930f1:0x3ffaf010 0x4008df61:0x3ffaf030 0x4008e21c:0x3ffaf050 0x40085038:0x3ffaf070 0x4008506a:0x3ffaf090 0x400851e1:0x3ffaf0c0 0x400e8a89:0x3ffaf0e0 0x400e7d87:0x3ffaf100 0x400e75bd:0x3ffaf120 0x4008a599:0x3ffaf140 0x40088f06:0x3ffaf160 0x40088f90:0x3ffaf180 0x4008947d:0x3ffaf1b0 0x4016102b:0x3ffaf1e0 0x4015a6f3:0x3ffaf200 0x4015a871:0x3ffaf510 0x4016c695:0x3ffaf540 0x40092e6d:0x3ffaf570 0x400dd966:0x3ffaf5c0 0x400de3a6:0x3ffaf5f0 0x400de500:0x3ffaf620 0x400d3754:0x3ffaf640 0x400d3afd:0x3ffaf6a0 0x400d391b:0x3ffaf6e0

ELF file SHA256: 0000000000000000

Rebooting...

please help me to solve this problem
thank you

Example not working

Hi @tobozo ...

How are you ?

I had time to try your example... .

This is my code...

#include <esp32fota.h>
#include "automatic_ota.h"
#include <ESP32-ENC28J60.h>

const char *firmware_name = "esp32-fota-http";
const bool check_signature = false;
const bool disable_security = true;

#define SPI_HOST 1
#define SPI_CLOCK_MHZ 20
#define INT_GPIO 4
#define MISO_GPIO 12
#define MOSI_GPIO 13
#define SCLK_GPIO 14
#define CS_GPIO 15

int firmware_version_major = 1;
int firmware_version_minor = 0;
int firmware_version_patch = 0;

esp32FOTA FOTA; // empty constructor

static bool eth_connected = false;

// using WiFiEvent to handle Ethernet events :-)
void WiFiEvent(WiFiEvent_t event)
{
    switch (event)
    {
    case ARDUINO_EVENT_ETH_START:
        Serial.println("ETH Started");
        ETH.setHostname("esp32-ethernet");
        break;
    case ARDUINO_EVENT_ETH_CONNECTED:
        Serial.println("ETH Connected");
        break;
    case ARDUINO_EVENT_ETH_GOT_IP:
        Serial.printf("ETH MAC: %s, IPv4: %s%s, %dMbps\n", ETH.macAddress().c_str(), ETH.localIP().toString().c_str(), ETH.fullDuplex() ? ", FULL_DUPLEX" : "", ETH.linkSpeed());
        eth_connected = true;
        break;
    case ARDUINO_EVENT_ETH_DISCONNECTED:
        Serial.println("ETH Disconnected");
        eth_connected = false;
        break;
    case ARDUINO_EVENT_ETH_STOP:
        Serial.println("ETH Stopped");
        eth_connected = false;
        break;
    default:
        break;
    }
}

static bool EthernetConnected()
{
    return eth_connected;
}

/**
 * @brief  Function to do the setup for the ota
 * @param  None
 * @retval None
 */
void Setup_automatic_ota(void)
{
    Serial.begin(115200);
    {
        auto cfg = FOTA.getConfig();
        cfg.name = firmware_name;
        cfg.manifest_url = FOTA_URL;
        cfg.sem = SemverClass(firmware_version_major, firmware_version_minor, firmware_version_patch);
        cfg.check_sig = check_signature;
        cfg.unsafe = disable_security;
        // cfg.root_ca      = MyRootCA;
        // cfg.pub_key      = MyRSAKey;
        FOTA.setConfig(cfg);
        FOTA.setStatusChecker(EthernetConnected);
    }
    WiFi.onEvent(WiFiEvent);
    ETH.begin(MISO_GPIO, MOSI_GPIO, SCLK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, SPI_HOST);
}
/**
 * @brief  Function to loop the ota
 * @param  None
 * @retval None
 */
void Loop_automatic_ota(void)
{
    if (!eth_connected)
    {
        Serial.println("Connecting...");
        delay(1000);
        return;
    }
    FOTA.handle();
    delay(20000);
}`

i am getting the following issue..

ETH Started
Connecting...
Connecting...
ETH Connected
Connecting...
Connecting...
Connecting...
ETH MAC: 02:00:00:12:34:56, IPv4: 192.168.0.39, FULL_DUPLEX, 10Mbps
[ 22066][E][ssl_client.cpp:37] _handle_error(): [start_ssl_client():276]: (-29312) SSL - The connection indicated an EOF
[ 22067][E][WiFiClientSecure.cpp:135] connect(): start_ssl_client: -29312
[ 52076][E][ssl_client.cpp:37] _handle_error(): [start_ssl_client():276]: (-29312) SSL - The connection indicated an EOF
[ 52077][E][WiFiClientSecure.cpp:135] connect(): start_ssl_client: -29312
[ 84085][E][ssl_client.cpp:37] _handle_error(): [start_ssl_client():276]: (-29312) SSL - The connection indicated an EOF
[ 84085][E][WiFiClientSecure.cpp:135] connect(): start_ssl_client: -29312
[126096][E][ssl_client.cpp:37] _handle_error(): [start_ssl_client():276]: (-29312) SSL - The connection indicated an EOF
[126096][E][WiFiClientSecure.cpp:135] connect(): start_ssl_client: -29312
[159106][E][ssl_client.cpp:37] _handle_error(): [start_ssl_client():276]: (-29312) SSL - The connection indicated an EOF
[159106][E][WiFiClientSecure.cpp:135] connect(): start_ssl_client: -29312
[198119][E][ssl_client.cpp:37] _handle_error(): [start_ssl_client():276]: (-80) UNKNOWN ERROR CODE (0050)
[198120][E][WiFiClientSecure.cpp:135] connect(): start_ssl_client: -80
[236130][E][ssl_client.cpp:37] _handle_error(): [start_ssl_client():276]: (-29312) SSL - The connection indicated an EOF
[236130][E][WiFiClientSecure.cpp:135] connect(): start_ssl_client: -29312
[270141][E][ssl_client.cpp:37] _handle_error(): [start_ssl_client():276]: (-29312) SSL - The connection indicated an EOF
[270141][E][WiFiClientSecure.cpp:135] connect(): start_ssl_client: -29312
[309151][E][ssl_client.cpp:37] _handle_error(): [start_ssl_client():276]: (-80) UNKNOWN ERROR CODE (0050)
[309152][E][WiFiClientSecure.cpp:135] connect(): start_ssl_client: -80
[342161][E][ssl_client.cpp:37] _handle_error(): [start_ssl_client():276]: (-29312) SSL - The connection indicated an EOF
[342162][E][WiFiClientSecure.cpp:135] connect(): start_ssl_client: -29312
[376171][E][ssl_client.cpp:37] _handle_error(): [start_ssl_client():276]: (-29312) SS

The ethernet connection seems to work but not the ssl part...

Any idea ?

This is the fota file already tested with the wifi connection . .

{
"type": "esp32-fota-http",
"version": "2",
"port": 443,
"url": "https://systelfota.000webhostapp.com/update.bin"
}

Thanks a lot again

100 megabit & full duplex

Hi,

I read that the ENC28J60 does not do automatic handshaking for speed etc.
How do I get it do (always) setup a 100Mb and fullduplex session?

Regards

hii, I ran your code and it showed me the following error message

c:\Users\nethupama\Documents\Arduino\libraries\ESP32-ENC28J60\src\ESP32-ENC28J60.h:28:4: error: #error "This version of Arduino is too old"
   #error "This version of Arduino is too old"
    ^
In file included from c:\Users\nethupama\Documents\Arduino\libraries\ESP32-ENC28J60\src\ESP32-ENC28J60.cpp:25:0:
c:\Users\nethupama\Documents\Arduino\libraries\ESP32-ENC28J60\src\extmod/esp_eth_enc28j60.h:21:25: fatal error: esp_eth_phy.h: No such file or directory
compilation terminated.

exit status 1

Compilation error: exit status 1

I'm using the latest arduino ide which is 2.1.0.What is the reason for this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.