mirror of
https://github.com/espressif/esp-idf.git
synced 2025-09-23 01:05:14 +00:00
efuse: Updates efuse table for esp32c6
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -17,59 +17,20 @@ int esp_efuse_rtc_calib_get_ver(void)
|
||||
|
||||
uint32_t esp_efuse_rtc_calib_get_init_code(int version, uint32_t adc_unit, int atten)
|
||||
{
|
||||
assert(version == 1);
|
||||
// Currently calibration is not supported on ESP32-C6, IDF-5236
|
||||
(void) version;
|
||||
(void) adc_unit;
|
||||
const esp_efuse_desc_t** init_code_efuse;
|
||||
assert(atten < 4);
|
||||
if (atten == 0) {
|
||||
init_code_efuse = ESP_EFUSE_ADC1_INIT_CODE_ATTEN0;
|
||||
} else if (atten == 1) {
|
||||
init_code_efuse = ESP_EFUSE_ADC1_INIT_CODE_ATTEN1;
|
||||
} else if (atten == 2) {
|
||||
init_code_efuse = ESP_EFUSE_ADC1_INIT_CODE_ATTEN2;
|
||||
} else {
|
||||
init_code_efuse = ESP_EFUSE_ADC1_INIT_CODE_ATTEN3;
|
||||
}
|
||||
|
||||
int init_code_size = esp_efuse_get_field_size(init_code_efuse);
|
||||
assert(init_code_size == 10);
|
||||
|
||||
uint32_t init_code = 0;
|
||||
ESP_ERROR_CHECK(esp_efuse_read_field_blob(init_code_efuse, &init_code, init_code_size));
|
||||
return init_code + 1000; // version 1 logic
|
||||
(void) atten;
|
||||
return 0;
|
||||
}
|
||||
|
||||
esp_err_t esp_efuse_rtc_calib_get_cal_voltage(int version, int atten, uint32_t* out_digi, uint32_t* out_vol_mv)
|
||||
{
|
||||
const esp_efuse_desc_t** cal_vol_efuse;
|
||||
uint32_t calib_vol_expected_mv;
|
||||
if (version != 1) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
if (atten >= 4) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
if (atten == 0) {
|
||||
cal_vol_efuse = ESP_EFUSE_ADC1_CAL_VOL_ATTEN0;
|
||||
calib_vol_expected_mv = 400;
|
||||
} else if (atten == 1) {
|
||||
cal_vol_efuse = ESP_EFUSE_ADC1_CAL_VOL_ATTEN1;
|
||||
calib_vol_expected_mv = 550;
|
||||
} else if (atten == 2) {
|
||||
cal_vol_efuse = ESP_EFUSE_ADC1_CAL_VOL_ATTEN2;
|
||||
calib_vol_expected_mv = 750;
|
||||
} else {
|
||||
cal_vol_efuse = ESP_EFUSE_ADC1_CAL_VOL_ATTEN3;
|
||||
calib_vol_expected_mv = 1370;
|
||||
}
|
||||
|
||||
assert(cal_vol_efuse[0]->bit_count == 10);
|
||||
|
||||
uint32_t cal_vol = 0;
|
||||
ESP_ERROR_CHECK(esp_efuse_read_field_blob(cal_vol_efuse, &cal_vol, cal_vol_efuse[0]->bit_count));
|
||||
|
||||
*out_digi = 2000 + ((cal_vol & BIT(9))? -(cal_vol & ~BIT9): cal_vol);
|
||||
*out_vol_mv = calib_vol_expected_mv;
|
||||
// Currently calibration is not supported on ESP32-C6, IDF-5236
|
||||
(void) version;
|
||||
(void) atten;
|
||||
(void) out_digi;
|
||||
(void) out_vol_mv;
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user