CarlosDerSeher / snapclient

snapclient on ESP32
GNU General Public License v3.0
101 stars 14 forks source link

Ethernet component under IDF v5 #82

Open whc2001 opened 1 month ago

whc2001 commented 1 month ago

Testing with sync_with_sample_stuffing branch under ESP-IDF v5.2.1:

[1178/1255] Building C object esp-idf/main/CMakeFiles/__idf_main.dir/main.c.obj
FAILED: esp-idf/main/CMakeFiles/__idf_main.dir/main.c.obj
ccache E:\Espressif\tools\xtensa-esp-elf\esp-13.2.0_20230928\xtensa-esp-elf\bin\xtensa-esp32-elf-gcc.exe -DESP_PLATFORM -DIDF_VER=\"v5.2.1\" -DMBEDTLS_CONFIG_FILE=\"mbedtls/esp_config.h\" -DSOC_MMU_PAGE_SIZE=CONFIG_MMU_PAGE_SIZE -DSOC_XTAL_FREQ_MHZ=CONFIG_XTAL_FREQ -D_GLIBCXX_HAVE_POSIX_SEMAPHORE -D_GLIBCXX_USE_POSIX_SEMAPHORE -D_GNU_SOURCE -D_POSIX_READER_WRITER_LOCKS -ID:/Git/snapclient/build/config -ID:/Git/snapclient/main -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/newlib/platform_include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/freertos/config/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/freertos/config/include/freertos -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/freertos/config/xtensa/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/freertos/FreeRTOS-Kernel/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/freertos/FreeRTOS-Kernel/portable/xtensa/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/freertos/FreeRTOS-Kernel/portable/xtensa/include/freertos -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/freertos/esp_additions/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/esp_hw_support/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/esp_hw_support/include/soc -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/esp_hw_support/include/soc/esp32 -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/esp_hw_support/port/esp32/. -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/heap/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/log/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/soc/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/soc/esp32 -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/soc/esp32/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/hal/platform_port/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/hal/esp32/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/hal/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/esp_rom/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/esp_rom/include/esp32 -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/esp_rom/esp32 -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/esp_common/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/esp_system/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/esp_system/port/soc -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/esp_system/port/include/private -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/xtensa/esp32/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/xtensa/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/xtensa/deprecated_include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/lwip/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/lwip/include/apps -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/lwip/include/apps/sntp -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/lwip/lwip/src/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/lwip/port/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/lwip/port/freertos/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/lwip/port/esp32xx/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/lwip/port/esp32xx/include/arch -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/lwip/port/esp32xx/include/sys -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/esp_timer/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/esp_wifi/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/esp_wifi/wifi_apps/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/esp_event/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/esp_phy/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/esp_phy/esp32/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/esp_netif/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/nvs_flash/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/spi_flash/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/esp_partition/include -ID:/Git/snapclient/components/wifi_interface/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/wifi_provisioning/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/protocomm/include/common -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/protocomm/include/security -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/protocomm/include/transports -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/protocomm/include/crypto/srp6a -ID:/Git/snapclient/components/audio_board/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/driver/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/driver/deprecated -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/driver/analog_comparator/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/driver/dac/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/driver/gpio/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/driver/gptimer/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/driver/i2c/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/driver/i2s/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/driver/ledc/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/driver/mcpwm/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/driver/parlio/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/driver/pcnt/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/driver/rmt/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/driver/sdio_slave/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/driver/sdmmc/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/driver/sigma_delta/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/driver/spi/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/driver/temperature_sensor/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/driver/touch_sensor/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/driver/twai/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/driver/uart/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/driver/usb_serial_jtag/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/driver/touch_sensor/esp32/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/esp_pm/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/esp_ringbuf/include -ID:/Git/snapclient/components/dsp_processor/include -ID:/Git/snapclient/components/audio_hal/include -ID:/Git/snapclient/components/audio_hal/driver/es8388 -ID:/Git/snapclient/components/audio_hal/driver/es8374 -ID:/Git/snapclient/components/audio_hal/driver/es8311 -ID:/Git/snapclient/components/audio_hal/driver/es8156 -ID:/Git/snapclient/components/audio_hal/driver/es7243 -ID:/Git/snapclient/components/audio_hal/driver/es7148 -ID:/Git/snapclient/components/audio_hal/driver/es7210 -ID:/Git/snapclient/components/audio_hal/driver/es7243e -ID:/Git/snapclient/components/audio_hal/driver/tas5805m -ID:/Git/snapclient/components/audio_hal/driver/include -ID:/Git/snapclient/components/audio_hal/driver/zl38063 -ID:/Git/snapclient/components/audio_hal/driver/zl38063/api_lib -ID:/Git/snapclient/components/audio_hal/driver/zl38063/example_apps -ID:/Git/snapclient/components/audio_hal/driver/zl38063/firmware -ID:/Git/snapclient/components/audio_sal/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/efuse/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/efuse/esp32/include -ID:/Git/snapclient/components/net_functions/include -ID:/Git/snapclient/managed_components/espressif__mdns/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/console -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/vfs/include -ID:/Git/snapclient/components/opus -ID:/Git/snapclient/components/opus/opus/include -ID:/Git/snapclient/components/opus/opus/silk -ID:/Git/snapclient/components/opus/opus/silk/fixed -ID:/Git/snapclient/components/opus/opus/silk/float -ID:/Git/snapclient/components/opus/opus/celt -ID:/Git/snapclient/components/flac -ID:/Git/snapclient/components/flac/flac/include -ID:/Git/snapclient/components/ota_server/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/app_update/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/bootloader_support/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/bootloader_support/bootloader_flash/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/esp_app_format/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/esp_bootloader_format/include -ID:/Git/snapclient/components/lightsnapcast/include -ID:/Git/snapclient/components/custom_board/generic_board/include -ID:/Git/snapclient/components/custom_board/pt8211/include -ID:/Git/snapclient/components/libbuffer/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/json/cJSON -ID:/Git/snapclient/components/libmedian/include -ID:/Git/snapclient/components/ui_http_server/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/spiffs/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/esp_http_server/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/http_parser -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/mbedtls/port/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/mbedtls/mbedtls/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/mbedtls/mbedtls/library -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/mbedtls/mbedtls/3rdparty/everest/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/mbedtls/mbedtls/3rdparty/p256-m -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/mbedtls/mbedtls/3rdparty/p256-m/p256-m -ID:/Git/snapclient/managed_components/espressif__esp-dsp/modules/dotprod/include -ID:/Git/snapclient/managed_components/espressif__esp-dsp/modules/support/include -ID:/Git/snapclient/managed_components/espressif__esp-dsp/modules/support/mem/include -ID:/Git/snapclient/managed_components/espressif__esp-dsp/modules/windows/include -ID:/Git/snapclient/managed_components/espressif__esp-dsp/modules/windows/hann/include -ID:/Git/snapclient/managed_components/espressif__esp-dsp/modules/windows/blackman/include -ID:/Git/snapclient/managed_components/espressif__esp-dsp/modules/windows/blackman_harris/include -ID:/Git/snapclient/managed_components/espressif__esp-dsp/modules/windows/blackman_nuttall/include -ID:/Git/snapclient/managed_components/espressif__esp-dsp/modules/windows/nuttall/include -ID:/Git/snapclient/managed_components/espressif__esp-dsp/modules/windows/flat_top/include -ID:/Git/snapclient/managed_components/espressif__esp-dsp/modules/iir/include -ID:/Git/snapclient/managed_components/espressif__esp-dsp/modules/fir/include -ID:/Git/snapclient/managed_components/espressif__esp-dsp/modules/math/include -ID:/Git/snapclient/managed_components/espressif__esp-dsp/modules/math/add/include -ID:/Git/snapclient/managed_components/espressif__esp-dsp/modules/math/sub/include -ID:/Git/snapclient/managed_components/espressif__esp-dsp/modules/math/mul/include -ID:/Git/snapclient/managed_components/espressif__esp-dsp/modules/math/addc/include -ID:/Git/snapclient/managed_components/espressif__esp-dsp/modules/math/mulc/include -ID:/Git/snapclient/managed_components/espressif__esp-dsp/modules/math/sqrt/include -ID:/Git/snapclient/managed_components/espressif__esp-dsp/modules/matrix/mul/include -ID:/Git/snapclient/managed_components/espressif__esp-dsp/modules/matrix/add/include -ID:/Git/snapclient/managed_components/espressif__esp-dsp/modules/matrix/addc/include -ID:/Git/snapclient/managed_components/espressif__esp-dsp/modules/matrix/mulc/include -ID:/Git/snapclient/managed_components/espressif__esp-dsp/modules/matrix/sub/include -ID:/Git/snapclient/managed_components/espressif__esp-dsp/modules/matrix/include -ID:/Git/snapclient/managed_components/espressif__esp-dsp/modules/fft/include -ID:/Git/snapclient/managed_components/espressif__esp-dsp/modules/dct/include -ID:/Git/snapclient/managed_components/espressif__esp-dsp/modules/conv/include -ID:/Git/snapclient/managed_components/espressif__esp-dsp/modules/common/include -ID:/Git/snapclient/managed_components/espressif__esp-dsp/modules/matrix/mul/test/include -ID:/Git/snapclient/managed_components/espressif__esp-dsp/modules/kalman/ekf/include -ID:/Git/snapclient/managed_components/espressif__esp-dsp/modules/kalman/ekf_imu13states/include -mlongcalls -Wno-frame-address  -fdiagnostics-color=always -ffunction-sections -fdata-sections -Wall -Werror=all -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=unused-but-set-variable -Wno-error=deprecated-declarations -Wextra -Wno-unused-parameter -Wno-sign-compare -Wno-enum-conversion -gdwarf-4 -ggdb -O2 -fmacro-prefix-map=D:/Git/snapclient=. -fmacro-prefix-map=E:/Espressif/frameworks/esp-idf-v5.2.1=/IDF -Wno-address -Wno-use-after-free -Wno-xor-used-as-pow -fstrict-volatile-bitfields -fno-jump-tables -fno-tree-switch-conversion -std=gnu17 -Wno-old-style-declaration -Wno-enum-int-mismatch -MD -MT esp-idf/main/CMakeFiles/__idf_main.dir/main.c.obj -MF esp-idf\main\CMakeFiles\__idf_main.dir\main.c.obj.d -o esp-idf/main/CMakeFiles/__idf_main.dir/main.c.obj -c D:/Git/snapclient/main/main.c
D:/Git/snapclient/main/main.c:21:10: fatal error: eth_interface.h: No such file or directory
   21 | #include "eth_interface.h"
      |          ^~~~~~~~~~~~~~~~~
