esp32c3 espefuse: Fix efuse programming timing on ESP32-C3 ECO3

Without this timing change, efuse programming occasionally appears to fail
(although the efuse is programmed correctly).
This commit is contained in:
Angus Gratton
2021-04-23 10:15:50 +10:00
parent a67793e9fc
commit 999f648a35
2 changed files with 9 additions and 3 deletions

View File

@@ -63,8 +63,14 @@ const esp_efuse_range_addr_t range_write_addr_blocks[] = {
// Update Efuse timing configuration
static esp_err_t esp_efuse_set_timing(void)
{
uint32_t clock_hz = esp_clk_apb_freq();
return ets_efuse_set_timing(clock_hz) ? ESP_FAIL : ESP_OK;
// efuse clock is fixed in ESP32-C3, so the ets_efuse_set_timing() function
// takes an argument for compatibility with older ROM functions but it's ignored.
int res = ets_efuse_set_timing(0);
assert(res == 0);
REG_SET_FIELD(EFUSE_WR_TIM_CONF2_REG, EFUSE_PWR_OFF_NUM, 0x60);
return ESP_OK;
}
#endif // ifndef CONFIG_EFUSE_VIRTUAL