espressif / esp-eth-drivers

Collection of additional Ethernet drivers for ESP-IDF
24 stars 16 forks source link

set ETH_RMII_CLK_MODE to output (IDFGH-8289) #6

Closed stkw0 closed 2 years ago

stkw0 commented 2 years ago

If RMII_CLK_MODE is set as input examples doesn't work and a reset timeout error is returned (see the next error message):

I (0) cpu_start: App cpu up.
I (310) cpu_start: Pro cpu start user code
I (310) cpu_start: cpu freq: 160000000 Hz
I (310) cpu_start: Application information:
I (315) cpu_start: Project name:     ksz8863_simple_switch
I (321) cpu_start: App version:      4bc3df6-dirty
I (327) cpu_start: Compile time:     Sep 12 2022 15:21:08
I (333) cpu_start: ELF file SHA256:  ff3ea4bf199cc89f...
I (339) cpu_start: ESP-IDF:          HEAD-HASH-NOTFOUND
I (345) heap_init: Initializing. RAM available for dynamic allocation:
I (352) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (358) heap_init: At 3FFB3FC8 len 0002C038 (176 KiB): DRAM
I (364) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (370) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (377) heap_init: At 4008ED80 len 00011280 (68 KiB): IRAM
I (384) spi_flash: detected chip: gd
I (387) spi_flash: flash io: dio
I (392) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
W (402) simple_switch_example: Simple Switch mode Example...

E (512) esp.emac: emac_esp32_init(361): reset timeout
E (512) esp_eth: esp_eth_driver_install(228): init mac failed
ESP_ERROR_CHECK failed: esp_err_t 0x107 (ESP_ERR_TIMEOUT) at 0x400d757c
0x400d757c: app_main at /home/droman/Develop/Projects/esp-eth-drivers/ksz8863/examples/simple_switch/main/simple_switch_main.c:170 (discriminator 1)

file: "./main/simple_switch_main.c" line 170
func: app_main
expression: esp_eth_driver_install(&config, &eth_handle)

abort() was called at PC 0x40087c83 on core 0
0x40087c83: _esp_error_check_failed at /usr/share/esp-idf/components/esp_system/esp_err.c:47

Backtrace: 0x40081d6a:0x3ffb6a10 0x40087c8d:0x3ffb6a30 0x4008d84e:0x3ffb6a50 0x40087c83:0x3ffb6ac0 0x400d757c:0x3ffb6af0 0x401046bc:0x3ffb6b80 0x4008a835:0x3ffb6ba0
0x40081d6a: panic_abort at /usr/share/esp-idf/components/esp_system/panic.c:408

0x40087c8d: esp_system_abort at /usr/share/esp-idf/components/esp_system/esp_system.c:135

0x4008d84e: abort at /usr/share/esp-idf/components/newlib/abort.c:38

0x40087c83: _esp_error_check_failed at /usr/share/esp-idf/components/esp_system/esp_err.c:47

0x400d757c: app_main at /home/droman/Develop/Projects/esp-eth-drivers/ksz8863/examples/simple_switch/main/simple_switch_main.c:170 (discriminator 1)

0x401046bc: main_task at /usr/share/esp-idf/components/freertos/FreeRTOS-Kernel/portable/port_common.c:131

0x4008a835: vPortTaskWrapper at /usr/share/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:151
kostaond commented 2 years ago

@stkw0 thank you for your contribution! However, it is not intended to make any changes to sdkconfig.defaults. It is just a "default" configuration to start with as the name of the file suggests. If you need to configure examples to fit your HW design, please do so via idf.py menuconfig. In the configuration menu go to Component config -> Ethernet -> Support ESP32 internal EMAC controller -> RMII clock mode -> Output RMII clock from internal.

Please let me know if it resolved your needs. If so, please close this PR.

stkw0 commented 2 years ago

Sorry, I'm not a hardware guy, my coworker is the one who did the hardware part. So, if I understand it correctly, the RMII clock mode is not related to how ksz8863 chip works but how it's connected?

kostaond commented 2 years ago

@stkw0 please have a look to ESP32 doc to learn more about EMAC and PHY configuration. If you had any follow-up questions, do not hesitate to ask - you can open a thread at ESP32 forum.

stkw0 commented 2 years ago

Thank you very much and sorry for any inconvenience.