-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UAC2 hang when adjusting volume from M4 Mac Mini running macOS Sequoia #2912
Comments
Update: This situation only happens when a 1000Hz report rate USB mouse is connected to the same hub and the mouse is being used for dragging the volume slider.
Update 2: When connecting the TinyUSB audio device to an iPhone 13 Pro Max via an OTG cable, there is a delay when adjusting volume. Example: Drag the volume slider back and forth for 2 times very quickly, then, after a few seconds, the volume slider will move itself for another 2 times. Please tell me if you need more information. |
That's quiet interesting, the opposite case will be easier explained. What's inside your volume callback (tud_audio_feature_unit_set_request), is there anything needs extra processing time ?
My surmise that you have a STT (single Transaction Translator) hub, where all FS devices sharing 12Mbps bandwidth. (cf. USB 2.0 specification 11.14) 772 bytes IN is pretty high for FS, when the total bandwidth exceed the limit weird things happens. |
It's the same as the example, that is, merely overwriting the values in the Now it almost gives me the impression that doing some blocking operation (like printing debugging log over UART) in the callbacks can make the problem go away
Yes it's a STT hub chip made by GenesysLogic
I tried to change it to 48000Hz (192 + 4 bytes) and the problem persists... Since this is only happening with |
I think an analyser is needed to see what happened. Maybe there is something related to bus time allocation and incomplete ISO transfer. Ideally 2 FS ISO packets have 1ms interval, if the bus is occupied the interval could be altered. (On a poorly Intel Gen11 PC I saw 20us between 2 HS ISO packets instead of 125us, wondering why my DAC keeps popping) At least for DWC2 DCD a special sequence is needed when incomplete IN/OUT ISO transfer happens. |
Some more detailed information about this bug:
The problem does not go away completely when debugging is enabled, it'll still stuck for around 5secs and then reply the control request. It can resume playing then. ISO transports/bulk transports never actually got stuck, only control ones. When I captured the USB transport using Wireshark, I can see a TT Buffer reset command sent from the host right after the control got a reply after the stuck, but nothing suspicious happened when the last volume control request was sent. Hubs I tested affected are:
The specific mouse only needs to be plugged in, no data transfer is required to trigger this bug. In fact, there's totally no log about any transports between the host and mouse in the Wireshark capture. |
Operating System
MacOS 15.2 Sequoia
Board
Custom PIC32MM board.
The PIC32MM uses the Chipidea IP. It has all 16 dual-direction EPs and only supports full-speed.
Firmware
Main program
TinyUSB commit: 7c1afa8
examples/device/uac2_speaker_fb
with a few tweaks to make it DMA 16bit 192kHz PCM audio to I2S:The
tud_audio_*_req_*
andtud_audio_feature_unit_*
functions are unchanged.Globals
The main loop
The USB interrupt handler
The I2S DMA interrupt handler
Platform
Device
PIC32MM (full-speed,
dcd_pic.c
), bare metal (osal_none
)Compiler
What happened ?
When the board is connected to an M4 Mac Mini running macOS 15.2 Sequoia, adjusting the volume can cause TinyUSB to hang.
This isn't happening when-
Connecting other USB audio devices to the Mac Mini:
-and-
Connecting the TinyUSB device to other devices:
The built-in debugging of TinyUSB didn't help at all (as mentioned below), so I attempted my investigation by toggling LEDs. Here are the observations:
tud_task()
can be invoked as usual but all USB activity ceased to exist.How to reproduce ?
Debug Log as txt file (LOG/CFG_TUSB_DEBUG=2)
It's just the usual volume get/set logs from the callbacks.
The problem completely disappears when I enable CFG_TUSB_DEBUG.
I spent half an hour dragging the volume slider back and forth and still unable to reproduce it with CFG_TUSB_DEBUG enabled.
The problem immediately comes back when CFG_TUSB_DEBUG is disabled again.
So please see the "What happened" section for my investigation attempts.
Screenshots
No response
I have checked existing issues, dicussion and documentation
The text was updated successfully, but these errors were encountered: