Author Topic: ESP32 C5  (Read 5188 times)

0 Members and 4 Guests are viewing this topic.

Online MitiTopic starter

  • Super Contributor
  • ***
  • Posts: 1758
  • Country: ca
ESP32 C5
« on: September 06, 2025, 10:22:14 pm »
I bought an ESP32 C5 and I can't get it to connect to Wi-Fi using Arduino IDE. The sketch compiles and uploads successfully, but in the serial monitor I get:

"Connecting to Wi-FiE (2316) wifi:can not get wifi protocol under WiFi band mode WIFI_BAND_MODE_AUTO, please use esp_wifi_get_protocols instead"

I've attached the sketch below. Do you have an example sketch that works for C5?

Cheers,
Miti

Code: [Select]
#include <WiFi.h>
#include "esp_wifi.h"

// Replace with your network credentials
const char* ssid     = "myssid";
const char* password = "mypassword";

// Built-in LED pin
const int ledPin = 13;
unsigned long previousMillis = 0;
const long interval = 500;
bool ledState = LOW;

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

  // Set up LED pin
  pinMode(ledPin, OUTPUT);
  digitalWrite(ledPin, LOW); // Turn off initially

  Serial.println();
  Serial.print("Connecting to Wi-Fi");

  WiFi.setBandMode(WIFI_BAND_MODE_5G_ONLY);

  WiFi.begin(ssid, password);
  WiFi.STA.begin();

  // Wait for connection
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }

  Serial.println();
  Serial.print("Connected! IP address: ");
  Serial.println(WiFi.localIP());

}

void loop() {
  unsigned long currentMillis = millis();

  if (WiFi.status() == WL_CONNECTED) {
    if (currentMillis - previousMillis >= interval) {
      previousMillis = currentMillis;
      ledState = !ledState;
      digitalWrite(ledPin, ledState);
    }
  } else {
    digitalWrite(ledPin, LOW);
  }
 
  // No blocking delay here, so Wi-Fi stays responsive
}
« Last Edit: September 06, 2025, 10:33:44 pm by Miti »
Fear does not stop death, it stops life.
 

Offline paulca

  • Super Contributor
  • ***
  • Posts: 6627
  • Country: gb
Re: ESP32 C5
« Reply #1 on: September 07, 2025, 10:52:21 am »
Does the arduino framework support WIFI 5Ghz?

Does it work without the band selection or does it work if you select 2.4?
"What could possibly go wrong?"
Current Open Projects:  68000 Self Build computer + OS.
 

Online MitiTopic starter

  • Super Contributor
  • ***
  • Posts: 1758
  • Country: ca
Re: ESP32 C5
« Reply #2 on: September 07, 2025, 10:53:37 am »
It’s working. It needs a WiFi.begin() before the WiFi.begin(ssid, password) to initialize the driver  :-// apparently.
Fear does not stop death, it stops life.
 

Online MitiTopic starter

  • Super Contributor
  • ***
  • Posts: 1758
  • Country: ca
Re: ESP32 C5
« Reply #3 on: September 07, 2025, 10:56:12 am »
Does the arduino framework support WIFI 5Ghz?

Does it work without the band selection or does it work if you select 2.4?

The latest Espressif library has a ESP32C5 Dev Board.
No, it didn’t work in any band before.
Fear does not stop death, it stops life.
 

Online MitiTopic starter

  • Super Contributor
  • ***
  • Posts: 1758
  • Country: ca
Re: ESP32 C5
« Reply #4 on: September 11, 2025, 12:14:49 pm »
The latency and jitter with these modules in terible. I have two of them connected to my home network, one Adafruit Feather on 2.4GHz and an ESP32 C5 on 5GHz, and I see the ping latency bouncing anywhere from 10mS to more than 800mS. They are not doing much, one is just flashing an LED while connected, the other one is an HTTP server simulating three temperature sensors. I ping my Octoprint server runing on Linux Mint on an Intel NUC, it is constant 2mS on 5GHz, wired is 1mS.
Fear does not stop death, it stops life.
 

Offline ahsrabrifat

  • Regular Contributor
  • *
  • Posts: 200
  • Country: pk
Re: ESP32 C5
« Reply #5 on: September 11, 2025, 12:24:37 pm »
Check that your router does support 5GHz with the modes compatible with ESP32-C5 (802.11ax / WiFi-6) or fallback to 2.4GHz. Sometimes routers have 5GHz channels that aren’t usable by certain devices.
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 17850
  • Country: fr
Re: ESP32 C5
« Reply #6 on: September 11, 2025, 12:55:42 pm »
The latency and jitter with these modules in terible. I have two of them connected to my home network, one Adafruit Feather on 2.4GHz and an ESP32 C5 on 5GHz, and I see the ping latency bouncing anywhere from 10mS to more than 800mS.

I have tested the ESP32-C6 a while back and here are some real test results:

https://www.eevblog.com/forum/microcontrollers/feedback-on-the-esp32-c6/msg5493736/#msg5493736

The most likely culprit of the high and varying latency is the power saving mode used. Refer to my post. I have specifically tested the -C6 and not the -C5, but I expect it to be very similar.

I have only used ESP-IDF directly. If you use the Arduino framework on these, it's very likely they use a default power saving mode that is favorable for power consumption, but not for latency, and no clue if they allow changing it from Arduino libs. If so, you can check for yourself.

I ping my Octoprint server runing on Linux Mint on an Intel NUC, it is constant 2mS on 5GHz, wired is 1mS.

Of course, you can't compare a mid-range MCU to a mini-PC. The TCP/IP stack overhead is significant, so you'll never go as low as on a PC (even with the lower-end CPU you can find). But still have a look at the power saving parameter, and you'll probably get much better results as I've tested (average 3.5 ms with the WIFI_PS_NONE parameter, of course with much higher average current).
« Last Edit: September 11, 2025, 12:59:00 pm by SiliconWizard »
 

Online MitiTopic starter

  • Super Contributor
  • ***
  • Posts: 1758
  • Country: ca
Re: ESP32 C5
« Reply #7 on: September 11, 2025, 01:51:04 pm »
Check that your router does support 5GHz with the modes compatible with ESP32-C5 (802.11ax / WiFi-6) or fallback to 2.4GHz. Sometimes routers have 5GHz channels that aren’t usable by certain devices.

It cannot fall back to 2.4 because I have different SSIDs and passwords for the two bands.
Fear does not stop death, it stops life.
 

Online MitiTopic starter

  • Super Contributor
  • ***
  • Posts: 1758
  • Country: ca
Re: ESP32 C5
« Reply #8 on: September 11, 2025, 01:58:25 pm »
I have tested the ESP32-C6 a while back and here are some real test results:

https://www.eevblog.com/forum/microcontrollers/feedback-on-the-esp32-c6/msg5493736/#msg5493736


Thanks, I will read.

Of course, you can't compare a mid-range MCU to a mini-PC. The TCP/IP stack overhead is significant, so you'll never go as low as on a PC (even with the lower-end CPU you can find).

I know, what I really meant was it’s not the router, it’s not the network.
Fear does not stop death, it stops life.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

- - -
-->