compilation terminated.

After adding eth_interface into the PRIV_REQUIRES statement in main/CMakeList.txt:

[887/1255] Building C object esp-idf/eth_interface/CMakeFiles/__idf_eth_interface.dir/eth_interface.c.obj
FAILED: esp-idf/eth_interface/CMakeFiles/__idf_eth_interface.dir/eth_interface.c.obj
ccache E:\Espressif\tools\xtensa-esp-elf\esp-13.2.0_20230928\xtensa-esp-elf\bin\xtensa-esp32-elf-gcc.exe -DESP_PLATFORM -DIDF_VER=\"v5.2.1\" -DSOC_MMU_PAGE_SIZE=CONFIG_MMU_PAGE_SIZE -DSOC_XTAL_FREQ_MHZ=CONFIG_XTAL_FREQ -D_GLIBCXX_HAVE_POSIX_SEMAPHORE -D_GLIBCXX_USE_POSIX_SEMAPHORE -D_GNU_SOURCE -D_POSIX_READER_WRITER_LOCKS -ID:/Git/snapclient/build/config -ID:/Git/snapclient/components/eth_interface/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/newlib/platform_include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/freertos/config/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/freertos/config/include/freertos -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/freertos/config/xtensa/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/freertos/FreeRTOS-Kernel/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/freertos/FreeRTOS-Kernel/portable/xtensa/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/freertos/FreeRTOS-Kernel/portable/xtensa/include/freertos -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/freertos/esp_additions/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/esp_hw_support/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/esp_hw_support/include/soc -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/esp_hw_support/include/soc/esp32 -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/esp_hw_support/port/esp32/. -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/heap/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/log/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/soc/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/soc/esp32 -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/soc/esp32/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/hal/platform_port/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/hal/esp32/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/hal/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/esp_rom/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/esp_rom/include/esp32 -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/esp_rom/esp32 -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/esp_common/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/esp_system/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/esp_system/port/soc -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/esp_system/port/include/private -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/xtensa/esp32/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/xtensa/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/xtensa/deprecated_include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/lwip/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/lwip/include/apps -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/lwip/include/apps/sntp -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/lwip/lwip/src/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/lwip/port/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/lwip/port/freertos/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/lwip/port/esp32xx/include -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/lwip/port/esp32xx/include/arch -IE:/Espressif/frameworks/esp-idf-v5.2.1/components/lwip/port/esp32xx/include/sys -mlongcalls -Wno-frame-address  -fdiagnostics-color=always -ffunction-sections -fdata-sections -Wall -Werror=all -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=unused-but-set-variable -Wno-error=deprecated-declarations -Wextra -Wno-unused-parameter -Wno-sign-compare -Wno-enum-conversion -gdwarf-4 -ggdb -O2 -fmacro-prefix-map=D:/Git/snapclient=. -fmacro-prefix-map=E:/Espressif/frameworks/esp-idf-v5.2.1=/IDF -Wno-address -Wno-use-after-free -Wno-xor-used-as-pow -fstrict-volatile-bitfields -fno-jump-tables -fno-tree-switch-conversion -std=gnu17 -Wno-old-style-declaration -Wno-enum-int-mismatch -MD -MT esp-idf/eth_interface/CMakeFiles/__idf_eth_interface.dir/eth_interface.c.obj -MF esp-idf\eth_interface\CMakeFiles\__idf_eth_interface.dir\eth_interface.c.obj.d -o esp-idf/eth_interface/CMakeFiles/__idf_eth_interface.dir/eth_interface.c.obj -c D:/Git/snapclient/components/eth_interface/eth_interface.c
D:/Git/snapclient/components/eth_interface/eth_interface.c:11:10: fatal error: driver/gpio.h: No such file or directory
   11 | #include "driver/gpio.h"
      |          ^~~~~~~~~~~~~~~
