Skip to main content
erik239955_st
Associate II
July 2, 2013
Question

Leave DFU Mode requires USB cable unplug

  • July 2, 2013
  • 1 reply
  • 714 views
Posted on July 02, 2013 at 16:20

I am having trouble leaving the DFU mode after programming a STM32F105.  The device has two USB modes:  DFU (via ROM bootloader) and HID Device (via application code).  The device can be programmed successfully and starts the application code correctly after the Leave DFU mode command, however the device does not automatically re-enumerate with the PC as a HID device.  The only way the PC will recognize the device is by un-plugging the USB cable and plugging it back in. 

Does anyone else have this issue?

#stm32-dfu-usb-dfuse-leave
This topic has been closed for replies.

1 reply

tsuneo
Associate II
July 2, 2013
Posted on July 02, 2013 at 18:23

Are you working on STM32_USB-Host-Device_Lib_V2.1.0?

At the entry of your ''application (HID)'' code,

1. disable USB interrupt,

  USB_OTG_DisableGlobalInt(&USB_OTG_dev);

and clear pending USB interrupts.

  USB_OTG_WRITE_REG32( &USB_OTG_dev.regs.GREGS->GINTSTS, 0xBFFFFFFF);

2. reset the USB core

  USB_OTG_CoreReset(&USB_OTG_dev);

3. wait for 200-300 ms before calling USBD_Init(), so that the host certainly recognizes disconnection.

Tsuneo