Motherboard Forums


Reply
Thread Tools Display Modes

LPC1768 USB hangup

 
 
John Larkin
Guest
Posts: n/a
 
      07-07-2012, 07:19 PM


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?



 
Reply With Quote
 
 
 
 
Stephen Pelc
Guest
Posts: n/a
 
      07-07-2012, 10:38 PM
On Sat, 07 Jul 2012 12:19:04 -0700, John Larkin
<(E-Mail Removed)> 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

--
Stephen Pelc, (E-Mail Removed)
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
 
Reply With Quote
 
 
 
 
Phil Hobbs
Guest
Posts: n/a
 
      07-07-2012, 10:58 PM
Stephen Pelc wrote:
>
> On Sat, 07 Jul 2012 12:19:04 -0700, John Larkin
> <(E-Mail Removed)> 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


I'm a big fan of Putty for this sort of job.

Cheers

Phil Hobbs

--
Dr Philip C D Hobbs
Principal Consultant
ElectroOptical Innovations LLC
Optics, Electro-optics, Photonics, Analog Electronics

160 North State Road #203
Briarcliff Manor NY 10510
845-480-2058

hobbs at electrooptical dot net
http://electrooptical.net
 
Reply With Quote
 
John Larkin
Guest
Posts: n/a
 
      07-07-2012, 11:00 PM
On Sat, 07 Jul 2012 22:38:23 GMT, (E-Mail Removed) (Stephen
Pelc) wrote:

>On Sat, 07 Jul 2012 12:19:04 -0700, John Larkin
><(E-Mail Removed)> 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.


 
Reply With Quote
 
me@linnix.info-for.us
Guest
Posts: n/a
 
      07-07-2012, 11:00 PM
On Saturday, July 7, 2012 3:58:39 PM UTC-7, Phil Hobbs wrote:
> Stephen Pelc wrote:
> >
> > On Sat, 07 Jul 2012 12:19:04 -0700, John Larkin
> > <(E-Mail Removed)> 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

>
> I'm a big fan of Putty for this sort of job.
>


Putty has the same issue. It's a window problem.

 
Reply With Quote
 
hamilton
Guest
Posts: n/a
 
      07-08-2012, 01:03 AM
On 7/7/2012 5:00 PM, John Larkin wrote:
> On Sat, 07 Jul 2012 22:38:23 GMT, (E-Mail Removed) (Stephen
> Pelc) wrote:
>
>> On Sat, 07 Jul 2012 12:19:04 -0700, John Larkin
>> <(E-Mail Removed)> 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.
>
>


There is NO program on ANY operating system that can survive a USB
serial port disconnect.

I have tried many, wrote some of my own.

Windoze, Linux, CE, none can survive without a program restart.

hamilton
 
Reply With Quote
 
Michael Karas
Guest
Posts: n/a
 
      07-08-2012, 01:53 AM
[This followup was posted to sci.electronics.design and a copy was sent
to the cited author.]

In article <(E-Mail Removed)>,
(E-Mail Removed) says...
>
> 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?


This is an annoying and complex problem that, as far as I know, does not
yet have a good solution from the operating system standpoint. I am not
totally sure what the root of the problem is but it could very well be
related to the type of combo drivers that are used to support USB/COMM
port type devices.

At the company where I work we had the very same problem as you have
described with a USB port connected into an external box where the USB
terminated into a 1->4 USB hub and then into an FT232R chip that then
went TTL serial port to a SiLabs MCU. The fix that was used was to
compose the host side program as multiple threads where the thread that
managed the "virtual serial COM port out USB" could be unloaded and
restarted from another monitoring thread. The monitoring thread kept an
ongoing heartbeat packet sent to the external device whenever there was
no normal serial traffic going on. If the serial traffic, either normal
or the heartbeat type, ever encountered an error due to sudden removal
of the USB cable the monitoring thread would unload the thread that
owned the crashed virtual comm port. It would then use some API calls
that are available to automate the same things you do in device manager
to to disable/enable the port. Then finally it could reload the thread
that managed the Comm port whilst it waited for the device to reappear
as connected.

Needless to say this was a complex solution to make the usage model of
the software a whole lot more user friendly. Without that the use of USB
Serial devices basically sucks if you suddenly unplug the USB cable
whilst it is in use.

Michael Karas


--

Michael Karas
Carousel Design Solutions
http://www.carousel-design.com
 
Reply With Quote
 
John Larkin
Guest
Posts: n/a
 
      07-08-2012, 02:12 AM
On Sat, 07 Jul 2012 19:03:57 -0600, hamilton <(E-Mail Removed)>
wrote:

>On 7/7/2012 5:00 PM, John Larkin wrote:
>> On Sat, 07 Jul 2012 22:38:23 GMT, (E-Mail Removed) (Stephen
>> Pelc) wrote:
>>
>>> On Sat, 07 Jul 2012 12:19:04 -0700, John Larkin
>>> <(E-Mail Removed)> 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.
>>
>>

>
>There is NO program on ANY operating system that can survive a USB
>serial port disconnect.
>
>I have tried many, wrote some of my own.
>
>Windoze, Linux, CE, none can survive without a program restart.
>
>hamilton


Going into Device Manager and disabling/enabling the port fixes the
hangup. Maybe there is a command-line equivalent. If so, I could shell
out to that.

This maybe?

http://support.microsoft.com/kb/311272



 
Reply With Quote
 
Paul
Guest
Posts: n/a
 
      07-08-2012, 02:25 AM
In article <jtama2$9s1$(E-Mail Removed)>, (E-Mail Removed) says...
>
> On 7/7/2012 5:00 PM, John Larkin wrote:
> > On Sat, 07 Jul 2012 22:38:23 GMT, (E-Mail Removed) (Stephen
> > Pelc) wrote:
> >
> >> On Sat, 07 Jul 2012 12:19:04 -0700, John Larkin
> >> <(E-Mail Removed)> 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.
> >
> >

>
> There is NO program on ANY operating system that can survive a USB
> serial port disconnect.
>
> I have tried many, wrote some of my own.
>
> Windoze, Linux, CE, none can survive without a program restart.
>
> hamilton


Writing your own serial emulator talking to the device driver meant for
a USB serial chip can help SOMETIMES.

Otherwise checking handles, and device drivers before nearly every call
or putting timeouts on serial port transactions can help. Make sure you
have a tiemout handler to close and open device.

Timeouts have existed on most serial ports and printer ports on most
operating systems for a long time. How well they work depends on the
operating system and its drivers as well as the USB driver.

Some drivers have a call to cycle the device from the driver, which
might help depending on how well written the driver is.

--
Paul Carpenter | (E-Mail Removed)
<http://www.pcserviceselectronics.co.uk/> PC Services
<http://www.pcserviceselectronics.co.uk/fonts/> Timing Diagram Font
<http://www.gnuh8.org.uk/> GNU H8 - compiler & Renesas H8/H8S/H8 Tiny
<http://www.badweb.org.uk/> For those web sites you hate
 
Reply With Quote
 
Martin Riddle
Guest
Posts: n/a
 
      07-08-2012, 02:58 AM

"John Larkin" <(E-Mail Removed)> wrote in
message news:(E-Mail Removed)...
>
>
> 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?
>
>
>


I have a similar problem with a Microchip USB stack. It's not serial
emulation.
If the device is unplugged the calls on the host may hang, and the whole
host controller is hung.
Windows will not shutdown, and is stuck on the USB hung call.
The multithreaded routine that Mike explains seem to be the only
solution.
You could do a 'try' 'catch', but if there is no exception thrown then
it's useless.

Cheers



 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
USB Composite LPC1768 CDC DSTWRT Embedded 0 08-30-2011 12:17 AM
LPC1768 EXT0 interrupt huge lag navman Embedded 14 07-08-2011 12:13 PM
LPC1768 copy & execute isr from sram navman Embedded 2 07-05-2011 08:13 PM
pulse counter using LPC1768 proving to very challenging navman Embedded 50 06-22-2011 12:30 PM
ARM LPC1768 Cortex M3 Project taharehman Embedded 4 02-17-2011 02:27 AM


All times are GMT. The time now is 07:06 AM.


Welcome!
Welcome to Motherboard Point
 

Advertisment