USB OTG CDC Device busy when trying to send
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2016-09-17 6:15 AM
Posted on September 17, 2016 at 15:15
hey guys,
so I am using an STM32F411 as an USB device. It's connected via VCOM to a PC. I am using HAL V2.4.1 from19-June-2 In general it works good, but when I quickly connect and disconnect the usb plug on the device for a few times in a row and then re-connect with my terminal PC tool the device is no longer sending data becauseUSBD_CDC_TransmitPacket
returnsUSBD_BUSY only!
I have no idea how handle this case. Should I somehow reset the USB driver? Is this an indication that s/t is messed up with my implementation? Why is it busy? What can cause such a state?
Any help is appreciated. Let me know if you need more information on this.
This discussion is locked. Please start a new topic to ask your question.
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2016-10-26 3:23 AM
Posted on October 26, 2016 at 12:23
Hi moll.benjamin,
If you want to know if you have a device is either connected or disconnected, use can a global variable inside both HAL_PCD_ConnectCallback() and HAL_PCD_DisconnectCallback().If USBD_LL_DevConnected status is USBD_OK you should change the value of the global variable to 1 (or whatever you prefer). You should write the code to update this global variable into every related callbacks.HAL_PCD_CconnectCallback() is called inside HAL_PCD_IRQHandler() (stm32fxx_hal_pcd.c), by GOTGINT.SEDET (session end detected) interrupt
.To ensure this interrupt is fired you need the following requirement:
- VBUS (PA9) pin should be connected to VBUS (5V) pin of the USB connector (for OTG_HS on on-chip FS PHY, VBUS (PB13) pin)
- Enable the Vbus sensing (vbus_sensing_enable is 'ENABLE'd in USBD_LL_Init() )
-Hannibal-
