본문 바로가기

ESPRESSIF/ESP32-C3

ESP32-C3 Arduino IDE - Iperf로 WiFi TCP Throughput 측정 테스트

ESP32-C3 Arduino 개발 환경에서 WiFi 성능을 테스트 해 보자

Arduino WiFi TCP 코드를 수정해 iperf 서버 코드를 만들었다.

#include <WiFi.h>

#ifdef ESP32
  #include "esp_task_wdt.h"
  #define WDT_TIMEOUT 9
#endif


const char* ssid = STASSID;
const char* password = STAPSK;
int port = 5001;

WiFiServer server(port);
void setup() {
    esp_task_wdt_init(WDT_TIMEOUT, 0);
    Serial.begin(115200);
    Serial.println("ESP32 Simple web Start");
    Serial.println(ssid);
    
    // Connect to your wi-fi modem
    WiFi.begin(ssid, password);
    
    // Check wi-fi is connected to wi-fi network
    while (WiFi.status() != WL_CONNECTED) {
    delay(1000);
    Serial.print(".");
    }
    
    Serial.println("");
    Serial.println("WiFi connected successfully");
    Serial.print("IP: ");
    Serial.println(WiFi.localIP());  //Show ESP32 IP on serial
    server.begin();
    delay(100); 
}

void loop() {
  byte buf[2048];
  unsigned int len = 0;
  
  WiFiClient client = server.available();
  
   if (client) {
    Serial.println("Here is new client for check arduino performance");
  
    while (client.connected())
    {
      len = client.available();
      if (len)
      {
       client.read(buf, 2048);
      }
     }
    // close the connection:
    client.stop();
  
    Serial.println("client disonnected");
  }
}

 

 

코드를 구동하면 iperf에서 TCP 전송률이 3Mbps 로 측정이 된다.

너무 느린데...

 
동작은 되지만 콘솔창에서 메시지를 확인해보면 와치독이 수행된다.
ESP32 Simple web Start
WiFi connected successfully
IP: 192.168.1.20
Here is new client for check arduino performance
E (73313) task_wdt: Task watchdog got triggered. The following tasks did not reset the watchdog in time:
E (73313) task_wdt:  - IDLE (CPU 0)
E (73313) task_wdt: Tasks currently running:
E (73313) task_wdt: CPU 0: loopTask
 

와치독 정지 시키고 테스트 해 보면 8Mbps 정도로 측정이 된다.

 
 
ESP32-C3 데이트 시트 상의 WiFi 전송률은 20Mbps로 되어 있는데 왜 이렇게 느리지?
 
Up to 20 MBit/s TCP throughput and 30 MBit/s UDP throughput over the air

 

Arduino 환경이라 그런가? 우선 ESD-IDF 환경에서 ESP32-C3 WiFi TCP 전송률 테스트를 해 보자.

 
반응형