Keil Logo

MCBSTM32F400: USB disconnect detection fails

Information in this knowledgebase article applies to:

  • Keil MCBSTM32F200 and MCBSTM32F400 board


When a Keil MCBSTM32F200/400 board is used as a self-powered USB-Device, it will not be possible to detect a USB-disconnect from a USB-Host.


The Keil MCBSTM32F200/400 board has ESD protection devices (IC5 and IC8 USBCL6-4) connected to both USB interfaces. The VBUS pins of both USB interfaces are connected to the corresponding inputs of the STM32F207/407 (PA9) and the external USB PHY (IC6). The microcontroller and the external USB PHY can connect an internal 1,5K pull-up resistor to the D+ USB signal to signal a connect condition. This resistor is powered by the on-board power supply which is independent of USB VBUS.

When the board is disconnected from a USB host, the VUSB voltage usually drops to LOW and the microcontroller or external USB PHY can detect this condition. Unfortunately, this does not work on a MCBSTM32F200/400 board because the diodes of the ESD protection devices (IC5 and IC8) prevent that the VUSB voltage drops below the D+ voltage.


The ESD protection devices IC5 and IC8 can be removed or exchanged with a WE-TVS 824014 (Würth Elektronik) to avoid this issue.

When using Keil MDK middleware, the define USBD_VBUS_DETECT must be set in the file USBD_FS_STM32F2xx.c (USB full speed) or USBD_HS_STM32F2xx.c (USB high speed) (names for STM32F4xx accordingly) in order to enable VBUS sensing for self powered USB devices.


Last Reviewed: Friday, June 3, 2016

Did this article provide the answer you needed?
Not Sure
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.