Question on USB CDC

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

Hello,

I am experiencing a problem related with CDC communications on a XMega-64A33U.

My board is connected, through a hub, to a PC. On the same hub I also have an USB camera. Recently we upgraded to a faster camera, and started having problems.

Analysing USB traffic with USBlyzer, I discovered that my board sends to the PC a message circa each ms, even if the board has nothing to send and if the virtual port is closed on the PC side.

In short, these packets disrupt the operations of the camera.

I fear that the behaviour is not related with ASF or XMega, but with the nature of CDC itself. According to what I read, these are periodical requests from the PC, because there is no other way to know if the CDC device has something to send.

Now I would like to know:

1) can you confirm that this is really a CDC-related behaviour?
2) if there is a way to reduce the polling frequency?
3) if not, can you suggest a workaround?

I understand the best solution is "use a dedicated port", but at the moment this is not possible.

Thanks

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

IIRC that's perfectly normal USB behaviour, not even CDC specific.

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

I see... do I have any control on the PC poll ratio?

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

AFAIK the 1ms framing is at the core of USB. But surely the whole point of the hub is to isolate the host from activity of the individual devices. If it's not doing that I'd may try a different hub.

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

Ok, thank you both for your suggestions.
Now it is more clear what my customer said ("it happens only with some hubs and some PCs")

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

The polling interval is part of the endpoint descriptor sent during enumeration and you could certainly try changing it. The parameter is usually called "bInterval", search the source for that or "endpoint".

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

That's only for control and interrupt type endpoints. Not bulk or isochronous.

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

You could try making your device a low speed device. Technically CDC devices must be full speed, but most operating systems don't care. The maximum polling frequency for low speed devices is 10ms.

Interesting I have observed with a full speed CDC device that the maximum update rate of the virtual serial port is 15ms. That is, if I set a line on the virtual port it will take up to 15ms for a Windows application to see it.

Is the camera a high speed device? Better hubs will prevent full speed devices interfering with high speed devices.

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

Hi mojo-chan, I already took into consideration passing to low speed. Unfortunately, ASF USB stack does not support LS for CDC.
Maybe LUFA can do the work, but in this case I should modify the firmware, and my customer redo all the qualification tests.

No idea about the camera, but I suppose is HS.

I already suggested my customer to carefully select a good-quality hub, or to move on a dedicated USB port.

Thanks for the good suggestion anyway

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

kalbun wrote:
Unfortunately, ASF USB stack does not support LS for CDC.

Just poke the bit in the USB control register :-)

You could also try sending NACKs during timing critical code. The USB peripheral supports doing that with no load on the CPU.