ethernet example is not working

aalhadi
Posts: 6
Joined: Sun Feb 20, 2022 1:48 pm

ethernet example is not working

Postby aalhadi » Mon Feb 28, 2022 6:25 am

Hello
I'm trying to run the Ethernet project "basic"
I get the following error:

Code: Select all

09:24:14.577 -> [0;32mI (27) boot: ESP-IDF v4.3.1-dirty 2nd stage bootloader[0m
09:24:14.577 -> [0;32mI (27) boot: compile time 17:10:52[0m
09:24:14.577 -> [0;32mI (27) boot: chip revision: 1[0m
09:24:14.577 -> [0;32mI (30) boot_comm: chip revision: 1, min. bootloader chip revision: 0[0m
09:24:14.624 -> [0;32mI (38) boot.esp32: SPI Speed      : 40MHz[0m
09:24:14.624 -> [0;32mI (42) boot.esp32: SPI Mode       : DIO[0m
09:24:14.624 -> [0;32mI (47) boot.esp32: SPI Flash Size : 2MB[0m
09:24:14.624 -> [0;32mI (51) boot: Enabling RNG early entropy source...[0m
09:24:14.624 -> [0;32mI (57) boot: Partition Table:[0m
09:24:14.624 -> [0;32mI (60) boot: ## Label            Usage          Type ST Offset   Length[0m
09:24:14.624 -> [0;32mI (67) boot:  0 nvs              WiFi data        01 02 00009000 00006000[0m
09:24:14.624 -> [0;32mI (75) boot:  1 phy_init         RF data          01 01 0000f000 00001000[0m
09:24:14.671 -> [0;32mI (82) boot:  2 factory          factory app      00 00 00010000 00100000[0m
09:24:14.671 -> [0;32mI (90) boot: End of partition table[0m
09:24:14.671 -> [0;32mI (94) boot_comm: chip revision: 1, min. application chip revision: 0[0m
09:24:14.671 -> [0;32mI (101) esp_image: segment 0: paddr=00010020 vaddr=3f400020 size=0ee8ch ( 61068) map[0m
09:24:14.671 -> [0;32mI (132) esp_image: segment 1: paddr=0001eeb4 vaddr=3ffbdb60 size=01164h (  4452) load[0m
09:24:14.718 -> [0;32mI (134) esp_image: segment 2: paddr=00020020 vaddr=400d0020 size=2e4d8h (189656) map[0m
09:24:14.764 -> [0;32mI (206) esp_image: segment 3: paddr=0004e500 vaddr=3ffbecc4 size=01a08h (  6664) load[0m
09:24:14.764 -> [0;32mI (209) esp_image: segment 4: paddr=0004ff10 vaddr=40080000 size=0bff0h ( 49136) load[0m
09:24:14.812 -> [0;32mI (232) esp_image: segment 5: paddr=0005bf08 vaddr=50000000 size=00010h (    16) load[0m
09:24:14.812 -> [0;32mI (239) boot: Loaded app from partition at offset 0x10000[0m
09:24:14.812 -> [0;32mI (239) boot: Disabling RNG early entropy source...[0m
09:24:14.812 -> [0;32mI (252) cpu_start: Pro cpu up.[0m
09:24:14.812 -> [0;32mI (252) cpu_start: Starting app cpu, entry point is 0x40081184[0m
09:24:14.812 -> [0;32mI (239) cpu_start: App cpu up.[0m
09:24:14.859 -> [0;32mI (267) cpu_start: Pro cpu start user code[0m
09:24:14.859 -> [0;32mI (267) cpu_start: cpu freq: 160000000[0m
09:24:14.859 -> [0;32mI (267) cpu_start: Application information:[0m
09:24:14.859 -> [0;32mI (271) cpu_start: Project name:     ethernet_basic[0m
09:24:14.859 -> [0;32mI (277) cpu_start: App version:      1[0m
09:24:14.859 -> [0;32mI (281) cpu_start: Compile time:     Feb 28 2022 08:39:36[0m
09:24:14.859 -> [0;32mI (287) cpu_start: ELF file SHA256:  9a20da197149ff66...[0m
09:24:14.859 -> [0;32mI (293) cpu_start: ESP-IDF:          v4.3.1-dirty[0m
09:24:14.859 -> [0;32mI (299) heap_init: Initializing. RAM available for dynamic allocation:[0m
09:24:14.906 -> [0;32mI (306) heap_init: At 3FFAE6E0 len 0000F480 (61 KiB): DRAM[0m
09:24:14.906 -> [0;32mI (312) heap_init: At 3FFC2038 len 0001DFC8 (119 KiB): DRAM[0m
09:24:14.906 -> [0;32mI (318) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM[0m
09:24:14.906 -> [0;32mI (325) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM[0m
09:24:14.906 -> [0;32mI (331) heap_init: At 4008C000 len 00014000 (80 KiB): IRAM[0m
09:24:14.906 -> [0;32mI (338) spi_flash: detected chip: generic[0m
09:24:14.906 -> [0;32mI (342) spi_flash: flash io: dio[0m
09:24:14.906 -> [0;33mW (346) spi_flash: Detected size(4096k) larger than the size in the binary image header(2048k). Using the size in the binary image header.[0m
09:24:14.952 -> [0;32mI (360) cpu_start: Starting scheduler on PRO CPU.[0m
09:24:14.952 -> [0;32mI (0) cpu_start: Starting scheduler on APP CPU.[0m
09:24:14.952 -> [0;32mI (380) system_api: Base MAC address is not set[0m
09:24:14.952 -> [0;32mI (380) system_api: read default base MAC address from EFUSE[0m
09:24:14.952 -> [0;31mE (400) lan8720: lan8720_init(429): wrong chip ID[0m
09:24:14.952 -> [0;31mE (400) esp_eth: esp_eth_driver_install(205): init phy failed[0m
09:24:14.952 -> ESP_ERROR_CHECK failed: esp_err_t 0xffffffff (ESP_FAIL) at 0x400842fc
09:24:15.000 -> file: "../main/ethernet_example_main.c" line 147
09:24:15.000 -> func: app_main
09:24:15.000 -> expression: esp_eth_driver_install(&config, &eth_handle)
09:24:15.000 -> 
09:24:15.000 -> abort() was called at PC 0x400842ff on core 0
09:24:15.000 -> 
09:24:15.000 -> Backtrace:0x400853c7:0x3ffb2550 0x40085bb9:0x3ffb2570 0x4008b042:0x3ffb2590 0x400842ff:0x3ffb2600 0x400d641d:0x3ffb2620 0x400fe1f5:0x3ffb2690 0x40088d09:0x3ffb26b0
09:24:15.000 -> 
09:24:15.000 -> 
09:24:15.000 -> ELF file SHA256: 9a20da197149ff66
09:24:15.000 -> 
09:24:15.000 -> Rebooting...

ESP_Sprite
Posts: 9766
Joined: Thu Nov 26, 2015 4:08 am

Re: ethernet example is not working

Postby ESP_Sprite » Mon Feb 28, 2022 7:38 am

The error is: 'lan8720: lan8720_init(429): wrong chip ID'. Are you sure you're using the correct PHY and that it's wired up OK?

aalhadi
Posts: 6
Joined: Sun Feb 20, 2022 1:48 pm

Re: ethernet example is not working

Postby aalhadi » Mon Feb 28, 2022 8:20 am

ESP_Sprite wrote:
Mon Feb 28, 2022 7:38 am
The error is: 'lan8720: lan8720_init(429): wrong chip ID'. Are you sure you're using the correct PHY and that it's wired up OK?
OK the problem was that I needed to power on the Ethernet. I have a custom board with esp32
Sorry my fault
But now I have another problem. I don't get an IP address
This is the output

Code: Select all

11:16:14.375 -> [0;32mI (372) gpio: GPIO[2]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 [0m
11:16:14.375 -> [0;32mI (392) system_api: Base MAC address is not set[0m
11:16:14.375 -> [0;32mI (392) system_api: read default base MAC address from EFUSE[0m
11:16:14.375 -> [0;32mI (412) esp_eth.netif.glue: 9c:9c:1f:d0:4e:3f[0m
11:16:14.375 -> [0;32mI (412) esp_eth.netif.glue: ethernet attached to netif[0m
11:16:18.362 -> [0;33mW (4412) lan8720: auto negotiation timeout[0m
11:16:18.362 -> [0;32mI (4412) eth_example: Ethernet Started[0m
I have another custom board with an ethernet and the fw in there works fine. So, hw wise it should be fine. I flashed the example to that board but it's failing as well. So, the problem is probably sw not hw

aalhadi
Posts: 6
Joined: Sun Feb 20, 2022 1:48 pm

Re: ethernet example is not working

Postby aalhadi » Mon Feb 28, 2022 8:24 am

Here are my configurations
I didn't change or add any other configurations other than the defaults in the example
Attachments
eth1.PNG
eth1.PNG (9.81 KiB) Viewed 10914 times
eth2.PNG
eth2.PNG (16.17 KiB) Viewed 10914 times

ESP_ondrej
Posts: 211
Joined: Fri May 07, 2021 10:35 am

Re: ethernet example is not working

Postby ESP_ondrej » Wed Mar 23, 2022 1:48 pm

Could you please share more information about your "custom board with an ethernet and the fw in there works fine"? I couldn't say if the shared SW configuration is correct without knowledge of actual HW design.

Thanks

xien551
Posts: 69
Joined: Wed Feb 02, 2022 4:04 am

Re: ethernet example is not working

Postby xien551 » Thu Mar 24, 2022 12:42 am

I have a project would using Ethernet. And I try the example with en28J60. Everything is OK. Here is the serial output.
---------------------------------------------------
I (284) cpu_start: Application information:
I (289) cpu_start: Project name: enc28j60
I (294) cpu_start: App version: v5.0-dev-1389-g5dcd630444-dirty
I (301) cpu_start: Compile time: Mar 24 2022 08:31:33
I (307) cpu_start: ELF file SHA256: 361950d5342f2a0e...
I (313) cpu_start: ESP-IDF: v5.0-dev-1389-g5dcd630444-dirty
I (320) heap_init: Initializing. RAM available for dynamic allocation:
I (327) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (333) heap_init: At 3FFB3E48 len 0002C1B8 (176 KiB): DRAM
I (339) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (346) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (352) heap_init: At 4008D210 len 00012DF0 (75 KiB): IRAM
I (359) spi_flash: detected chip: generic
I (363) spi_flash: flash io: dio
W (367) spi_flash: Detected size(4096k) larger than the size in the binary image header(2048k). Using the size in the binary image header.
I (381) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (391) gpio: GPIO[4]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (401) enc28j60: revision: 6
I (421) esp_eth.netif.netif_glue: 02:00:00:12:34:56
I (421) esp_eth.netif.netif_glue: ethernet attached to netif
I (421) eth_example: Ethernet Started
-------------------------------------------------
So is there any problem with your board. If you are not sure, I suggest using 28j60 phy with official example instead of custom board.

ESP_ondrej
Posts: 211
Joined: Fri May 07, 2021 10:35 am

Re: ethernet example is not working

Postby ESP_ondrej » Thu Mar 24, 2022 7:20 am

Well, ENC28J60 could certainly do the job but I would strongly discourage everybody from using it for any new design. See the reasons why:
1) It supports only 10 Mbps
2) It has bunch of errata, I tried to address them in the latest example update, but still...
3) And most importantly, it has crazy power consumption which may cause chip instability if you use improper powering. See here for more information. In addition, power consumption should be a concern in general for any IoT solution.

xien551
Posts: 69
Joined: Wed Feb 02, 2022 4:04 am

Re: ethernet example is not working

Postby xien551 » Thu Mar 24, 2022 8:58 am

Thanks for your information, ESP_ondrej.

I will try 8720 and 83840 again with basic example.

xien551
Posts: 69
Joined: Wed Feb 02, 2022 4:04 am

Re: ethernet example is not working

Postby xien551 » Thu Mar 24, 2022 10:22 am

below is my serial output using above setting with LAN8720. Is it OK?
-------------------------------------------------------------------------------------
I (336) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (343) heap_init: At 4008BC04 len 000143FC (80 KiB): IRAM
I (350) spi_flash: detected chip: generic
I (354) spi_flash: flash io: dio
W (357) spi_flash: Detected size(4096k) larger than the size in the binary image header(2048k). Using the size in the binary image header.
I (372) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (381) system_api: Base MAC address is not set
I (391) system_api: read default base MAC address from EFUSE
I (411) esp_eth.netif.netif_glue: a4:e5:7c:db:99:9f
I (411) esp_eth.netif.netif_glue: ethernet attached to netif
I (1911) eth_example: Ethernet Started
I (1911) eth_example: Ethernet Link Up
I (1911) eth_example: Ethernet HW Addr a4:e5:7c:db:99:9f
I (4381) esp_netif_handlers: eth ip: 192.168.1.37, mask: 255.255.255.0, gw: 192.168.1.1
I (4381) eth_example: Ethernet Got IP Address
I (4381) eth_example: ~~~~~~~~~~~
I (4381) eth_example: ETHIP:192.168.1.37
I (4391) eth_example: ETHMASK:255.255.255.0
I (4391) eth_example: ETHGW:192.168.1.1
I (4401) eth_example: ~~~~~~~~~~~

ESP_ondrej
Posts: 211
Joined: Fri May 07, 2021 10:35 am

Re: ethernet example is not working

Postby ESP_ondrej » Thu Mar 24, 2022 10:26 am

Yes, it is correct. Now you can try "ping 192.168.1.37"

Who is online

Users browsing this forum: No registered users and 6 guests