Hi awarnick, I was not insinuating writing the entire buffer would fix the problem, I figured that you were already aware that writing packets had a huge speed advantage over writing single bytes, my comments were aimed at anyone following this thread that might not have known that.
I am not criticizing what you are doing and I see you have a serious interest in what you are doing, for me it is fun and so far I have enjoyed this thread.
Sorry 10 Gb was a typo and should have been 10 Mb. The application I wrote transmitted one 1024 byte and received one 1024 byte packet 5000 times, so as you pointed out 5 Mb each way for a total ~10 Mb. There were a few extra bytes for the value of 6 written at the head of each Arduino packet. I went to 5000 because you mentioned 3000 as being a failure point and I wanted to go well beyond that.
This is the Arduino code, not as pretty as the original but it worked for testing.
typedef unsigned char byte;
int expSize = 1025, left = expSize;
byte buf[1025];
void loop()
{
while(Serial.available())
{
byte b = (byte)Serial.read();
if(b != 0xF) {left = expSize; Serial.write((byte)5);}
else if(!(--left))
{
Serial.write(buf,1025);
left = expSize;
}
}
}
void setup() {Serial.begin(500000);
while(expSize--) buf[expSize]=0xF0;
buf[0]=6;
expSize=1025;}
The Windows app was a .Net app and I used the System IO Ports SerialPort object at 500000 baud, no flow control and standard read buffer (which is 4096 I think). The program initialized the cycle by transmitting 1024 bytes of 0xF then waited for the byte of 6 followed by 1024 bytes of 0xF0 continuing for 5000 iterations, I did try a higher baud but that failed immediately, I may revisit that.
The data was written to a rich text box, I thought that may be slowing things down but after trying a few things I could see it was not making a lot of difference. The text box gave me a visual of what was happening and at the end of each run I would get the total time taken and a character count of all received characters so I could determine if there were errors. The total time for 10 Mb was in the range of 4m which when calculated against the baud rate was fairly good.
In my mind the Arduino works well and looks to me to be reliable with the right Windows environment.