mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-30 02:37:19 +02:00
Merge branch 'feature/mac_crc_v5.0' into 'release/v5.0'
esp_hw_support(esp32): If the MAC_FACTORY CRC check fails, then INVALID_CRC instead of abort (v5.0) See merge request espressif/esp-idf!22114
This commit is contained in:
@ -22,6 +22,15 @@ menu "Hardware Settings"
|
|||||||
|
|
||||||
# Insert chip-specific MAC config
|
# Insert chip-specific MAC config
|
||||||
rsource "./port/$IDF_TARGET/Kconfig.mac"
|
rsource "./port/$IDF_TARGET/Kconfig.mac"
|
||||||
|
|
||||||
|
config ESP_MAC_IGNORE_MAC_CRC_ERROR
|
||||||
|
bool "Ignore MAC CRC error (not recommended)"
|
||||||
|
depends on IDF_TARGET_ESP32
|
||||||
|
default n
|
||||||
|
help
|
||||||
|
If you have an invalid MAC CRC (ESP_ERR_INVALID_CRC) problem
|
||||||
|
and you still want to use this chip, you can enable this option to bypass such an error.
|
||||||
|
This applies to both MAC_FACTORY and CUSTOM_MAC efuses.
|
||||||
endmenu
|
endmenu
|
||||||
|
|
||||||
menu "Sleep Config"
|
menu "Sleep Config"
|
||||||
|
@ -98,7 +98,11 @@ esp_err_t esp_efuse_mac_get_custom(uint8_t *mac)
|
|||||||
|
|
||||||
if (efuse_crc != calc_crc) {
|
if (efuse_crc != calc_crc) {
|
||||||
ESP_LOGE(TAG, "Base MAC address from BLK3 of EFUSE CRC error, efuse_crc = 0x%02x; calc_crc = 0x%02x", efuse_crc, calc_crc);
|
ESP_LOGE(TAG, "Base MAC address from BLK3 of EFUSE CRC error, efuse_crc = 0x%02x; calc_crc = 0x%02x", efuse_crc, calc_crc);
|
||||||
|
#ifdef CONFIG_ESP_MAC_IGNORE_MAC_CRC_ERROR
|
||||||
|
ESP_LOGW(TAG, "Ignore MAC CRC error");
|
||||||
|
#else
|
||||||
return ESP_ERR_INVALID_CRC;
|
return ESP_ERR_INVALID_CRC;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
#endif
|
#endif
|
||||||
@ -134,7 +138,11 @@ esp_err_t esp_efuse_mac_get_default(uint8_t *mac)
|
|||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
} else {
|
} else {
|
||||||
ESP_LOGE(TAG, "Base MAC address from BLK0 of EFUSE CRC error, efuse_crc = 0x%02x; calc_crc = 0x%02x", efuse_crc, calc_crc);
|
ESP_LOGE(TAG, "Base MAC address from BLK0 of EFUSE CRC error, efuse_crc = 0x%02x; calc_crc = 0x%02x", efuse_crc, calc_crc);
|
||||||
abort();
|
#ifdef CONFIG_ESP_MAC_IGNORE_MAC_CRC_ERROR
|
||||||
|
ESP_LOGW(TAG, "Ignore MAC CRC error");
|
||||||
|
#else
|
||||||
|
return ESP_ERR_INVALID_CRC;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // CONFIG_IDF_TARGET_ESP32
|
#endif // CONFIG_IDF_TARGET_ESP32
|
||||||
|
@ -603,7 +603,7 @@ static esp_err_t load_cal_data_from_nvs_handle(nvs_handle_t handle,
|
|||||||
return ESP_ERR_INVALID_SIZE;
|
return ESP_ERR_INVALID_SIZE;
|
||||||
}
|
}
|
||||||
uint8_t sta_mac[6];
|
uint8_t sta_mac[6];
|
||||||
esp_efuse_mac_get_default(sta_mac);
|
ESP_ERROR_CHECK(esp_efuse_mac_get_default(sta_mac));
|
||||||
if (memcmp(sta_mac, cal_data_mac, sizeof(sta_mac)) != 0) {
|
if (memcmp(sta_mac, cal_data_mac, sizeof(sta_mac)) != 0) {
|
||||||
ESP_LOGE(TAG, "%s: calibration data MAC check failed: expected " \
|
ESP_LOGE(TAG, "%s: calibration data MAC check failed: expected " \
|
||||||
MACSTR ", found " MACSTR,
|
MACSTR ", found " MACSTR,
|
||||||
@ -635,7 +635,7 @@ static esp_err_t store_cal_data_to_nvs_handle(nvs_handle_t handle,
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint8_t sta_mac[6];
|
uint8_t sta_mac[6];
|
||||||
esp_efuse_mac_get_default(sta_mac);
|
ESP_ERROR_CHECK(esp_efuse_mac_get_default(sta_mac));
|
||||||
err = nvs_set_blob(handle, PHY_CAL_MAC_KEY, sta_mac, sizeof(sta_mac));
|
err = nvs_set_blob(handle, PHY_CAL_MAC_KEY, sta_mac, sizeof(sta_mac));
|
||||||
if (err != ESP_OK) {
|
if (err != ESP_OK) {
|
||||||
ESP_LOGE(TAG, "%s: store calibration mac failed(0x%x)\n", __func__, err);
|
ESP_LOGE(TAG, "%s: store calibration mac failed(0x%x)\n", __func__, err);
|
||||||
@ -726,7 +726,7 @@ void esp_phy_load_cal_and_init(void)
|
|||||||
calibration_mode = PHY_RF_CAL_FULL;
|
calibration_mode = PHY_RF_CAL_FULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
esp_efuse_mac_get_default(sta_mac);
|
ESP_ERROR_CHECK(esp_efuse_mac_get_default(sta_mac));
|
||||||
memcpy(cal_data->mac, sta_mac, 6);
|
memcpy(cal_data->mac, sta_mac, 6);
|
||||||
esp_err_t ret = register_chipv7_phy(init_data, cal_data, calibration_mode);
|
esp_err_t ret = register_chipv7_phy(init_data, cal_data, calibration_mode);
|
||||||
if (ret == ESP_CAL_DATA_CHECK_FAIL) {
|
if (ret == ESP_CAL_DATA_CHECK_FAIL) {
|
||||||
|
Reference in New Issue
Block a user