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

APP_USBD_EVT_POWER_READY is not triggered properly when USB is connected after initizalization

We're using nRF52840 with S140 SoftDevice (version 7.0.1) and 16.0.0 SDK. When USB cable is connected before USB initialization we receive correctly APP_USBD_EVT_POWER_READY event, but when we start our device and later connect USB cable event APP_USBD_EVT_POWER_READY is not triggered. What should we check in our application?

Parents
  • The event APP_USBD_EVT_POWER_READY should trigger when you power up the VBUS pin. Is this on a custom board? How do you handle the VBUS pin?

  • Yes, it is connected to USB connector. Diagrams below.


  • Hello,

    Let us look at this from a SW point of view, then:

    the APP_USBD_EVT_POWER_READY event is generated in app_usbd.c:

            case NRF_DRV_POWER_USB_EVT_READY:
            {
                static const app_usbd_internal_evt_t ev = {
                    .type = APP_USBD_EVT_POWER_READY
                };
                app_usbd_event_add(&ev);
                break;

    And the NRF_DRV_POWER_USB_EVT_READY is generated if "APP_USBD_CONFIG_POWER_EVENTS_PROCESS" is defined as 1 in sdk_config.h, and USBD_POWER_DETECTION needs to be set to true somewhere in your project, like it is e.g. in the usbd_cdc_acm example project.

    So in your project:

    1. is APP_USBD_CONFIG_POWER_EVENTS_PROCESS set to 1 in sdk_config.h?

    2. is USBD_POWER_DETECTION set to true?

    3. is app_usbd_power_events_enable() called? If so, does it return NRF_SUCCESS?

    4. is the app_usbd_power_event_handler() in app_usbd.c called with the NRF_DRV_POWER_USB_EVT_READY event?

    5. if all of the above is set correctly, is the APP_USBD_EVT_POWER_READY event generated?

    Best regards,

    Edvin

Reply
  • Hello,

    Let us look at this from a SW point of view, then:

    the APP_USBD_EVT_POWER_READY event is generated in app_usbd.c:

            case NRF_DRV_POWER_USB_EVT_READY:
            {
                static const app_usbd_internal_evt_t ev = {
                    .type = APP_USBD_EVT_POWER_READY
                };
                app_usbd_event_add(&ev);
                break;

    And the NRF_DRV_POWER_USB_EVT_READY is generated if "APP_USBD_CONFIG_POWER_EVENTS_PROCESS" is defined as 1 in sdk_config.h, and USBD_POWER_DETECTION needs to be set to true somewhere in your project, like it is e.g. in the usbd_cdc_acm example project.

    So in your project:

    1. is APP_USBD_CONFIG_POWER_EVENTS_PROCESS set to 1 in sdk_config.h?

    2. is USBD_POWER_DETECTION set to true?

    3. is app_usbd_power_events_enable() called? If so, does it return NRF_SUCCESS?

    4. is the app_usbd_power_event_handler() in app_usbd.c called with the NRF_DRV_POWER_USB_EVT_READY event?

    5. if all of the above is set correctly, is the APP_USBD_EVT_POWER_READY event generated?

    Best regards,

    Edvin

Children
No Data
Related