I am working on a project in VS with Platformio and C++ which involves connecting an ESP32 to wifi. Suddenly my program stopped connecting to my Wifi. Nothing relevant was altered but suddenly nothing will connect, mystifying! Current program listed below which just tries to make the connection which compiles uploads and runs fine but doesn't connect in the same way nothing else does!...
#include <Arduino.h>
#include <WiFi.h>
// put function declarations here:
#define WIFI_SSID "your SSID"
#define WIFI_PASSWORD "your password"
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
pinMode(LED_BUILTIN, OUTPUT);
WiFi.begin(WIFI_SSID,WIFI_PASSWORD);
Serial.println("starting");
}
bool isConnected = false;
void loop() {
// put your main code here, to run repeatedly:
if (WiFi.status() == WL_CONNECTED) {
Serial.println("Connected");
digitalWrite(LED_BUILTIN,HIGH);
isConnected = true;
}
if (WiFi.status() != WL_CONNECTED) {
Serial.print(".");
digitalWrite(LED_BUILTIN,digitalRead(LED_BUILTIN));
delay(1000);
isConnected = false;
}
}
Compilation up to upload....
Verbose mode can be enabled via -v, --verbose
option
PLATFORM: Espressif 32 (6.4.0) > DOIT ESP32 DEVKIT V1
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, esp-bridge, esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:
- framework-arduinoespressif32 @ 3.20011.230801 (2.0.11)
- tool-esptoolpy @ 1.40501.0 (4.5.1)
- tool-mkfatfs @ 2.0.1
- tool-mklittlefs @ 1.203.210628 (2.3)
- tool-mkspiffs @ 2.230.0 (2.30)
- toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch5 LDF: Library Dependency Finder LDF Modes: Finder ~ chain, Compatibility ~ soft Found 33 compatible libraries Scanning dependencies... Dependency Graph |-- WiFi @ 2.0.0 Building in release mode Compiling .pio/build/esp32doit-devkit-v1/src/main.cpp.o Building .pio/build/esp32doit-devkit-v1/bootloader.bin esptool.py v4.5.1 Creating esp32 image... Merged 1 ELF section Successfully created esp32 image. Generating partitions .pio/build/esp32doit-devkit-v1/partitions.bin Compiling .pio/build/esp32doit-devkit-v1/lib00b/WiFi/WiFi.cpp.o Compiling .pio/build/esp32doit-devkit-v1/lib00b/WiFi/WiFiAP.cpp.o Compiling .pio/build/esp32doit-devkit-v1/lib00b/WiFi/WiFiClient.cpp.o Compiling .pio/build/esp32doit-devkit-v1/lib00b/WiFi/WiFiGeneric.cpp.o Compiling .pio/build/esp32doit-devkit-v1/lib00b/WiFi/WiFiMulti.cpp.o Compiling .pio/build/esp32doit-devkit-v1/lib00b/WiFi/WiFiSTA.cpp.o Compiling .pio/build/esp32doit-devkit-v1/lib00b/WiFi/WiFiScan.cpp.o Compiling .pio/build/esp32doit-devkit-v1/lib00b/WiFi/WiFiServer.cpp.o Compiling .pio/build/esp32doit-devkit-v1/lib00b/WiFi/WiFiUdp.cpp.o Compiling .pio/build/esp32doit-devkit-v1/FrameworkArduino/Esp.cpp.o Archiving .pio/build/esp32doit-devkit-v1/lib00b/libWiFi.a Compiling .pio/build/esp32doit-devkit-v1/FrameworkArduino/FirmwareMSC.cpp.o Compiling .pio/build/esp32doit-devkit-v1/FrameworkArduino/FunctionalInterrupt.cpp.o Compiling .pio/build/esp32doit-devkit-v1/FrameworkArduino/HWCDC.cpp.o Compiling .pio/build/esp32doit-devkit-v1/FrameworkArduino/HardwareSerial.cpp.o Compiling .pio/build/esp32doit-devkit-v1/FrameworkArduino/IPAddress.cpp.o Compiling .pio/build/esp32doit-devkit-v1/FrameworkArduino/IPv6Address.cpp.o Compiling .pio/build/esp32doit-devkit-v1/FrameworkArduino/MD5Builder.cpp.o Compiling .pio/build/esp32doit-devkit-v1/FrameworkArduino/Print.cpp.o Compiling .pio/build/esp32doit-devkit-v1/FrameworkArduino/Stream.cpp.o Compiling .pio/build/esp32doit-devkit-v1/FrameworkArduino/StreamString.cpp.o Compiling .pio/build/esp32doit-devkit-v1/FrameworkArduino/Tone.cpp.o Compiling .pio/build/esp32doit-devkit-v1/FrameworkArduino/USB.cpp.o Compiling .pio/build/esp32doit-devkit-v1/FrameworkArduino/USBCDC.cpp.o Compiling .pio/build/esp32doit-devkit-v1/FrameworkArduino/USBMSC.cpp.o Compiling .pio/build/esp32doit-devkit-v1/FrameworkArduino/WMath.cpp.o Compiling .pio/build/esp32doit-devkit-v1/FrameworkArduino/WString.cpp.o Compiling .pio/build/esp32doit-devkit-v1/FrameworkArduino/base64.cpp.o Compiling .pio/build/esp32doit-devkit-v1/FrameworkArduino/cbuf.cpp.o Compiling .pio/build/esp32doit-devkit-v1/FrameworkArduino/esp32-hal-adc.c.o Compiling .pio/build/esp32doit-devkit-v1/FrameworkArduino/esp32-hal-bt.c.o Compiling .pio/build/esp32doit-devkit-v1/FrameworkArduino/esp32-hal-cpu.c.o Compiling .pio/build/esp32doit-devkit-v1/FrameworkArduino/esp32-hal-dac.c.o Compiling .pio/build/esp32doit-devkit-v1/FrameworkArduino/esp32-hal-gpio.c.o Compiling .pio/build/esp32doit-devkit-v1/FrameworkArduino/esp32-hal-i2c-slave.c.o Compiling .pio/build/esp32doit-devkit-v1/FrameworkArduino/esp32-hal-i2c.c.o Compiling .pio/build/esp32doit-devkit-v1/FrameworkArduino/esp32-hal-ledc.c.o Compiling .pio/build/esp32doit-devkit-v1/FrameworkArduino/esp32-hal-matrix.c.o Compiling .pio/build/esp32doit-devkit-v1/FrameworkArduino/esp32-hal-misc.c.o Compiling .pio/build/esp32doit-devkit-v1/FrameworkArduino/esp32-hal-psram.c.o Compiling .pio/build/esp32doit-devkit-v1/FrameworkArduino/esp32-hal-rgb-led.c.o Compiling .pio/build/esp32doit-devkit-v1/FrameworkArduino/esp32-hal-rmt.c.o Compiling .pio/build/esp32doit-devkit-v1/FrameworkArduino/esp32-hal-sigmadelta.c.o Compiling .pio/build/esp32doit-devkit-v1/FrameworkArduino/esp32-hal-spi.c.o Compiling .pio/build/esp32doit-devkit-v1/FrameworkArduino/esp32-hal-time.c.o Compiling .pio/build/esp32doit-devkit-v1/FrameworkArduino/esp32-hal-timer.c.o Compiling .pio/build/esp32doit-devkit-v1/FrameworkArduino/esp32-hal-tinyusb.c.o Compiling .pio/build/esp32doit-devkit-v1/FrameworkArduino/esp32-hal-touch.c.o Compiling .pio/build/esp32doit-devkit-v1/FrameworkArduino/esp32-hal-uart.c.o Compiling .pio/build/esp32doit-devkit-v1/FrameworkArduino/firmware_msc_fat.c.o Compiling .pio/build/esp32doit-devkit-v1/FrameworkArduino/libb64/cdecode.c.o Compiling .pio/build/esp32doit-devkit-v1/FrameworkArduino/libb64/cencode.c.o Compiling .pio/build/esp32doit-devkit-v1/FrameworkArduino/main.cpp.o Compiling .pio/build/esp32doit-devkit-v1/FrameworkArduino/stdlib_noniso.c.o Compiling .pio/build/esp32doit-devkit-v1/FrameworkArduino/wiring_pulse.c.o Compiling .pio/build/esp32doit-devkit-v1/FrameworkArduino/wiring_shift.c.o Archiving .pio/build/esp32doit-devkit-v1/libFrameworkArduino.a Linking .pio/build/esp32doit-devkit-v1/firmware.elf Retrieving maximum program size .pio/build/esp32doit-devkit-v1/firmware.elf Checking size .pio/build/esp32doit-devkit-v1/firmware.elf Advanced Memory Usage is available via "PlatformIO Home > Project Inspect" RAM: [= ] 12.9% (used 42320 bytes from 327680 bytes) Flash: [===== ] 54.5% (used 714193 bytes from 1310720 bytes) Building .pio/build/esp32doit-devkit-v1/firmware.bin esptool.py v4.5.1 Creating esp32 image... Merged 25 ELF sections Successfully created esp32 image. Configuring upload protocol... AVAILABLE: cmsis-dap, esp-bridge, esp-prog, espota, esptool, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa CURRENT: upload_protocol = esptool Looking for upload port... Auto-detected: /dev/ttyACM0 Uploading .pio/build/esp32doit-devkit-v1/firmware.bin esptool.py v4.5.1 Serial port /dev/ttyACM0 Connecting.... Chip is ESP32-D0WD-V3 (revision v3.0) Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None Crystal is 40MHz MAC: b0:a7:32:de:a3:30 Uploading stub... Running stub... Stub running...
etc etc etc......
I have tried previous working versions, run them on two different ESP32's pinned earlier versions of ESPidf then explored completely seperate connecting only programs including wifi scanners (it can see the network). Current 'vehicle' is shown below with listing and compilation. I have looked at the router log and can't find any error or indication of a problem anywhere after several days exploring everything I can think of. At a complete loss as to how to proceed, where to look, what to do! Can anyone suggest what might be wrong?
Many thanks in advance