compilation terminated.
...
Compilation failed because eth_interface.c (in "eth_interface" component) includes driver/gpio.h, provided by driver component(s).
However, driver component(s) is not in the requirements list of "eth_interface".
To fix this, add driver to PRIV_REQUIRES list of idf_component_register call in D:\Git\snapclient\components\eth_interface\CMakeLists.txt.

Tried to add REQUIRES driver or PRIV_REQUIRES driver to the idf_component_register statement in components/eth_interface/CMakeLists.txt, still the same error.

CarlosDerSeher commented 1 month ago

Supported IDF version is ESP-IDF v5.1.1

whc2001 commented 1 month ago

Supported IDF version is ESP-IDF v5.1.1

Unfortunately I tried with v5.1 and the result is the same. I have checked the migrating guide and it does not mention anything about peripheral from v5.1 to v5.2, only v4 to v5, which I already did but no good.

CarlosDerSeher commented 1 month ago

Ok so I must have broken something doing the upgrade to IDF v5 . I'll check as soon as I can. What you can try in the meantime is to find the original Ethernet Basic Example from IDF v5.1.1 and see if you can replace it in eth_interface. I took this example and adapted it to my needs but it is based on IDF v4.3 and that's probably the issue

CarlosDerSeher commented 1 month ago

I did a quick check and it seems they changed a few things in this example. So there's gonna be some more work to do on that end I guess

