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

nRF52840: Enable/disable usbd generic hid endpoints using app_usbd_ep_disable/app_usbd_ep_enable

Hello Nordic experts,

I am trying to use app_usbd_ep_enable and app_usbd_ep_disable in order to enable/disable an endpoint. I need this to fake usb unplug/re-plug. Currently, I use app_usbd_stop and app_usbd_start and they work fine, but this actually stops the whole USB. I just want to stop/restart one endpoint.

I am working on nRF52840 USB Dongle with nRF5_SDK_15.0.0_a53641a. I am using example usbd_hid_generic and just added an output endpoint to the HID generic. 

When I call app_usbd_ep_disable, I can see the following error on a USB monitoring tool. After that, the endpoint does not work even by calling app_usbd_ep_enable.

USTS c0000011 xact error.

Thanks

  • Wrong method. Disabling EPs requires driver support in the PC - which is not available in the default hid driver.

    A simple disconnect can be triggered by writing a zero in the USBPULLUP register - disconnecting the pullup resistor on D+. From the host side this look excactly like a disconnected port.

  • Thanks for your comment. So, that's why it does not work. However, I am looking for a way to just disconnect/connect a particular endpoint with no distraction to others.

  • That is not really possible unless the interface in question supports that in another way (e.g. "removable" USB Mass storage device).