ESP32-C3-Mini Wifi Problems

Ferran
Posts: 2
Joined: Wed Aug 28, 2024 1:39 pm

ESP32-C3-Mini Wifi Problems

Postby Ferran » Wed Aug 28, 2024 1:55 pm

Hello, I apologize in advance if I make any mistake, is that I am new to this forum.

I have an ESP32-C3-Mini on my own PCB and the problem I have is that when I run some code that contains some Wifi function it does not execute it. The only Wifi function that I run is the Wifi Status function.

As you can see in one of the example code that I provided. The program executes the first print but once it does the “WiFi.mode(WIFI_STA);” it stops executing and does not do the second print.

Has anyone had or knows how to solve this problem?

Thank you very much






Code: Select all

/*
 *  This sketch demonstrates how to scan WiFi networks.
 *  The API is based on the Arduino WiFi Shield library, but has significant changes as newer WiFi functions are supported.
 *  E.g. the return value of encryptionType() different because more modern encryption is supported.
 */
#include "WiFi.h"

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

  // Set WiFi to station mode and disconnect from an AP if it was previously connected.
  Serial.println("#### Start");
  WiFi.mode(WIFI_STA);
  Serial.println("#### Pass 2");
  WiFi.disconnect();
  delay(100);

  Serial.println("Setup done");
}

void loop() {
  Serial.println("Scan start");

  // WiFi.scanNetworks will return the number of networks found.
  int n = WiFi.scanNetworks();
  Serial.println("Scan done");
  if (n == 0) {
    Serial.println("no networks found");
  } else {
    Serial.print(n);
    Serial.println(" networks found");
    Serial.println("Nr | SSID                             | RSSI | CH | Encryption");
    for (int i = 0; i < n; ++i) {
      // Print SSID and RSSI for each network found
      Serial.printf("%2d", i + 1);
      Serial.print(" | ");
      Serial.printf("%-32.32s", WiFi.SSID(i).c_str());
      Serial.print(" | ");
      Serial.printf("%4ld", WiFi.RSSI(i));
      Serial.print(" | ");
      Serial.printf("%2ld", WiFi.channel(i));
      Serial.print(" | ");
      switch (WiFi.encryptionType(i)) {
        case WIFI_AUTH_OPEN: Serial.print("open"); break;
        case WIFI_AUTH_WEP: Serial.print("WEP"); break;
        case WIFI_AUTH_WPA_PSK: Serial.print("WPA"); break;
        case WIFI_AUTH_WPA2_PSK: Serial.print("WPA2"); break;
        case WIFI_AUTH_WPA_WPA2_PSK: Serial.print("WPA+WPA2"); break;
        case WIFI_AUTH_WPA2_ENTERPRISE: Serial.print("WPA2-EAP"); break;
        case WIFI_AUTH_WPA3_PSK: Serial.print("WPA3"); break;
        case WIFI_AUTH_WPA2_WPA3_PSK: Serial.print("WPA2+WPA3"); break;
        case WIFI_AUTH_WAPI_PSK: Serial.print("WAPI"); break;
        default: Serial.print("unknown");
      }
      Serial.println();
      delay(10);
    }
  }
  Serial.println("");

  // Delete the scan result to free memory for code below.
  WiFi.scanDelete();

  // Wait a bit before scanning again.
  delay(5000);
}


Serial Monitor:

Code: Select all