whc2001 commented 1 month ago

I attempted to port the newer example to this project, but interestingly it failed with the exact same problem. I am starting to think I got a broken environment, as I followed the suggestion exactly. I'll try again later with a fresh install of v5.1 in a Linux environment.

image

CarlosDerSeher commented 1 month ago

@whc2001 ok I am a bit lost here ...

#include "driver/gpio.h"
#include "esp_eth.h"
#include "esp_event.h"
#include "esp_log.h"
#include "esp_netif.h"

The only inclusion which is found seems to be #include "esp_log.h" but I don't know why it isn't.

I've tried adding esp_eth to wifi_interface component and also add #include "esp_eth.h" and it is found without any issue. The only difference in the Cmakelist file is the if else part which I also temporary removed without any luck.

Not sure if this is related but I found #define CONFIG_ETH_USE_SPI_ETHERNET 1 in sdkconfig.h but I selected the internal MAC. Maybe there is some problematic kconfig code?

CarlosDerSeher commented 1 month ago

Ok so it seems you'll need to replace Cmakefilelist.txt content of eth_interface component by this

idf_component_register(SRCS "eth_interface.c"
                       INCLUDE_DIRS "include"
                       REQUIRES driver esp_eth esp_netif)

To make those inclusion errors go away. You'll still need to port the code afterwards. Not sure why the if else isn't working as expected anymore...

