Conversation
…speaker and headset in usb_audio to resolve bug adafruit#11216
…dio-enabling-speaker-fail-to-start
|
@jbirchall-svg The original post looks like LLM output? Have you done the tests listed? |
@dhalbert it is LLM output (Cursor AI Grok 4.6 model) and I have only done the Windows 11 Pro tests on a single Adafruit QT Py RP2040 board connected to an Adafruit I2S Amplifier BFF and an 8 Ohm speaker. Audio streams correctly for me from the PC, through the circuit, and into the speaker after applying the PR and building my fork. |
FoamyGuy
left a comment
There was a problem hiding this comment.
I had an agent confirm no regressions from this change on linux.
I don't have any easy way to test on windows.
…dio-enabling-speaker-fail-to-start
…TUSB_ISO_EP_ATT_ASYNCHRONOUS
FoamyGuy
left a comment
There was a problem hiding this comment.
Looks good to me. Thank you!
I confirmed no regression for linux on this branch.
Closes: #11216
Fixes Windows 11 Code 10 ("This device cannot start") when
usb_audio.enable(speaker=True)is used.The speaker (and headset speaker) OUT endpoint was copied from TinyUSB's
TUD_AUDIO20_SPEAKER_*_FB_DESCRIPTORbut the feedback endpoint wasintentionally omitted. The data EP was still marked Asynchronous.
usbaudio2.sysrequires an explicit feedback endpoint for async OUT anddoes not support implicit feedback, so the driver fails during start
before any audio flows. Linux is more lenient, which is why RP2040
speaker tests looked fine there.
The USBSpeaker sink already adapts: it drains whatever the host sends
and underruns/overruns in the ring. Advertise that honestly as Adaptive
instead of Asynchronous. Microphone IN stays Asynchronous (valid
without a feedback EP).
This is not a full clock-matching implementation. Long-term drift can
still produce drop/insert artifacts; a later change can add a feedback
EP (and TinyUSB
CFG_TUD_AUDIO_ENABLE_FEEDBACK_EP) if we need theboard to be the clock master. Explicit feedback is also a poor first
fix on full-speed parts: Windows' UAC2 driver has known FS feedback
format bugs, and TinyUSB's own speaker example emits UAC1 on FS.
Test plan:
usb_audio.enable(sample_rate=48000, channel_count=2, microphone=False, speaker=True)— audio device starts, no Code 10, playback reaches I2Susb_audio.enable(speaker=True)(headset; mic still defaults on) — speaker device starts