Jump to content
43oh

TM4C1294XL - High latency


Recommended Posts

Hi,

 

I have strange problems with my connected launchpad. This is the code :

byte mac[] = {
  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
};

EthernetServer server(1234);


void setup() {

  Ethernet.begin(mac);
  server.begin();

  Serial.begin(9600);
  Serial.print("Chat server address:");
  Serial.println(Ethernet.localIP());
}

void loop() {

  EthernetClient client = server.available();

  if (client) {

    unsigned long timing = micros();

    Serial.println("New client !");

    while (client.connected()) {

      if (client.available() > 0) {

        if (client.read() == 'A') {
          
          char buffer[300];
          memset(buffer, NULL, sizeof(buffer));
          strcat(buffer, "1000");
          strcat(buffer, ",");
          strcat(buffer, "1000");
          strcat(buffer, ",");
          strcat(buffer, "1000");
          strcat(buffer, ",");
          strcat(buffer, "1000");
          server.write(buffer);

        }

      }
    }

    Serial.println("Client disconnected!");
    client.stop();

  }
}

It's very simple : I send a 'A', it responds. For now it's just a simulation, the purpose is to send data. My probleme is the latency : I have a soft which send a 'A', receives the response, and immediately sends another 'A' etc ... With connected launchpad, it's very slow, around 400-500ms to get the answer. I tested the same code with an Arduino Uno + ethernet shield, it's so much faster.

 

And another strange thing : even if I close my TCP socket from computer, client.connected() still returns true. On Arduino I immediately get a "Client disconnected!".

 

Any ideas ?

 

Link to post
Share on other sites
  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...