This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to detect if USB device is connected?

Does anyone know how I can detect if my USB device is connected to a Host or not?

Thx
Steven

Parents
  • > Well if monitoring VBUS is problematic, you can monitor Start Of Frame interrupts, only potential problem is that if host puts your device into suspend mode SOF will not be generated during suspended bus.

    Unfortunately, "SOF interrupt" is not an indication of bus connection in many USB MCUs.
    In such USB engine, "SOF interrupt" is internally generated by counter, synchronized to bus SOF timing (digital PLL). Even while no bus SOF appears, SOF interrupt generation continues. This mechanism is so-called "SOF recovery", to keep track over missing SOF on the bus, which is essential for USB audio/video implementation.

    STM32F2xx/4xx is such a device.

    Tsuneo

Reply
  • > Well if monitoring VBUS is problematic, you can monitor Start Of Frame interrupts, only potential problem is that if host puts your device into suspend mode SOF will not be generated during suspended bus.

    Unfortunately, "SOF interrupt" is not an indication of bus connection in many USB MCUs.
    In such USB engine, "SOF interrupt" is internally generated by counter, synchronized to bus SOF timing (digital PLL). Even while no bus SOF appears, SOF interrupt generation continues. This mechanism is so-called "SOF recovery", to keep track over missing SOF on the bus, which is essential for USB audio/video implementation.

    STM32F2xx/4xx is such a device.

    Tsuneo

Children