View previous topic :: View next topic |
Author |
Message |
javick82
Joined: 12 Jul 2007 Posts: 43
|
Sustaining USB Connection - CDC Implementation |
Posted: Wed Jun 08, 2011 11:59 am |
|
|
I have seen a couple of posts about this but from what I can tell, no good solutions.
I am sending data back and forth via USB intermittently - a quick handshake and response:
PC sends 8 bytes
FW responds with 2 bytes (handshake)
FW does something
FW responds with 2 bytes (response)
After 30 minutes or so, the handshakes stop. However, the firmware is still running. A couple of the posts I saw alluded to a buffer issue in the CDC implementation. Has anyone else come across this problem? If so, what did you do to resolve it?
Thanks and I appreciate the information.
Jason |
|
![](templates/subSilver/images/spacer.gif) |
vinniewryan
Joined: 29 Jul 2009 Posts: 154 Location: at work
|
|
Posted: Wed Jun 08, 2011 1:31 pm |
|
|
can you check/ clear the buffer? What device are you using? _________________ Vinnie Ryan |
|
![](templates/subSilver/images/spacer.gif) |
javick82
Joined: 12 Jul 2007 Posts: 43
|
|
Posted: Wed Jun 08, 2011 1:38 pm |
|
|
I am on a PIC18F2550.
I adapted my USB handling from the CDC example provided with the USB demo board. Everything works fine for about an hour, then just goes kaput. |
|
![](templates/subSilver/images/spacer.gif) |
javick82
Joined: 12 Jul 2007 Posts: 43
|
|
Posted: Wed Jun 08, 2011 2:38 pm |
|
|
OK, so I poked around in the examples a little more and found this comment:
Quote: | usb_task() must be called periodically in your main loop. If it is not called faster than once per millisecond, USB may not work (PIC18 and PIC24 only). |
I am running something that outputs some text every 1000 calls of usb_task() to make sure it happens quicker than one millisecond, which it does. Note that I have included a call to usb_task() before, but with no different results. Hopefully I will know something in about an hour. |
|
![](templates/subSilver/images/spacer.gif) |
javick82
Joined: 12 Jul 2007 Posts: 43
|
|
Posted: Wed Jun 08, 2011 3:12 pm |
|
|
20 minutes later (actually 18), communication ceased.
I am going to try a couple more things to see if there is something in the usb_cdc driver that will help diagnose the issue at hand. |
|
![](templates/subSilver/images/spacer.gif) |
javick82
Joined: 12 Jul 2007 Posts: 43
|
|
Posted: Thu Jun 09, 2011 5:37 pm |
|
|
Maybe some other info that would help...
My client program is written in C#. I am using the System.IO.Ports namespace to handle the data transfer on the PC side. All that happens when I get this connection issue is the port basically gets "lost", and it can no longer be talked to. However, the USB device (PIC) remains enumerated.
It seems that if I pull the USB plug and put it back in, the connection comes back most of the time, re-enumerating itself, without reinitializing USB nor any other fancy tricks.
I'll post my code tomorrow when I get back to work.
Could it be the CDC driver? |
|
![](templates/subSilver/images/spacer.gif) |
vinniewryan
Joined: 29 Jul 2009 Posts: 154 Location: at work
|
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19369
|
|
Posted: Fri Jun 10, 2011 4:51 am |
|
|
One thing not said, what USB chipset on the PC, and what OS?.
There have been a number of chipsets, with some USB oddities. One is one of the Intel chipset's, which if running under XP or Vista, can forget completely about an attached device, and stop polling it, yet still show it as enumerated.... On these installing the Intel drivers (older than the ones that come with Vista, supposedly only for XP), fixes the problem completely. W7 seems to have this fixed. Have seen some similar problems with the USB stack, on other systems.
So worth 'ruling this out', by trying a different computer, with a different motherboard chipset, and if this changes the problem start investigating whether alternative drivers exist....
Best Wishes |
|
![](templates/subSilver/images/spacer.gif) |
javick82
Joined: 12 Jul 2007 Posts: 43
|
|
Posted: Fri Jun 10, 2011 7:47 am |
|
|
Unfortunately, I am using Windows 7, but 64-bit.
My chipset is the Intel ICH10. |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19369
|
|
Posted: Fri Jun 10, 2011 8:43 am |
|
|
I would try another completely different system.
<http://www.maximumpc.com/forums/viewtopic.php?f=1&t=103046>
In this case the problem seems to be caused by the drivers for another component, causing a USB hang only affecting certain devices!...
You really need to rule this out by testing.
There are a couple of known issues with the ICH10, if you are powering the device off the USB (current available is below spec for example).
Best Wishes |
|
![](templates/subSilver/images/spacer.gif) |
javick82
Joined: 12 Jul 2007 Posts: 43
|
|
Posted: Fri Jun 10, 2011 12:34 pm |
|
|
I ran example 12 from the USB exercise book. On two different machines.
First - Windows 7 - 64 bit, Intel ICH10 USB controller
Second - Windows XP - 32 bit, Intel IC7 USB Controller
Sadly, I got the same result both times. I am working with my IS group to get a PCI USB port. |
|
![](templates/subSilver/images/spacer.gif) |
javick82
Joined: 12 Jul 2007 Posts: 43
|
|
Posted: Fri Jun 10, 2011 1:14 pm |
|
|
Another thought (moving away from PIC programming and into PC HW architecture and settings), but could there be something with the port powering down when the PC locks or idles or something? |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19369
|
|
Posted: Fri Jun 10, 2011 2:49 pm |
|
|
OK.
How big/what type is the capacitor on the Vusb pin?.
Commonest cause for a hang of this type is a problem with this. There was a fault on some chips with them requiring about twice the capacitance listed in the data sheet for reliability. I generally run a 1uF ceramic with 100% reliability. Anything under 0.47uF is 'worrying', and the capacitor must be something like a polyester or a ceramic. Electrolytic's are _not_ reliable here.
Best Wishes |
|
![](templates/subSilver/images/spacer.gif) |
javick82
Joined: 12 Jul 2007 Posts: 43
|
|
Posted: Fri Jun 10, 2011 3:00 pm |
|
|
0.47 µF ceramic cap.
I'll see if I can track down a 1 µF cap see if the issue comes up again. |
|
![](templates/subSilver/images/spacer.gif) |
javick82
Joined: 12 Jul 2007 Posts: 43
|
|
Posted: Fri Jun 10, 2011 4:43 pm |
|
|
Same issue, even with a 1 µF capacitor in place for VUSB. |
|
![](templates/subSilver/images/spacer.gif) |
|