ReWrite BLK3 ADC TP calibration values esp32 eFuse?

MikeLemon
Posts: 45
Joined: Tue Feb 02, 2021 5:55 pm

ReWrite BLK3 ADC TP calibration values esp32 eFuse?

Postby MikeLemon » Fri Apr 23, 2021 9:33 am

Hello,

I've been playing for sometime with the esp32 ADC calibration found a nice quick sketch that assist with that:
https://github.com/tommag/ESP32_ADC_Calibration_tool
and burned the Fuse according to the values the sketch game me:

Code: Select all

 Final ADC readings after 4096 samples:  308

Now, apply 850mV to GPIO 25 and GPIO34. Press Enter when ready.

Final ADC readings after 4096 samples: 3181

Scaled and shifted calibration values: A1 = 7, B1 = -21, A2 = 918, B2 = 172
EFUSE_BLK3_RDATA3 value: 0x5616F587
------------------------------
To burn these calibration values permanently use the following commands:

echo -n -e \\x87\\xf5\\x16\\x56 > efuse_blk3.bin
espefuse.py burn_block_data --offset 12 BLK3 efuse_blk3.bin
espefuse.py burn_efuse BLK3_PART_RESERVE 1
With the file the command

Code: Select all

echo -n -e \\x87\\xf5\\x16\\x56 > efuse_blk3.bin
I've just had to remove the "-n -e" and "x16\\x56" in the "efuse_blk3.bin" File to work correctly

now trying to burn it again it says the following
A fatal error occurred: Efuse block already has values written.
Is there a not too painful way to re write this fuse block?

Also how does the

Code: Select all

espefuse.py burn_block_data --offset 12 BLK3 efuse_blk3.bin
command works? how does it read the values from the bin file and punts them in the right space? how does it distinguish between hex values decimal and binary ones?

less related but still might be relevant:
After flash the TP calibration ADC eFuse registers, Do you just call esp_adc_cal_raw_to_voltage(); to get the correct values or do I have to read the TP calibration values and re use them everytime the sketch inits?

User avatar
Vader_Mester
Posts: 300
Joined: Tue Dec 05, 2017 8:28 pm
Location: Hungary
Contact:

Re: ReWrite BLK3 ADC TP calibration values esp32 eFuse?

Postby Vader_Mester » Fri Apr 23, 2021 11:04 am

Hi,

eFuse can not be rewritten. It is only possible to write it once (hence the name). You could change bit in the eFuse that are 0, to 1, but not the other way.

For details, I suggest you read this:
https://docs.espressif.com/projects/esp ... alibration

Good luck :)

Code: Select all

task_t coffeeTask()
{
	while(atWork){
		if(!xStreamBufferIsEmpty(mug)){
			coffeeDrink(mug);
		} else {
			xTaskCreate(sBrew, "brew", 9000, &mug, 1, NULL);
			xSemaphoreTake(sCoffeeRdy, portMAX_DELAY);
		}
	}
	vTaskDelete(NULL);
}

MikeLemon
Posts: 45
Joined: Tue Feb 02, 2021 5:55 pm

Re: ReWrite BLK3 ADC TP calibration values esp32 eFuse?

Postby MikeLemon » Fri Apr 23, 2021 11:43 am

Yeah so esfpressifs documentation about ADC calibration and specific espefuse.py commands are not realy useful in explanation other than some forum threads which don't all go in-depth as to where the specific documentation of using the value after burning the fuse happen or how espfuse tool accepts commands at what formats.

Who is online

Users browsing this forum: No registered users and 82 guests