Page 1 of 1

ESP32 Ethernet for TCP/IP without internet connection

Posted: Mon Apr 03, 2023 6:32 pm
by kaushikmp8
Hi,
I am quite new to the ESP32 world.
Environment used: VS Code + IDF
Hardware: Lilygo ESP32-WROOM LAN8720A Ethernet board.

I am working with a ESP32 WROOM based Ethernet board which uses the LAN87XX chip.
The Ethernet/Basic example works well and I can get the Ethernet up when it is connected to a network.
However, I wish to directly connect the board to a Ethernet based device which is NOT on any network.
This device(sensor) has a staic IP address and I need to read data and store it locally on SD card.
This appliation is in remote rural area, so there is no network.

Based on what I read, I need to set a static IP for my device, bring up the Ethernet and TCP/IP stack and then begin
communication with my device.
However, I am not able to set static IP without a network connection.
The protocols\static_ip example works okay, but uses the esp_wifi_start to get a valid network before swithching to a Static IP.

Using piece of the code to set IP (esp_netif_set_ip_info), it fails as netif is NULL.

Any inputs would be highly appreciated!!!

The log is as follows: (Here I am using valid)

I (3533) esp_eth.netif.netif_glue: 02:00:00:12:34:56
I (3533) esp_eth.netif.netif_glue: ethernet attached to netif
I (7533) Example: Ethernet Started
I (7533) Example: Setting static IP
I (7533) Example: esp_netif_dhcpc_stop_api esp_netif:0x0
E (7533) esp_netif_lwip: dhcp client stop called with NULL api
E (7543) Example: Failed to stop dhcp client
I (7543) Example: Setting static IP... memset
I (7553) Example: Setting IP: IP, netmask, Gateway
I (7553) esp_netif_lwip: esp_netif_set_ip_info_api esp_netif:0x0
E (7563) Example: Failed to set ip info

Re: ESP32 Ethernet for TCP/IP without internet connection

Posted: Wed Aug 09, 2023 10:21 am
by bilicdav
Hello,

you can try first to set in menuconfig -> Component config -> LwIP -> Enable IPv4 Link-Local Addressing (AUTOIP).
Then your device will get IP address, and then you can try to change it. Tell me is it helpfull ?