sw is a stopwatch that calculates time in milliseconds. When I run this, it takes about 145ms to send the data. I am running using Ctrl-F5 (without debugging.) If I decrease the number of bytes send, the time goes down. Given the baud rate set to 1,000,000 , I would expect this to be faster.
Would a board like the Hydra perform faster? Any suggestions? Thank you.
Not an answer, I know, but is two stop bits a deal breaker? Might be hitting something weird/special there. What is the receiver, an xbee? A TTL uart? Perhaps there’s also a buffering issue.
Thanks Brett for the reply. I tried removing the two bit stop and had the same issue. I also tried setting the baud rate down to 500,000 and my test yeilds the same amount of time. So, I think I am hitting some limitation. I wonder if other boards have the same issue. I have been looking at the Hydra but want to make sure it passes this test first.
var sp = new SerialPort("COM2", 500000, Parity.None, 8, StopBits.Two);
var data = new byte[2048];
sp.Open();
var start = DateTime.Now.Ticks;
sp.Write(data, 0, data.Length);
var end = DateTime.Now.Ticks;
Debug.Print(string.Concat("took ", (end - start) / TimeSpan.TicksPerMillisecond, " ms."));
I get this output (on a Cerb40, not the most recent firmware):