cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F303 Custom HID out report problem. MCU always stops receiving out reports after transmitting two IN reports

SKape
Associate II

Project based on STM32F303 generated from CubeIDE 1.10.1 using HAL 1.11.3 library. The project was made according to the ST example. IN enpoint with a report of 64 bytes. OUT endpoint also with 64 byte report.

I can send any number of IN or OUT reports separately. Then everything works without problems.

But when I want to send reports back and forth, every time I send two IN reports, I stop receiving OUT reports. IN reports then continue to work correctly.

Only restarting the microcontroller helps.

I think there is a bug in the USB library.

Has anyone managed to solve this problem?

5 REPLIES 5
SKape
Associate II

I found a solution to the problem.

There is a bug in the USB library for the F3 family. It has not been updated since 2019.

This error does not occur for the F1 family. I compared both libraries and found a problem in the interrupt handling in the file stm32fxxx_hal_pdc.c

On the left is the code for stm32f103 and on the right is for stm32f303. Just replace this part and the problem disappears.

0693W00000YAZzFQAX.png

Imen.D
ST Employee

Hello @Sławomir Kapelko​ and welcome to the Community :)

Thanks for sharing the issue and the solution.

I will check this and come back to you soon.

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
Imen.D
ST Employee

Hi @Sławomir Kapelko​ ,

You are using a quite old HAL for STM32F3. The fix was already published to allow multi packet sending. The fix was pushed in USB branch since June 2021, on top of that we also add another fix to allow multi packet sending.

When your question is answered, please close this topic by choosing Select as Best. This will help other users find that answer faster.

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
SKape
Associate II

Hi @Imen DAHMEN​

I generated the project again from the new version from the STMCubeIDE software version 1.11.2 and the libraries STM32CubeF3 Firmware Package V1.11.3 /23-July-2021 and the problem still exists.

Why has the file stm32fxxx_hal_pdc.c not changed since the library has been corrected?