Skip to content

WiFi softAP extremely slow #6706

@rtrbt

Description

@rtrbt

Board

ESP32-Ethernet-Kit V1.2, Tinkerforge ESP32 Brick (all flashed as ESP32 Dev Module)

Device Description

ESP32 Ethernet Kit: https://docs.espressif.com/projects/esp-idf/en/latest/esp32/hw-reference/esp32/get-started-ethernet-kit.html#get-started-esp32-ethernet-kit-v1-2

ESP32 Brick: https://www.tinkerforge.com/en/doc/Hardware/Bricks/ESP32_Brick.html
ESP32 Ethernet Brick: https://www.tinkerforge.com/en/doc/Hardware/Bricks/ESP32_Ethernet_Brick.html

Hardware Configuration

Nothing else is attached to the boards.

Version

other

IDE Name

Arduino IDE

Operating System

Arch Linux

Flash frequency

80 MHz

PSRAM enabled

no

Upload speed

921600

Description

The WiFi performance of clients connected to an ESP running as softAP is extremely bad in my tests. I'm using the following test setup:

Both clients are connected to the access point, one runs as Iperf server, one as client with the following results:
(Server)

iperf> sta yourAP yourPassword
I (71521) cmd_wifi: sta connecting to 'yourAP'
I (73029) esp_netif_handlers: sta ip: 192.168.4.2, mask: 255.255.255.0, gw: 192.168.4.1
iperf> iperf -s -i 3
I (112400) cmd_wifi: mode=tcp-server sip=192.168.4.2:5001, dip=0.0.0.0:5001, interval=3, time=30
I (112402) iperf: Socket created
iperf> W (123592) wifi:<ba-add>idx:0 (ifx:0, c4:dd:57:b8:16:e9), tid:0, ssn:0, winSize:64
I (123606) iperf: accept: 192.168.4.3,54260


        Interval Bandwidth
   0-   3 sec       0.03 Mbits/sec
   3-   6 sec       0.02 Mbits/sec
   6-   9 sec       0.02 Mbits/sec
   9-  12 sec       0.02 Mbits/sec
  12-  15 sec       0.01 Mbits/sec
  15-  18 sec       0.01 Mbits/sec
  18-  21 sec       0.01 Mbits/sec
  21-  24 sec       0.02 Mbits/sec
  24-  27 sec       0.01 Mbits/sec
  27-  30 sec       0.01 Mbits/sec
   0-  30 sec       0.02 Mbits/sec
I (153688) iperf: TCP Socket server is closed.

(Client; note that the connection error after 30 seconds happens only because the server iperf command misses -t 30)

iperf> sta yourAP yourPassword
I (26924) cmd_wifi: sta connecting to 'yourAP'
I (28530) esp_netif_handlers: sta ip: 192.168.4.3, mask: 255.255.255.0, gw: 192.168.4.1
iperf> iperf -c 192.168.4.2 -i 3 -t 60
I (70414) cmd_wifi: mode=tcp-client sip=192.168.4.3:5001, dip=192.168.4.2:5001, interval=3, time=60
W (70508) wifi:<ba-add>idx:0 (ifx:0, c4:dd:57:b8:16:e9), tid:0, ssn:0, winSize:64
                                                                                                                                                                                                                  I (70522) iperf: Successfully connected

        Interval Bandwidth
iperf>    0-   3 sec       0.17 Mbits/sec
   3-   6 sec       0.00 Mbits/sec
   6-   9 sec       0.04 Mbits/sec
   9-  12 sec       0.00 Mbits/sec
  12-  15 sec       0.04 Mbits/sec
  15-  18 sec       0.00 Mbits/sec
  18-  21 sec       0.00 Mbits/sec
  21-  24 sec       0.00 Mbits/sec
  24-  27 sec       0.04 Mbits/sec
  27-  30 sec       0.00 Mbits/sec
W (103478) iperf: tcp client send error, error code: 104, reason: Connection reset by peer
I (103480) iperf: tcp client send error

I (103491) iperf: TCP Socket client is closed.
I (103491) iperf: iperf exit

If I run exactly the same test, but don't use the arduino-esp32 WiFiAccessPoint example, but instead the ESP-IDF 4.4.1 wifi/getting_started/softAP example https://github.com/espressif/esp-idf/tree/master/examples/wifi/getting_started/softAP
the throughput is still not great, but way better than before:
(Server)

