mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-08 20:21:04 +00:00
adc: support adc efuse-based calibration on esp32s3
This commit is contained in:

committed by
Armando (Dou Yiwen)

parent
c54caa457e
commit
c45c6f52f1
@@ -33,7 +33,7 @@ uint8_t esp_efuse_get_chip_ver(void)
|
||||
uint32_t esp_efuse_get_pkg_ver(void)
|
||||
{
|
||||
uint32_t pkg_ver = 0;
|
||||
esp_efuse_read_field_blob(ESP_EFUSE_PKG_VERSION, &pkg_ver, 4);
|
||||
esp_efuse_read_field_blob(ESP_EFUSE_PKG_VERSION, &pkg_ver, ESP_EFUSE_PKG_VERSION[0]->bit_count);
|
||||
return pkg_ver;
|
||||
}
|
||||
|
||||
@@ -45,9 +45,9 @@ esp_err_t esp_efuse_disable_rom_download_mode(void)
|
||||
esp_err_t esp_efuse_set_rom_log_scheme(esp_efuse_rom_log_scheme_t log_scheme)
|
||||
{
|
||||
int cur_log_scheme = 0;
|
||||
esp_efuse_read_field_blob(ESP_EFUSE_UART_PRINT_CONTROL, &cur_log_scheme, 2);
|
||||
esp_efuse_read_field_blob(ESP_EFUSE_UART_PRINT_CONTROL, &cur_log_scheme, ESP_EFUSE_UART_PRINT_CONTROL[0]->bit_count);
|
||||
if (!cur_log_scheme) { // not burned yet
|
||||
return esp_efuse_write_field_blob(ESP_EFUSE_UART_PRINT_CONTROL, &log_scheme, 2);
|
||||
return esp_efuse_write_field_blob(ESP_EFUSE_UART_PRINT_CONTROL, &log_scheme, ESP_EFUSE_UART_PRINT_CONTROL[0]->bit_count);
|
||||
} else {
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
}
|
||||
|
103
components/efuse/esp32s3/esp_efuse_rtc_calib.c
Normal file
103
components/efuse/esp32s3/esp_efuse_rtc_calib.c
Normal file
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2020-2021 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <esp_bit_defs.h>
|
||||
#include "esp_err.h"
|
||||
#include "esp_log.h"
|
||||
#include "esp_efuse.h"
|
||||
#include "esp_efuse_table.h"
|
||||
|
||||
//Don't introduce new dependency of ADC, keep these macro same as ADC related definations
|
||||
#define ADC_ATTEN_MAX 4
|
||||
#define ADC_NUM_MAX 2
|
||||
#define ADC_NUM_1 0
|
||||
#define ADC_NUM_2 1
|
||||
|
||||
|
||||
int esp_efuse_rtc_calib_get_ver(void)
|
||||
{
|
||||
uint32_t blk1_version = 0;
|
||||
uint32_t blk2_version = 0;
|
||||
ESP_ERROR_CHECK(esp_efuse_read_field_blob(ESP_EFUSE_BLOCK1_VERSION, &blk1_version, ESP_EFUSE_BLOCK1_VERSION[0]->bit_count));
|
||||
ESP_ERROR_CHECK(esp_efuse_read_field_blob(ESP_EFUSE_BLOCK2_VERSION, &blk2_version, ESP_EFUSE_BLOCK2_VERSION[0]->bit_count));
|
||||
|
||||
if (blk1_version == blk2_version) {
|
||||
return blk1_version;
|
||||
} else {
|
||||
blk1_version = 0;
|
||||
blk2_version = 0;
|
||||
ESP_LOGW("eFuse", "calibration efuse version does not match, set default version: %d", 0);
|
||||
}
|
||||
|
||||
return blk2_version;
|
||||
}
|
||||
|
||||
uint16_t esp_efuse_rtc_calib_get_init_code(int version, uint32_t adc_unit, int atten)
|
||||
{
|
||||
assert(version == 1);
|
||||
assert(atten < 4);
|
||||
assert(adc_unit < ADC_NUM_MAX);
|
||||
|
||||
const esp_efuse_desc_t **desc[8] = {ESP_EFUSE_ADC1_INIT_CODE_ATTEN0, ESP_EFUSE_ADC1_INIT_CODE_ATTEN1, ESP_EFUSE_ADC1_INIT_CODE_ATTEN2, ESP_EFUSE_ADC1_INIT_CODE_ATTEN3,
|
||||
ESP_EFUSE_ADC2_INIT_CODE_ATTEN0, ESP_EFUSE_ADC2_INIT_CODE_ATTEN1, ESP_EFUSE_ADC2_INIT_CODE_ATTEN2, ESP_EFUSE_ADC2_INIT_CODE_ATTEN3};
|
||||
int efuse_icode_bits = 0;
|
||||
uint32_t adc_icode[4] = {};
|
||||
uint32_t adc_icode_diff[4] = {};
|
||||
uint8_t desc_index = (adc_unit == ADC_NUM_1) ? 0 : 4;
|
||||
|
||||
for (int diff_index = 0; diff_index < 4; diff_index++) {
|
||||
efuse_icode_bits = esp_efuse_get_field_size(desc[desc_index]);
|
||||
ESP_ERROR_CHECK(esp_efuse_read_field_blob(desc[desc_index], &adc_icode_diff[diff_index], efuse_icode_bits));
|
||||
desc_index++;
|
||||
}
|
||||
|
||||
//Version 1 logic for calculating ADC ICode based on EFUSE burnt value
|
||||
if (adc_unit == ADC_NUM_1) {
|
||||
adc_icode[0] = adc_icode_diff[0] + 1850;
|
||||
adc_icode[1] = adc_icode_diff[1] + adc_icode[0] + 90;
|
||||
adc_icode[2] = adc_icode_diff[2] + adc_icode[1];
|
||||
adc_icode[3] = adc_icode_diff[3] + adc_icode[2] + 70;
|
||||
} else {
|
||||
adc_icode[0] = adc_icode_diff[0] + 2020;
|
||||
adc_icode[1] = adc_icode_diff[1] + adc_icode[0];
|
||||
adc_icode[2] = adc_icode_diff[2] + adc_icode[1];
|
||||
adc_icode[3] = adc_icode_diff[3] + adc_icode[2];
|
||||
}
|
||||
|
||||
return adc_icode[atten];
|
||||
}
|
||||
|
||||
esp_err_t esp_efuse_rtc_calib_get_cal_voltage(int version, uint32_t adc_unit, int atten, uint32_t *out_digi, uint32_t *out_vol_mv)
|
||||
{
|
||||
assert(version == 1);
|
||||
assert(atten < 4);
|
||||
assert(adc_unit < ADC_NUM_MAX);
|
||||
|
||||
int efuse_vol_bits = 0;
|
||||
uint32_t adc_vol_diff[8] = {};
|
||||
uint32_t adc1_vol[4] = {};
|
||||
uint32_t adc2_vol[4] = {};
|
||||
const esp_efuse_desc_t **desc[8] = {ESP_EFUSE_ADC1_CAL_VOL_ATTEN0, ESP_EFUSE_ADC1_CAL_VOL_ATTEN1, ESP_EFUSE_ADC1_CAL_VOL_ATTEN2, ESP_EFUSE_ADC1_CAL_VOL_ATTEN3,
|
||||
ESP_EFUSE_ADC2_CAL_VOL_ATTEN0, ESP_EFUSE_ADC2_CAL_VOL_ATTEN1, ESP_EFUSE_ADC2_CAL_VOL_ATTEN2, ESP_EFUSE_ADC2_CAL_VOL_ATTEN3};
|
||||
for (int i = 0; i < 8; i++) {
|
||||
efuse_vol_bits = esp_efuse_get_field_size(desc[i]);
|
||||
ESP_ERROR_CHECK(esp_efuse_read_field_blob(desc[i], &adc_vol_diff[i], efuse_vol_bits));
|
||||
}
|
||||
|
||||
adc1_vol[3] = adc_vol_diff[3] + 900;
|
||||
adc1_vol[2] = adc_vol_diff[2] + adc1_vol[3] + 800;
|
||||
adc1_vol[1] = adc_vol_diff[1] + adc1_vol[2] + 700;
|
||||
adc1_vol[0] = adc_vol_diff[0] + adc1_vol[1] + 800;
|
||||
adc2_vol[3] = adc1_vol[3] - adc_vol_diff[7] + 15;
|
||||
adc2_vol[2] = adc1_vol[2] - adc_vol_diff[6] + 20;
|
||||
adc2_vol[1] = adc1_vol[1] - adc_vol_diff[5] + 10;
|
||||
adc2_vol[0] = adc1_vol[0] - adc_vol_diff[4] + 40;
|
||||
|
||||
*out_digi = (adc_unit == ADC_NUM_1) ? adc1_vol[atten] : adc2_vol[atten];
|
||||
*out_vol_mv = 850;
|
||||
|
||||
return ESP_OK;
|
||||
}
|
@@ -9,7 +9,7 @@
|
||||
#include <assert.h>
|
||||
#include "esp_efuse_table.h"
|
||||
|
||||
// md5_digest_table 2b4b79060b04576a3d189a54f42dd462
|
||||
// md5_digest_table 0f3dc076304dac1cb56cea03c223d26d
|
||||
// This file was generated from the file esp_efuse_table.csv. DO NOT CHANGE THIS FILE MANUALLY.
|
||||
// If you want to change some fields, you need to change esp_efuse_table.csv file
|
||||
// then run `efuse_common_table` or `efuse_custom_table` command it will generate this file.
|
||||
@@ -417,15 +417,15 @@ static const esp_efuse_desc_t WAFER_VERSION[] = {
|
||||
};
|
||||
|
||||
static const esp_efuse_desc_t PKG_VERSION[] = {
|
||||
{EFUSE_BLK1, 117, 4}, // Package version 0:ESP32-S2 1:ESP32-S2FH16 2:ESP32-S2FH32,
|
||||
{EFUSE_BLK1, 117, 3}, // Package version,
|
||||
};
|
||||
|
||||
static const esp_efuse_desc_t BLOCK1_VERSION[] = {
|
||||
{EFUSE_BLK1, 121, 3}, // BLOCK1 efuse version 0:No calibration 1:With calibration,
|
||||
{EFUSE_BLK1, 120, 3}, // BLOCK1 efuse version 0:No calibration 1:With calibration,
|
||||
};
|
||||
|
||||
static const esp_efuse_desc_t SYS_DATA_PART0[] = {
|
||||
{EFUSE_BLK1, 126, 66}, // System configuration,
|
||||
static const esp_efuse_desc_t ADC2_CAL_VOL_ATTEN3[] = {
|
||||
{EFUSE_BLK1, 186, 6}, // ADC2 calibration voltage at atten3,
|
||||
};
|
||||
|
||||
static const esp_efuse_desc_t OPTIONAL_UNIQUE_ID[] = {
|
||||
@@ -433,7 +433,75 @@ static const esp_efuse_desc_t OPTIONAL_UNIQUE_ID[] = {
|
||||
};
|
||||
|
||||
static const esp_efuse_desc_t BLOCK2_VERSION[] = {
|
||||
{EFUSE_BLK2, 132, 3}, // Version of BLOCK2,
|
||||
{EFUSE_BLK2, 128, 4}, // Version of BLOCK2,
|
||||
};
|
||||
|
||||
static const esp_efuse_desc_t TEMP_CALIB[] = {
|
||||
{EFUSE_BLK2, 132, 9}, // Temperature calibration data,
|
||||
};
|
||||
|
||||
static const esp_efuse_desc_t OCODE[] = {
|
||||
{EFUSE_BLK2, 141, 8}, // ADC OCode,
|
||||
};
|
||||
|
||||
static const esp_efuse_desc_t ADC1_INIT_CODE_ATTEN0[] = {
|
||||
{EFUSE_BLK2, 149, 8}, // ADC1 init code at atten0,
|
||||
};
|
||||
|
||||
static const esp_efuse_desc_t ADC1_INIT_CODE_ATTEN1[] = {
|
||||
{EFUSE_BLK2, 157, 6}, // ADC1 init code at atten1,
|
||||
};
|
||||
|
||||
static const esp_efuse_desc_t ADC1_INIT_CODE_ATTEN2[] = {
|
||||
{EFUSE_BLK2, 163, 6}, // ADC1 init code at atten2,
|
||||
};
|
||||
|
||||
static const esp_efuse_desc_t ADC1_INIT_CODE_ATTEN3[] = {
|
||||
{EFUSE_BLK2, 169, 6}, // ADC1 init code at atten3,
|
||||
};
|
||||
|
||||
static const esp_efuse_desc_t ADC2_INIT_CODE_ATTEN0[] = {
|
||||
{EFUSE_BLK2, 175, 8}, // ADC2 init code at atten0,
|
||||
};
|
||||
|
||||
static const esp_efuse_desc_t ADC2_INIT_CODE_ATTEN1[] = {
|
||||
{EFUSE_BLK2, 183, 6}, // ADC2 init code at atten1,
|
||||
};
|
||||
|
||||
static const esp_efuse_desc_t ADC2_INIT_CODE_ATTEN2[] = {
|
||||
{EFUSE_BLK2, 189, 6}, // ADC2 init code at atten2,
|
||||
};
|
||||
|
||||
static const esp_efuse_desc_t ADC2_INIT_CODE_ATTEN3[] = {
|
||||
{EFUSE_BLK2, 195, 6}, // ADC2 init code at atten3,
|
||||
};
|
||||
|
||||
static const esp_efuse_desc_t ADC1_CAL_VOL_ATTEN0[] = {
|
||||
{EFUSE_BLK2, 201, 8}, // ADC1 calibration voltage at atten0,
|
||||
};
|
||||
|
||||
static const esp_efuse_desc_t ADC1_CAL_VOL_ATTEN1[] = {
|
||||
{EFUSE_BLK2, 209, 8}, // ADC1 calibration voltage at atten1,
|
||||
};
|
||||
|
||||
static const esp_efuse_desc_t ADC1_CAL_VOL_ATTEN2[] = {
|
||||
{EFUSE_BLK2, 217, 8}, // ADC1 calibration voltage at atten2,
|
||||
};
|
||||
|
||||
static const esp_efuse_desc_t ADC1_CAL_VOL_ATTEN3[] = {
|
||||
{EFUSE_BLK2, 225, 8}, // ADC1 calibration voltage at atten3,
|
||||
};
|
||||
|
||||
static const esp_efuse_desc_t ADC2_CAL_VOL_ATTEN0[] = {
|
||||
{EFUSE_BLK2, 233, 8}, // ADC2 calibration voltage at atten0,
|
||||
};
|
||||
|
||||
static const esp_efuse_desc_t ADC2_CAL_VOL_ATTEN1[] = {
|
||||
{EFUSE_BLK2, 241, 7}, // ADC2 calibration voltage at atten1,
|
||||
};
|
||||
|
||||
static const esp_efuse_desc_t ADC2_CAL_VOL_ATTEN2[] = {
|
||||
{EFUSE_BLK2, 248, 7}, // ADC2 calibration voltage at atten2,
|
||||
};
|
||||
|
||||
static const esp_efuse_desc_t USER_DATA[] = {
|
||||
@@ -977,7 +1045,7 @@ const esp_efuse_desc_t* ESP_EFUSE_WAFER_VERSION[] = {
|
||||
};
|
||||
|
||||
const esp_efuse_desc_t* ESP_EFUSE_PKG_VERSION[] = {
|
||||
&PKG_VERSION[0], // Package version 0:ESP32-S2 1:ESP32-S2FH16 2:ESP32-S2FH32
|
||||
&PKG_VERSION[0], // Package version
|
||||
NULL
|
||||
};
|
||||
|
||||
@@ -986,8 +1054,8 @@ const esp_efuse_desc_t* ESP_EFUSE_BLOCK1_VERSION[] = {
|
||||
NULL
|
||||
};
|
||||
|
||||
const esp_efuse_desc_t* ESP_EFUSE_SYS_DATA_PART0[] = {
|
||||
&SYS_DATA_PART0[0], // System configuration
|
||||
const esp_efuse_desc_t* ESP_EFUSE_ADC2_CAL_VOL_ATTEN3[] = {
|
||||
&ADC2_CAL_VOL_ATTEN3[0], // ADC2 calibration voltage at atten3
|
||||
NULL
|
||||
};
|
||||
|
||||
@@ -1001,6 +1069,91 @@ const esp_efuse_desc_t* ESP_EFUSE_BLOCK2_VERSION[] = {
|
||||
NULL
|
||||
};
|
||||
|
||||
const esp_efuse_desc_t* ESP_EFUSE_TEMP_CALIB[] = {
|
||||
&TEMP_CALIB[0], // Temperature calibration data
|
||||
NULL
|
||||
};
|
||||
|
||||
const esp_efuse_desc_t* ESP_EFUSE_OCODE[] = {
|
||||
&OCODE[0], // ADC OCode
|
||||
NULL
|
||||
};
|
||||
|
||||
const esp_efuse_desc_t* ESP_EFUSE_ADC1_INIT_CODE_ATTEN0[] = {
|
||||
&ADC1_INIT_CODE_ATTEN0[0], // ADC1 init code at atten0
|
||||
NULL
|
||||
};
|
||||
|
||||
const esp_efuse_desc_t* ESP_EFUSE_ADC1_INIT_CODE_ATTEN1[] = {
|
||||
&ADC1_INIT_CODE_ATTEN1[0], // ADC1 init code at atten1
|
||||
NULL
|
||||
};
|
||||
|
||||
const esp_efuse_desc_t* ESP_EFUSE_ADC1_INIT_CODE_ATTEN2[] = {
|
||||
&ADC1_INIT_CODE_ATTEN2[0], // ADC1 init code at atten2
|
||||
NULL
|
||||
};
|
||||
|
||||
const esp_efuse_desc_t* ESP_EFUSE_ADC1_INIT_CODE_ATTEN3[] = {
|
||||
&ADC1_INIT_CODE_ATTEN3[0], // ADC1 init code at atten3
|
||||
NULL
|
||||
};
|
||||
|
||||
const esp_efuse_desc_t* ESP_EFUSE_ADC2_INIT_CODE_ATTEN0[] = {
|
||||
&ADC2_INIT_CODE_ATTEN0[0], // ADC2 init code at atten0
|
||||
NULL
|
||||
};
|
||||
|
||||
const esp_efuse_desc_t* ESP_EFUSE_ADC2_INIT_CODE_ATTEN1[] = {
|
||||
&ADC2_INIT_CODE_ATTEN1[0], // ADC2 init code at atten1
|
||||
NULL
|
||||
};
|
||||
|
||||
const esp_efuse_desc_t* ESP_EFUSE_ADC2_INIT_CODE_ATTEN2[] = {
|
||||
&ADC2_INIT_CODE_ATTEN2[0], // ADC2 init code at atten2
|
||||
NULL
|
||||
};
|
||||
|
||||
const esp_efuse_desc_t* ESP_EFUSE_ADC2_INIT_CODE_ATTEN3[] = {
|
||||
&ADC2_INIT_CODE_ATTEN3[0], // ADC2 init code at atten3
|
||||
NULL
|
||||
};
|
||||
|
||||
const esp_efuse_desc_t* ESP_EFUSE_ADC1_CAL_VOL_ATTEN0[] = {
|
||||
&ADC1_CAL_VOL_ATTEN0[0], // ADC1 calibration voltage at atten0
|
||||
NULL
|
||||
};
|
||||
|
||||
const esp_efuse_desc_t* ESP_EFUSE_ADC1_CAL_VOL_ATTEN1[] = {
|
||||
&ADC1_CAL_VOL_ATTEN1[0], // ADC1 calibration voltage at atten1
|
||||
NULL
|
||||
};
|
||||
|
||||
const esp_efuse_desc_t* ESP_EFUSE_ADC1_CAL_VOL_ATTEN2[] = {
|
||||
&ADC1_CAL_VOL_ATTEN2[0], // ADC1 calibration voltage at atten2
|
||||
NULL
|
||||
};
|
||||
|
||||
const esp_efuse_desc_t* ESP_EFUSE_ADC1_CAL_VOL_ATTEN3[] = {
|
||||
&ADC1_CAL_VOL_ATTEN3[0], // ADC1 calibration voltage at atten3
|
||||
NULL
|
||||
};
|
||||
|
||||
const esp_efuse_desc_t* ESP_EFUSE_ADC2_CAL_VOL_ATTEN0[] = {
|
||||
&ADC2_CAL_VOL_ATTEN0[0], // ADC2 calibration voltage at atten0
|
||||
NULL
|
||||
};
|
||||
|
||||
const esp_efuse_desc_t* ESP_EFUSE_ADC2_CAL_VOL_ATTEN1[] = {
|
||||
&ADC2_CAL_VOL_ATTEN1[0], // ADC2 calibration voltage at atten1
|
||||
NULL
|
||||
};
|
||||
|
||||
const esp_efuse_desc_t* ESP_EFUSE_ADC2_CAL_VOL_ATTEN2[] = {
|
||||
&ADC2_CAL_VOL_ATTEN2[0], // ADC2 calibration voltage at atten2
|
||||
NULL
|
||||
};
|
||||
|
||||
const esp_efuse_desc_t* ESP_EFUSE_USER_DATA[] = {
|
||||
&USER_DATA[0], // User data
|
||||
NULL
|
||||
|
@@ -130,14 +130,31 @@
|
||||
SPI_PAD_CONFIG_D6, EFUSE_BLK1, 102, 6, SPI_PAD_configure D6
|
||||
SPI_PAD_CONFIG_D7, EFUSE_BLK1, 108, 6, SPI_PAD_configure D7
|
||||
WAFER_VERSION, EFUSE_BLK1, 114, 3, WAFER version 0:A
|
||||
PKG_VERSION, EFUSE_BLK1, 117, 4, Package version 0:ESP32-S2 1:ESP32-S2FH16 2:ESP32-S2FH32
|
||||
BLOCK1_VERSION, EFUSE_BLK1, 121, 3, BLOCK1 efuse version 0:No calibration 1:With calibration
|
||||
SYS_DATA_PART0, EFUSE_BLK1, 126, 66, System configuration
|
||||
PKG_VERSION, EFUSE_BLK1, 117, 3, Package version
|
||||
BLOCK1_VERSION, EFUSE_BLK1, 120, 3, BLOCK1 efuse version 0:No calibration 1:With calibration
|
||||
ADC2_CAL_VOL_ATTEN3, EFUSE_BLK1, 186, 6, ADC2 calibration voltage at atten3
|
||||
|
||||
# SYS_DATA_PART1 BLOCK# - System configuration
|
||||
#######################
|
||||
OPTIONAL_UNIQUE_ID, EFUSE_BLK2, 0, 128, Optional unique 128-bit ID
|
||||
BLOCK2_VERSION, EFUSE_BLK2, 132, 3, Version of BLOCK2
|
||||
BLOCK2_VERSION, EFUSE_BLK2, 128, 4, Version of BLOCK2
|
||||
TEMP_CALIB, EFUSE_BLK2, 132, 9, Temperature calibration data
|
||||
OCODE, EFUSE_BLK2, 141, 8, ADC OCode
|
||||
ADC1_INIT_CODE_ATTEN0, EFUSE_BLK2, 149, 8, ADC1 init code at atten0
|
||||
ADC1_INIT_CODE_ATTEN1, EFUSE_BLK2, 157, 6, ADC1 init code at atten1
|
||||
ADC1_INIT_CODE_ATTEN2, EFUSE_BLK2, 163, 6, ADC1 init code at atten2
|
||||
ADC1_INIT_CODE_ATTEN3, EFUSE_BLK2, 169, 6, ADC1 init code at atten3
|
||||
ADC2_INIT_CODE_ATTEN0, EFUSE_BLK2, 175, 8, ADC2 init code at atten0
|
||||
ADC2_INIT_CODE_ATTEN1, EFUSE_BLK2, 183, 6, ADC2 init code at atten1
|
||||
ADC2_INIT_CODE_ATTEN2, EFUSE_BLK2, 189, 6, ADC2 init code at atten2
|
||||
ADC2_INIT_CODE_ATTEN3, EFUSE_BLK2, 195, 6, ADC2 init code at atten3
|
||||
ADC1_CAL_VOL_ATTEN0, EFUSE_BLK2, 201, 8, ADC1 calibration voltage at atten0
|
||||
ADC1_CAL_VOL_ATTEN1, EFUSE_BLK2, 209, 8, ADC1 calibration voltage at atten1
|
||||
ADC1_CAL_VOL_ATTEN2, EFUSE_BLK2, 217, 8, ADC1 calibration voltage at atten2
|
||||
ADC1_CAL_VOL_ATTEN3, EFUSE_BLK2, 225, 8, ADC1 calibration voltage at atten3
|
||||
ADC2_CAL_VOL_ATTEN0, EFUSE_BLK2, 233, 8, ADC2 calibration voltage at atten0
|
||||
ADC2_CAL_VOL_ATTEN1, EFUSE_BLK2, 241, 7, ADC2 calibration voltage at atten1
|
||||
ADC2_CAL_VOL_ATTEN2, EFUSE_BLK2, 248, 7, ADC2 calibration voltage at atten2
|
||||
|
||||
################
|
||||
USER_DATA, EFUSE_BLK3, 0, 256, User data
|
||||
|
Can't render this file because it contains an unexpected character in line 8 and column 53.
|
56
components/efuse/esp32s3/include/esp_efuse_rtc_calib.h
Normal file
56
components/efuse/esp32s3/include/esp_efuse_rtc_calib.h
Normal file
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2020-2021 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <esp_types.h>
|
||||
#include <esp_err.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Get the RTC calibration efuse version
|
||||
*
|
||||
* @return Version of the stored efuse
|
||||
*/
|
||||
int esp_efuse_rtc_calib_get_ver(void);
|
||||
|
||||
/**
|
||||
* @brief Get the init code in the efuse, for the corresponding attenuation.
|
||||
*
|
||||
* @param version Version of the stored efuse
|
||||
* @param adc_unit ADC unit
|
||||
* @param atten Attenuation of the init code
|
||||
* @return The init code stored in efuse
|
||||
*/
|
||||
uint16_t esp_efuse_rtc_calib_get_init_code(int version, uint32_t adc_unit, int atten);
|
||||
|
||||
/**
|
||||
* @brief Get the calibration digits stored in the efuse, and the corresponding voltage.
|
||||
*
|
||||
* @param version Version of the stored efuse
|
||||
* @param adc_unit ADC unit
|
||||
* @param atten Attenuation to use
|
||||
* @param out_digi Output buffer of the digits
|
||||
* @param out_vol_mv Output of the voltage, in mV
|
||||
* @return
|
||||
* - ESP_ERR_INVALID_ARG: If efuse version or attenuation is invalid
|
||||
* - ESP_OK: if success
|
||||
*/
|
||||
esp_err_t esp_efuse_rtc_calib_get_cal_voltage(int version, uint32_t adc_unit, int atten, uint32_t* out_digi, uint32_t* out_vol_mv);
|
||||
|
||||
/**
|
||||
* @brief Get the temperature sensor calibration number delta_T stored in the efuse.
|
||||
*
|
||||
* @param version Version of the stored efuse
|
||||
*
|
||||
* @return The specification of temperature sensor calibration number in efuse.
|
||||
*/
|
||||
float esp_efuse_rtc_calib_get_cal_temp(int version);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
@@ -9,7 +9,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
// md5_digest_table 2b4b79060b04576a3d189a54f42dd462
|
||||
// md5_digest_table 0f3dc076304dac1cb56cea03c223d26d
|
||||
// This file was generated from the file esp_efuse_table.csv. DO NOT CHANGE THIS FILE MANUALLY.
|
||||
// If you want to change some fields, you need to change esp_efuse_table.csv file
|
||||
// then run `efuse_common_table` or `efuse_custom_table` command it will generate this file.
|
||||
@@ -117,9 +117,26 @@ extern const esp_efuse_desc_t* ESP_EFUSE_SPI_PAD_CONFIG_D7[];
|
||||
extern const esp_efuse_desc_t* ESP_EFUSE_WAFER_VERSION[];
|
||||
extern const esp_efuse_desc_t* ESP_EFUSE_PKG_VERSION[];
|
||||
extern const esp_efuse_desc_t* ESP_EFUSE_BLOCK1_VERSION[];
|
||||
extern const esp_efuse_desc_t* ESP_EFUSE_SYS_DATA_PART0[];
|
||||
extern const esp_efuse_desc_t* ESP_EFUSE_ADC2_CAL_VOL_ATTEN3[];
|
||||
extern const esp_efuse_desc_t* ESP_EFUSE_OPTIONAL_UNIQUE_ID[];
|
||||
extern const esp_efuse_desc_t* ESP_EFUSE_BLOCK2_VERSION[];
|
||||
extern const esp_efuse_desc_t* ESP_EFUSE_TEMP_CALIB[];
|
||||
extern const esp_efuse_desc_t* ESP_EFUSE_OCODE[];
|
||||
extern const esp_efuse_desc_t* ESP_EFUSE_ADC1_INIT_CODE_ATTEN0[];
|
||||
extern const esp_efuse_desc_t* ESP_EFUSE_ADC1_INIT_CODE_ATTEN1[];
|
||||
extern const esp_efuse_desc_t* ESP_EFUSE_ADC1_INIT_CODE_ATTEN2[];
|
||||
extern const esp_efuse_desc_t* ESP_EFUSE_ADC1_INIT_CODE_ATTEN3[];
|
||||
extern const esp_efuse_desc_t* ESP_EFUSE_ADC2_INIT_CODE_ATTEN0[];
|
||||
extern const esp_efuse_desc_t* ESP_EFUSE_ADC2_INIT_CODE_ATTEN1[];
|
||||
extern const esp_efuse_desc_t* ESP_EFUSE_ADC2_INIT_CODE_ATTEN2[];
|
||||
extern const esp_efuse_desc_t* ESP_EFUSE_ADC2_INIT_CODE_ATTEN3[];
|
||||
extern const esp_efuse_desc_t* ESP_EFUSE_ADC1_CAL_VOL_ATTEN0[];
|
||||
extern const esp_efuse_desc_t* ESP_EFUSE_ADC1_CAL_VOL_ATTEN1[];
|
||||
extern const esp_efuse_desc_t* ESP_EFUSE_ADC1_CAL_VOL_ATTEN2[];
|
||||
extern const esp_efuse_desc_t* ESP_EFUSE_ADC1_CAL_VOL_ATTEN3[];
|
||||
extern const esp_efuse_desc_t* ESP_EFUSE_ADC2_CAL_VOL_ATTEN0[];
|
||||
extern const esp_efuse_desc_t* ESP_EFUSE_ADC2_CAL_VOL_ATTEN1[];
|
||||
extern const esp_efuse_desc_t* ESP_EFUSE_ADC2_CAL_VOL_ATTEN2[];
|
||||
extern const esp_efuse_desc_t* ESP_EFUSE_USER_DATA[];
|
||||
extern const esp_efuse_desc_t* ESP_EFUSE_USER_DATA_MAC_CUSTOM[];
|
||||
extern const esp_efuse_desc_t* ESP_EFUSE_KEY0[];
|
||||
|
@@ -1,3 +1,4 @@
|
||||
set(EFUSE_SOC_SRCS "esp_efuse_table.c"
|
||||
"esp_efuse_fields.c"
|
||||
"esp_efuse_rtc_calib.c"
|
||||
"esp_efuse_utility.c")
|
||||
|
Reference in New Issue
Block a user