cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L4 - USB - Sporadic Stall (-EPIPE) when reading control-endpoint.

stst9180
Associate III

Dear list,

I'm currently developing an USB-Audio composite device with the help of an stm32L4.

As composite is not really supported in the cube firmware, I have adopted the stack to support that meanwhile.

The device consists of an virtual com-port and 2 audio devices.

Everything is recognized well and is also basically working the most time.

Unfortunately there is one single problem left which seems to be a timing issue somehow:

Sometimes when doing a EP0-IN transfer because of a descriptor read or a audio-ctrl read (e.g. reading the frequency of the clock unit), I see an endpoint-stall status (-EPIPE) on wireshark although the corresponding data is appended in the packet. Yes: There is a packet with a -EPIPE status but containing the data requested.

I don't have any clue where this could originate from, as all breakpoints that I try to generate examining the STALL (e.g. where it is set) do not come true.

So may that be something in the core?

Is there any further Idea where / what to examine where this single stall status could come from although "USBD_CtlError" is not hit?

I see that a stall condition is also set on end of a successfull transfer of the data-in endpoint and is reset on a new Setup-Packet. But as the whole stack seems to be interrupt-based (from the same interrupt source), I'm wondering who could interfere here.

I just added one dissected trace which shows the problem:

Here you can see 2 tries to get the Manufacturer-String-Descriptor.

The 1st one fails, the 2nd one come true although this is completely the same request.

The same happens for other control-in transfers.

Maybe s.o. has some ideas how to debug this further. If one needs further information (code-parts, descriptors, wireshark-dissections) pleas contact me.. I just didn't want to flood the board.

Thanks in advance.

Best Regards

Pascal

14 REPLIES 14

Do you have more such captures of STALLed transfers?

JW

stst9180
Associate III

NZLSOHSK is not set, even in errornous situation.

I could do some more captures (e.g. of errornous device-descriptor reads) soon, but then i first need to rework the triggering of my LA to trigger on some other errors.. I'll try later.

I'm with you that tracking the writes to the DOEPCTRL would be worth a try.

stst9180
Associate III

BTW Thank you very much for your quick answers and exhaustive help!

Piranha
Chief II

> As composite is not really supported in the cube firmware, I have adopted the stack to support that meanwhile.

Take a look on TinyUSB. It supports composite devices and it is not a broken bloatware with everything processed in interrupts like in ST's one. And in a long term it is probably a much better investment of effort, because the community is very active and you can push your improvements upstream.

stst9180
Associate III

@Piranha​ : I just have had a look at the tinyusb stack and gave it a first try.

Unfortunately it does not support HOST-Mode for stm32L4 which is also needed on this device ( currently the mode is switched on startup ), So I would still need the stm32-host-stack in parallel.. I currently don't know if this can be achieved easily.

Imho it would also be a bigger deal to get this running :(