iperf> sta myssid mypassword
I (11517) cmd_wifi: sta connecting to 'myssid'
I (13029) esp_netif_handlers: sta ip: 192.168.4.2, mask: 255.255.255.0, gw: 192.168.4.1
iperf> iperf -s -i 3
I (27293) cmd_wifi: mode=tcp-server sip=192.168.4.2:5001, dip=0.0.0.0:5001, interval=3, time=30
I (27295) iperf: Socket created
iperf> W (40402) wifi:<ba-add>idx:0 (ifx:0, c4:dd:57:b8:16:e9), tid:0, ssn:0, winSize:64
I (40409) iperf: accept: 192.168.4.3,57407


        Interval Bandwidth
   0-   3 sec       0.53 Mbits/sec
   3-   6 sec       6.85 Mbits/sec
   6-   9 sec       2.86 Mbits/sec
   9-  12 sec       0.22 Mbits/sec
  12-  15 sec       0.27 Mbits/sec
  15-  18 sec       0.38 Mbits/sec
  18-  21 sec       0.33 Mbits/sec
  21-  24 sec       0.39 Mbits/sec
  24-  27 sec       0.28 Mbits/sec
  27-  30 sec       0.44 Mbits/sec
   0-  30 sec       1.26 Mbits/sec
I (70708) iperf: TCP Socket server is closed.
I (70709) iperf: iperf exit

(Client; TCP error for the same reason as above)

iperf> sta myssid mypassword
I (15559) cmd_wifi: sta connecting to 'myssid'
I (17029) esp_netif_handlers: sta ip: 192.168.4.3, mask: 255.255.255.0, gw: 192.168.4.1
iperf> iperf -c 192.168.4.2 -i 3 -t 60
I (39321) cmd_wifi: mode=tcp-client sip=192.168.4.3:5001, dip=192.168.4.2:5001, interval=3, time=60
iperf> W (39536) wifi:<ba-add>idx:0 (ifx:0, c4:dd:57:b8:16:e9), tid:0, ssn:0, winSize:64
I (39545) iperf: Successfully connected

        Interval Bandwidth
   0-   3 sec       0.66 Mbits/sec
   3-   6 sec       6.90 Mbits/sec
   6-   9 sec       2.84 Mbits/sec
   9-  12 sec       0.17 Mbits/sec
  12-  15 sec       0.31 Mbits/sec
  15-  18 sec       0.39 Mbits/sec
  18-  21 sec       0.31 Mbits/sec
  21-  24 sec       0.39 Mbits/sec
  24-  27 sec       0.31 Mbits/sec
  27-  30 sec       0.39 Mbits/sec
W (70051) iperf: tcp client send error, error code: 104, reason: Connection reset by peer
I (70052) iperf: tcp client send error

I (70063) iperf: TCP Socket client is closed.
I (70064) iperf: iperf exit

If I use another Tinkerforge ESP32 Brick or ESP32 Ethernet Brick, as the softAP (instead of the ESP Ethernet Kit by Espressif), the performance stays the same.

If I use two linux PCs as Iperf server and client, both connected to a ESP softAP, the performance is as follows:
(Running the ESP-IDF softAP example)

$ iperf -s -i 3
------------------------------------------------------------
Server listening on TCP port 5001
TCP window size:  128 KByte (default)
------------------------------------------------------------
[  1] local 192.168.4.2 port 5001 connected with 192.168.4.3 port 46338 (icwnd/mss/irtt=14/1448/3960)
[ ID] Interval       Transfer     Bandwidth
[  1] 0.0000-3.0000 sec  7.97 MBytes  22.3 Mbits/sec
[  1] 3.0000-6.0000 sec  7.89 MBytes  22.1 Mbits/sec
[  1] 6.0000-9.0000 sec  7.95 MBytes  22.2 Mbits/sec
[  1] 9.0000-12.0000 sec  8.18 MBytes  22.9 Mbits/sec
[  1] 12.0000-15.0000 sec  6.70 MBytes  18.7 Mbits/sec
[  1] 15.0000-18.0000 sec  8.04 MBytes  22.5 Mbits/sec
[  1] 18.0000-21.0000 sec  7.95 MBytes  22.2 Mbits/sec
[  1] 21.0000-24.0000 sec  8.66 MBytes  24.2 Mbits/sec
[  1] 24.0000-27.0000 sec  8.17 MBytes  22.9 Mbits/sec
[  1] 27.0000-30.0000 sec  8.45 MBytes  23.6 Mbits/sec
[  1] 0.0000-30.1010 sec  80.3 MBytes  22.4 Mbits/sec

