WiFiManager: ESP32-S2 crashes instantly on autoConnect() ?

Basic Infos

Hardware

WiFimanager Branch/Release: Master

Esp8266/Esp32: ESP32-S2

Hardware: ESP32-S2 Mini (Wemos/Lolin board)

Core Version: 5.0.0

Description

Chip instantly crashes upon using autoConnect().

Sketch

#include <Arduino.h>
#include <WiFiManager.h>
WiFiManager wifiManager;
#include "USB.h"

#if ARDUINO_USB_CDC_ON_BOOT
#define HWSerial Serial0
#define USBSerial Serial
#else
#define HWSerial Serial
USBCDC USBSerial;
#endif

void setup() {
    Serial.begin(115200);
    delay(5000);

    wifiManager.setDebugOutput(true);
    wifiManager.autoConnect();
 
}

void loop() {}

Platformio.ini:

[env:lolin_s2_mini]
platform = espressif32
board = lolin_s2_mini
framework = arduino
monitor_speed = 115200
build_flags = 
	-D ARDUINO_USB_CDC_ON_BOOT
lib_deps = 
	https://github.com/tzapu/WiFiManager.git

USB Serial Output:

Output from above sketch:

--- Terminal on COM9 | 115200 8-N-1
--- Available filters and text transformations: colorize, debug, default, direct, esp32_exception_decoder, hexlify, log2file, nocontrol, printable, send_on_enter, time
--- More details at https://bit.ly/pio-monitor-filters
--- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H
*wm:[1] AutoConnect 

Since I’m using the CDC, I don’t get a stack trace, and I’m actually not sure if the proper UART GPIOs are broken out on this board.

Edit:

Moving some stuff around I was able to get a little more output, but still crashing instantly.

*wm:[1] AutoConnect
*wm:[1] No Credentials are Saved, skipping connect 
*wm:[2] Starting Config Portal
*wm:[2] Disabling STA
*wm:[2] Enabling AP
*wm:[1] StartAP with SSID:  ESP32_D803F784
*wm:[2] AP has anonymous access!

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 23

Most upvoted comments

I heard of another issue maybe with this board maybe, not sure, you have to decrease the wifi power or it wont initialize wifi, as there is not enough power or something?

Definitely get your hands on a real dev board or some others when working with this stuff, will save your days of debugging

So, after doing some tests and research, I have some stuff to share.

When testing the board’s WiFi with a normal Wifi.begin(), it would also crash!

It turns out that the ESP32-S2 board I have is a clone of the Lolin S2 Mini, and has a flaw in the copy: the capacitor on the reset line is missing its connection to GND. Scraping the soldermask of the GND plane directly near it and using a solder blob to connect it to the capacitor works with fixing A crash when Wifi is being used.

image

Source of image and fix.

I was able to write the rest of my sketch (send a payload to my MQTT server and then go into deep sleep) to make sure it works with the capacitor fix, and it does.

However, this does not fix my issue with the library.

If I try to use autoConnect() still, it does just crash. ok or not anymore

i swear im going mad

Now it does work?? But autoConnect() consistently fails until I put WiFi.mode(WIFI_AP); before autoConnect()

By fails, I mean the AP it makes when a connection fails does not appear on my phone. And if it has credentials saved, connection attempts will fail.