How to rewrite EFUSE

chadpham75
Posts: 27
Joined: Thu Sep 12, 2019 11:39 am

How to rewrite EFUSE

Postby chadpham75 » Mon Nov 11, 2019 1:07 am

Hi all,
Could you please let me know if it is possible (or we are allowed) to rewrite the EFUSE BLK3? If it is, could you please advice the process?
Thank you all.

WiFive
Posts: 2821
Joined: Tue Dec 01, 2015 7:35 am

Re: How to rewrite EFUSE

Postby WiFive » Mon Nov 11, 2019 1:45 am


chadpham75
Posts: 27
Joined: Thu Sep 12, 2019 11:39 am

Re: How to rewrite EFUSE

Postby chadpham75 » Mon Nov 11, 2019 4:59 am

WiFive,
Thank you for the link. I used the information in that link to execute
esp_efuse_write_field_blob()- writes an array
and read back the information using
esp_efuse_read_field_blob()- returns an array of read eFuse bits.

However, when I tried to write different value again, I got ESP_ERR_EFUSE_REPEATED_PROG error.

From the link, I did see the statement "Each eFuse is a one-bit field which can be programmed to 1 after which it cannot be reverted back to 0.", but I hope there is a special way to erase and rewrite different value to the efuse.

I am looking for a sector only around 16 bytes or less to store the NVM data. I tried the NVS but it such a wasteful since the smallest erase/hence the smallest size is 4096 bytes.
Do you have any suggestion?

WiFive
Posts: 2821
Joined: Tue Dec 01, 2015 7:35 am

Re: How to rewrite EFUSE

Postby WiFive » Mon Nov 11, 2019 6:44 am

No efuse cannot be erased.

It is true that nvs partition has to be at least 8k but it can rewrite values many times before a page is erased. You can have separate namespaces in nvs partition so can't you just share your main nvs partition?

chadpham75
Posts: 27
Joined: Thu Sep 12, 2019 11:39 am

Re: How to rewrite EFUSE

Postby chadpham75 » Mon Nov 11, 2019 7:22 am

WiFive,
Thank you for your confirmation of efuse can't be erase.
The reason I can't use the main nvs because the nvs space has the sticky data that will be read/write quite often, which can be full erase once it is full and erase will also erase my serial number.
I need a small space about 10 bytes for our serial number for our product, which can be coming back for service or any reason the serial number can be change.

Just one thing I would like your confirmation from this link https://docs.espressif.com/projects/esp ... ables.html,
I saw if the subtype is NVS(2) the spec "It is strongly recommended that you include an NVS partition of at least 0x3000 bytes in your project."
Can you please point it out for me your reference to your saying "It is true that nvs partition has to be at least 8k"? If it is the case, I actually can decrease the space that not needed.
Thank you for your helps.

chadpham75
Posts: 27
Joined: Thu Sep 12, 2019 11:39 am

Re: How to rewrite EFUSE

Postby chadpham75 » Tue Nov 12, 2019 10:22 am

WiFive,
I came across these code which indicate we can rewrite new value for efuse. Is that correct?
void esp_efuse_burn_new_values(void)
{
REG_WRITE(EFUSE_CONF_REG, EFUSE_CONF_WRITE);
REG_WRITE(EFUSE_CMD_REG, EFUSE_CMD_PGM);
while (REG_READ(EFUSE_CMD_REG) != 0) {
}
REG_WRITE(EFUSE_CONF_REG, EFUSE_CONF_READ);
REG_WRITE(EFUSE_CMD_REG, EFUSE_CMD_READ);
while (REG_READ(EFUSE_CMD_REG) != 0) {
}
esp_efuse_reset();
}

void esp_efuse_reset(void)
{
REG_WRITE(EFUSE_CONF_REG, EFUSE_CONF_READ);
const uint32_t block_start[4] = { EFUSE_BLK0_WDATA0_REG, EFUSE_BLK1_WDATA0_REG,
EFUSE_BLK2_WDATA0_REG, EFUSE_BLK3_WDATA0_REG };
const uint32_t block_end[4] = { EFUSE_BLK0_WDATA6_REG, EFUSE_BLK1_WDATA7_REG,
EFUSE_BLK2_WDATA7_REG, EFUSE_BLK3_WDATA7_REG };
for (int i = 0; i < 4; i++) {
for (uint32_t r = block_start; r <= block_end; r+= 4) {
REG_WRITE(r, 0);
}
}
}

WiFive
Posts: 2821
Joined: Tue Dec 01, 2015 7:35 am

Re: How to rewrite EFUSE

Postby WiFive » Tue Nov 12, 2019 11:55 am

No, reset only clears the shadow registers, not the efuse

Who is online

Users browsing this forum: Baidu [Spider] and 25 guests