Is there an easy way to override the fuse value when calling esp_adc_cal_characterize? No matter what I supply for the VREF param it always gets set to 1100 because the fuse takes priority.
In esp-idf, the simplest way is to modify the esp_adc_cal_characterize()
function directly as such:
Code: Select all
//Check eFuse if enabled to do so
bool efuse_tp_present = check_efuse_tp();
bool efuse_vref_present = check_efuse_vref();
bool efuse_tp_present = false;
bool efuse_vref_present = false;
However, this could be more difficult in Arduino. IIRC the esp-idf features used in Arduino come from precompiled libraries. esp_adc_cal.c
is a pretty independent component. Most of calibration values and lookup tables are statically defined inside the source file. In theory, what you could do is just copy and rename esp_adc_cal.c
into your project, then just rename all the public facing API in esp_adc_cal.h
to avoid conflicting names.
I read that eFuse burning is a one time process. Is there any way to overwrite them or am I stuck with 1100 for the VREF now?
Once an eFuse bit has been burned to 1, it can never be reverted back to zero. However, since your eFuse Vref is set at 1100, the 5 bit eFuse value should be 5'b10000, so in theory you should be able burn some of the bits to 1, but you'll need to modify espefuse.py to allow you to burn an already burnt eFuse field.
FYI, eFuse Vref is a 5 bit sign-magnitude representation of the chips deviation (in units of 7mV) from the ideal reference voltage of 1100mV, with a calibrated zero deviation as a negative zero in sign-magnitude. For example:
- A reference voltage of 1149mV would have an eFuse Vref of 5'b00111
- A reference voltage of 1100mV would have an eFuse Vref of 5'b10000
- A reference voltage of 1016mV would have an eFuse Vref of 5'b11100