10:13:36.270 -> ESP-ROM:esp32c3-api1-20210207
10:13:36.317 -> Build:Feb  7 2021
10:13:36.317 -> rst:0x3 (RTC_SW_SYS_RST),boot:0xf (SPI_FAST_FLASH_BOOT)
10:13:36.317 -> Saved PC:0x40048b82
10:13:36.317 -> SPIWP:0xee
10:13:36.317 -> mode:DIO, clock div:1
10:13:36.317 -> load:0x3fcd5820,len:0x458
10:13:36.317 -> load:0x403cc710,len:0x814
10:13:36.317 -> load:0x403ce710,len:0x2880
10:13:36.317 -> entry 0x403cc710
10:13:36.650 -> =========== Before Setup Start ===========
10:13:36.650 -> Chip Info:
10:13:36.650 -> ------------------------------------------
10:13:36.650 ->   Model             : ESP32-C3
10:13:36.650 ->   Package           : 0
10:13:36.650 ->   Revision          : 4
10:13:36.650 ->   Cores             : 1
10:13:36.650 ->   CPU Frequency     : 160 MHz
10:13:36.650 ->   XTAL Frequency    : 40 MHz
10:13:36.650 ->   Embedded Flash    : No
10:13:36.650 ->   Embedded PSRAM    : No
10:13:36.650 ->   2.4GHz WiFi       : Yes
10:13:36.650 ->   Classic BT        : No
10:13:36.650 ->   BT Low Energy     : Yes
10:13:36.650 ->   IEEE 802.15.4     : No
10:13:36.650 -> ------------------------------------------
10:13:36.650 -> INTERNAL Memory Info:
10:13:36.650 -> ------------------------------------------
10:13:36.650 ->   Total Size        :   310168 B ( 302.9 KB)
10:13:36.650 ->   Free Bytes        :   281296 B ( 274.7 KB)
10:13:36.650 ->   Allocated Bytes   :    25192 B (  24.6 KB)
10:13:36.650 ->   Minimum Free Bytes:   281296 B ( 274.7 KB)
10:13:36.650 ->   Largest Free Block:   147444 B ( 144.0 KB)
10:13:36.650 -> ------------------------------------------
10:13:36.650 -> Flash Info:
10:13:36.650 -> ------------------------------------------
10:13:36.650 ->   Chip Size         :  4194304 B (4 MB)
10:13:36.650 ->   Block Size        :    65536 B (  64.0 KB)
10:13:36.650 ->   Sector Size       :     4096 B (   4.0 KB)
10:13:36.650 ->   Page Size         :      256 B (   0.2 KB)
10:13:36.650 ->   Bus Speed         : 80 MHz
10:13:36.650 ->   Bus Mode          : QIO
10:13:36.650 -> ------------------------------------------
10:13:36.650 -> Partitions Info:
10:13:36.650 -> ------------------------------------------
10:13:36.650 ->                 nvs : addr: 0x00009000, size:    20.0 KB, type: DATA, subtype: NVS
10:13:36.650 ->             otadata : addr: 0x0000E000, size:     8.0 KB, type: DATA, subtype: OTA
10:13:36.650 ->                app0 : addr: 0x00010000, size:  1280.0 KB, type:  APP, subtype: OTA_0
10:13:36.650 ->                app1 : addr: 0x00150000, size:  1280.0 KB, type:  APP, subtype: OTA_1
10:13:36.650 ->              spiffs : addr: 0x00290000, size:  1408.0 KB, type: DATA, subtype: SPIFFS
10:13:36.650 ->            coredump : addr: 0x003F0000, size:    64.0 KB, type: DATA, subtype: COREDUMP
10:13:36.650 -> ------------------------------------------
10:13:36.650 -> Software Info:
10:13:36.650 -> ------------------------------------------
10:13:36.650 ->   Compile Date/Time : Aug 23 2024 09:54:19
10:13:36.650 ->   Compile Host OS   : windows
10:13:36.650 ->   ESP-IDF Version   : v5.1.4-497-gdc859c1e67-dirty
10:13:36.650 ->   Arduino Version   : 3.0.3
10:13:36.650 -> ------------------------------------------
10:13:36.650 -> Board Info:
10:13:36.650 -> ------------------------------------------
10:13:36.650 ->   Arduino Board     : ESP32C3_DEV
10:13:36.650 ->   Arduino Variant   : esp32c3
10:13:36.650 ->   Arduino FQBN      : esp32:esp32:esp32c3:UploadSpeed=115200,CDCOnBoot=default,CPUFreq=160,FlashFreq=80,FlashMode=qio,FlashSize=4M,PartitionScheme=default,DebugLevel=debug,EraseFlash=none,JTAGAdapter=default,ZigbeeMode=default
10:13:36.650 -> ============ Before Setup End ============
10:13:36.787 -> ### Start

Ferran
Posts: 2
Joined: Wed Aug 28, 2024 1:39 pm

Re: ESP32-C3-Mini Wifi Problems

Postby Ferran » Tue Sep 03, 2024 8:41 am

Update, I have put the debug level code to Verbose and it has given me the following information, using the same program.

As you can see it does execute the function WiFi.mode(WIFI_STA); but at some point in the execution of this, before getting to the next print, the program fails.

Code: Select all

10:36:42.974 -> #### Start
10:36:42.974 -> [   635][V][NetworkEvents.cpp:119] checkForEvent(): Network Event: 9 - WIFI_READY

lbernstone
Posts: 828
Joined: Mon Jul 22, 2019 3:20 pm

Re: ESP32-C3-Mini Wifi Problems

Postby lbernstone » Wed Sep 04, 2024 6:20 am

Sounds like an insufficient power supply. You need at least a 500mA regulator, Espressif calls for a 1A (AMS1117). I've gotten away with 4.7uF capacitance, Espressif recommends 10uF. Follow the reference if you don't have any way to breadboard.

Who is online

Users browsing this forum: No registered users and 121 guests