Subj : Re: win32 - High speed serial streaming code??? To : comp.programming From : DarkD Date : Thu Sep 01 2005 05:54 pm wrote in message news:1125554723.399493.269650@g14g2000cwa.googlegroups.com... > > DarkD wrote: > > I need to capture data from a serial device that has 115200bps output. Its > > continously outputs 3byte packets 1250 times per second. > > > > I have tried using the win standard way to do serial port access (CreateFile > > ReadFile etc.) and cannot obtain anywhere near 3750 bytes per second. The > > system is completely dropping some data. > > > > The 3rd byte in every packet is 0xFF and the packets can have no break in > > time between the 3rd byte of one and the first of the next. I am not sure if > > 0xFF is affecting anything. Alot of the packets are: 0x00 0x00 0xFF, so im > > not sure if this is cuasing the problem either. > > > > I have tried use setupcomm to give massive buffers (30KB etc.) and can't get > > close to 3750 bytes per second > > . > > With ReadFile how many bytes should I be reading? If I put 3 I can get about > > 100 packets per second. If I put 1000bytes I get about 200 packets per > > second... > > > > I am using visual c++ > > > > I know it is not a CPU performance thing because this is a 3GHz P4 and the > > CPU usuage is zero all the time. > > > > Is there some other way to low level access the uart chip so I can stream in > > this data fully? I cannot understand why modern computer cannot continously > > stream and save data at 115200bps. > > > > I have also tried event based triggering and the performance is just as bad. > > > Something else is wrong. On that fast a machine doing even one byte > reads should be able to keep up with that with no problem whatsoever. Thanks for your help. I found the problem to a bad cable that was stuffing up most bits including the start/stop bits etc. Now its working flawlessly. I have about 4 threads running, one just buffers as fast as it can and one works off the buffer to convert data as it comes and other grabs converted data for displaying etc. .