Merge branch 'bugfix/tw20575_fix_potential_phy_calibration_bug' into 'master'
esp32: fix potential PHY calibration bug See merge request idf/esp-idf!2339
This commit is contained in:
commit
dc7280c1d9
1 changed files with 20 additions and 5 deletions
|
@ -483,19 +483,34 @@ static esp_err_t store_cal_data_to_nvs_handle(nvs_handle handle,
|
||||||
const esp_phy_calibration_data_t* cal_data)
|
const esp_phy_calibration_data_t* cal_data)
|
||||||
{
|
{
|
||||||
esp_err_t err;
|
esp_err_t err;
|
||||||
uint32_t cal_format_version = phy_get_rf_cal_version() & (~BIT(16));
|
|
||||||
ESP_LOGV(TAG, "phy_get_rf_cal_version: %d\n", cal_format_version);
|
err = nvs_set_blob(handle, PHY_CAL_DATA_KEY, cal_data, sizeof(*cal_data));
|
||||||
err = nvs_set_u32(handle, PHY_CAL_VERSION_KEY, cal_format_version);
|
|
||||||
if (err != ESP_OK) {
|
if (err != ESP_OK) {
|
||||||
|
ESP_LOGE(TAG, "%s: store calibration data failed(0x%x)\n", __func__, err);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t sta_mac[6];
|
uint8_t sta_mac[6];
|
||||||
esp_efuse_mac_get_default(sta_mac);
|
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);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
err = nvs_set_blob(handle, PHY_CAL_DATA_KEY, cal_data, sizeof(*cal_data));
|
|
||||||
|
uint32_t cal_format_version = phy_get_rf_cal_version() & (~BIT(16));
|
||||||
|
ESP_LOGV(TAG, "phy_get_rf_cal_version: %d\n", cal_format_version);
|
||||||
|
err = nvs_set_u32(handle, PHY_CAL_VERSION_KEY, cal_format_version);
|
||||||
|
if (err != ESP_OK) {
|
||||||
|
ESP_LOGE(TAG, "%s: store calibration version failed(0x%x)\n", __func__, err);
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
err = nvs_commit(handle);
|
||||||
|
if (err != ESP_OK) {
|
||||||
|
ESP_LOGE(TAG, "%s: store calibration nvs commit failed(0x%x)\n", __func__, err);
|
||||||
|
}
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -533,7 +548,7 @@ void esp_phy_load_cal_and_init(phy_rf_module_t module)
|
||||||
err = ESP_OK;
|
err = ESP_OK;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
esp_phy_rf_init(NULL, PHY_RF_CAL_FULL, cal_data, module);
|
esp_phy_rf_init(init_data, PHY_RF_CAL_FULL, cal_data, module);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
esp_phy_release_init_data(init_data);
|
esp_phy_release_init_data(init_data);
|
||||||
|
|
Loading…
Reference in a new issue