This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

USB data detection

Hello,

My device is a USB HID peripheral connected to a PC. There is a case when the PC is turned off, but USB power is present. I want to detect this situation.

At the moment I use APP_USBD_EVT_DRV_SOF event as an indicator that the data line is active. Basically if there is no event for some time, it means that the data line is not active and thus the PC is turned off.  But I feel that this approach is not very reliable, as I had several cases where I didn't receive an event for 2 seconds. I could not reproduce these cases though.

Please advice me if there other ways to detect absence of activity on USB data line. 

Related