uac2_headset on STM32F401 - TU_BREAKPOINT() on USB reconnect
Operating System
Windows 11
Board
STM32F401 custom design
Firmware
Same as https://github.com/hathach/tinyusb/issues/1935
(CubeMX Makefile project on FREERTOS, using the new dcd_dwc2 driver)
Just to be sure, I tested without FREERTOS with a minimal application and nothing in the main loop but tinyusb. The behaviour is identical.
What happened ?
In general, I can connect the USB device and I can play music or loop it back to the microphone without issues. The looped back signal looks like the one I transmitted.
Now, there are two cases:
- I pause/stop the music, disconnect USB, reconnect USB -> no problems
- I leave the music playing, disconnect USB, reconnect USB -> I hit
TU_BREAKPOINT()indcd_dwc2.c:1085withpktsts == 0pktsts == 9orpktsts == 11(random).
Why could that happen, only when I reconnect when I previously had music playing?
I do hit both the tud_umount_cb() when disconnecting, and the tud_mount_cb() when reconnecting, before I run into the breakpoint.
My tusb_config.h has __RX__ defined, so I limit the quality to 16 bit/48 kHz.
How to reproduce ?
See above (point 2.)
Debug Log as txt file
The log starts just before I disconnect (while playing music) and then reconnect. A lot of the configuration goes well, but it fails at getting the set volume: audio_log.txt
This is the log, when I reconnect without playing music: audio_log_no_error.txt
Please have a look at the difference between the two: https://diffonline.net/cHSN6gt3J5
When playing music while replugging, there are seemingly a lot more configuration messages exchanged - which might be normal. I have no experience with the protocol yet.
I have checked existing issues, dicussion and documentation
- [X] I confirm I have checked existing issues, dicussion and documentation.
I've hit the same issue with an STM32U575. I had similar behavior to what was described in https://github.com/hathach/tinyusb/issues/1935 but https://github.com/hathach/tinyusb/pull/1928/ allowed me to advance one step forward to this current bug (with the default settings of 96 kHz 24-bit). Do you have any updates on this issue ?
@gabChouin Unfortunately not. I gave up eventually and wrote my own UAC (1.0 only) driver.
Could you take a looks the version of dwc2 IP used in F401 ? Basically these registers : https://github.com/hathach/tinyusb/blob/d6b8b3515df4bb83b6038bd60260771e65af8de7/src/portable/synopsys/dwc2/dwc2_info.py#L6C4-L6C4
I'll see if it's reproducible on my F429 board.
Could you try #2333 ?
While I didn't hit breakpoint, sometimes after re-plug it NAK all OUT transfers (which will cause host to re-enumerate like in your log)
@rpascalsdl It's not the same issue. This one is specific to dwc2 IP, rp2040 use a different USB controller.
@HiFiPhile thanks. I removed the comment. Will try to create an issue when I have better repro steps.