From e0cbd30f09eee11f09af6bf0882e9fd3de28b349 Mon Sep 17 00:00:00 2001 From: iranl Date: Tue, 16 Sep 2025 22:14:14 +0200 Subject: [PATCH] Add P4 with C5 build --- .github/workflows/beta.yml | 2 +- .github/workflows/build.yml | 2 +- .github/workflows/nightly.yml | 2 +- .github/workflows/release.yml | 2 +- README.md | 21 +++++++---------- boards/nuki-esp32-p4-c5.json | 34 +++++++++++++++++++++++++++ pio_package_post.py | 2 ++ platformio.ini | 16 ++++++++++++- resources/how-to-flash.txt | 4 ++++ sdkconfig.defaults.esp32-p4c5 | 1 + src/Config.h | 21 ++++++++++++++--- updater/pio_package_post.py | 2 ++ updater/platformio.ini | 7 ++++++ updater/sdkconfig.defaults.esp32-p4c5 | 1 + 14 files changed, 97 insertions(+), 20 deletions(-) create mode 100644 boards/nuki-esp32-p4-c5.json create mode 100644 sdkconfig.defaults.esp32-p4c5 create mode 100644 updater/sdkconfig.defaults.esp32-p4c5 diff --git a/.github/workflows/beta.yml b/.github/workflows/beta.yml index fe07e9f..82f8a17 100644 --- a/.github/workflows/beta.yml +++ b/.github/workflows/beta.yml @@ -12,7 +12,7 @@ jobs: strategy: fail-fast: false matrix: - board: [esp32, esp32-nopsram, esp32-s3, esp32-s3-nopsram, esp32-s3-oct, esp32-c3, esp32-c5, esp32-c6, esp32-h2, esp32-solo1, esp32-gl-s10, esp32-p4] + board: [esp32, esp32-nopsram, esp32-s3, esp32-s3-nopsram, esp32-s3-oct, esp32-c3, esp32-c5, esp32-c6, esp32-h2, esp32-solo1, esp32-gl-s10, esp32-p4, esp32-p4c5] build: [release] env: BOARD: ${{ matrix.board }} diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 26d708e..9cdad3c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,7 +18,7 @@ jobs: strategy: fail-fast: false matrix: - board: [esp32, esp32-nopsram, esp32-s3, esp32-s3-nopsram, esp32-s3-oct, esp32-c3, esp32-c5, esp32-c6, esp32-h2, esp32-solo1, esp32-gl-s10, esp32-p4] + board: [esp32, esp32-nopsram, esp32-s3, esp32-s3-nopsram, esp32-s3-oct, esp32-c3, esp32-c5, esp32-c6, esp32-h2, esp32-solo1, esp32-gl-s10, esp32-p4, esp32-p4c5] build: [release] env: BOARD: ${{ matrix.board }} diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index f5a1a33..9047f01 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -34,7 +34,7 @@ jobs: strategy: fail-fast: false matrix: - board: [esp32, esp32-nopsram, esp32-s3, esp32-s3-nopsram, esp32-s3-oct, esp32-c3, esp32-c5, esp32-c6, esp32-h2, esp32-solo1, esp32-gl-s10, esp32-p4] + board: [esp32, esp32-nopsram, esp32-s3, esp32-s3-nopsram, esp32-s3-oct, esp32-c3, esp32-c5, esp32-c6, esp32-h2, esp32-solo1, esp32-gl-s10, esp32-p4, esp32-p4c5] build: [release] env: BOARD: ${{ matrix.board }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5e0ed88..d4fc12b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,7 +12,7 @@ jobs: strategy: fail-fast: false matrix: - board: [esp32, esp32-nopsram, esp32-s3, esp32-s3-nopsram, esp32-s3-oct, esp32-c3, esp32-c5, esp32-c6, esp32-h2, esp32-solo1, esp32-gl-s10, esp32-p4] + board: [esp32, esp32-nopsram, esp32-s3, esp32-s3-nopsram, esp32-s3-oct, esp32-c3, esp32-c5, esp32-c6, esp32-h2, esp32-solo1, esp32-gl-s10, esp32-p4, esp32-p4c5] build: [release] env: BOARD: ${{ matrix.board }} diff --git a/README.md b/README.md index 1586f49..4f9fe66 100644 --- a/README.md +++ b/README.md @@ -16,8 +16,8 @@ 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.5.0 and Arduino Core 3.3.0. -- Tested stable builds are provided for the ESP32, ESP32-S3, ESP32-C3, ESP32-C5, ESP32-C6, ESP32-P4 (with the ESP32-C6-MINI-1 module for BLE and WiFi) and ESP32-H2. -- Untested builds are provided for the ESP32-Solo1 (as the developers don't own one). +- Tested stable builds are provided for the ESP32, ESP32-S3, ESP32-C3, ESP32-C5, ESP32-C6, ESP32-P4 (with the ESP32-C6 for BLE and WiFi) and ESP32-H2. +- Untested builds are provided for the ESP32-Solo1 and ESP32-P4 with the ESP32-C5 module (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. @@ -61,27 +61,24 @@ See the "[Connecting via Ethernet](#connecting-via-ethernet-optional)" section f We don't recommend using the original ESP32 or ESP32-Solo1 devices because these devices experience unexpected crashes related to the (closed-source) BLE controller.
In newer models (e.g. ESP32-S3, ESP32-P4, ESP32-C3, ESP32-C5, ESP32-C6, ESP32-H2) these unexpected crashed are seen a lot less. -We also don't recommend using the original ESP32 or ESP32-Solo1 devices because these devices experience unexpected crashes related to the (closed-source) BLE controller.
-In newer models (e.g. ESP32-S3, ESP32-P4, ESP32-C3, ESP32-C6, ESP32-H2) these unexpected crashes are seen less. - When buying a new device in 2025 we can only recommend the ESP32-P4 or ESP32-S3 with PSRAM (look for an ESP32-S3 with the designation N>=4 and R>=2 such as an ESP32-S3 N16R8).
-The ESP32-P4 with ESP32-C6-MINI-1 module for BLE/WiFi is the most powerfull ESP32 in 2025. -It supports (with the C6 co-processor) anything the ESP32 range has to offer with the highest CPU clocks, largest flash and PSRAM, Ethernet, PoE and WiFi6. -The only function missing (when not using a C5 as co-processor) is 5Ghz WiFi support. +The ESP32-P4 with ESP32-C6 or ESP32-C5 module for BLE/WiFi is the most powerfull ESP32 in 2025. +It supports anything the ESP32 range has to offer with the highest CPU clocks, largest flash and PSRAM, Ethernet, PoE and WiFi6 (and 5 GHZ WiFi with the C5 as co-processor). 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 (C5, C6 or ESP32-P4 with C6 module) +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 (C5, C6 or ESP32-P4 with C6/C5 module) The ESP32-C5 with PSRAM is a good option providing higher clockspeeds than the C6 and adding PSRAM and WIFI 6 on the 5 Ghz band support. Nuki Hub uses both CPU cores (if available) to process tasks (e.g. HTTP server/MQTT client/BLE scanner/BLE client) and thus runs better on dual-core devices.
Other considerations: -- If Ethernet/PoE is required: ESP32-P4 with ESP32-C6-MINI-1 module or 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 required: ESP32-P4 with ESP32-C6-MINI-1 module, ESP32-C5 or ESP32-C6 +- If Ethernet/PoE is required: ESP32-P4 with ESP32-C6 or ESP32-C5 module or 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 required: ESP32-P4 with ESP32-C6 or ESP32-C5 module, ESP32-C5 or ESP32-C6 Devices ranked best-to-worst: -- ESP32-P4 with ESP32-C6-MINI-1 module +- ESP32-P4 with ESP32-C5 module (UNTESTED) +- ESP32-P4 with ESP32-C6 module - ......
- ESP32-S3 with PSRAM - ESP32-C5 with PSRAM diff --git a/boards/nuki-esp32-p4-c5.json b/boards/nuki-esp32-p4-c5.json new file mode 100644 index 0000000..0a05148 --- /dev/null +++ b/boards/nuki-esp32-p4-c5.json @@ -0,0 +1,34 @@ +{ + "build": { + "core": "esp32", + "extra_flags": [ + "-DBOARD_HAS_PSRAM" + ], + "f_cpu": "360000000L", + "f_flash": "80000000L", + "flash_mode": "qio", + "mcu": "esp32p4", + "variant": "esp32p4" + }, + "connectivity": [ + "bluetooth", + "openthread" + ], + "debug": { + "openocd_target": "esp32p4.cfg" + }, + "frameworks": [ + "arduino", + "espidf" + ], + "name": "Espressif ESP32-P4 generic", + "upload": { + "flash_size": "4MB", + "maximum_ram_size": 327680, + "maximum_size": 4194304, + "require_upload_port": true, + "speed": 460800 + }, + "url": "https://docs.espressif.com", + "vendor": "Espressif" +} diff --git a/pio_package_post.py b/pio_package_post.py index eaf03e8..395b418 100644 --- a/pio_package_post.py +++ b/pio_package_post.py @@ -9,6 +9,8 @@ def get_board_name(env): if env.get('BOARD') == 'nuki-esp32solo1': board = 'esp32solo1' + elif env.get('BOARD') == 'nuki-esp32-p4-c5': + board = 'esp32p4c5' elif env.get('BOARD') == 'nuki-esp32gls10': board = 'esp32gls10' elif env.get('BOARD') == 'nuki-esp32-s3-oct': diff --git a/platformio.ini b/platformio.ini index 7b076c1..81f2135 100644 --- a/platformio.ini +++ b/platformio.ini @@ -211,6 +211,13 @@ custom_component_remove = espressif/esp-zigbee-lib espressif/qrcode +[env:esp32-p4c5] +extends = env:esp32-p4 +board = nuki-esp32-p4-c5 +board_build.cmake_extra_args = + -DSDKCONFIG_DEFAULTS="sdkconfig.defaults;sdkconfig.release.defaults;sdkconfig.ramoptimize.defaults;sdkconfig.defaults.esp32-p4;sdkconfig.defaults.esp32-p4c5" + -DNUKI_TARGET_P4_C5=y + [env:esp32_dbg] extends = env:esp32 custom_build = debug @@ -321,4 +328,11 @@ custom_build = debug board_build.cmake_extra_args = -DSDKCONFIG_DEFAULTS="sdkconfig.defaults;sdkconfig.debug.defaults;sdkconfig.ramoptimize.defaults;sdkconfig.defaults.esp32-p4" build_flags = - ${env:esp32_dbg.build_flags} \ No newline at end of file + ${env:esp32_dbg.build_flags} + +[env:esp32-p4c5_dbg] +extends = env:esp32-p4_dbg +board = nuki-esp32-p4-c5 +board_build.cmake_extra_args = + -DSDKCONFIG_DEFAULTS="sdkconfig.defaults;sdkconfig.debug.defaults;sdkconfig.ramoptimize.defaults;sdkconfig.defaults.esp32-p4;sdkconfig.defaults.esp32-p4c5" + -DNUKI_TARGET_P4_C5=y \ No newline at end of file diff --git a/resources/how-to-flash.txt b/resources/how-to-flash.txt index 6b2e6aa..9f1177a 100644 --- a/resources/how-to-flash.txt +++ b/resources/how-to-flash.txt @@ -162,6 +162,10 @@ esptool.py --chip esp32h2 --port /dev/ttyUSB0 --baud 921600 --before default-res esptool.py --chip esp32p4 --port /dev/ttyUSB0 --baud 921600 --before default-reset --after hard-reset write-flash -z --flash-mode dio --flash-freq keep --flash-size detect 0xe000 boot_app0.bin 0x2000 nuki_hub_bootloader_esp32p4.bin 0x10000 nuki_hub_esp32p4.bin 0x270000 nuki_hub_updater_esp32p4.bin 0x8000 nuki_hub_partitions_esp32p4.bin +## ESP32-P4C5 + +esptool.py --chip esp32p4 --port /dev/ttyUSB0 --baud 921600 --before default-reset --after hard-reset write-flash -z --flash-mode dio --flash-freq keep --flash-size detect 0xe000 boot_app0.bin 0x2000 nuki_hub_bootloader_esp32p4c5.bin 0x10000 nuki_hub_esp32p4c5.bin 0x270000 nuki_hub_updater_esp32p4c5.bin 0x8000 nuki_hub_partitions_esp32p4c5.bin + ## ESP32-SOLO1 esptool.py --chip esp32 --port /dev/ttyUSB0 --baud 921600 --before default-reset --after hard-reset write-flash -z --flash-mode dio --flash-freq keep --flash-size detect 0xe000 boot_app0.bin 0x1000 nuki_hub_bootloader_esp32solo1.bin 0x10000 nuki_hub_esp32solo1.bin 0x270000 nuki_hub_updater_esp32solo1.bin 0x8000 nuki_hub_partitions_esp32solo1.bin diff --git a/sdkconfig.defaults.esp32-p4c5 b/sdkconfig.defaults.esp32-p4c5 new file mode 100644 index 0000000..ff66d68 --- /dev/null +++ b/sdkconfig.defaults.esp32-p4c5 @@ -0,0 +1 @@ +CONFIG_SLAVE_IDF_TARGET_ESP32C5=y \ No newline at end of file diff --git a/src/Config.h b/src/Config.h index 0bdc9b6..25b0ae1 100644 --- a/src/Config.h +++ b/src/Config.h @@ -5,12 +5,27 @@ #define NUKI_HUB_VERSION "9.13" #define NUKI_HUB_VERSION_INT (uint32_t)913 #define NUKI_HUB_BUILD "unknownbuildnr" -#define NUKI_HUB_DATE "2025-09-10" +#define NUKI_HUB_DATE "2025-09-16" #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" -#if defined(CONFIG_IDF_TARGET_ESP32P4) +#if defined(NUKI_TARGET_P4_C5) +#define GITHUB_LATEST_RELEASE_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/nuki_hub_esp32p4c5.bin" +#define GITHUB_LATEST_UPDATER_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/nuki_hub_updater_esp32p4c5.bin" +#define GITHUB_BETA_RELEASE_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/beta/nuki_hub_esp32p4c5.bin" +#define GITHUB_BETA_UPDATER_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/beta/nuki_hub_updater_esp32p4c5.bin" +#define GITHUB_MASTER_RELEASE_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/master/nuki_hub_esp32p4c5.bin" +#define GITHUB_MASTER_UPDATER_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/master/nuki_hub_updater_esp32p4c5.bin" +#define GITHUB_LATEST_RELEASE_BINARY_URL_DBG (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/debug/nuki_hub_esp32p4c5.bin" +#define GITHUB_LATEST_UPDATER_BINARY_URL_DBG (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/debug/nuki_hub_updater_esp32p4c5.bin" +#define GITHUB_BETA_RELEASE_BINARY_URL_DBG (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/debug/beta/nuki_hub_esp32p4c5.bin" +#define GITHUB_BETA_UPDATER_BINARY_URL_DBG (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/debug/beta/nuki_hub_updater_esp32p4c5.bin" +#define GITHUB_MASTER_RELEASE_BINARY_URL_DBG (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/debug/master/nuki_hub_esp32p4c5.bin" +#define GITHUB_MASTER_UPDATER_BINARY_URL_DBG (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/debug/master/nuki_hub_updater_esp32p4c5.bin" +#define NUKI_HUB_HW (char*)"ESP32-P4 (C5)" +#define BOOT_BUTTON_GPIO (gpio_num_t)35 +#elif defined(CONFIG_IDF_TARGET_ESP32P4) #define GITHUB_LATEST_RELEASE_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/nuki_hub_esp32p4.bin" #define GITHUB_LATEST_UPDATER_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/nuki_hub_updater_esp32p4.bin" #define GITHUB_BETA_RELEASE_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/beta/nuki_hub_esp32p4.bin" @@ -23,7 +38,7 @@ #define GITHUB_BETA_UPDATER_BINARY_URL_DBG (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/debug/beta/nuki_hub_updater_esp32p4.bin" #define GITHUB_MASTER_RELEASE_BINARY_URL_DBG (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/debug/master/nuki_hub_esp32p4.bin" #define GITHUB_MASTER_UPDATER_BINARY_URL_DBG (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/debug/master/nuki_hub_updater_esp32p4.bin" -#define NUKI_HUB_HW (char*)"ESP32-P4" +#define NUKI_HUB_HW (char*)"ESP32-P4 (C6)" #define BOOT_BUTTON_GPIO (gpio_num_t)35 #elif defined(CONFIG_IDF_TARGET_ESP32C3) #define GITHUB_LATEST_RELEASE_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/nuki_hub_esp32c3.bin" diff --git a/updater/pio_package_post.py b/updater/pio_package_post.py index 5f757a4..545d9d8 100644 --- a/updater/pio_package_post.py +++ b/updater/pio_package_post.py @@ -8,6 +8,8 @@ def get_board_name(env): board = env.get('BOARD_MCU') if env.get('BOARD') == 'nuki-esp32solo1': board = 'esp32solo1' + elif env.get('BOARD') == 'nuki-esp32-p4-c5': + board = 'esp32p4c5' elif env.get('BOARD') == 'nuki-esp32gls10': board = 'esp32gls10' elif env.get('BOARD') == 'nuki-esp32-s3-oct': diff --git a/updater/platformio.ini b/updater/platformio.ini index 93648b1..2dd79df 100644 --- a/updater/platformio.ini +++ b/updater/platformio.ini @@ -172,6 +172,13 @@ custom_component_remove = espressif/esp-zigbee-lib espressif/qrcode +[env:updater_esp32-p4c5] +extends = env:updater_esp32-p4 +board = nuki-esp32-p4-c5 +board_build.cmake_extra_args = + -DSDKCONFIG_DEFAULTS="sdkconfig.defaults;sdkconfig.defaults.esp32-p4;sdkconfig.defaults.esp32-p4c5" + -DNUKI_TARGET_P4_C5=y + [env:updater_esp32-h2] extends = env:updater_esp32 board = esp32-h2-devkitm-1 diff --git a/updater/sdkconfig.defaults.esp32-p4c5 b/updater/sdkconfig.defaults.esp32-p4c5 new file mode 100644 index 0000000..ff66d68 --- /dev/null +++ b/updater/sdkconfig.defaults.esp32-p4c5 @@ -0,0 +1 @@ +CONFIG_SLAVE_IDF_TARGET_ESP32C5=y \ No newline at end of file