whc2001 commented 1 month ago

Ok so it seems you'll need to replace Cmakefilelist.txt content of eth_interface component by this

idf_component_register(SRCS "eth_interface.c"
                       INCLUDE_DIRS "include"
                       REQUIRES driver esp_eth esp_netif)

To make those inclusion errors go away. You'll still need to port the code afterwards. Not sure why the if else isn't working as expected anymore...

I got a new Linux environment and tried this, still complaining about unable to find driver/gpio.h. Not sure about what to do at this point...

whc2001 commented 1 month ago

I don't know what I did but the the driver/gpio.h is now working, however the main.c is still using WiFi. After some fiddling I found that the if guard in the CMakeList.txt of eth_interface is not working somehow. I deleted everything only keeping the idf_component_register line, and after fixing some careless error in .c and .h when porting it compiled without problem (I didn't plug in the module so it keeps crashing): image

whc2001 commented 1 month ago

Can you please check this, seems like it's compiling for me. My ESP32 board does not have GPIO21 broken out so I need to get another one to test on hardware...

https://github.com/whc2001/snapclient/tree/idf_v5_eth

CarlosDerSeher commented 1 month ago

After some fiddling I found that the if guard in the CMakeList.txt of eth_interface is not working somehow. I deleted everything only keeping the idf_component_register line

That's what I meant with my comment above.

I'll try as soon as I can

whc2001 commented 1 month ago

Seems no good. Added some debug print:

E (904) snapclient_eth_init: >>>>> init Ethernet - calloc
E (914) snapclient_eth_init: >>>>> init internal Ethernet - init_internal
E (922) snapclient_eth_init: >>>>> init internal Ethernet - new_esp32
E (929) snapclient_eth_init: >>>>> init internal Ethernet - new_esp32 done, x = 1073487700
E (938) snapclient_eth_init: >>>>> init internal Ethernet - new_lan87xx
E (945) snapclient_eth_init: >>>>> init internal Ethernet - new_lan87xx done, x = 1073495584
E (954) snapclient_eth_init: >>>>> init internal Ethernet - driver_install
E (1072) eth_phy_802_3: esp_eth_phy_802_3_pwrctl(250): power up timeout
E (1072) eth_phy_802_3: esp_eth_phy_802_3_basic_phy_init(433): power control failed
E (1076) lan87xx: lan87xx_init(341): failed to init PHY
E (1082) esp_eth: esp_eth_driver_install(229): init phy failed
E (1089) snapclient_eth_init: eth_init_internal(109): Ethernet driver install failed
E (1097) snapclient_eth_init: >>>>> init internal Ethernet done, x = 0
E (1104) snapclient_eth_init: original_eth_init(281): internal Ethernet init failed
ESP_ERROR_CHECK failed: esp_err_t 0xffffffff (ESP_FAIL) at 0x400daaa6
file: "./components/eth_interface/eth_interface.c" line 385
func: eth_init
expression: original_eth_init(&eth_handles, &eth_port_cnt)

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

