diff --git a/.github/workflows/beta.yml b/.github/workflows/beta.yml index f5cb18d..db11241 100644 --- a/.github/workflows/beta.yml +++ b/.github/workflows/beta.yml @@ -12,6 +12,7 @@ jobs: strategy: fail-fast: false matrix: + #board: [esp32, esp32-s3, esp32-s3-oct, esp32-c3, esp32-c6, esp32-h2, esp32-solo1, esp32-gl-s10, esp32-p4] board: [esp32, esp32-s3, esp32-s3-oct, esp32-c3, esp32-c6, esp32-h2, esp32-solo1, esp32-gl-s10] build: [release] env: diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a43601c..5728308 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,6 +18,7 @@ jobs: strategy: fail-fast: false matrix: + #board: [esp32, esp32-s3, esp32-s3-oct, esp32-c3, esp32-c6, esp32-h2, esp32-solo1, esp32-gl-s10, esp32-p4] board: [esp32, esp32-s3, esp32-s3-oct, esp32-c3, esp32-c6, esp32-h2, esp32-solo1, esp32-gl-s10] build: [release] env: diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 28be9a7..f493baf 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -34,6 +34,7 @@ jobs: strategy: fail-fast: false matrix: + #board: [esp32, esp32-s3, esp32-s3-oct, esp32-c3, esp32-c6, esp32-h2, esp32-solo1, esp32-gl-s10, esp32-p4] board: [esp32, esp32-s3, esp32-s3-oct, esp32-c3, esp32-c6, esp32-h2, esp32-solo1, esp32-gl-s10] build: [release] env: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ed34bd1..953a8a2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,6 +12,7 @@ jobs: strategy: fail-fast: false matrix: + #board: [esp32, esp32-s3, esp32-s3-oct, esp32-c3, esp32-c6, esp32-h2, esp32-solo1, esp32-gl-s10, esp32-p4] board: [esp32, esp32-s3, esp32-s3-oct, esp32-c3, esp32-c6, esp32-h2, esp32-solo1, esp32-gl-s10] build: [release] env: diff --git a/Docker/README.md b/Docker/README.md index 140d733..1809df4 100644 --- a/Docker/README.md +++ b/Docker/README.md @@ -2,7 +2,7 @@ You can build this project using Docker. Just run the following commands in the console: -## Build with PlatformIO (will build for the ESP32, ESP32-S3, ESP32-C3, ESP32-C6, ESP32-H2 and ESP32-Solo1) +## Build with PlatformIO (will build for the ESP32, ESP32-S3, ESP32-C3, ESP32-C6, ESP32-H2, ESP32-P4 and ESP32-Solo1) ```console git clone https://github.com/technyon/nuki_hub --recursive cd nuki_hub/Docker diff --git a/README.md b/README.md index 2d88421..efc40c8 100644 --- a/README.md +++ b/README.md @@ -17,11 +17,10 @@ Feel free to join us on Discord: https://discord.gg/9nPq85bP4p Supported ESP32 devices: - Nuki Hub is compiled against all ESP32 models with Wi-Fi and Bluetooh Low Energy (BLE) which are supported by ESP-IDF 5.3.2 and Arduino Core 3.1.3. - Tested stable builds are provided for the ESP32, ESP32-S3, ESP32-C3, ESP32-C6 and ESP32-H2. -- Untested builds are provided for the ESP32-Solo1 (as the developers don't own one). +- Untested builds are provided for the ESP32-P4 (with the ESP32-C6-MINI-1 module for BLE and WiFi) and ESP32-Solo1 (as the developers don't own one). Not supported ESP32 devices: - The ESP32-S2 has no built-in BLE and as such can't run Nuki Hub. -- We are looking into supporting the ESP32-P4 with the ESP32-C6-MINI-1 module for BLE and WiFi Supported Nuki devices: - Nuki Smart Lock 1.0 @@ -60,13 +59,14 @@ When buying a new device in 2025 we can only recommend the ESP32-S3 with PSRAM ( The ESP32-S3 is a dual-core CPU with many GPIO's, ability to enlarge RAM using PSRAM, ability to connect Ethernet modules over SPI and optionally power the device with a PoE splitter.
The only functions missing from the ESP32-S3 as compared to other ESP devices is the ability to use some Ethernet modules only supported by the original ESP32 (and ESP32-P4) and the ability to connect over WIFI6 (C6 or ESP32-P4 with C6 module) -If/When the ESP32-P4 with ESP32-C6-MINI-1 module for BLE/WiFi is supported this will probably become the preferred device for Nuki Hub. +We provide a build for the ESP32-P4 with ESP32-C6-MINI-1 module for BLE/WiFi but this device is untested as of now. Other considerations: - If Ethernet/PoE is required: An ESP32-S3 with PSRAM in combination with a SPI Ethernet module ([W5500](https://www.aliexpress.com/w/wholesale-w5500.html)) and [PoE to Ethernet and USB type B/C splitter](https://aliexpress.com/w/wholesale-poe-splitter-usb-c.html) or the LilyGO-T-ETH ELite, LilyGO-T-ETH-Lite-ESP32S3 or M5stack Atom S3R with the M5stack AtomPoe W5500 module -- If WIFI6 is absolutely required (it probably isn't): ESP32-C6 +- If WIFI6 is absolutely required (it probably isn't): ESP32-C6 or ESP32-P4 with ESP32-C6-MINI-1 module (UNTESTED) Devices ranked best-to-worst: +- ESP32-P4 with ESP32-C6-MINI-1 module (UNTESTED) - ESP32-S3 with PSRAM - ...... - ...... @@ -938,7 +938,7 @@ Now connect via Wi-Fi and change the network hardware to "Generic W5500".
If Ethernet hardware isn't detected or initialised properly after changing the network device, Wi-Fi will be used as a fallback.

-Note: LAN8720 modules are only supported on the ESP32 and ESP32-Solo1, not on the ESP32-S3, ESP32-C3 or ESP-C6
+Note: LAN8720 modules are only supported on the ESP32, ESP32-P4 and ESP32-Solo1, not on the ESP32-S3, ESP32-C3 or ESP-C6
## FAQ / Troubleshooting diff --git a/platformio.ini b/platformio.ini index 17a2196..0b7fa51 100644 --- a/platformio.ini +++ b/platformio.ini @@ -131,6 +131,23 @@ board = nuki-esp32solo1 board_build.cmake_extra_args = -DSDKCONFIG_DEFAULTS="sdkconfig.defaults;sdkconfig.release.defaults;sdkconfig.singlecore.defaults;sdkconfig.defaults.esp32-solo1" +[env:esp32-p4] +extends = env:esp32 +board_build.embed_txtfiles = +board = esp32-p4 +build_flags = + ${env.build_flags} + -DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_NONE + -DCONFIG_NIMBLE_CPP_LOG_LEVEL=0 + -DCONFIG_BT_NIMBLE_LOG_LEVEL=0 + -DCONFIG_ESP_WIFI_ESPNOW_MAX_ENCRYPT_NUM=7 + -DCONFIG_ESP_WIFI_CACHE_TX_BUFFER_NUM=32 + -DCONFIG_ESP_WIFI_TX_BUFFER_TYPE=0 + -DCONFIG_ESP_WIFI_STATIC_RX_BUFFER_NUM=16 + -DCONFIG_ESP_WIFI_DYNAMIC_RX_BUFFER_NUM=32 + -DCONFIG_ESP_WIFI_DYNAMIC_RX_MGMT_BUF=0 + -DCONFIG_ESP_WIFI_SOFTAP_SUPPORT=y + [env:esp32_dbg] extends = env:esp32 custom_build = debug @@ -226,4 +243,23 @@ build_flags = -DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG -DCONFIG_NIMBLE_CPP_LOG_LEVEL=0 -DCONFIG_BT_NIMBLE_LOG_LEVEL=0 - -DDEBUG_NUKIHUB \ No newline at end of file + -DDEBUG_NUKIHUB + +[env:esp32-p4_dbg] +extends = env:esp32-p4 +custom_build = debug +board_build.cmake_extra_args = + -DSDKCONFIG_DEFAULTS="sdkconfig.defaults;sdkconfig.debug.defaults;sdkconfig.defaults.esp32-p4" +build_flags = + ${env.build_flags} + -DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG + -DCONFIG_NIMBLE_CPP_LOG_LEVEL=0 + -DCONFIG_BT_NIMBLE_LOG_LEVEL=0 + -DDEBUG_NUKIHUB + -DCONFIG_ESP_WIFI_ESPNOW_MAX_ENCRYPT_NUM=7 + -DCONFIG_ESP_WIFI_CACHE_TX_BUFFER_NUM=32 + -DCONFIG_ESP_WIFI_TX_BUFFER_TYPE=0 + -DCONFIG_ESP_WIFI_STATIC_RX_BUFFER_NUM=16 + -DCONFIG_ESP_WIFI_DYNAMIC_RX_BUFFER_NUM=32 + -DCONFIG_ESP_WIFI_DYNAMIC_RX_MGMT_BUF=0 + -DCONFIG_ESP_WIFI_SOFTAP_SUPPORT=y \ No newline at end of file diff --git a/resources/how-to-flash.txt b/resources/how-to-flash.txt index 99c1956..4e9fe8d 100644 --- a/resources/how-to-flash.txt +++ b/resources/how-to-flash.txt @@ -71,6 +71,13 @@ e000 boot_app0.bin 10000 nuki_hub_esp32h2.bin 280000 nuki_hub_updater_esp32h2.bin +ESP32-P4 +e000 boot_app0.bin +0 bootloader.bin +8000 nuki_hub.partitions.bin +10000 nuki_hub_esp32p4.bin +280000 nuki_hub_updater_esp32p4.bin + ESP32-SOLO1 e000 boot_app0.bin 1000 bootloader.bin diff --git a/sdkconfig.defaults.esp32-p4 b/sdkconfig.defaults.esp32-p4 new file mode 100644 index 0000000..affa10c --- /dev/null +++ b/sdkconfig.defaults.esp32-p4 @@ -0,0 +1,38 @@ +CONFIG_SPIRAM=y +CONFIG_SPIRAM_IGNORE_NOTFOUND=y +CONFIG_MBEDTLS_DEFAULT_MEM_ALLOC=y +CONFIG_BT_NIMBLE_MEM_ALLOC_MODE_DEFAULT=y +CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL=50768 + +CONFIG_LWIP_TCP_SND_BUF_DEFAULT=65534 +CONFIG_LWIP_TCP_WND_DEFAULT=65534 +CONFIG_LWIP_TCP_RECVMBOX_SIZE=64 +CONFIG_LWIP_UDP_RECVMBOX_SIZE=64 +CONFIG_LWIP_TCPIP_RECVMBOX_SIZE=64 +CONFIG_LWIP_TCP_SACK_OUT=y + +CONFIG_ESP_WIFI_STATIC_RX_BUFFER_NUM=16 +CONFIG_ESP_WIFI_DYNAMIC_RX_BUFFER_NUM=64 +CONFIG_ESP_WIFI_DYNAMIC_TX_BUFFER_NUM=64 +CONFIG_ESP_WIFI_AMPDU_TX_ENABLED=y +CONFIG_ESP_WIFI_TX_BA_WIN=32 +CONFIG_ESP_WIFI_AMPDU_RX_ENABLED=y +CONFIG_ESP_WIFI_RX_BA_WIN=32 +CONFIG_ESP_WIFI_REMOTE_ENABLED=y +CONFIG_ESP_WIFI_REMOTE_LIBRARY_HOSTED=y +CONFIG_ESP_WIFI_ESPNOW_MAX_ENCRYPT_NUM=7 +CONFIG_ESP_WIFI_CACHE_TX_BUFFER_NUM=32 +CONFIG_ESP_WIFI_TX_BUFFER_TYPE=0 +CONFIG_ESP_WIFI_STATIC_RX_BUFFER_NUM=16 +CONFIG_ESP_WIFI_DYNAMIC_RX_BUFFER_NUM=32 +CONFIG_ESP_WIFI_DYNAMIC_RX_MGMT_BUF=0 + +CONFIG_ESP_HCI_VHCI=y +CONFIG_BT_CONTROLLER_DISABLED=y +CONFIG_BT_BLUEDROID_ENABLED=n +CONFIG_BT_NIMBLE_TRANSPORT_UART=n +CONFIG_ESP_ENABLE_BT=y +CONFIG_ESP32_P4_EV_BOARD=y +CONFIG_BT_NIMBLE_ENABLED=y +CONFIG_ESP_HOSTED_ENABLE_BT_NIMBLE=y +CONFIG_SLAVE_IDF_TARGET_ESP32C6=y \ No newline at end of file diff --git a/src/Config.h b/src/Config.h index 3317061..ec87df2 100644 --- a/src/Config.h +++ b/src/Config.h @@ -5,7 +5,7 @@ #define NUKI_HUB_VERSION "9.09" #define NUKI_HUB_VERSION_INT (uint32_t)909 #define NUKI_HUB_BUILD "unknownbuildnr" -#define NUKI_HUB_DATE "2025-02-20" +#define NUKI_HUB_DATE "2025-03-03" #define GITHUB_LATEST_RELEASE_URL (char*)"https://github.com/technyon/nuki_hub/releases/latest" #define GITHUB_OTA_MANIFEST_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/manifest.json" @@ -120,6 +120,8 @@ #define GITHUB_BETA_UPDATER_BINARY_URL_DBG (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/debug/beta/nuki_hub_updater_esp32.bin" #define GITHUB_MASTER_RELEASE_BINARY_URL_DBG (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/debug/master/nuki_hub_esp32-gl-s10.bin" #define GITHUB_MASTER_UPDATER_BINARY_URL_DBG (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/debug/master/nuki_hub_updater_esp32.bin" +#define GITHUB_LATEST_RELEASE_BINARY_URL_OTHER (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/nuki_hub_esp32.bin" +#define GITHUB_LATEST_UPDATER_BINARY_URL_OTHER (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/nuki_hub_updater_esp32.bin" #define NUKI_HUB_HW (char*)"ESP32-GL-S10" #define BOOT_BUTTON_GPIO (gpio_num_t)0 #else @@ -135,6 +137,8 @@ #define GITHUB_BETA_UPDATER_BINARY_URL_DBG (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/debug/beta/nuki_hub_updater_esp32.bin" #define GITHUB_MASTER_RELEASE_BINARY_URL_DBG (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/debug/master/nuki_hub_esp32.bin" #define GITHUB_MASTER_UPDATER_BINARY_URL_DBG (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/debug/master/nuki_hub_updater_esp32.bin" +#define GITHUB_LATEST_RELEASE_BINARY_URL_OTHER (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/nuki_hub_esp32-gl-s10.bin" +#define GITHUB_LATEST_UPDATER_BINARY_URL_OTHER (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/nuki_hub_updater_esp32.bin" #define NUKI_HUB_HW (char*)"ESP32" #define BOOT_BUTTON_GPIO (gpio_num_t)0 #endif diff --git a/src/Gpio.cpp b/src/Gpio.cpp index b3cd5f1..fdf2447 100644 --- a/src/Gpio.cpp +++ b/src/Gpio.cpp @@ -329,7 +329,7 @@ const std::vector Gpio::getDisabledPins() const disabledPins.push_back(_preferences->getInt(preference_network_custom_mdc, -1)); disabledPins.push_back(_preferences->getInt(preference_network_custom_mdio, -1)); break; -#if defined(CONFIG_IDF_TARGET_ESP32) +#if defined(CONFIG_IDF_TARGET_ESP32) || defined(CONFIG_IDF_TARGET_ESP32P4) case 4: disabledPins.push_back(12); disabledPins.push_back(ETH_RESET_PIN_LAN8720); diff --git a/src/WebCfgServer.cpp b/src/WebCfgServer.cpp index b4a0a45..74d9602 100644 --- a/src/WebCfgServer.cpp +++ b/src/WebCfgServer.cpp @@ -1609,6 +1609,11 @@ esp_err_t WebCfgServer::buildOtaHtml(PsychicRequest *request, PsychicResponse* r { response.print("

"); } + #elif defined(CONFIG_IDF_TARGET_ESP32) && !defined(NUKI_TARGET_GL_S10) + if(_preferences->getInt(preference_network_hardware) == 8) + { + response.print("

"); + } #endif response.print("

"); @@ -4825,7 +4830,7 @@ esp_err_t WebCfgServer::buildCustomNetworkConfigHtml(PsychicRequest *request, Ps response.print(""); printDropDown(&response, "NWCUSTPHY", "PHY", String(_preferences->getInt(preference_network_custom_phy)), getNetworkCustomPHYOptions(), ""); printInputField(&response, "NWCUSTADDR", "ADDR", _preferences->getInt(preference_network_custom_addr, 1), 6, ""); -#if defined(CONFIG_IDF_TARGET_ESP32) +#if defined(CONFIG_IDF_TARGET_ESP32) || defined(CONFIG_IDF_TARGET_ESP32P4) printDropDown(&response, "NWCUSTCLK", "CLK", String(_preferences->getInt(preference_network_custom_clk, 0)), getNetworkCustomCLKOptions(), "internalopt"); printInputField(&response, "NWCUSTPWR", "PWR", _preferences->getInt(preference_network_custom_pwr, 12), 6, "class=\"internalopt\""); printInputField(&response, "NWCUSTMDIO", "MDIO", _preferences->getInt(preference_network_custom_mdio), 6, "class=\"internalopt\""); @@ -6732,7 +6737,7 @@ esp_err_t WebCfgServer::processUpdate(PsychicRequest *request, PsychicResponse* _preferences->putString(preference_ota_main_url, GITHUB_MASTER_RELEASE_BINARY_URL); //} } - #if defined(CONFIG_IDF_TARGET_ESP32S3) + #if (defined(CONFIG_IDF_TARGET_ESP32S3) || defined(CONFIG_IDF_TARGET_ESP32)) && !defined(CONFIG_FREERTOS_UNICORE) else if(request->hasParam("other")) { res = buildConfirmHtml(request, resp, "Rebooting to update Nuki Hub and Nuki Hub updater
Updating to latest RELEASE version", 2, true); @@ -6981,7 +6986,7 @@ const std::vector> WebCfgServer::getNetworkCustomPHYOp options.push_back(std::make_pair("1", "W5500")); options.push_back(std::make_pair("2", "DN9051")); options.push_back(std::make_pair("3", "KSZ8851SNL")); -#if defined(CONFIG_IDF_TARGET_ESP32) +#if defined(CONFIG_IDF_TARGET_ESP32) || defined(CONFIG_IDF_TARGET_ESP32P4) options.push_back(std::make_pair("4", "LAN8720")); options.push_back(std::make_pair("5", "RTL8201")); options.push_back(std::make_pair("6", "TLK110/IP101")); @@ -6992,7 +6997,7 @@ const std::vector> WebCfgServer::getNetworkCustomPHYOp return options; } -#if defined(CONFIG_IDF_TARGET_ESP32) +#if defined(CONFIG_IDF_TARGET_ESP32) || defined(CONFIG_IDF_TARGET_ESP32P4) const std::vector> WebCfgServer::getNetworkCustomCLKOptions() const { std::vector> options; diff --git a/src/WebCfgServer.h b/src/WebCfgServer.h index f32a06e..4a97f34 100644 --- a/src/WebCfgServer.h +++ b/src/WebCfgServer.h @@ -83,7 +83,7 @@ private: const std::vector> getNetworkDetectionOptions() const; const std::vector> getGpioOptions() const; const std::vector> getNetworkCustomPHYOptions() const; - #if defined(CONFIG_IDF_TARGET_ESP32) + #if defined(CONFIG_IDF_TARGET_ESP32) || defined(CONFIG_IDF_TARGET_ESP32P4) const std::vector> getNetworkCustomCLKOptions() const; #endif #ifdef CONFIG_SOC_SPIRAM_SUPPORTED diff --git a/src/idf_component.yml b/src/idf_component.yml index 6f95df3..d174900 100644 --- a/src/idf_component.yml +++ b/src/idf_component.yml @@ -8,6 +8,16 @@ dependencies: espressif/libsodium: "^1.0.20~2" + espressif/esp_hosted: + version: "*" + rules: + - if: "target in [esp32p4]" + + espressif/esp_wifi_remote: + version: "*" + rules: + - if: "target in [esp32p4]" + # # Defining a dependency from the registry: # # https://components.espressif.com/component/example/cmp # example/cmp: "^3.3.3" # Automatically update minor releases diff --git a/src/networkDevices/EthernetDevice.cpp b/src/networkDevices/EthernetDevice.cpp index f3ef974..83ae97a 100644 --- a/src/networkDevices/EthernetDevice.cpp +++ b/src/networkDevices/EthernetDevice.cpp @@ -4,7 +4,7 @@ #include "../RestartReason.h" #include "../EspMillis.h" -#ifdef CONFIG_IDF_TARGET_ESP32 +#if defined(CONFIG_IDF_TARGET_ESP32) || defined(CONFIG_IDF_TARGET_ESP32P4) #include "esp_private/esp_gpio_reserve.h" #include #include "esp_psram.h" @@ -90,7 +90,7 @@ void EthernetDevice::initialize() _hardwareInitialized = ETH.begin(_type, _phy_addr, _cs, _irq, _rst, SPI); ethCriticalFailure = false; } -#ifdef CONFIG_IDF_TARGET_ESP32 +#if defined(CONFIG_IDF_TARGET_ESP32) || defined(CONFIG_IDF_TARGET_ESP32P4) else { Log->println("Use RMII"); diff --git a/src/networkDevices/LAN8720Definitions.h b/src/networkDevices/LAN8720Definitions.h index ab076d6..904e211 100644 --- a/src/networkDevices/LAN8720Definitions.h +++ b/src/networkDevices/LAN8720Definitions.h @@ -1,6 +1,6 @@ #pragma once -#ifndef CONFIG_IDF_TARGET_ESP32 +#if !defined(CONFIG_IDF_TARGET_ESP32) && !defined(CONFIG_IDF_TARGET_ESP32P4) typedef enum { ETH_CLOCK_GPIO0_IN = 0, ETH_CLOCK_GPIO0_OUT = 1, @@ -11,11 +11,26 @@ typedef enum { #define ETH_PHY_TYPE_LAN8720 ETH_PHY_MAX #else #define ETH_PHY_TYPE_LAN8720 ETH_PHY_LAN8720 +#if defined(CONFIG_IDF_TARGET_ESP32P4) +#define ETH_CLOCK_GPIO0_IN EMAC_CLK_EXT_IN +#define ETH_CLOCK_GPIO0_OUT EMAC_CLK_OUT +#define ETH_CLOCK_GPIO16_OUT EMAC_CLK_OUT +#define ETH_CLOCK_GPIO17_OUT EMAC_CLK_OUT +#endif #endif +#if defined(CONFIG_IDF_TARGET_ESP32P4) +#define ETH_CLK_MODE_LAN8720 EMAC_CLK_EXT_IN +#define ETH_PHY_ADDR_LAN8720 0 +#define ETH_PHY_MDC_LAN8720 31 +#define ETH_PHY_MDIO_LAN8720 52 +#define ETH_PHY_POWER_LAN8720 51 +#define ETH_RESET_PIN_LAN8720 1 +#else #define ETH_CLK_MODE_LAN8720 ETH_CLOCK_GPIO0_IN #define ETH_PHY_ADDR_LAN8720 0 #define ETH_PHY_MDC_LAN8720 23 #define ETH_PHY_MDIO_LAN8720 18 #define ETH_PHY_POWER_LAN8720 -1 -#define ETH_RESET_PIN_LAN8720 1 \ No newline at end of file +#define ETH_RESET_PIN_LAN8720 1 +#endif diff --git a/src/util/NetworkDeviceInstantiator.cpp b/src/util/NetworkDeviceInstantiator.cpp index 9bc841d..23bb3bc 100644 --- a/src/util/NetworkDeviceInstantiator.cpp +++ b/src/util/NetworkDeviceInstantiator.cpp @@ -118,7 +118,7 @@ NetworkDevice *NetworkDeviceInstantiator::Create(NetworkDeviceType networkDevice preferences->getInt(preference_network_custom_mosi, -1), custEthtype); } -#if defined(CONFIG_IDF_TARGET_ESP32) +#if defined(CONFIG_IDF_TARGET_ESP32) || defined(CONFIG_IDF_TARGET_ESP32P4) else if(custPHY >= 4 && custPHY <= 9) { int custCLKpref = preferences->getInt(preference_network_custom_clk, 0); diff --git a/src/util/NetworkUtil.cpp b/src/util/NetworkUtil.cpp index d85b080..8590f29 100644 --- a/src/util/NetworkUtil.cpp +++ b/src/util/NetworkUtil.cpp @@ -77,7 +77,7 @@ std::string NetworkUtil::GetCustomEthernetDeviceName(int custPHY) } } -#if defined(CONFIG_IDF_TARGET_ESP32) +#if defined(CONFIG_IDF_TARGET_ESP32) || defined(CONFIG_IDF_TARGET_ESP32P4) eth_phy_type_t NetworkUtil::GetCustomEthernetType(int custPHY) { switch(custPHY) diff --git a/src/util/NetworkUtil.h b/src/util/NetworkUtil.h index 9f22552..6de135b 100644 --- a/src/util/NetworkUtil.h +++ b/src/util/NetworkUtil.h @@ -9,7 +9,7 @@ class NetworkUtil public: static NetworkDeviceType GetDeviceTypeFromPreference(int hardwareDetect, int customPhy); static std::string GetCustomEthernetDeviceName(int custPHY); -#if defined(CONFIG_IDF_TARGET_ESP32) +#if defined(CONFIG_IDF_TARGET_ESP32) || defined(CONFIG_IDF_TARGET_ESP32P4) static eth_phy_type_t GetCustomEthernetType(int custPHY); static eth_clock_mode_t GetCustomClock(int custCLKpref); #endif diff --git a/updater/platformio.ini b/updater/platformio.ini index 18fa09c..66f12cf 100644 --- a/updater/platformio.ini +++ b/updater/platformio.ini @@ -94,6 +94,23 @@ board_build.cmake_extra_args = extends = env:updater_esp32 board = esp32-c6-devkitm-1 +[env:updater_esp32-p4] +extends = env:updater_esp32 +board_build.embed_txtfiles = +board = esp32-p4 +build_flags = + ${env.build_flags} + -DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_NONE + -DCONFIG_NIMBLE_CPP_LOG_LEVEL=0 + -DCONFIG_BT_NIMBLE_LOG_LEVEL=0 + -DCONFIG_ESP_WIFI_ESPNOW_MAX_ENCRYPT_NUM=7 + -DCONFIG_ESP_WIFI_CACHE_TX_BUFFER_NUM=32 + -DCONFIG_ESP_WIFI_TX_BUFFER_TYPE=0 + -DCONFIG_ESP_WIFI_STATIC_RX_BUFFER_NUM=16 + -DCONFIG_ESP_WIFI_DYNAMIC_RX_BUFFER_NUM=32 + -DCONFIG_ESP_WIFI_DYNAMIC_RX_MGMT_BUF=0 + -DCONFIG_ESP_WIFI_SOFTAP_SUPPORT=y + [env:updater_esp32-h2] extends = env:updater_esp32 board = esp32-h2-devkitm-1 diff --git a/updater/sdkconfig.defaults.esp32-p4 b/updater/sdkconfig.defaults.esp32-p4 new file mode 100644 index 0000000..b8c91d6 --- /dev/null +++ b/updater/sdkconfig.defaults.esp32-p4 @@ -0,0 +1,29 @@ +CONFIG_SPIRAM=y +CONFIG_SPIRAM_IGNORE_NOTFOUND=y +CONFIG_MBEDTLS_DEFAULT_MEM_ALLOC=y +CONFIG_BT_NIMBLE_MEM_ALLOC_MODE_DEFAULT=y +CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=4096 +CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL=50768 +CONFIG_ESP_WIFI_STATIC_RX_BUFFER_NUM=16 +CONFIG_ESP_WIFI_DYNAMIC_RX_BUFFER_NUM=64 +CONFIG_ESP_WIFI_DYNAMIC_TX_BUFFER_NUM=64 +CONFIG_ESP_WIFI_AMPDU_TX_ENABLED=y +CONFIG_ESP_WIFI_TX_BA_WIN=32 +CONFIG_ESP_WIFI_AMPDU_RX_ENABLED=y +CONFIG_ESP_WIFI_RX_BA_WIN=32 +CONFIG_LWIP_TCP_SND_BUF_DEFAULT=65534 +CONFIG_LWIP_TCP_WND_DEFAULT=65534 +CONFIG_LWIP_TCP_RECVMBOX_SIZE=64 +CONFIG_LWIP_UDP_RECVMBOX_SIZE=64 +CONFIG_LWIP_TCPIP_RECVMBOX_SIZE=64 +CONFIG_LWIP_TCP_SACK_OUT=y +CONFIG_BT_NIMBLE_TRANSPORT_UART=n +CONFIG_ESP_HCI_VHCI=y +CONFIG_ESP_WIFI_REMOTE_ENABLED=y +CONFIG_ESP_WIFI_REMOTE_LIBRARY_HOSTED=y +CONFIG_ESP_WIFI_ESPNOW_MAX_ENCRYPT_NUM=7 +CONFIG_ESP_WIFI_CACHE_TX_BUFFER_NUM=32 +CONFIG_ESP_WIFI_TX_BUFFER_TYPE=0 +CONFIG_ESP_WIFI_STATIC_RX_BUFFER_NUM=16 +CONFIG_ESP_WIFI_DYNAMIC_RX_BUFFER_NUM=32 +CONFIG_ESP_WIFI_DYNAMIC_RX_MGMT_BUF=0 \ No newline at end of file diff --git a/updater/src/idf_component.yml b/updater/src/idf_component.yml new file mode 100644 index 0000000..737cd20 --- /dev/null +++ b/updater/src/idf_component.yml @@ -0,0 +1,46 @@ +dependencies: + # Required IDF version + idf: ">=5.2" + + espressif/esp_hosted: + version: "*" + rules: + - if: "target in [esp32p4]" + + espressif/esp_wifi_remote: + version: "*" + rules: + - if: "target in [esp32p4]" + + # # Defining a dependency from the registry: + # # https://components.espressif.com/component/example/cmp + # example/cmp: "^3.3.3" # Automatically update minor releases + # + # # Other ways to define dependencies + # + # # For components maintained by Espressif only name can be used. + # # Same as `espressif/cmp` + # component: "~1.0.0" # Automatically update bugfix releases + # + # # Or in a longer form with extra parameters + # component2: + # version: ">=2.0.0" + # + # # For transient dependencies `public` flag can be set. + # # `public` flag doesn't have an effect for the `main` component. + # # All dependencies of `main` are public by default. + # public: true + # + # # For components hosted on non-default registry: + # service_url: "https://componentregistry.company.com" + # + # # For components in git repository: + # test_component: + # path: test_component + # git: ssh://git@gitlab.com/user/components.git + # + # # For test projects during component development + # # components can be used from a local directory + # # with relative or absolute path + # some_local_component: + # path: ../../projects/component