I have been programming an ESP8285 Teensy Add-on board (https://www.tindie.com/products/onehorse/esp8285-add-on-for-teensy-32/) and today ran into a problem. I was sending UDP packets, but then the ESP started sending packets on the "QUIC" protocol, for no reason that I am aware of. The exact same code, when flashed to a second, identical ESP8285 Add-on board, sends UDP packets as expected. I wired up both devices identically too. I have tried resetting and re-programming the ESP but to no avail.
Here is the code:
char msg[59] = "hello world 123456789 10 11 12 13 14 15 16 17 18 19 20!!!!";
const uint16_t port = 1234;
const char server_ip[] = "192.168.43.243";
WiFiUDP client;
void initWifi() {
std::string ssid = "********"; //removed, but I can say that it is definitely connecting to my AP
std::string password = "*******"; // also removed
WiFi.mode(WIFI_STA);
WiFi.begin(ssid.c_str(), password.c_str());
uint8_t count = 0;
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
count++;
}
client.begin(port);
}
void test_udpsend() {
uint8_t size = sizeof(msg);
client.beginPacket(server_ip, port);
client.write(msg, size);
client.endPacket();
queue_s_w.increment_read_pos();
}
void setup() {
Serial.begin(230400);
initWifi();
wifi_set_sleep_type(LIGHT_SLEEP_T); // Enable light sleep mode to save power
}
void loop() {
test_udpsend();
}
This image shows the wireshark capture for the working ESP:
This image shows the wireshark capture for the "protected payload" mode ESP:
I assume that the ESP has got into some mode that I am unaware of... but I'd have thought that reprogramming it and re-connecting all the wires might have solved this. Any thoughts would be appreciated!
Thanks!