Backtrace: 0x40081c89:0x3ffb84c0 0x4008988d:0x3ffb84e0 0x4008d0a1:0x3ffb8500 0x40089883:0x3ffb8570 0x400daaa6:0x3ffb85a0 0x400da6db:0x3ffb8620 0x4014b012:0x3ffb8680

Not sure if it's the driver or the knockoff Waveshare LAN8720A module. Gonna inspect further later...

DerPicknicker commented 1 month ago

I can't tell you @whc2001 how much I love the docker image. This IDF stuff is really annoying to install. So maybe use the docker image instead for getting your dev machine ready. I know that it's code related see this as a friendly suggestion;-)

CarlosDerSeher commented 1 month ago

@whc2001 OK i found the problem. First you forgot to enable this in main.c

#if CONFIG_SNAPCLIENT_USE_INTERNAL_ETHERNET || \
        CONFIG_SNAPCLIENT_USE_SPI_ETHERNET

Altough I am not sure if you'll need this as I don't know how you provide the clock to your LAN8720. This is specific to the my board design.

Another thing you need to add right after this line is

  esp32_emac_config.clock_config.rmii.clock_mode = EMAC_CLK_EXT_IN;
  esp32_emac_config.clock_config.rmii.clock_gpio = 0;

With these changes my Ethernet chip initializes and starts up correctly. I am looking forward to your pull request :)

whc2001 commented 1 month ago

I can't tell you @whc2001 how much I love the docker image. This IDF stuff is really annoying to install. So maybe use the docker image instead for getting your dev machine ready. I know that it's code related see this as a friendly suggestion;-)

Thanks, I already got the environment ready for now.

@whc2001 OK i found the problem. First you forgot to enable this in main.c

#if CONFIG_SNAPCLIENT_USE_INTERNAL_ETHERNET || \
      CONFIG_SNAPCLIENT_USE_SPI_ETHERNET

Altough I am not sure if you'll need this as I don't know how you provide the clock to your LAN8720. This is specific to the my board design.

Another thing you need to add right after this line is

esp32_emac_config.clock_config.rmii.clock_mode = EMAC_CLK_EXT_IN;
esp32_emac_config.clock_config.rmii.clock_gpio = 0;

With these changes my Ethernet chip initializes and starts up correctly. I am looking forward to your pull request :)

I am using the WaveShare module where it contains the onboard active oscillator. I decided to ignore the GPIO5 clock inhibit signal for now (as we talked about making it a separate config in #79 before) and just reset multiple times until it boots.

I tried to set the clock_mode and clock_gpio but the error is the same. I tried to solder a wire to the resistor of nRST and connect it to GPIO17, still no go. There is a small detail that the green LED of the ethernet port lights up even if I don't plug in the cable.

whc2001 commented 1 month ago

Nvm, silly error ;)

The LAN8720 on the Waveshare board is bootstraped to use I²C address 1.

image

I'll do some test then generate a pull request for just migrating ethernet to IDF v5 for now. After that I'll look into splitting the clock inhibit signal into separate menuconfig.

whc2001 commented 1 month ago

Update: seems like the connection can be made, but once the snapserver starts send anything to the client, it would jam the connection (?) that Couldn't get PCM chunk is output indefinitely and it can no longer be pinged (always getting timeout).

image

CarlosDerSeher commented 1 month ago

@whc2001 I've add a pull request at your repo, see whc2001/snapclient#1

Also the code seems to work perfectly for me even without the modifications above. I'd still prefer to wait for the connection to be established before going on. What do you think?

whc2001 commented 1 month ago

@whc2001 I've add a pull request at your repo, see whc2001#1

Also the code seems to work perfectly for me even without the modifications above. I'd still prefer to wait for the connection to be established before going on. What do you think?

I totally agree with this logic. After doing this the connection error -4 log spam disappeared.

However it does not seem to fix the issue. It still hangs just after connection for some reason. The green LED on the RJ45 does not blink often, and I cannot ping it. I am not sure what is happening and I might need to test this module with some other program to ensure that the module itself is working. I'll report back ASAP. Sorry for that.

