66 ESP32 ethernetasic实验记录

Posted Chasing_Chasing

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了66 ESP32 ethernetasic实验记录相关的知识,希望对你有一定的参考价值。

1.引言

        最近买了一块esp32以太网开发板(如下图示),想测试esp32以太网功能,但新人上手肯定会遇到一些问题,特此记录。

2.实验 

        我的编译环境是:idf,而非arduino。使用的SDK是4.4版本。

        选择的demo是esp-idf-v4.4\\examples\\ethernet\\basic。遇到的问题是,编译配置esp32的ethernet\\basic demo后,烧录至设备,esp32上电不断重启,打印如下log。

I (254) cpu_start: Pro cpu up.
I (255) cpu_start: Starting app cpu, entry point is 0x400810b4
I (241) cpu_start: App cpu up.
I (269) cpu_start: Pro cpu start user code
I (269) cpu_start: cpu freq: 160000000
I (269) cpu_start: Application information:
I (273) cpu_start: Project name:     ethernet_basic
I (279) cpu_start: App version:      v4.4-dirty
I (284) cpu_start: Compile time:     Apr  7 2022 17:19:05
I (290) cpu_start: ELF file SHA256:  5753ad8f9d190cda...
I (296) cpu_start: ESP-IDF:          v4.4-dirty
I (302) heap_init: Initializing. RAM available for dynamic allocation:
I (309) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (315) heap_init: At 3FFB3BF8 len 0002C408 (177 KiB): DRAM
I (321) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (327) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (334) heap_init: At 4008B948 len 000146B8 (81 KiB): IRAM
I (341) spi_flash: detected chip: generic
I (345) spi_flash: flash io: dio
I (350) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
E (459) esp.emac: emac_esp32_init(355): reset timeout
E (459) esp_eth: esp_eth_driver_install(222): init mac failed
ESP_ERROR_CHECK failed: esp_err_t 0x107 (ESP_ERR_TIMEOUT) at 0x4008548c
file: "../main/ethernet_example_main.c" line 122
func: app_main
expression: esp_eth_driver_install(&config, &eth_handle)

abort() was called at PC 0x4008548f on core 0


Backtrace:0x40081926:0x3ffb6fe00x40085499:0x3ffb7000 0x4008a63a:0x3ffb7020 0x4008548f:0x3ffb7090 0x400d6361:0x3ffb70b0 0x400ffd11:0x3ffb7140 0x400880e5:0x3ffb7160 



        当然我肯定知道肯定要改一下代码或配置什么的,所以我就根据卖家提供的arduino代码对demo重新进行配置,如下图示。

        配置重新编译结果还是一样,期间因为我接的网线是带poe的线,网线有供电,导致开发板电流达到1A,急剧发热。然后按卖家提供资料的配置还是不行,所以以为是芯片坏了,烧掉了。

        后面看了下面官方的介绍,才知道自己少配置了。Ethernet - ESP32 - — ESP-IDF Programming Guide latest documentation

         下面的配置比较关键,是因为LAN8720A所使用的以太网电路没有外部晶振提供时钟的,如下图的第三种。

        LAN8720A所处于的模式是REF_CLK_IN模式,所以需要由esp32输出来提供50MHz时钟驱动网络芯片,因此配置完下面后,重新烧录代码就成功运行了。

        经过上述配置,成功运行以太网demo。

I (240) boot: Disabling RNG early entropy source...
I (254) cpu_start: Pro cpu up.
I (254) cpu_start: Starting app cpu, entry point is 0x400810b4
I (0) cpu_start: App cpu up.
I (268) cpu_start: Pro cpu start user code
I (268) cpu_start: cpu freq: 160000000
I (268) cpu_start: Application information:
I (273) cpu_start: Project name:     ethernet_basic
I (278) cpu_start: App version:      v4.4-dirty
I (283) cpu_start: Compile time:     Apr  7 2022 18:19:57
I (289) cpu_start: ELF file SHA256:  f076945ba85f01ea...
I (295) cpu_start: ESP-IDF:          v4.4-dirty
I (301) heap_init: Initializing. RAM available for dynamic allocation:
I (308) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (314) heap_init: At 3FFB3BF8 len 0002C408 (177 KiB): DRAM
I (320) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (327) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (333) heap_init: At 4008B948 len 000146B8 (81 KiB): IRAM
I (340) spi_flash: detected chip: generic
I (344) spi_flash: flash io: dio
I (349) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (369) system_api: Base MAC address is not set
I (369) system_api: read default base MAC address from EFUSE
I (389) esp_eth.netif.netif_glue: 78:e3:6d:1b:24:af
I (389) esp_eth.netif.netif_glue: ethernet attached to netif
I (4389) eth_example: Ethernet Started
I (6389) eth_example: Ethernet Link Up
I (6389) eth_example: Ethernet HW Addr 78:e3:6d:1b:24:af
I (8859) esp_netif_handlers: eth ip: 192.168.0.213, mask: 255.255.255.0, gw: 192.168.0.1
I (8859) eth_example: Ethernet Got IP Address
I (8859) eth_example: ~~~~~~~~~~~
I (8859) eth_example: ETHIP:192.168.0.213
I (8869) eth_example: ETHMASK:255.255.255.0
I (8869) eth_example: ETHGW:192.168.0.1
I (8879) eth_example: ~~~~~~~~~~~

over!

以上是关于66 ESP32 ethernetasic实验记录的主要内容,如果未能解决你的问题,请参考以下文章

ESP32 单片机学习笔记 - 06 - (以太网)Ethernet转Wifi

ESP32,ESP8266之间WiFi互联实验

ESP32基础应用之LVGL基础

ESP32基础应用之LVGL基础

手机ESP32单片机MQTT服务器连接实验

野路子学习esp32(十四) 学习ESP32真正的好东西 MicroPython 以及 1z实验室@a.宏万