Electronics-Related.com
Forums

LPC1768 USB hangup

Started by John Larkin July 7, 2012
On Sun, 08 Jul 2012 11:30:50 GMT, stephenXXX@mpeforth.com (Stephen
Pelc) wrote:

>It's been a while since I rewrote our terminal emulator for USB. >I think that we check the error code returned by ClearCommError(), and >check for CE_MODE. If this is set, the channel has been disconnected >and you should close the comms.
It now turns out that ClearCommError() returns 0 if a USB serial port is disconnected. This fits well with the current Windows documentation. Our terminal emulator now closes the port gracefully when the USB adapter is diconnected. Stephen -- Stephen Pelc, stephenXXX@mpeforth.com MicroProcessor Engineering Ltd - More Real, Less Time 133 Hill Lane, Southampton SO15 5AF, England tel: +44 (0)23 8063 1441, fax: +44 (0)23 8033 9691 web: http://www.mpeforth.com - free VFX Forth downloads
On Sat, 07 Jul 2012 12:19:04 -0700, John Larkin
<jjlarkin@highNOTlandTHIStechnologyPART.com> wrote:

> > >We built a little picosecond pulse generator box with a USB interface. >The USB is directly into an LPC1768 NXP ARM chip, and we're using the >USB stack and inf file that Code Red provided. It enumerates as a >serial port. It's "unsupported", which means it's *really* >unsupported. > >Under Windows XP, there's a small glitch. I can plug/unplug the USB >cable, and it always makes all the proper bleep/bloop >connect/disconnect noises. It shows up as COM6 or some such. I can >talk to it from Hyperterminal or from a PowerBasic program. But if I >disconnect the USB cable while the port is open, it hangs up. The fix >is to close the program, then go to Device Manager, disable it, and >re-enable it. > >I've seen other USB devices behave this way, too. > >Anybody know what's going on, and maybe how to fix it? >
My first guess is that Winders does not properly comply with the USB specification, or that the specification itself has problems with disconnect followed by reconnect. Fortunately the USB specification is publicly available from the USB consortium. ?-)
W dniu 2012-07-08 01:00, John Larkin pisze:
> On Sat, 07 Jul 2012 22:38:23 GMT, stephenXXX@mpeforth.com (Stephen > Pelc) wrote: > >> On Sat, 07 Jul 2012 12:19:04 -0700, John Larkin >> <jjlarkin@highNOTlandTHIStechnologyPART.com> wrote: >> >>> Under Windows XP, there's a small glitch. I can plug/unplug the USB >>> cable, and it always makes all the proper bleep/bloop >>> connect/disconnect noises. It shows up as COM6 or some such. I can >>> talk to it from Hyperterminal or from a PowerBasic program. But if I >>> disconnect the USB cable while the port is open, it hangs up. The fix >>> is to close the program, then go to Device Manager, disable it, and >>> re-enable it. >> >> The problem is that a USB serial device can be closed by disconnecting >> the device, whereas a real serial port cannot. The comms program has >> to be aware of USB serial ports. HyperTerm is just too old. >> >> Stephen > > My PowerBasic program did the same thing. What do you mean by "be > aware" ? What would a program do the prevent the hangup? Closing the > open port after the disconnect is apparently too late. >
Hi. Use terminal v1.9b by Br@y++. It can close virtual port after disconnecting usb cable. -- Regards MD