cancel
Showing results for 
Search instead for 
Did you mean: 

I found a bug in the stm32WB usb library. After sending an HID message once, the usb will send empty messages indefinitely, which cannot be stopped, and even affects data reception.

ZZh.1
Associate

0693W000008z5EbQAI.pngThis is the data I grabbed with bushound. As shown in the picture, when I send data through HID once, the USB will send empty data packets indefinitely, and subsequent data packets will cause the transmission to be stuck and repeated. I tested the USB driver I designed and the HID sample program of FW_WB_V1.11.0, both of which are the same phenomenon. Through jtag debugging, it is found that after sending data, the register USB_EPnR will repeatedly change between 0x3673 and 0x7633. This is the proof that USB is sending data cyclically, but I can’t find a way to stop or solve it.

And this kind of problem has never appeared in the USB debugging of STM32F4.

1 ACCEPTED SOLUTION

Accepted Solutions

Hello @ZZh.1​ ,

For the mentioned behavior, the problem is fixed and it will be available in the next version FW_WB_V1.12.0

Here’s the fix : on the file stm32wbxx_hal_pcd.c incomplete condition for the IT handler with interrupt transfers.

Line 1854:

the condition should be :

if ((ep->type == EP_TYPE_INTR) || (ep->type == EP_TYPE_CTRL) ||

            ((ep->type == EP_TYPE_BULK) && ((wEPVal & USB_EP_KIND) == 0U)))

Instead of :

if ((ep->type == EP_TYPE_BULK) && ((wEPVal & USB_EP_KIND) == 0U))

Thanks for your contribution and feel free to raise any issue or feedback.

You're always welcome.

BeST Regards,

Walid

View solution in original post

2 REPLIES 2

Hello @ZZh.1​ ,

Thanks for your contribution.

We confirm the point and we are working on it. We will give you an update as soon as possible.

BeST Regards,

Walid

Hello @ZZh.1​ ,

For the mentioned behavior, the problem is fixed and it will be available in the next version FW_WB_V1.12.0

Here’s the fix : on the file stm32wbxx_hal_pcd.c incomplete condition for the IT handler with interrupt transfers.

Line 1854:

the condition should be :

if ((ep->type == EP_TYPE_INTR) || (ep->type == EP_TYPE_CTRL) ||

            ((ep->type == EP_TYPE_BULK) && ((wEPVal & USB_EP_KIND) == 0U)))

Instead of :

if ((ep->type == EP_TYPE_BULK) && ((wEPVal & USB_EP_KIND) == 0U))

Thanks for your contribution and feel free to raise any issue or feedback.

You're always welcome.

BeST Regards,

Walid