My wifi settings stop working after each reboot. How can I solve this?
My board:
ESP32-s2 saola wrover /r1 (https://www.adafruit.com/product/4693)
running Circuitpython 8.0.4
the board is connected to windows pc via USB to the native USB on the GPIO pins 19 and 20
I can see the board as USB drive and in Thonny I get a REPL prompt.
So far so good.
I can save a settings.toml file with the right network credentials to the board via the usb drive
[using the f.write etc commands as suggested in the tutorial does not work as the filesystem is readonly to circuitpython]
I then unmount the usb drive, and press reset on the board
and indeed, I can now access the board in a browser via the ip address
when I now open settings.toml, I only see some hex codes between two curly brackets like this:
{E 4 F 1 A 0 9 B - 5 3 1 D - [....] - 0 F}
I assume this is intended[??]
But when I reset once more, I can no longer access the board via the ip address.
reset, repower; it all does not work. The board is no longer connecting to the network; it is not pingable.
The only way to get it back online is to restore the original settings.toml, which will work exactly one time.
Can someone help me solve this?
esp32-s2 wifi settings stop working after each reboot
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- dr_donkey
- Posts: 6
- Joined: Sat Jan 11, 2020 6:40 pm
- danhalbert
- Posts: 4652
- Joined: Tue Aug 08, 2017 12:37 pm
Re: esp32-s2 wifi settings stop working after each reboot
This is not intended. CircuitPython does not write the settings.toml file (at least not intentionally). I'm not sure if this is a Thonny issue or a CircuitPython issue. What version of Thonny are you using, and what is the host operating system?when I now open settings.toml, I only see some hex codes between two curly brackets like this:
{E 4 F 1 A 0 9 B - 5 3 1 D - [....] - 0 F}
I assume this is intended[??]
Could you give a step-by-step recipe to reproduce this, with your settings.toml file contents (with private info redacted)? What is in your code.py, and do you have a boot.py, and if so, what is in it?
- dr_donkey
- Posts: 6
- Joined: Sat Jan 11, 2020 6:40 pm
Re: esp32-s2 wifi settings stop working after each reboot
Thanks for looking into this.
I use Thonny 4.0.2 on windows 10
But it happens regardless of my using Thonny
I have no boot.py and no code.py
My settings.toml looks like this
CIRCUITPY_WIFI_SSID = "XXXX"
CIRCUITPY_WIFI_PASSWORD = "YYYY"
CIRCUITPY_WEB_API_PASSWORD= "ZZZZ"
I have also made a file test.toml containing the word "TEST" on the board, in exactly the same way. This file remains unchanged.
The hex codes in the settings.toml do not change on subsequent reboots (only the first reboot it changes from text to hex codes).
Steps are like this:
1. connect esp32-s2 to windows pc via native usb on pins 19 and 20
2. windows sees usb drive (D:)
[skipping step 3 makes no difference:]
3. I start Thonny, Thonny sees the board and shows REPL prompt
4. I make settings.toml file in notepad++
5. I save to D: drive (in notepad++)
6. I check contents of settings.toml file on D: with notepad, it is correct)
7. I close notepad++ and notepad, to make sure settings.toml is not open
7. I press reset button on the ESP32-S2
8. I open browser, enter the IP adress of the board
9. It connects, filebrowser and REPL working
10. I open settings,toml file in notepad, it shows the hex codes
11. I press reset on the ESP32-S2
12. D: drive and Thonny still see the board
13. In the browser, with the right IP address, it does not find the board
14. settings.toml still contains the (same) hex codes
I use Thonny 4.0.2 on windows 10
But it happens regardless of my using Thonny
I have no boot.py and no code.py
My settings.toml looks like this
CIRCUITPY_WIFI_SSID = "XXXX"
CIRCUITPY_WIFI_PASSWORD = "YYYY"
CIRCUITPY_WEB_API_PASSWORD= "ZZZZ"
I have also made a file test.toml containing the word "TEST" on the board, in exactly the same way. This file remains unchanged.
The hex codes in the settings.toml do not change on subsequent reboots (only the first reboot it changes from text to hex codes).
Steps are like this:
1. connect esp32-s2 to windows pc via native usb on pins 19 and 20
2. windows sees usb drive (D:)
[skipping step 3 makes no difference:]
3. I start Thonny, Thonny sees the board and shows REPL prompt
4. I make settings.toml file in notepad++
5. I save to D: drive (in notepad++)
6. I check contents of settings.toml file on D: with notepad, it is correct)
7. I close notepad++ and notepad, to make sure settings.toml is not open
7. I press reset button on the ESP32-S2
8. I open browser, enter the IP adress of the board
9. It connects, filebrowser and REPL working
10. I open settings,toml file in notepad, it shows the hex codes
11. I press reset on the ESP32-S2
12. D: drive and Thonny still see the board
13. In the browser, with the right IP address, it does not find the board
14. settings.toml still contains the (same) hex codes
- danhalbert
- Posts: 4652
- Joined: Tue Aug 08, 2017 12:37 pm
Re: esp32-s2 wifi settings stop working after each reboot
Notepad++ does not flush file changes to the disk right away, so it can appear that you wrote the file, but it’s not really true. See https://learn.adafruit.com/welcome-to-c ... ed-editors
Thonny does. If you repeated your recipe above with Thonny, would you see the same problem?
Thonny does. If you repeated your recipe above with Thonny, would you see the same problem?
- blakebr
- Posts: 957
- Joined: Tue Apr 17, 2012 6:23 pm
Re: esp32-s2 wifi settings stop working after each reboot
Dan is right. Notepad++ does not save your file until you select save/save all or the single/stack of floppy disks. Same for Visual Studio Code.
Bruce
Bruce
- dr_donkey
- Posts: 6
- Joined: Sat Jan 11, 2020 6:40 pm
Re: esp32-s2 wifi settings stop working after each reboot
Same thing happens with Thonny, which I tested just to be sure.
In step 6 I checked with windows-notepad (not++) if the file was written correctly to D:,
which it was.
As noted, all other files remain intact.
When I check settings.toml immediately after reset (before connecting via web), the change has already taken place. Still, I can connect via the web browser, until the next reset.
In step 6 I checked with windows-notepad (not++) if the file was written correctly to D:,
which it was.
As noted, all other files remain intact.
When I check settings.toml immediately after reset (before connecting via web), the change has already taken place. Still, I can connect via the web browser, until the next reset.
Please be positive and constructive with your questions and comments.