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

EP 8 IN enabled check when writing a USB audio device (microphone)

Hi,

When I write a very simple USB audio device that just pass a sinuous wave created in a timer that runs at a 16KHz freq - how can I tell "someone" on the host listens to it and that I should keep passing data to the app_usbd_audio_class_tx_start() function ?

Apparently when the host doesnt have a recording application running app_usbd_audio_class_tx_start() detects that the EP isnt enabled and returns NRF_ERROR_INVALID_STATE.

How can I do that in a higher level without failing ?

Remark #1:
The device can be in configured state and still fail passing data to the host because the EP isnt enabled.

Parents
  • Hello,

    If you look into:

    app_usbd_audio_class_tx_start() -> app_usbd_ep_transfer()

    This function will check the EP: nrf_drv_usbd_ep_enable_check(ep), and it will return NRF_ERROR_INVALID_STATE. So it basically checks what you want to know, but if you like, you can use nrf_drv_usbd_ep_enable_check(ep); before calling app_usbd_audio_class_tx_start().

  • What can disable an endpoint ?

    Why does it gets disabled in the middle of operation ?

    Is there a driver event for an endpoint getting enabled/disabled ?

Reply
  • What can disable an endpoint ?

    Why does it gets disabled in the middle of operation ?

    Is there a driver event for an endpoint getting enabled/disabled ?

Children
  • How do you decide that the EP is disabled? Is it because it returns NRF_ERROR_INVALID_STATE? if so, do you know what check inside app_usbd_ep_transfer() or what function call that returns this?

  • Look at the reply I wrote for this question.

    You can find source code that shows this behavior in this question (the full main.c was posted 6 days ago by me)