Replies: 6 comments
-
|
Hi, the behavior is indeed abnormal, even if the feedback value is incorrect the host will still send more data.
|
Beta Was this translation helpful? Give feedback.
-
|
Hi,
I will work some more on your example but I had to switch UAC2 from HIGH SPEED to FULL SPEED and maybe I am missing things. I will put more attention to that. Not sure if the problem is around DCD2 as other STM32 chips seem to use fsdev. |
Beta Was this translation helpful? Give feedback.
-
|
If you are on mac you have to use UAC1 for FS due to some feedback format (3 bytes vs 4 bytes) shenanigans acrossing different OS.
|
Beta Was this translation helpful? Give feedback.
-
|
Thank you for your feedback, this is giving me a great understanding of things I wasn't aware. Although forgive my my ignorance as I am new to TinyUSB but I would like to still use UAC2 (same descriptor) across FS/HS however here are my questions, if those are stupid questions please help me understand why they are stupid:
I do appreciate your work on TinyUSB audio part and thanks for making this happen! |
Beta Was this translation helpful? Give feedback.
-
Nope, not sure where did you heard that ;) In FS bandwidth limit is 1023 bytes/ms which translate to more than 4CH 16bit/96kHz ((96+1)*2*4) = 778 < 1023, no matter you are UAC1 or UAC2. In FS UAC2 brings little to no advantage compared to UAC1.
It's a deliberate choice to drop all quirks/workaround and stick on specification for maintenance sake, it was a nightmare to test all audio examples everytime on my Windows desktop, Linux laptop then mac VM.... Besides there is zero guarantee that the quirk will still work with a OS update. The quirk was needed because UAC1 supported was missing and there was no other way to make UAC2 works on every OS. You can easily turn
diff --git a/examples/device/uac2_speaker_fb/src/usb_descriptors.h b/examples/device/uac2_speaker_fb/src/usb_descriptors.h
index 79f25bbfa..b1fb9c395 100644
--- a/examples/device/uac2_speaker_fb/src/usb_descriptors.h
+++ b/examples/device/uac2_speaker_fb/src/usb_descriptors.h
@@ -97,7 +102,7 @@
+ TUD_AUDIO10_DESC_CS_AC_LEN(1)\
+ TUD_AUDIO10_DESC_INPUT_TERM_LEN\
+ TUD_AUDIO10_DESC_OUTPUT_TERM_LEN\
- + TUD_AUDIO10_DESC_FEATURE_UNIT_LEN(2)\
+ + TUD_AUDIO10_DESC_FEATURE_UNIT_LEN(4)\
+ TUD_AUDIO10_DESC_STD_AS_LEN\
+ TUD_AUDIO10_DESC_STD_AS_LEN\
+ TUD_AUDIO10_DESC_CS_AS_INT_LEN\
@@ -112,11 +117,16 @@
/* Class-Specific AC Interface Header Descriptor(4.3.2) */\
TUD_AUDIO10_DESC_CS_AC(/*_bcdADC*/ 0x0100, /*_totallen*/ (TUD_AUDIO10_DESC_INPUT_TERM_LEN+TUD_AUDIO10_DESC_OUTPUT_TERM_LEN+TUD_AUDIO10_DESC_FEATURE_UNIT_LEN(2)), /*_itf*/ ((_itfnum)+1)),\
/* Input Terminal Descriptor(4.3.2.1) */\
- TUD_AUDIO10_DESC_INPUT_TERM(/*_termid*/ 0x01, /*_termtype*/ AUDIO_TERM_TYPE_USB_STREAMING, /*_assocTerm*/ 0x00, /*_nchannels*/ 0x02, /*_channelcfg*/ AUDIO10_CHANNEL_CONFIG_LEFT_FRONT | AUDIO10_CHANNEL_CONFIG_RIGHT_FRONT, /*_idxchannelnames*/ 0x00, /*_stridx*/ 0x00),\
+ TUD_AUDIO10_DESC_INPUT_TERM(/*_termid*/ 0x01, /*_termtype*/ AUDIO_TERM_TYPE_USB_STREAMING, /*_assocTerm*/ 0x00, /*_nchannels*/ 0x04, /*_channelcfg*/ AUDIO10_CHANNEL_CONFIG_LEFT_FRONT | AUDIO10_CHANNEL_CONFIG_RIGHT_FRONT, /*_idxchannelnames*/ 0x00, /*_stridx*/ 0x00),\
/* Output Terminal Descriptor(4.3.2.2) */\
TUD_AUDIO10_DESC_OUTPUT_TERM(/*_termid*/ 0x03, /*_termtype*/ AUDIO_TERM_TYPE_OUT_DESKTOP_SPEAKER, /*_assocTerm*/ 0x00, /*_srcid*/ 0x02, /*_stridx*/ 0x00),\
/* Feature Unit Descriptor(4.3.2.5) */\
- TUD_AUDIO10_DESC_FEATURE_UNIT(/*_unitid*/ 0x02, /*_srcid*/ 0x01, /*_stridx*/ 0x00, /*_ctrlmaster*/ (AUDIO10_FU_CONTROL_BM_MUTE | AUDIO10_FU_CONTROL_BM_VOLUME), /*_ctrlch1*/ (AUDIO10_FU_CONTROL_BM_MUTE | AUDIO10_FU_CONTROL_BM_VOLUME), /*_ctrlch2*/ (AUDIO10_FU_CONTROL_BM_MUTE | AUDIO10_FU_CONTROL_BM_VOLUME)),\
+ TUD_AUDIO10_DESC_FEATURE_UNIT(/*_unitid*/ 0x02, /*_srcid*/ 0x01, /*_stridx*/ 0x00, \
+ /*_ctrlmaster*/ (AUDIO10_FU_CONTROL_BM_MUTE | AUDIO10_FU_CONTROL_BM_VOLUME), \
+ /*_ctrlch1*/ (AUDIO10_FU_CONTROL_BM_MUTE | AUDIO10_FU_CONTROL_BM_VOLUME), \
+ /*_ctrlch2*/ (AUDIO10_FU_CONTROL_BM_MUTE | AUDIO10_FU_CONTROL_BM_VOLUME), \
+ /*_ctrlch3*/ (AUDIO10_FU_CONTROL_BM_MUTE | AUDIO10_FU_CONTROL_BM_VOLUME), \
+ /*_ctrlch4*/ (AUDIO10_FU_CONTROL_BM_MUTE | AUDIO10_FU_CONTROL_BM_VOLUME)),\
/* Standard AS Interface Descriptor(4.5.1) */\
/* Interface 1, Alternate 0 - default alternate setting with 0 bandwidth */\
TUD_AUDIO10_DESC_STD_AS_INT(/*_itfnum*/ (uint8_t)((_itfnum)+1), /*_altset*/ 0x00, /*_nEPs*/ 0x00, /*_stridx*/ 0x00),\
@@ -126,7 +136,7 @@
/* Class-Specific AS Interface Descriptor(4.5.2) */\
TUD_AUDIO10_DESC_CS_AS_INT(/*_termid*/ 0x01, /*_delay*/ 0x00, /*_formattype*/ AUDIO10_DATA_FORMAT_TYPE_I_PCM),\
/* Type I Format Type Descriptor(2.2.5) */\
- TUD_AUDIO10_DESC_TYPE_I_FORMAT(/*_nrchannels*/ 0x02, /*_subframesize*/ _nBytesPerSample, /*_bitresolution*/ _nBitsUsedPerSample, /*_freqs*/ __VA_ARGS__),\
+ TUD_AUDIO10_DESC_TYPE_I_FORMAT(/*_nrchannels*/ 0x04, /*_subframesize*/ _nBytesPerSample, /*_bitresolution*/ _nBitsUsedPerSample, /*_freqs*/ __VA_ARGS__),\
/* Standard AS Isochronous Audio Data Endpoint Descriptor(4.6.1.1) */\
TUD_AUDIO10_DESC_STD_AS_ISO_EP(/*_ep*/ _epout, /*_attr*/ (uint8_t) ((uint8_t)TUSB_XFER_ISOCHRONOUS | (uint8_t)TUSB_ISO_EP_ATT_ASYNCHRONOUS), /*_maxEPsize*/ _epoutsize, /*_interval*/ 0x01, /*_sync_ep*/ _epfb),\
/* Class-Specific AS Isochronous Audio Data Endpoint Descriptor(4.6.1.2) */\ |
Beta Was this translation helpful? Give feedback.
-
|
Thank you for claryfying that. If UAC1 can handle my needs then indeed it's better to stick with the specification and not being dependant on hacks that are fragile and suspectible to changes. Your help is really really appreciated and now I know how I am going to approach my tiny project. Thank you so much for all your hard work on TinyUSB and thank you for your time to explain me those nuances. Cheers! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I have problem with feedback on UAC2 and I cannot tell if the problem is with my descriptor, with the STM32H750 driver or maybe with all endpoint configuration. So fwar I have managed to get both input and output of audio fully working however I have small clicks with audio coming from host because my DAC frequency slightly differs (driven from STM32H7 MCLK) from 48000 Hz audio.
Now the problem, whenever I try to enable Feedback EP host stops streaming audio after several frames. I can see queued EP 83 (Feedback EP) messages but not anymore audio packets. Also, Feedback EP callback is called only once when device is initialised and is not being called repeatedly. While most likely problem is on my side I would really appreciate feedback on feedback (pun intended).
As I cannot attach .h files I have attached one .c file with audio descriptor and other important settings (4 channels audio, but same problems for 2 channels). Also attached is log at level 3 that clearly shows problem.
problematic_descriptor.c
usb_log.txt
Any help will be greatly appreciated! Thanks for amazing work on TinyUSB!
I am using the latest master branch.
Kind regards, Duddie
Beta Was this translation helpful? Give feedback.
All reactions