(Running the arduino-esp32 softAP example)

$ iperf -s -i 3
------------------------------------------------------------
Server listening on TCP port 5001
TCP window size:  128 KByte (default)
------------------------------------------------------------
[  1] local 192.168.4.2 port 5001 connected with 192.168.4.3 port 46368 (icwnd/mss/irtt=14/1448/4440)
[ ID] Interval       Transfer     Bandwidth
[  1] 0.0000-3.0000 sec  1.32 MBytes  3.68 Mbits/sec
[  1] 3.0000-6.0000 sec  1.33 MBytes  3.72 Mbits/sec
[  1] 6.0000-9.0000 sec  1.34 MBytes  3.75 Mbits/sec
[  1] 9.0000-12.0000 sec  1.39 MBytes  3.87 Mbits/sec
[  1] 12.0000-15.0000 sec  1.40 MBytes  3.92 Mbits/sec
[  1] 15.0000-18.0000 sec  1.37 MBytes  3.83 Mbits/sec
[  1] 18.0000-21.0000 sec  1.32 MBytes  3.68 Mbits/sec
[  1] 21.0000-24.0000 sec  1.36 MBytes  3.80 Mbits/sec
[  1] 24.0000-27.0000 sec  1.01 MBytes  2.83 Mbits/sec
[  1] 27.0000-30.0000 sec  1.37 MBytes  3.84 Mbits/sec
[  1] 0.0000-30.6199 sec  13.5 MBytes  3.70 Mbits/sec

So the performance is much better in this case, however the ESP-IDF softAP is still faster by a factor of 6.

Sketch

/*
  WiFiAccessPoint.ino creates a WiFi access point and provides a web server on it.

  Steps:
  1. Connect to the access point "yourAp"
  2. Point your web browser to http://192.168.4.1/H to turn the LED on or http://192.168.4.1/L to turn it off
     OR
     Run raw TCP "GET /H" and "GET /L" on PuTTY terminal with 192.168.4.1 as IP address and 80 as port

  Created for arduino-esp32 on 04 July, 2018
  by Elochukwu Ifediora (fedy0)
*/

#include <WiFi.h>
#include <WiFiClient.h>
#include <WiFiAP.h>

#define LED_BUILTIN 2   // Set the GPIO pin where you connected your test LED or comment this line out if your dev board has a built-in LED

// Set these to your desired credentials.
const char *ssid = "yourAP";
const char *password = "yourPassword";

void setup() {
  pinMode(LED_BUILTIN, OUTPUT);

  Serial.begin(115200);
  Serial.println();
  Serial.println("Configuring access point...");

  // You can remove the password parameter if you want the AP to be open.
  WiFi.softAP(ssid, password);
  IPAddress myIP = WiFi.softAPIP();
  Serial.print("AP IP address: ");
  Serial.println(myIP);
  
}

void loop() {
}

Debug Message

ets Jul 29 2019 12:21:46

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:1344
load:0x40078000,len:13516
load:0x40080400,len:3604
entry 0x400805f0
[⸮⸮m�um⸮⸮⸮⸮2-hal-cpu.c:214] setCpuFrequencyMhz(): PLL: 480 / 2 = 240 Mhz, APB: 80000000 Hz

Configuring access point...
[    29][D][WiFiGeneric.cpp:852] _eventCallback(): Arduino Event: 0 - WIFI_READY
[   114][D][WiFiGeneric.cpp:852] _eventCallback(): Arduino Event: 10 - AP_START
AP IP address: 192.168.4.1
Server started
[ 13349][D][WiFiGeneric.cpp:852] _eventCallback(): Arduino Event: 12 - AP_STACONNECTED
[ 13422][D][WiFiGeneric.cpp:852] _eventCallback(): Arduino Event: 14 - AP_STAIPASSIGNED
[ 44244][D][WiFiGeneric.cpp:852] _eventCallback(): Arduino Event: 12 - AP_STACONNECTED
[ 44286][D][WiFiGeneric.cpp:852] _eventCallback(): Arduino Event: 14 - AP_STAIPASSIGNED

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

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions