Skip to content

Commit 7f5ecbe

Browse files
committed
Merge branch 'bugfix/wafer_version_minor_s3_v5.0' into 'release/v5.0'
esp32s3: fixed bug chip v0.0 detected as vX.8 (v5.0) See merge request espressif/esp-idf!21351
2 parents 5afd0f5 + 277e4d5 commit 7f5ecbe

File tree

1 file changed

+23
-10
lines changed

1 file changed

+23
-10
lines changed

components/hal/esp32s3/efuse_hal.c

+23-10
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,38 @@
1111
#include "hal/efuse_hal.h"
1212
#include "hal/efuse_ll.h"
1313
#include "esp32s3/rom/efuse.h"
14+
#include "esp_attr.h"
1415

1516
#define ESP_EFUSE_BLOCK_ERROR_BITS(error_reg, block) ((error_reg) & (0x0F << (4 * (block))))
1617

17-
uint32_t efuse_hal_get_major_chip_version(void)
18+
19+
//The wafer_major and MSB of wafer_minor fields was allocated to other purposes when block version is v1.1.
20+
//Luckily only chip v0.0 have this kind of block version and efuse usage.
21+
//This workaround fixes the issue.
22+
static inline bool is_eco0(uint32_t minor_raw)
23+
{
24+
return ((minor_raw & 0x7) == 0 &&
25+
efuse_ll_get_blk_version_major() == 1 && efuse_ll_get_blk_version_minor() == 1);
26+
}
27+
28+
IRAM_ATTR uint32_t efuse_hal_get_major_chip_version(void)
1829
{
19-
uint32_t ret = efuse_ll_get_chip_wafer_version_major();
20-
//Workaround: The major version field was allocated to other purposes when block version is v1.1.
21-
//Luckily only chip v0.0 have this kind of block version and efuse usage.
22-
if (efuse_ll_get_chip_wafer_version_minor() == 0 &&
23-
efuse_ll_get_blk_version_major() == 1 &&
24-
efuse_ll_get_blk_version_minor() == 1) {
25-
ret = 0;
30+
uint32_t minor_raw = efuse_ll_get_chip_wafer_version_minor();
31+
32+
if (is_eco0(minor_raw)) {
33+
return 0;
2634
}
27-
return ret;
35+
return efuse_ll_get_chip_wafer_version_major();
2836
}
2937

3038
uint32_t efuse_hal_get_minor_chip_version(void)
3139
{
32-
return efuse_ll_get_chip_wafer_version_minor();
40+
uint32_t minor_raw = efuse_ll_get_chip_wafer_version_minor();
41+
42+
if (is_eco0(minor_raw)) {
43+
return 0;
44+
}
45+
return minor_raw;
3346
}
3447

3548
/******************* eFuse control functions *************************/

0 commit comments

Comments
 (0)