3

I'm working with esp8266 Arduino (via Adafruit Feather Huzzah) I'm trying to continuously write 3 characters to a TCP socket, but there's nothing continuous about it. It has a very regular pattern of high and low bandwidth. It writes at a very high rate for ~10 seconds, and then a very low rate for 4 seconds (see graph of received packets)

//...
void loop() {
  if (!client.connect(host, port)) {
    delay(10);
    return;
  }

  for (int i=0; i < 1024; i++){
    client.print(String(analogRead(A0)) + "\r\n");
    delay(1);
  }
}

Number of received messages (v2.2.0 and 2.3.0 firmware)

Number of received messages

Any ideas if it's the wifi driver, something in the chip or hardware timers that I can't get around... or maybe something else?

-- Update --

I have tested this with master, and it gets a different, but still bursty result. It appears that it now "catches up", instead of slowing down, but it's still on a ~10s / ~4s pattern. What could be causing this? What are the options for mitigation?

enter image description here

Issac Kelly
  • 6,309
  • 6
  • 43
  • 50

1 Answers1

0

I know this is not a proper answer, but this may be due to the Nagle's algorithm the runs by default on espduino. Try turning it off using the client.setNoDelay(false) method. Also, if you post your code other people (like myself) can test it!!

Cristóvão Trevisan
  • 1,775
  • 17
  • 18