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

About identifying the USB device plugged into the PC or power bank or adapter

Hi,

I am using NRF52833 to develop a wireless and USB combo mouse.

My switch method is detecting VBUS to switch between USB mode or wireless mode.

But a problem is if I plug in power bank or adapter, the mouse will switch to USB mode. And I need to stay in wireless mode. 

I have read this, and realize the VBUS can't solve this problem.

Is there any USB API about D+ and D- or SOF probably can solve?

Best Regards

Parents Reply
  • As an addition to this answer, you can also check using the function "app_usbd_core_state_get()", which will return this enum:

    typedef enum
    {
        APP_USBD_STATE_Disabled  , /**< The whole USBD library is disabled */
        APP_USBD_STATE_Unattached, /**< Device is currently not connected to the host */
        APP_USBD_STATE_Powered   , /**< Device is connected to the host but has not been enumerated */
        APP_USBD_STATE_Default   , /**< USB Reset condition detected, waiting for the address */
        APP_USBD_STATE_Addressed , /**< Device has been addressed but has not been configured */
        APP_USBD_STATE_Configured, /**< Device is addressed and configured */
    }app_usbd_state_t;

     

    Kind regards,

    Håkon

Children
Related