0

I'm try reading data from COM port. i used PL2303TA Convertor that increases data transfer speed. my data transfer speed is 3Mpbs and I'm looking for sample to read data at this Speed. i wrote a program by C# and use "while" loop to read receiving data. but some data has been lost.

int _max = 50000; // max sample
SerialPort port = new SerialPort("COM4",
      3000000, Parity.None, 8, StopBits.One);
port.Open();
List<string> slist = new List<string>();
while(true)
{
   string sdata = port.ReadLine();
   slist.Add(sdata);
   if (slist.Count > _max)
      break;
}

my device sending data sequence like this:

 1,2,3,...,7000,1,2,3...,7000,1,2,3

and by this code i receive data like this:

 1,3,5,...,6999,1,3,5,...,6999,1,3,5

(my device is "ARM Micro-controller AT91SAM7S64-AU" and send each number by newline Character: "\n" )

how can i improve reading speed?

thanks.

PL2303TA USB to Serial Bridge Controller http://www.prolific.com.tw/US/ShowProduct.aspx?p_id=153&pcid=41

  • How do you know the data is transmitted as expected? Since entire lines are missing, the problem is more likely at the source. – Codo Jun 09 '21 at 21:19
  • Have you tested at any slower baudrates to verify hardware connections and software are all performing as expected? If not, then why not? – sawdust Jun 10 '21 at 03:16

1 Answers1

0

This sounds not like a software problem but a hardware one. Please make sure that the wires of the uart are as close as possible when using such high speeds.

Another option would be to use twisted and shielded wires when the interferences are still too high.

If you have a scope, please check the signal edges. I assume they do not have a clean rectangular shape anymore. I don't know the chip or the board in particular, but some boards also support something called oversampling. If you have noise on the signal, this may help sampling the serial signal as it samples multiple times on a single bit and uses an average to determine the single bit states.

Michael H.
  • 11
  • 2
  • The way I understand the question, each number is on a separate line and entire lines are missing but never single characters. This is unlikely to be a hardware issue. It would know about the new line character. – Codo Jun 09 '21 at 21:16