efuse: Checks errors of 4x coding scheme for BLOCK0 if so then abort

This commit is contained in:
KonstantinKondrashov
2021-08-11 19:06:48 +05:00
parent 46f0313d6b
commit 5ec9baff36
10 changed files with 82 additions and 0 deletions

View File

@@ -68,6 +68,26 @@ void esp_efuse_utility_clear_program_registers(void)
efuse_hal_clear_program_registers();
}
esp_err_t esp_efuse_utility_check_errors(void)
{
if (efuse_ll_get_err_rst_enable()) {
for (unsigned i = 0; i < 5; i++) {
uint32_t error_reg = REG_READ(EFUSE_RD_REPEAT_ERR0_REG + i * 4);
if (error_reg) {
uint32_t data_reg = REG_READ(EFUSE_RD_REPEAT_DATA0_REG + i * 4);
if (error_reg & data_reg) {
// For 0001 situation (4x coding scheme):
// an error bit points that data bit is wrong in case the data bit equals 1. (need to reboot in this case).
ESP_EARLY_LOGE(TAG, "Error in EFUSE_RD_REPEAT_DATA%d_REG of BLOCK0 (error_reg=0x%08x, data_reg=0x%08x). Need to reboot", i, error_reg, data_reg);
efuse_hal_read();
return ESP_FAIL;
}
}
}
}
return ESP_OK;
}
// Burn values written to the efuse write registers
esp_err_t esp_efuse_utility_burn_chip(void)
{