AnsweredAssumed Answered

STM32F4 USB Polling interval

Question asked by mmax on Jun 22, 2016

Hello,


Using the  processorSTMF401VETx I generate the project with  STM Cube:

     STMCube Mx version4.12.0

     library STM32CubeFW_F4 v.1.10.0

 

I used the midlewarelibraries included in the framework to develop a USB HID device.

 

A little descriptionof my system:

 

USB  Custom HID.

In the custom HIDpart the maximun packet size is 64Bytes (report id included) definedusing this constants.

 

#defineCUSTOM_HID_EPIN_SIZE                    0x40

 

#defineCUSTOM_HID_EPOUT_SIZE                0x40

 

In the DeviceConfiguration Description the polling interval for the input and alsofor the output interval are set by defautl with 32ms.

 

It has an input andan output report both of them with 10 bytes lenght.

 

The device shouldsend every 10ms a status report (10 bytes).

 

The output reportsare received in interrupt mode.

 

Device comunicatewith a Windows' application that I have develop or with with a thirdparty, using the HID interface.

 

In that situation myapplication works fine but the third party application has a sloweddown behaviour.

 

Here is my problem:If I set the interrupt polling init with a value lower than 32ms theWindows' app work with a normal speed for a limited period and thenget totally hanged. In this situation the device is still working andit continues sending its state report but it can not receiveanything. When the Windows'  application is blocked if I unplug andplug the device, the application recover its normal state until itgets blocked again like the firts time.

 

Endpoint Descriptor 81 1 In, Interrupt, 32 ms

                        </colgroup>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

 

EndpointDescriptor 01 1 Out, Interrupt, 32 ms

           

Offset

           
           

Field

           
           

Size

           
           

Value

           
           

Description

           
           

0

           
           

bLength

           
           

1

           
           

07h

           
           

1

           
           

bDescriptorType

           
           

1

           
           

05h

           
           

Endpoint

           
           

2

           
           

bEndpointAddress

           
           

1

           
           

81h

           
           

1 In

           
           

3

           
           

bmAttributes

           
           

1

           
           

03h

           
           

Interrupt

           
           

1..0: Transfer Type

           
           

......11 

           
           

Interrupt

           
           

7..2: Reserved

           
           

000000.. 

           
           

4

           
           

wMaxPacketSize

           
           

2

           
           

0040h

           
           

64 bytes

           
           

6

           
           

bInterval

           
           

1

           
           

20h

           
           

32 ms

           
                        </colgroup>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

 

 

First i tried tomake smaller the MaxPacketSize in both endpoints, but the problesstill remains.

 

Then I searched inthe FW release notes for possibly fixes issues and I found this fixederror in version 4.13 release

343224 [USB CDC] usb_cdc_if.c receive function needs update to detectreceived packets

 

But after porting myprojecto to the newest version

     STM Cube Mxversione 4.15.1

     library STM32CubeFW_F4 v.1.12.0

the problem stillpersists, so it does not refer to this problem

Kind Regards
Max

           

Offset

           
           

Field

           
           

Size

           
           

Value

           
           

Description

           
           

0

           
           

bLength

           
           

1

           
           

07h

           
           

1

           
           

bDescriptorType

           
           

1

           
           

05h

           
           

Endpoint

           
           

2

           
           

bEndpointAddress

           
           

1

           
           

01h

           
           

1 Out

           
           

3

           
           

bmAttributes

           
           

1

           
           

03h

           
           

Interrupt

           
           

1..0: Transfer Type

           
           

......11 

           
           

Interrupt

           
           

7..2: Reserved

           
           

000000.. 

           
           

4

           
           

wMaxPacketSize

           
           

2

           
           

0040h

           
           

64 bytes

           
           

6

           
           

bInterval

           
           

1

           
           

20h

           
           

32 ms

           

Outcomes