whc2001 commented 1 month ago

Good news, the LAN8720A module works perfectly; Bad news, now I'm not even sure where is the problem ;) I don't know where it stucks, I'll try some debug print but I doubt it would help locating.

CarlosDerSeher commented 1 month ago

Which board are you using?

CarlosDerSeher commented 1 month ago

Did you enable sample insertion (still experimental) in menuconfig? If you did, try disabling it.

whc2001 commented 1 month ago

Which board are you using?

I am using a generic ESP32-WROVER dev module (I didn't enable PSRAM for now because seems like it creates more problems) and a WaveShare LAN8720A clone. I have tested with Arduino and ESPHome that this configuration could work (make connection, obtain info from DHCP, ping from another host, connect to icanhazip.com and print out public IP).

PXL_20240526_063424348

Did you enable sample insertion (still experimental) in menuconfig? If you did, try disabling it.

I did, I just tried to disable it and there is no change. After ethernet just connected it would sometimes ping once or twice, but as soon as SnapClient starts running it's lost.

image

CarlosDerSeher commented 1 month ago

Did you try using wifi to test if it works that way?

whc2001 commented 1 month ago

Did you try using wifi to test if it works that way?

If I use WiFi seems like the connection can be made, but it looks very unstable. I have used up all my dupont cables on hand and currently I don't have the PT8211 DAC attached. I have purchaed a MAX98357 and some cabled to simple things up, and it would take two or three days...

image

whc2001 commented 1 month ago

Firstly really sorry for taking your time, it turns out I was a total idiot. The following two images speak themselves.

image image

I was gonna to wire up the MAX98357 just arrived, only when I realized I never change the default I2S pins which are occupied already by the ethernet MAC. After setting them to spare pins (there really aren't many since the LAN8720 already took a lot of pins) and recompiling again...

https://github.com/CarlosDerSeher/snapclient/assets/16266909/7c1c9759-becd-49f1-9361-896c63bb9b8d

Still two things to do, the first is the configurable clock inhibit GPIO which should be easy. Another is that if you pull the ethernet cable when it's working, the last audio frame would repeat indefinitely (if you ever experienced a bluescreen when there is audio playing you know how it sounds like) until it reconnected or reset is performed. It should somehow listen to the ETHERNET_EVENT_DISCONNECTED event and shut up the DAC or even better kill the SnapClient until the connection recovers.

image

Unfortunately I will go on another trip which includes my graduation ceremony in June, so it might still take me some time...

CarlosDerSeher commented 1 month ago

Ok good to know it mostly works now.

Maybe we could do a sanity check regarding double use of gpios during cmake.

It should somehow listen to the ETHERNET_EVENT_DISCONNECTED event and shut up the DAC or even better kill the SnapClient until the connection recovers

Good thinking. I've never unplugged the cables since I installed my clients :)

CarlosDerSeher commented 1 month ago

which includes my graduation ceremony

Oh and congratulations 🎊

whc2001 commented 2 weeks ago

Clock enable GPIO is added to the menuconfig. Also I've added the functionality to opt for static IP instead of DHCP (although it would make more sense to configure a static lease in the DHCP server, but I needed a quick and dirty static IP when testing with direct ethernet connection to my computer w/o DHCP server, so why not).

Tested with hardware and seems like it's working. However pre-commit glitched on the first commit and didn't perform formatting. I only realized that after making the second commit and hope that's fine.

As for the network connection/disconnection detection, I am thinking about creating a new component (something like net_events) to manage events from both WiFi and wired. ETH_XXX_BIT and WIFI_XXX_BIT will be merged into this component and share the same EventGroupHandle_t. It provides a single function to the main task to wait in OR logic for any type of connection. Would you think that'll make sense?

CarlosDerSeher commented 2 weeks ago

As for the network connection/disconnection detection, I am thinking about creating a new component (something like net_events) to manage events from both WiFi and wired.

I'd love to see this implemented. The improv component could benefit from this too. I always wanted to auto switch between ethernet and wifi depending which is available but never had time to do it.