ESP8266 UDP transmission interruptions
- Dominant language
- C++
- Stars
- 16.7k
- Forks
- 13.1k
- PR merge metrics
- No merged PRs in 30d
Description
### Basic Infos
#### Hardware
Hardware: NodeMCU 1.0 ESP-12E 80MHz
### Description
Problem description
I'm trying to transfer data from ESP8266(NodeMCU ESP12E) to my laptop. I'm coding ESP using Arduino IDE. I am able to receive correct packets (each containing 400 bytes) on a visual basic console program. However, to see whether the transmission is continuous or not, I have toggled an output pin whenever UDP.endpacket() returns 1. I observed waveforms on DSO. I found that UDP.endpacket() does NOT return 1 many times and the there is no transmission from ESP for a significant amount of time (milliseconds). Refer attached waveforms.Why does UDP.endpacket() return 0 for such long time? Why is UDP transmission getting interrupted? How can I solve this? Please feel free to ask for more details if necessary.
-- | --
### Settings in IDE
Module: NodeMCU 1.0 (ESP-12E module), 80MHz
Flash Size: 4MB
CPU Frequency: 80Mhz
Upload Using: SERIAL
### Sketch
```cpp
#include
#include
const char* ssid = "Connectify-me33";
const char* password = "donfour276";
WiFiUDP Udp;
unsigned int localUdpPort = 65000;
unsigned int dest_port = 11000;
unsigned char clientBuf[400];
int clientBuf_len=0;
#define test_pin 5
int return_udp_fcn = 0;
void setup()
{
WiFi.begin(ssid, password);
delay(5000);
Udp.begin(localUdpPort);
pinMode(test_pin, OUTPUT);
digitalWrite(test_pin, HIGH);
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, LOW);
delay(1000);
digitalWrite(LED_BUILTIN, HIGH);
delay(1000);
digitalWrite(LED_BUILTIN, LOW);
delay(1000);
digitalWrite(LED_BUILTIN, HIGH);
delay(1000);
}
void loop()
{
digitalWrite(test_pin, HIGH);
//filling up buffer
for(clientBuf_len = 0; clientBuf_len<=399; clientBuf_len++)
{
clientBuf[clientBuf_len] = 0x7E;
}
//UDP transmit
Udp.beginPacket("172.22.0.1", dest_port);
Udp.write((const uint8_t *)clientBuf, 400);
return_udp_fcn = 0;
return_udp_fcn = Udp.endPacket();
if(return_udp_fcn == 1){
digitalWrite(test_pin, LOW);
}
delayMicroseconds(100);
}

Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.