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

device initialization problems

Hi everyone,
I made a custom class composite device. The firmware seems to work except for one thing I can't fix.
If I initialize the USB in the following way:
If instead I initialize by doing:


the part relating to the custom class device works but other stop working.

Is there a way to make it all work at the same time?

BR
Parents
  • Hi,

    app_usbd_init() will internally call nrf_drv_usbd_init() with the library's own event handler. If you call nrf_drv_usbd_init() again outside of the library, the function will return an error code. 

    If you need to use both, you need to initialize the USBD driver outside of the app_usbd library and pass the events from the driver to the library yourself. I have not tested this, so I cannot comment on how easy it is to achieve and how well it will work. The handler you pass to the app_usbd config is for the library to send events back to the application, it is not related to the handler you pass to the driver, which pass events from the driver back to the application. app_usbd has its own internal handler where it receives events from the USBD driver.

    Best regards,
    Jørgen

Reply
  • Hi,

    app_usbd_init() will internally call nrf_drv_usbd_init() with the library's own event handler. If you call nrf_drv_usbd_init() again outside of the library, the function will return an error code. 

    If you need to use both, you need to initialize the USBD driver outside of the app_usbd library and pass the events from the driver to the library yourself. I have not tested this, so I cannot comment on how easy it is to achieve and how well it will work. The handler you pass to the app_usbd config is for the library to send events back to the application, it is not related to the handler you pass to the driver, which pass events from the driver back to the application. app_usbd has its own internal handler where it receives events from the USBD driver.

    Best regards,
    Jørgen

Children
Related