CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

USB mostly works, but disconnects and all hell breaks loose

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
sarodrig



Joined: 14 Aug 2009
Posts: 6
Location: Seattle, WA, USA

View user's profile Send private message

USB mostly works, but disconnects and all hell breaks loose
PostPosted: Tue Mar 23, 2010 1:02 pm     Reply with quote

I'm using USB as a serial port on a PIC18F2550. It works like a charm 99% of the time. However, sometimes after several hours or days, I lose communication and can't reconnect.

If I have the serial port open (with Hyperterminal, or whatever), and comm is lost, then it hangs. I have to manually close the port, disconnect the USB cable, and then reconnect it in order to be able to reopen the port. Simple closing and opening the port without disconnecting the cable does not work. I think the problem is that the Windows driver (Win XP, with cdc_NTXP.inf) doesn't let go of the COM port on a disconnect.

This is easily repeatable by momentarily disconnecting the USB cable and then reconnecting it while the COM port is open by another program, such as Hyperterminal.

I'm fairly certain this is a PC-side driver problem. Anybody else seen this or come up with a workaround?

Thanks!
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Tue Mar 23, 2010 1:27 pm     Reply with quote

I see two points. Some Windows applications (e.g. Hyperterminal, at least previous versions) don't handle a driver fault like a disconnect correctly. The other point is, that interferences, e.g. electrostatic discharges or plug/unplug of a power supply can cause the USB connection to be suspended. Apparently only disconnection of the USB cable can revive it, although I guess, there's an option to force a reconnect by io_requests to the driver.
jbmiller



Joined: 07 Oct 2006
Posts: 73
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue Mar 23, 2010 4:40 pm     Reply with quote

Welcome to the woes of the Useless Serial Bus....sigh. Ever since 'they' got rid of real RS-232 ports, PC programming has been a 'challenge'. The sheer amount of overhead for USB is astounding, mind boggling that it ever works.
Two workarounds. I've used both, #1 is my favorite, #2 was to learn yet another language.
1...use a PCI serial card if possible, get rid of USB unless you want to tear out your hair tracking down the problems in the driver.
2...Cut your own code using Borland's Delphi. It'll create tight, fast, self contained code bypassing all those hooks to flakey .dlls,etc.
I'm sure others will praise USB as the cat's meow but I require fast realtime interrupts something USB cannot ever give you.
Jay
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group