The very first packet should start with 00 01 2A 2A 00 02 2A 2A 00 03 2A 2A, etc.
I just put the asterisks in there for separation while viewing.
I have tested some more:
If I set the counter value from 1500 to 513 or 512 or 500, it works fine.
If I set the counter value to 514 or more, it exhibits the problem.
Here i have changed everything to ints.
I also am printing to serial the highByte and lowBtye, and they both appear fine in the serial monitor.
The highByte data looks fine in the serial monitor, but not in the packets.
#include <SPI.h> // needed for Arduino versions later than 0018
#include <Ethernet.h>
#include <EthernetUdp.h>
// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; // mac address for this device
IPAddress ip(192, 168, 1, 170); // IP for this device
unsigned int localPort = 8880; // local port to listen on
IPAddress remoteIP(192, 168, 1, 240); // the remote IP address
unsigned int remotePort = 7770; // the destination port
EthernetUDP Udp;
int MyArray1[1502];
int MyIndex = 1;
int x = 0;
int temp1 = 0;
void setup() {
// start the Ethernet and UDP:
Ethernet.begin(mac,ip);
Udp.begin(localPort);
// initialize serial communications at 9600 bps:
Serial.begin(9600);
Serial.println("Here we go.");
int StartTime;
}
void loop() {
if(MyIndex < 1500){
MyArray1[MyIndex] = MyIndex;
MyIndex = MyIndex + 1;
}
if(MyIndex == 1500){
Udp.beginPacket(remoteIP, remotePort);
for(x = 1; x < MyIndex; x++){
temp1 = highByte(MyArray1[x]);
Serial.println(temp1);
Udp.write(temp1);
temp1 = lowByte(MyArray1[x]);
Serial.println(temp1);
Udp.write(temp1);
//Udp.write("**");
}
Udp.endPacket();
delay(5000);
MyIndex = 1;
}
}
I also am printing to serial the highByte and lowBtye, and they both appear fine in the serial monitor.
The highByte data looks fine in the serial monitor, but not in the packets.
That was going to be my next question. You are using the ethernet library included with the IDE? No custom stuff, right?
edit: I looked at the code. Try sending it as two bytes like this.
Did you see my edit to my last post above? Try sending it as a 2 byte array. That will avoid one routine in the library.
edit: It may be possible you are overflowing the w5100 tx buffer. You are sending 3000 bytes, and the tx buffer is something like 1500 bytes. How does it do if you send 2 bytes? Skip the for loop as a test.