From 9072d8444cc8e2e8a5e47491f34d3dfaccf9760d Mon Sep 17 00:00:00 2001 From: Ali Devrim OGUZ <11381547+devrim-oguz@users.noreply.github.com> Date: Wed, 1 Mar 2023 16:48:40 +0300 Subject: [PATCH 1/3] Fix the F_CPU frequency for the ESP32-S3 Hello, I was using the FastLED library and it was complaining about F_CPU not being defined. So, I just noticed that it is not defined for the ESP32-S3 module. So I made this change in the header file and it compiled. Therefore I wanted to propose this change to the HAL library to improve compatibility. Thank you for your time. --- cores/esp32/esp32-hal.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cores/esp32/esp32-hal.h b/cores/esp32/esp32-hal.h index 51ecea405df..8630d8dbae1 100644 --- a/cores/esp32/esp32-hal.h +++ b/cores/esp32/esp32-hal.h @@ -46,6 +46,8 @@ extern "C" { #define F_CPU (CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ * 1000000U) #elif CONFIG_IDF_TARGET_ESP32S2 #define F_CPU (CONFIG_ESP32S2_DEFAULT_CPU_FREQ_MHZ * 1000000U) +#elif CONFIG_IDF_TARGET_ESP32S3 +#define F_CPU (CONFIG_ESP32S3_DEFAULT_CPU_FREQ_MHZ * 1000000U) #endif #endif From 652dd1cdf664d1f23571ccbce02fbd2942b3ef90 Mon Sep 17 00:00:00 2001 From: Rodrigo Garcia Date: Wed, 29 Mar 2023 23:30:15 -0300 Subject: [PATCH 2/3] Makes F_CPU generic based on the SoC frequency Works for ESP32, ESP32C3, ESP32S2, ESP32S3 --- cores/esp32/esp32-hal.h | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/cores/esp32/esp32-hal.h b/cores/esp32/esp32-hal.h index 8630d8dbae1..e6dc0277935 100644 --- a/cores/esp32/esp32-hal.h +++ b/cores/esp32/esp32-hal.h @@ -42,13 +42,7 @@ extern "C" { #endif #ifndef F_CPU -#if CONFIG_IDF_TARGET_ESP32 // ESP32/PICO-D4 -#define F_CPU (CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ * 1000000U) -#elif CONFIG_IDF_TARGET_ESP32S2 -#define F_CPU (CONFIG_ESP32S2_DEFAULT_CPU_FREQ_MHZ * 1000000U) -#elif CONFIG_IDF_TARGET_ESP32S3 -#define F_CPU (CONFIG_ESP32S3_DEFAULT_CPU_FREQ_MHZ * 1000000U) -#endif +#define F_CPU (CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ * 1000000U) #endif #if CONFIG_ARDUINO_ISR_IRAM From 4863b5b26d1067b26bfd4cded6c0b8291d2759ae Mon Sep 17 00:00:00 2001 From: Rodrigo Garcia Date: Wed, 29 Mar 2023 23:52:05 -0300 Subject: [PATCH 3/3] Includes ESP32C3 in the F_CPU definition Necessary for ESP32 Arduino Core 2.0.x based on IDF 4.4 --- cores/esp32/esp32-hal.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/cores/esp32/esp32-hal.h b/cores/esp32/esp32-hal.h index e6dc0277935..2a51c3ebae7 100644 --- a/cores/esp32/esp32-hal.h +++ b/cores/esp32/esp32-hal.h @@ -42,7 +42,15 @@ extern "C" { #endif #ifndef F_CPU -#define F_CPU (CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ * 1000000U) +#if CONFIG_IDF_TARGET_ESP32 // ESP32/PICO-D4 +#define F_CPU (CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ * 1000000U) +#elif CONFIG_IDF_TARGET_ESP32C3 +#define F_CPU (CONFIG_ESP32C3_DEFAULT_CPU_FREQ_MHZ * 1000000U) +#elif CONFIG_IDF_TARGET_ESP32S2 +#define F_CPU (CONFIG_ESP32S2_DEFAULT_CPU_FREQ_MHZ * 1000000U) +#elif CONFIG_IDF_TARGET_ESP32S3 +#define F_CPU (CONFIG_ESP32S3_DEFAULT_CPU_FREQ_MHZ * 1000000U) +#endif #endif #if CONFIG_ARDUINO_ISR_IRAM