AnsweredAssumed Answered

Yet another STM32F105/7 USB OTG driver issue (VCP device)

Question asked by anderson.shane on Nov 7, 2011
Latest reply on Sep 15, 2016 by Wood.Robert
Hello all,

I've taken the VCP example from the USB OTG Driver/Library v3.3.0 and incorporated it with my embedded application.  I've seen some strange latencies introduced in the app due to the USB interrupt, so I started instrumenting/timing the USB IRQ handler.  I see that most of the time the IRQ handler takes about 4.5uS to execute, with a maximum time of 24uS or so.  Not too shabby, but that didn't explain my weird latencies.  Then I looked at how many IRQs happen per second:

When idle I get 1000 IRQs per second, as expected (the SOF IRQ).
When transmitting about 200Kbytes/second I get about 32,000 IRQs per second!   This is where it gets odd.  I have a 64 byte EP packet size so I figure I should get about 4 IN EP IRQs per mS, which it turns out is basically correct.  This accounts for about 4K of those 32K interrupts.  The other 27-28K of interrupts are the transmit fifo empty interrupt, which based on the IRQ handler in usb_dcd_int.c should be cleared by the macro call: CLEAR_IN_EP_INTR(epnum, emptyintr).   Is this normal?  I guess I don't have a complete understanding of when these IRQs are supposed to happen in relation to each other.

One other note: I've seen the VCP driver not function through a USB hub, but work fine directly attached to a PC--is this a known bug/limitiation?

Thanks for any advice/assistance!

-sa

Outcomes