Skip to main content
frackers
Senior
June 26, 2017
Question

Bug in USB CDC Class Init/Deinit

  • June 26, 2017
  • 1 reply
  • 1065 views
Posted on June 26, 2017 at 04:04

I plug in my CubeMX generated USB CDC class implementation into a PC host and CDC_Init_FS gets called as expected

When I unplug, I expect that CDC_DeInit_FS be called so I can take the link down but it doesn't.

When I plug in for a second time, CDC_DeInit_FS DOES get called and the CDC device fails to enumerate on the host. Again, when I unplug, no Init or DeInit calls.

All other aspects (transmit and receive of data) operate correctly, its just that my device needs to know if its connected and at present I can't get that information.

I'm using CubeMX 4.21.0 and HAL STM32Cube FW_F3 V1.8.0

    This topic has been closed for replies.

    1 reply

    frackers
    frackersAuthor
    Senior
    June 26, 2017
    Posted on June 26, 2017 at 06:17

    Can someone confirm that the connect/disconnect callbacks are only implemented on the OTG block used by the F4 series as I can't find anywhere on the F3 where HAL_PCD_ConnectCallback & HAL_PCD_DisconnectCallback are hooked.

    If that is the case I'm buggered!

    Technical Moderator
    June 28, 2017
    Posted on June 28, 2017 at 12:12

    Hi

    Gilks.Robin

    ,

    Please note that Connect and Disconnect

    PCD

    callback are not used in PCD IRQ handler is not an issue.

    This is because there is no ISRs to manage connection and disconnection in the USB version available in F3 product (unlike F4 for example). For F3 products and others products which integrate the same USB version, you need to use a GPIO and monitor Vbus.

    Regards

    Imen

    In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Thanks