Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update for arduino-esp32 v3.0 #14

Merged
merged 5 commits into from
Jun 5, 2024
Merged

Update for arduino-esp32 v3.0 #14

merged 5 commits into from
Jun 5, 2024

Conversation

webspiderteam
Copy link

I have done all update changes but I am getting these errors:
/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-12.2.0_20230208/bin/../lib/gcc/xtensa-esp32-elf/12.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: /ESP32-ENC28J60.cpp:114: undefined reference to enc28j60_begin' /appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-12.2.0_20230208/bin/../lib/gcc/xtensa-esp32-elf/12.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: Documents\Arduino\ETH_ENC28J60/ESP32-ENC28J60.cpp:121: undefined reference to esp_eth_phy_new_enc28j60'
/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-12.2.0_20230208/bin/../lib/gcc/xtensa-esp32-elf/12.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: Documents\Arduino\ETH_ENC28J60/ESP32-ENC28J60.cpp:135: undefined reference to `emac_enc28j60_get_chip_info'
may be you can fix these issues. I not pro in C coding.

@tobozo
Copy link
Owner

tobozo commented Jun 4, 2024

hi,

thanks for your PR 👍

I cloned your fork and got a totally different linker error (complaining about missing tcpipInit()), tried to solve that instead until I got a successful compilation, but I don't have an ENC28J60 to test with, I hope this will solve your linker error too.

diff --git a/src/ESP32-ENC28J60.cpp b/src/ESP32-ENC28J60.cpp
index 55a9d9a..95a006b 100644
--- a/src/ESP32-ENC28J60.cpp
+++ b/src/ESP32-ENC28J60.cpp
@@ -76,7 +76,8 @@ ENC28J60Class::~ENC28J60Class() {}
 esp_netif_t *eth_netif{nullptr};
 //bool ENC28J60Class::begin(uint8_t phy_addr, int power, int mdc, int mdio, eth_phy_type_t type, eth_clock_mode_t clock_mode, bool use_mac_from_efuse)
 bool ENC28J60Class::begin(int MISO_GPIO, int MOSI_GPIO, int SCLK_GPIO, int CS_GPIO, int INT_GPIO, int SPI_CLOCK_MHZ, int SPI_HOST, uint8_t* ENC28J60_Mac) {
-  tcpipInit();
+  //tcpipInit();
+  Network.begin();
 
   //uint8_t ENC28J60_Default_Mac[6] = { 0x02, 0x00, 0x00, 0x12, 0x34, 0x56 };
 
diff --git a/src/ESP32-ENC28J60.h b/src/ESP32-ENC28J60.h
index 1ddb53a..d71cd4b 100644
--- a/src/ESP32-ENC28J60.h
+++ b/src/ESP32-ENC28J60.h
@@ -20,6 +20,7 @@
 #ifndef _ENC28J60_ESP32_ETH_H_
 #define _ENC28J60_ESP32_ETH_H_
 
+#include "Network.h"
 #include "WiFi.h"
 #include "esp_system.h"
 #include "esp_eth.h"
@@ -73,8 +74,8 @@ public:
     uint8_t* macAddress(uint8_t* mac);
     String macAddress();
 
-    friend class WiFiClient;
-    friend class WiFiServer;
+    friend class NetworkClient;
+    friend class NetworkServer;
 };
 
 extern ENC28J60Class ETH;
diff --git a/src/extmod/esp_eth_spi_enc28j60.c b/src/extmod/esp_eth_spi_enc28j60.c
index bea3be1..e6ae598 100644
--- a/src/extmod/esp_eth_spi_enc28j60.c
+++ b/src/extmod/esp_eth_spi_enc28j60.c
@@ -14,7 +14,7 @@
 
 esp_eth_mac_t* enc28j60_new_mac(int SPI_HOST, spi_device_interface_config_t* spi_devcfg, int INT_GPIO )
 {
-    eth_enc28j60_config_t enc28j60_config = ETH_ENC28J60_DEFAULT_CONFIG(SPI_HOST, *spi_devcfg);
+    eth_enc28j60_config_t enc28j60_config = ETH_ENC28J60_DEFAULT_CONFIG(SPI_HOST, spi_devcfg);
     enc28j60_config.int_gpio_num = INT_GPIO;
 
     eth_mac_config_t mac_config = ETH_MAC_DEFAULT_CONFIG();

@webspiderteam
Copy link
Author

I think there was an file encoding issue. Because I downloaded all files back and put them in workspace manually. Now all files shows there is changes but no difference.

Thanks for fixing Tcpipinit issue. I haven't testted with hardware yet but I don't think there will be an issue.

@tobozo tobozo merged commit 2f95507 into tobozo:main Jun 5, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants