-
Here's my config for an audio microphone input from a Pi Pico, with a MIDI controller interface. Unfortunately this doesn't work. What GPT is telling me, and seems likely correct, is that the MIDI interface 'looks' like a an audio device, and when TinyUSB starts up, the audio or the Midi (whichever I put first), slurps up both interfaces. Then I get asserts in the code that there are no available devices for the 'other' one. Is this something that has been solved? I'm not sure how to approach it yet. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 8 replies
-
|
What's not working exactly ? Currently audio driver misses some checking to avoid messing around midi for more complexe config but your config should work. Example based on audio_test_multi_rate diff --git a/examples/device/audio_test_multi_rate/src/tusb_config.h b/examples/device/audio_test_multi_rate/src/tusb_config.h
index 3587ae089..d8826cf8d 100644
--- a/examples/device/audio_test_multi_rate/src/tusb_config.h
+++ b/examples/device/audio_test_multi_rate/src/tusb_config.h
@@ -100,7 +100,7 @@ extern "C" {
#define CFG_TUD_CDC 0
#define CFG_TUD_MSC 0
#define CFG_TUD_HID 0
-#define CFG_TUD_MIDI 0
+#define CFG_TUD_MIDI 1
#define CFG_TUD_VENDOR 0
//--------------------------------------------------------------------
@@ -139,6 +139,11 @@ extern "C" {
// Example write FIFO every 1ms (8 HS frames), so buffer size should be 8 times larger for HS device
#define CFG_TUD_AUDIO_FUNC_1_EP_IN_SW_BUF_SZ TU_MAX(4 * CFG_TUD_AUDIO10_FUNC_1_FORMAT_1_EP_SZ_IN, TU_MAX(32 * CFG_TUD_AUDIO20_FUNC_1_FORMAT_1_EP_SZ_IN, 32 * CFG_TUD_AUDIO20_FUNC_1_FORMAT_2_EP_SZ_IN))
+// MIDI FIFO size of TX and RX
+#define CFG_TUD_MIDI_RX_BUFSIZE (TUD_OPT_HIGH_SPEED ? 512 : 64)
+#define CFG_TUD_MIDI_TX_BUFSIZE (TUD_OPT_HIGH_SPEED ? 512 : 64)
+
+
#ifdef __cplusplus
}
#endif
diff --git a/examples/device/audio_test_multi_rate/src/usb_descriptors.c b/examples/device/audio_test_multi_rate/src/usb_descriptors.c
index 505936fdb..5256565fe 100644
--- a/examples/device/audio_test_multi_rate/src/usb_descriptors.c
+++ b/examples/device/audio_test_multi_rate/src/usb_descriptors.c
@@ -76,6 +76,8 @@ uint8_t const * tud_descriptor_device_cb(void) {
enum {
ITF_NUM_AUDIO_CONTROL = 0,
ITF_NUM_AUDIO_STREAMING,
+ ITF_NUM_MIDI,
+ ITF_NUM_MIDI_STREAMING,
ITF_NUM_TOTAL
};
@@ -92,14 +94,19 @@ enum {
#define EPNUM_AUDIO 0x01
#endif
-#define CONFIG_UAC1_TOTAL_LEN (TUD_CONFIG_DESC_LEN + TUD_AUDIO10_MIC_ONE_CH_DESC_LEN(3))
+ #define EPNUM_MIDI_OUT 0x02
+ #define EPNUM_MIDI_IN 0x82
+
+#define CONFIG_UAC1_TOTAL_LEN (TUD_CONFIG_DESC_LEN + TUD_MIDI_DESC_LEN + TUD_AUDIO10_MIC_ONE_CH_DESC_LEN(3))
uint8_t const desc_uac1_configuration[] = {
// Config number, interface count, string index, total length, attribute, power in mA
TUD_CONFIG_DESCRIPTOR(1, ITF_NUM_TOTAL, 0, CONFIG_UAC1_TOTAL_LEN, 0x00, 100),
// Interface number, string index, EP Out & EP In address, EP size
- TUD_AUDIO10_MIC_ONE_CH_DESCRIPTOR(/*_itfnum*/ ITF_NUM_AUDIO_CONTROL, /*_stridx*/ 0, /*_nBytesPerSample*/ 2, /*_nBitsUsedPerSample*/ 16, /*_epin*/ 0x80 | EPNUM_AUDIO, /*_epsize*/ CFG_TUD_AUDIO10_FUNC_1_FORMAT_1_EP_SZ_IN, 32000, 48000, 96000)
+ TUD_AUDIO10_MIC_ONE_CH_DESCRIPTOR(/*_itfnum*/ ITF_NUM_AUDIO_CONTROL, /*_stridx*/ 0, /*_nBytesPerSample*/ 2, /*_nBitsUsedPerSample*/ 16, /*_epin*/ 0x80 | EPNUM_AUDIO, /*_epsize*/ CFG_TUD_AUDIO10_FUNC_1_FORMAT_1_EP_SZ_IN, 32000, 48000, 96000),
+
+ TUD_MIDI_DESCRIPTOR(ITF_NUM_MIDI, 0, EPNUM_MIDI_OUT, (0x80 | EPNUM_MIDI_IN), 64)
};
TU_VERIFY_STATIC(sizeof(desc_uac1_configuration) == CONFIG_UAC1_TOTAL_LEN, "Incorrect size"); |
Beta Was this translation helpful? Give feedback.
-
Isn't you are using also UAC1 ?
|
Beta Was this translation helpful? Give feedback.
-
Your fix did the trick :) |
Beta Was this translation helpful? Give feedback.


That's what happens with more complexe configfixed in #3383Midi driver is ok, it's audio driver who swallowed both.
Isn't you are using also UAC1 ?
You must have other modifications other than mine.