Quantcast
Channel: MSP430 Technical Forums
Viewing all articles
Browse latest Browse all 2077

Tiva 129 Connected Ethernet Write / Print is very slow

$
0
0

Hi,

I am using Energia ethernet library for Ti Tiva c 129 Launchpad. I wrote a simple program in Energia that gets a byte from stream and sends back two bytes.

It seems there is lag when I send bytes back from Ti board. Here is my code.

 

byte           mac[] = {0x00, 0x0A, 0xB7, 0x52, 0xBA, 0x16 };
IPAddress      ip(192,168,1,192);
IPAddress      gateway(192,168,1,1);
IPAddress      subnet(255,255,255,0);
EthernetServer server(80);
EthernetClient client;


void setup()
{
   Ethernet.begin(mac, ip, gateway, subnet);
   server.begin();
   Serial.begin(9600);
}


void loop()
{
  byte buf[2];
  buf[0] = 'O';
  buf[1] = 'K';
  client = server.available();
  if (client.available()) {
    char c = client.read();
    if (c == 'S'){
      Serial.print("A");
      client.write(buf, 2);
    }
  }
}
 
And i am sending data from a simple vb program like this

        Dim d As Byte()
        data = New [Byte](2) {}


        d = System.Text.Encoding.ASCII.GetBytes("S")
        stream.Write(d, 0, d.Length)
        While stream.DataAvailable = False
        End While
        stream.Read(data, 0, data.Length)


        d = System.Text.Encoding.ASCII.GetBytes("S")
        stream.Write(d, 0, d.Length)
        While stream.DataAvailable = False
        End While
        stream.Read(data, 0, data.Length)


        d = System.Text.Encoding.ASCII.GetBytes("S")
        stream.Write(d, 0, d.Length)
        While stream.DataAvailable = False
        End While
        stream.Read(data, 0, data.Length)
        MessageBox.Show("Test")
 
It takes more than half a second for "Test" message to appear on the screen using Ti Tiva C129 board and Energia.
If we send data byte by byte like this:
client.write('O');
client.write('K');
It works fine.
 
I tried the same program with Arduino Mega and it works fine regardless of how we send it. When using Arduino Mega it takes less than maybe 50 milliseconds for message to appear on the screen

Viewing all articles
Browse latest Browse all 2077

Trending Articles