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

Passing Audio data (PCM 16 bit) to a USB audio device *not* from headphones

Hi,

I'm trying to implement a USB audio device (michrophone) and I cant seem to be able to call app_usbd_audio_class_tx_start() without getting NRF_ERROR_INVALID_STATE from time to time (sometimes it returns NRF_SUCCESS).

I've tried 2 things:
1. call it inside the callback passed to app_usbd_audio_sof_interrupt_register().
2. call it in the case block for APP_USBD_EVT_DRV_SOF.

I've searched google for any code that uses app_usbd_audio_class_tx_start() and I come empty handed. The only link where app_usbd_audio_class_tx_start() is used is in your USB audio device example which doesnt suit my needs since app_usbd_audio_class_tx_start() is called there inside a piggybacked SOF event generated for the headphones device.

Can you please provide an example on how to call app_usbd_audio_class_tx_start() reliably ? (something other than the example which has both headphones and mic)

An example that does something as simple as passing a sinusoidal wave generated in a timer will be great.

I wouldn't have asked for that if there was any example (other than yours) on how to use the USB audio device and I believe other developers will benefit from it as well.

Thanks

Parents
  • After debugging the SDK and checking why I get NRF_ERROR_INVALID_STATE when I call app_usbd_audio_class_tx_start() I found out that it is returned from inside the following if statement:

    if (!nrf_drv_usbd_ep_enable_check(ep))
    {
        return NRF_ERROR_INVALID_STATE;
    }

    inside the file "nRF5_SDK_15.3.0/components/libraries/usbd/app_usbd.c" inside function app_usbd_ep_transfer() (line 1820).

    What can disable the endpoint ? why does it happen in the middle of using it ?

Reply
  • After debugging the SDK and checking why I get NRF_ERROR_INVALID_STATE when I call app_usbd_audio_class_tx_start() I found out that it is returned from inside the following if statement:

    if (!nrf_drv_usbd_ep_enable_check(ep))
    {
        return NRF_ERROR_INVALID_STATE;
    }

    inside the file "nRF5_SDK_15.3.0/components/libraries/usbd/app_usbd.c" inside function app_usbd_ep_transfer() (line 1820).

    What can disable the endpoint ? why does it happen in the middle of using it ?

Children
No Data
Related