Page 1 of 1

How to re-provision ESP for new Wi-Fi credentials

Posted: Tue Sep 26, 2023 11:33 am
by sameer_kelaskar
Hi,
We are trying to use ble reprovisioning for ESP32 devkit v1 and to flash the code we are using ESP-IDF v4.3.2 . Now the ESP documentation is as follows:
If the provisioning state needs to be reset, any of the following approaches may be taken:

1. The associated part of NVS partition has to be erased manually

2. The main application must implement some logic to call esp_wifi_ APIs for erasing the credentials at runtime

3. The main application must implement some logic to force start the provisioning irrespective of the provisioning state
So for the first part we use the nvs funtions : nvs_open, nvs_erase_all, nvs_commit and nvs_close.
Then using esp_wifi_set_config we use an empty wifi_config_t
After that we disconnect the wifi, initialize a new provisioning configuration and start provisioning once again using wifi_prov_mgr_start_provisioning() and new parameter arguments required for it.
But there are errors when we flash and monitor as shown in image:

Please let us know if this approach in proper, any help is appreciated.

Thank you,
Sameer