ESP-IDF 4.2 resetting WiFi SSID and PASSWORD set previously in menuconfig

martin_004
Posts: 1
Joined: Wed Mar 11, 2020 4:58 pm

ESP-IDF 4.2 resetting WiFi SSID and PASSWORD set previously in menuconfig

Postby martin_004 » Wed Mar 11, 2020 6:23 pm

Good morning,

--- Problem ---

I am trying to run example /wifi/getting_started/station. I set my WiFi SSID and PASSWORD using menuconfig, but when I run idf.py these SSID and PASSWORD always get overwritten back to the default values of "myssid" and "mypassword". How can this be fixed ?

--- Full description ---

OS: Ubuntu 18.04.4
Shell: bash
ESP-IDF: v4.2-dev-630-gf7d1ed5f3-dirty
Programming port: /dev/ttyUSB0

ESP-IDF installation directory: ~/esp/esp-idf
My workfolder: ~/esp/myprojects

I copied folder: ~/esp/esp-idf/examples/wifi/getting_started/station
into: ~/esp/myprojects

I then open a shell and move here: $ cd ~/esp/myprojects/station

I then open the ESP-IDF in-shell menuconfig tool: $ ifd.py menuconfig

I then navigate to:

Example Configuration
> WiFi SSID (myssid) changed to WiFi SSID (NETGEAR1234)
pasword (mypassword) changed to password (grumpycat)
> Q
> Save configuration: Y

I keep the shell opened. In another shell, I then look into file: ~/esp/myprojects/station/sdkconfig

and I can see the following new section has appeared:

# Example Configuration
#
CONFIG_ESP_WIFI_SSID="NETGEAR1234"
CONFIG_ESP_WIFI_PASSWORD="grumpycat"
CONFIG_ESP_MAXIMUM_RETRY=5
# end of Example Configuration

I then go back to the shell where I had run "idf.py menuconfig" a few seconds earlier and I now run

$ idf.py -p /dev/ttyUSB0 -b 115200 set-target esp32 flash monitor

The project compiles & gets flashed into the ESP32. The ESP32 then tries to connect the WiFi and fails. In the very last line, it tells me it had been trying to use SSID myssid and password mypassword, which are the default values.

(...)

I (766) wifi station: wifi_init_sta finished.
I (2826) wifi station: retry to connect to the AP
I (2826) wifi station: connect to the AP fail
I (4876) wifi station: retry to connect to the AP
I (4876) wifi station: connect to the AP fail
I (6926) wifi station: retry to connect to the AP
I (6926) wifi station: connect to the AP fail
I (8976) wifi station: retry to connect to the AP
I (8976) wifi station: connect to the AP fail
I (11026) wifi station: retry to connect to the AP
I (11026) wifi station: connect to the AP fail
I (13076) wifi station: connect to the AP fail
I (13076) wifi station: Failed to connect to SSID:myssid, password:mypassword

When I go back into file ~/esp/myprojects/station/sdkconfig, I can see that CONFIG_ESP_WIFI_SSID and CONFIG_ESP_WIFI_PASSWORD were overwritten back to their default values:

# Example Configuration
#
CONFIG_ESP_WIFI_SSID="myssid"
CONFIG_ESP_WIFI_PASSWORD="mypassword"
CONFIG_ESP_MAXIMUM_RETRY=5
# end of Example Configuration

How can I prevent these variables to be overwritten back to their default values at each ESP-IDF run ?

Thank you ! :-)

Martin

User avatar
ESP_Roland
Posts: 265
Joined: Tue Oct 09, 2018 10:28 am

Re: ESP-IDF 4.2 resetting WiFi SSID and PASSWORD set previously in menuconfig

Postby ESP_Roland » Fri Mar 13, 2020 9:06 am

Hi Martin,

you use "set-target" after menuconfig which invokes fullclean and cleans the project. If you want to change target then do it once in the beginning before running menuconfig. If your target is esp32 then you don't have to use it at all because that is the default target.

Roland

WilliamR
Posts: 6
Joined: Wed Jan 13, 2021 1:03 am

Re: ESP-IDF 4.2 resetting WiFi SSID and PASSWORD set previously in menuconfig

Postby WilliamR » Wed Jan 13, 2021 1:11 am

Martin,

Another option is to simply edit the WiFi username and password in the sdkconfig file (be sure to edit plain sdkconfig, not sdkconfig.ci or similar). If you are simply plugging into example_connect() from the examples to obtain a WiFi connection, you will then need to change the following lines in the sdkconfig file:

Code: Select all

# Example Connection Configuration
#
CONFIG_EXAMPLE_CONNECT_WIFI=y
CONFIG_EXAMPLE_WIFI_SSID="YOURSSID"
CONFIG_EXAMPLE_WIFI_PASSWORD="YOURSSID"
Next time you flash your project to the ESP32, components will rebuild and your username/password changes will be applied

Who is online

Users browsing this forum: No registered users and 421 guests