From c0c17bd3de5ea575b775db6cbef84befd020d524 Mon Sep 17 00:00:00 2001 From: Juan Schiavoni <55675185+jjsch-dev@users.noreply.github.com> Date: Tue, 18 Jul 2023 06:49:07 -0300 Subject: [PATCH] Fails with ESP32 (Standard) and not run with ESP-IDF v5.2 (#542) * Fails with ESP32 (standard) and ESP-IDF v5.2 With IDF 5.2 master it works with esp32-s3 but fails with esp32 standard, and has two problems: First is that when compiling it does not find the function: ets_delay_us'. implicit declaration of function 'ets_delay_us'; Second that it fails to initialize xlock. camera_xclk: ledc_timer_config failed, rc=103 The solution is to add #define ets_delay_us esp_rom_delay_us when the idf version is greater than 5 and initialize the variable timer_conf.deconfigure = false; * Build fails with ESP32 (Standard) and does not run with ESP-IDF v5.2 With IDF 5.2 master it works with esp32-s3 but fails with esp32 standard, and has two problems: First is that when compiling it does not find the function: ets_delay_us'. implicit declaration of function 'ets_delay_us'; Second that it fails to initialize xlock. camera_xclk: ledc_timer_config failed, rc=103 The solution is to add #define ets_delay_us esp_rom_delay_us when the idf version is greater than 5 and initialize the variable timer_conf.deconfigure = false; * Fails with ESP32 (Standard) and not run with ESP-IDF v5.2 With IDF 5.2 master it works with esp32-s3 but fails with esp32 standard, and has two problems: First is that when compiling it does not find the function: ets_delay_us'. implicit declaration of function 'ets_delay_us'; Second that it fails to initialize xlock. camera_xclk: ledc_timer_config failed, rc=103 The solution is to add #define ets_delay_us esp_rom_delay_us when the idf version is greater than 5 and initialize the variable timer_conf.deconfigure = false; --------- Co-authored-by: Me No Dev --- target/esp32/ll_cam.c | 4 ++++ target/xclk.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/target/esp32/ll_cam.c b/target/esp32/ll_cam.c index 566ebb5..12a9e70 100644 --- a/target/esp32/ll_cam.c +++ b/target/esp32/ll_cam.c @@ -44,6 +44,10 @@ static inline int gpio_ll_get_level(gpio_dev_t *hw, int gpio_num) #define gpio_matrix_in(a,b,c) esp_rom_gpio_connect_in_signal(a,b,c) #endif +#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 2) +#define ets_delay_us esp_rom_delay_us +#endif + static const char *TAG = "esp32 ll_cam"; #define I2S_ISR_ENABLE(i) {I2S0.int_clr.i = 1;I2S0.int_ena.i = 1;} diff --git a/target/xclk.c b/target/xclk.c index 384fed6..cb67b67 100755 --- a/target/xclk.c +++ b/target/xclk.c @@ -23,6 +23,10 @@ esp_err_t xclk_timer_conf(int ledc_timer, int xclk_freq_hz) timer_conf.freq_hz = xclk_freq_hz; timer_conf.speed_mode = LEDC_LOW_SPEED_MODE; +#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 2, 0) + timer_conf.deconfigure = false; +#endif + #if ESP_IDF_VERSION_MAJOR >= 4 timer_conf.clk_cfg = LEDC_AUTO_CLK; #endif