Does serial port buffer behave differently under Windows 7 x64 vs x32

3k Views Asked by At

After switching to Windows 7 x64 the weight indicator device connected to a serial port started to behave differently than in Windows 7 x32.

It seems that timing of read operations or read buffer behavior is little different.

I am monitoring the output on serial port COM2 with SerialWatcher and get different results:

Under x64 it shows:

 0029484       00 11<CR><LF>z0011807       00 11<CR><LF>
 0029489       00 11<CR><LF> 0029486       00 11<CR>
<LF> 0029485       00 11<CR><LF> 0029485      
 00 11<CR><LF> 0029486       00 11<CR><LF> 002948
5       00 11<CR><LF> 0029487       00 11<CR><LF>
 0029487       00 11<CR><LF> 0029488       00 11<CR><LF>
 0029486       00 11<CR><LF> 0029486       00 11<CR><LF>
 0029485       00 11<CR><LF> 0029486       00 11<CR><LF>

Under x32 it shows:

 0029910       20 11<CR><LF> 0029911       20 11<CR><LF>
 0029912       20 11<CR><LF> 0029913       20 11<CR><LF>
 0029910       20 11<CR><LF> 0029910       20 11<CR><LF>
 0029910       20 11<CR><LF> 0029911       20 11<CR><LF>
 0029911       20 11<CR><LF>z0012057       20 11<CR><LF>
 0029912       20 11<CR><LF> 0029910       20 11<CR><LF>
 0029912       20 11<CR><LF> 0029910       20 11<CR><LF>
 0029912       20 11<CR><LF> 0029911       20 11<CR><LF>
 0029909       20 11<CR><LF> 0029910       20 11<CR><LF>
 0029910       20 11<CR><LF> 0029909       20 11<CR><LF>

The size of incoming data chunks tends to be more irregular on Windows x64 with this particular weight indicator device.

I am aware that this can be easily fixed on application level with waiting for complete data to come to the read buffer and then process it correctly but this serial port data are being currently processed by a 3rd party application that I cannot modify.

I am using FTDI USB serial converter:

settings

Is there some system setting in Windows that could fix that? Also we have very similar problem with another weight indicator connected directly to COM port on motherboard. Thanks for any suggestions.

2

There are 2 best solutions below

0
On BEST ANSWER

This is entirely normal, the amount of data you get in each call is timing sensitive. The faster the program runs, the fewer bytes it gets for each ReadFile() call. Getting 1 or 2 is normal, serial ports are slow.

Devices often send extra bytes to help programs figure out when they got the complete response. This scale does as well, just keep collecting bytes/chars until you get \r\n. Don't be thrown off by extra line breaks added by a debugging tool. If you'd use, say, the .NET SerialPort class then you'd fix it simply by using its ReadLine() method.

0
On

I have finally fixed the problems with both devices under Win x64 thanks FTDI USB driver that has Latency timer setting.

Seems that setting Latency timer to a lower value - I set it to 4 - solves the problem. Recommended are settings of 4 and bellow.

Changing settings of normal COM port in a standard Windows driver had no effect.

This is a workaround for applications that do not process buffers correctly.