usb serial port buffer problem

chrislock
chrislock used Ask the Experts™
on
Delphi 7 XP prof UC310 USB/RS232 converter

Hi

I dont think that this problem is related to Delphi as such, but the basic problem is that if I open a port whilst a continuous flow of data is being supplied to it (in this case, a weighing machine at 9600,n,7,1 - a repeated simple sequence of '  1.234  Kg CR+LF') sometimes the whole machine will reboot (I have tried two different machines, two different USB converters and two different Delphi components in my software ('comport and asyncpro').
There is a reboot due to data entering the PC  via the USB converter if the port is opened or closed whilst data is being input. This is an intermittent problem and it must be due to some kind of internal buffer overflow.
Note that this problem does not occur if the port is a standard PC serial port.
Any ideas?
Thanks.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
I seem to think the difference between programming serial ports vs the USB port is the serial port doesn't get interrupted by the O/S whereas the USB port is switched in and out. what I'm trying to say is the USB port needs a seperate thread/process to initialise the port and catch the data overflow/underflow errors and reset the device and wait until the application software is ready.

Author

Commented:
Yes - I suppose your right, because the hardware on the standard serial port is not specifically controlled by the O/S and buffering can be done automatically. However, I'm surprised that a 9600 baud source causes problems!
Chris
MerijnBSr. Software Engineer
Commented:
Indeed strange at such low data speeds. It might very well  be an issue in the USB to serial driver used. Can you try another? Do you really need to poll at full speed, or can you poll at for example 100 ms to avoid this problem?
11/26 Forrester Webinar: Savings for Enterprise

How can your organization benefit from savings just by replacing your legacy backup solutions with Acronis' #CyberProtection? Join Forrester's Joe Branca and Ryan Davis from Acronis live as they explain how you can too.

Author

Commented:
I've tried two different pc's and two different USB converters. Problem occurs when opening or closing port. I'm using a packet component, which also sometimes gets confused, and triggers with the data shifted slightly i.e. I'm triggering on CRLF at the end, but sometimes the string in the packet is shifted so that the spaces at the front appear after the CRLF - I've noticed this on Tcomport (free). Havent had time to look at source.
Chris
MerijnBSr. Software Engineer

Commented:
I've been using TComport for quite a while now but never seen this kind of problems. Did you check their forum at sourgeforge?
Can you reproduce this problem without the scale (write an app which simulates the scales behaviour)?

Author

Commented:
I am doing that and I will post details ASAP. Have got various other commitments at the moment!
Top Expert 2014

Commented:
since this is XP Pro, my guess is that there a need to stop/restart or unmount/mount the device.

Question...Is this a USB 1.0, 1.1, 2.0 emulation?

Author

Commented:
Thanks all - while I've been on holiday, the problem has resolved itself by fading out of importance and is now on the back burner, where I hope it will stay for a long time!
Chris
MerijnBSr. Software Engineer

Commented:
That's one way of 'solving' a problem :)

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial