cancel
Showing results for 
Search instead for 
Did you mean: 

STM32WB55 USB CDC Transmit always return USBD_BUSY

LHans.2
Associate II

I have setup USB connectivity between the STM32WB55 Nucleo board and my pc.

As I connect to the board, my application sends some data and the board response accordingly. I can send another command to start the application running on the hardware, which should return some calculated results to the pc. But as soon as I send this command, the ((USBD_CDC_HandleTypeDef*)hUsbDevice_struct.pClassData)->TxState will always return 1 and not reset to 0. I'm using the Windows 10 VCP driver that gets installed as soon as you plug the board into to the pc.

None of the calculated results ever reach the host, which is weird because the commands I send when connecting to the target get a response from the board. Sometimes a couples bytes reach the pc, but most of the times 0 bytes are received by the host.

I use the CDC_Transmit_FS function that gets generated when you configure USB in the CubeMX. The TxState should get reset after the transmission happened by the USBD_CDC_DataIn function in the usbd_cdc.c file.

1 ACCEPTED SOLUTION

Accepted Solutions
LHans.2
Associate II

I indeed set the interrupt priority wrong.

View solution in original post

2 REPLIES 2
gbm
Lead III

And of course you call Transmit from the interrupt routine of the same priority as the USB interrupt, right? Otherwise it must hang sooner or later.

My STM32 stuff on github - compact USB device stack and more: https://github.com/gbm-ii/gbmUSBdevice
LHans.2
Associate II

I indeed set the interrupt priority wrong.