rtc_clk_cpu_freq_set() lockups
Posted: Sat Oct 14, 2017 12:32 pm
Hi,
I'm having issues very early in the boot process on my ESP32 Thing from Spakfun (26Mhz XTAL). I can only describe the problem as a total lockup of the entire system.
To track down the issue I've enabled every debug option I've found but since that didn't yield any additional information I'm not back a nearly default config; only verbose logging, 26Mhz XTAL and increased main task stack size (8192) changed.
The only thing I know is that the boot process locks up in, or very soon after the call to rtc_clk_cpu_freq_set(). I've determined this though old-fashioned printf() (or as is the case here ESP_EARLY_LOGI) logging.
My clk.c currently looks as follows:
This produces the following output (startcpu0_default() is also sprinkled with logging)
There is no output after the last line, garbled or otherwise. The lockup happens about 50% of the time the device starts. The log on line 100 is never seen.
Anyone with an idea of what is going on?
I'm having issues very early in the boot process on my ESP32 Thing from Spakfun (26Mhz XTAL). I can only describe the problem as a total lockup of the entire system.
To track down the issue I've enabled every debug option I've found but since that didn't yield any additional information I'm not back a nearly default config; only verbose logging, 26Mhz XTAL and increased main task stack size (8192) changed.
The only thing I know is that the boot process locks up in, or very soon after the call to rtc_clk_cpu_freq_set(). I've determined this though old-fashioned printf() (or as is the case here ESP_EARLY_LOGI) logging.
My clk.c currently looks as follows:
Code: Select all
<Line 90> // Wait for UART TX to finish, otherwise some UART output will be lost
// when switching APB frequency
ESP_EARLY_LOGI("esp_clk_init", "%d", __LINE__);
uart_tx_wait_idle(CONFIG_CONSOLE_UART_NUM);
ESP_EARLY_LOGI("esp_clk_init", "%d", __LINE__);
uint32_t freq_before = rtc_clk_cpu_freq_value(rtc_clk_cpu_freq_get()) / MHZ ;
<Line 97> ESP_EARLY_LOGI("esp_clk_init", "%d", __LINE__);
rtc_clk_cpu_freq_set(freq);
ESP_EARLY_LOGI("esp_clk_init", "%d", __LINE__);
// Re calculate the ccount to make time calculation correct.
uint32_t freq_after = CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ;
Code: Select all
I (0) cpu_start: App cpu up.
I (305) heap_init: Initializing. RAM available for dynamic allocation:
D (312) heap_init: New heap initialised at 0x3ffae6e0
I (317) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
D (323) heap_init: New heap initialised at 0x3ffb9e48
I (328) heap_init: At 3FFB9E48 len 000261B8 (152 KiB): DRAM
I (335) heap_init: At 3FFE0440 len 00003BC0 (14 KiB): D/IRAM
I (341) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
D (347) heap_init: New heap initialised at 0x4008ffb4
I (352) heap_init: At 4008FFB4 len 0001004C (64 KiB): IRAM
I (359) cpu_start: Pro cpu start user code
I (363) start_cpu0_default: 257
I (367) start_cpu0_default: 259
I (371) start_cpu0_default: 300
I (375) esp_clk_init: 53
I (378) esp_clk_init: 55
I (381) esp_clk_init: 57
I (384) esp_clk_init: 59
I (388) esp_clk_init: 66
D (398) clk: RTC_SLOW_CLK calibration value: 3272350
I (398) esp_clk_init: 68
I (399) esp_clk_init: 71
I (402) esp_clk_init: 88
I (406) esp_clk_init: 92
I (420) esp_clk_init: 94
I (420) esp_clk_init: 97
Anyone with an idea of what is going on?