cancel
Showing results for 
Search instead for 
Did you mean: 

USB HID Blocking write with UM1021 code

charlieincanada69
Associate II
Posted on June 26, 2014 at 22:48

Hi All,

I'm running a USB HID device on a STM32F207ZG IAR dev board. Details:

 * HS OTG port in use (not host)

 * Using the STM32 OTG core:

  * No DMA

  * Device Mode

  * Embedded Phy (operating at FS)

All is working fine - it is enumerating and transferring data. However...

I am finding that when I call the transmit routine for the device section of the library - DCD_EP_Tx() - it blocks (spins the processor) until the data has been transmitted on the bus.

I'm running an RTOS and I hoped (expected!?!) that this would be a non blocking call. I assumed that the DataIn callback specified by the library would run under interrupt when the data transfer has completed (which could thne populate a semaphore).

Has anyone else used this lib? Anyone else experienced blocking writes?

Interested in any help!!

Thanks,

Charlie

#um1021 #usb-hid
1 REPLY 1
charlieincanada69
Associate II
Posted on June 27, 2014 at 19:38

Replying to my own post :)

So it turns out that the performance of the ST supplied USB OTG core lib (documented in UM1021) in the following mode...

  • High Speed Core ID

  • Embedded Phy

  • Device Mode

  • No DMA enabled

... is really slow. The ''blocking write'' I was experiencing was in fact slow performance. I fixed a few things within the ST lib (calling functions through pointers without checking for NULLs first etc etc) then configured it to use DMA. Everything now works as you would expect it too.

The moral of the story is: if using the High Speed Core ID from ST, make sure you enable DMA.