Skip to content

Revisiting WiFi Connection Speed (<200ms with static ip + bssid+ channel, 1.5-2 secs without static IP) #11139

Open
@kapyaar

Description

@kapyaar

Board

ESP32 Dev Module

Device Description

ESP32 Dev Module

Hardware Configuration

Base Board with no peripherals.

Version

latest master (checkout manually)

IDE Name

Arduino IDE 2.3.4

Operating System

Windows 11

Flash frequency

80

PSRAM enabled

no

Upload speed

921600

Description

I am working on a battery powered application, hence connection speed to wifi is being tested. I have gone through 1675, but wanted to check if there has been any changes (for good or bad) in this context.
Is the almost 10x time disparity between static ip and dhcp expected?

Sketch

#include <WiFi.h>
const char *ssid = "wifi_ssid";          
const char *password = "wifi_password"; 

void setup() {
  Serial.begin(115200);
  Serial.print("Start Connect At ");
  Serial.println(millis());

  uint8_t bssid[6] = { 0xDE, 0xAD, 0xBE, 0xEF, 0x10, 0x3E };
  int32_t channel = 6;

  IPAddress local_IP(192, 168, 2, 61);
  IPAddress gateway(192, 168, 2, 1);
  IPAddress subnet(255, 255, 255, 0);
  IPAddress primaryDNS(8, 8, 8, 8);
  IPAddress secondaryDNS(8, 8, 4, 4);

  WiFi.config(local_IP, gateway, subnet, primaryDNS, secondaryDNS);  // Static IP connects in ~200mS. Without, Takes upto 2 seconds.
  WiFi.begin(ssid, password, channel, bssid, 1);

  //WiFi.begin(ssid, password);

  while (WiFi.status() != WL_CONNECTED) {
    delay(10);
    Serial.print(".");
  }
  Serial.println("WiFi connected at ");
  Serial.println(millis());
}
void loop() {
  esp_sleep_enable_timer_wakeup(10 * 1000000);
  esp_deep_sleep_start();
}

Debug Message

Just the time difference in connection, under 

  while (WiFi.status() != WL_CONNECTED) {
    delay(10);
    Serial.print(".");
  }

No Error messages.

Other Steps to Reproduce

No response

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions