USB CDC device not always recognised after soft reset

Go To Last Post
7 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am having an issue with a USB device that uses the ASF CDC framework running on an XMEGA 128A3U.

When the AVR is soft reset, for example by updating the firmware or the MCU resetting itself, it is not always recognised by the computer afterwards. I don't get any error messages but I can't open the COM port and the USB device itself seems to be disconnected (the PC can't see it), even though it is physically connected. Physically unplugging and re-connecting fixes the problem.

I have had issues like this in the past with USB when devices don't do a proper disconnect. I tried forcing a disconnect via udd_detach/udd_attach for 250ms and made sure the pull-ups were disabled, but it doesn't seem to help.

I am using Windows 7 x64 and XP x86. Tried a couple of different PCs. It could just be Windows handling of CDC devices.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
It could just be Windows handling of CDC devices.

It is. Especially disconnecting the USB device while a program has still that port open is problematic. Without reinstalling the USB device you can never reopen the port until the next reboot (at least on my machine).

This behaviour of the standard usbser.sys driver is the reason manufacturers like FTDI supply their own drivers.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The software I am using (Terminal by Br@y and my own custom written code) does close the COM port when not in use. The MCU is reset while the COM port is closed.

The result can be rather strange. If I watch Device Manager often the COM port stays there for a minute or two afterwards, but eventually disappears. During that time my software can find the device by VID/PID pair but cannot open the COM port, and Terminal just freezes.

It looks like Windows is not registering that the device has been disconnected properly, and not registering its re-connection either. Removing the USB plug makes it notice instantly.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What I'd love is an alternative USBSER.SYS that keeps the COM port visible regardless whether the USB device is connected. Especially during development it saves a tremendous amount of open/closing Putty.

They seem to exist, but so far found nothing :(

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Did you try a Linux Host ;-)

-sb

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

No, and I won't :P

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The main attraction with Terminal is that it has an auto connect/disconnect mode for development. When you focus the window it connects, when you switch to something else it disconnects.

No need to close the session all the time. Makes development much easier, except that sometimes it locks up due to the problem I originally described.