You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Starting with the uac2_headset example, I'm working on a composite device with two identical headset functions on a Raspberry Pi Pico.
I've made two descriptors, using the example as a base, different only in the FUNCTION number
eg:
With #define CFG_TUD_AUDIO 1
Either of the descriptors work as expected (at least with mic data) so I'm reasonably convinced that they are both OK individually.
However, with #define CFG_TUD_AUDIO 2 and both descriptors in the configuration
the first function still works, but I just get repeating noise on the second function, as below from Audacity
(the second function is the first recording)
this is a closer look at the (non-random) noise. It's been the same pattern through various compilations, which suggests that it does not represent uninitialised memory.
The write into the endpoint looks like this tud_audio_n_write((0 or 1), (uint8_t *)mic_buf, (uint16_t)sample_count * 4);
The function and endpoint addresses look like this
I suspect the issue may be around the assignment of Unit Numbers, but unfortunately I can't find any document that explains how to work this out. Currently, they look like this.
Which I take to mean that every other write to the fifo is pointing
to a start point of zero.
From an earlier discussion, I know that there is no problem with two dissimilar audio devices running together (thanks @HiFiPhile !), but after two days, I'm stumped.
I 'think' the information above might be enough to allow someone to give me a suggestion where to look, rather than ask someone to trawl through the descriptors, but they are attached anyway, apologies for the mess....
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Starting with the uac2_headset example, I'm working on a composite device with two identical headset functions on a Raspberry Pi Pico.
I've made two descriptors, using the example as a base, different only in the FUNCTION number
eg:
etc, etc. \
With
#define CFG_TUD_AUDIO 1
Either of the descriptors work as expected (at least with mic data) so I'm reasonably convinced that they are both OK individually.
However, with
#define CFG_TUD_AUDIO 2
and both descriptors in the configurationthe first function still works, but I just get repeating noise on the second function, as below from Audacity
(the second function is the first recording)
this is a closer look at the (non-random) noise. It's been the same pattern through various compilations, which suggests that it does not represent uninitialised memory.
The write into the endpoint looks like this
tud_audio_n_write((0 or 1), (uint8_t *)mic_buf, (uint16_t)sample_count * 4);
The function and endpoint addresses look like this
I suspect the issue may be around the assignment of Unit Numbers, but unfortunately I can't find any document that explains how to work this out. Currently, they look like this.
So it looks like using two uac_functions somehow messes up the endpoint fifo??
Digging down to _tu_fifo_write_n in tusb_fifo.c the log of the first function recording looks like this.
rd = 704, wr = 704, count = 0, remain = 1552, n = 176:
rd = 768, wr = 768, count = 0, remain = 388, n = 128:
rd = 880, wr = 880, count = 0, remain = 1552, n = 176:
rd = 120, wr = 120, count = 0, remain = 388, n = 128:
rd = 1056, wr = 1056, count = 0, remain = 1552, n = 176:
while the log of the second (bad) function looks like this.
rd = 896, wr = 896, count = 0, remain = 776, n = 128:
rd = 0, wr = 1056, count = 1056, remain = 496, n = 176:
rd = 1024, wr = 1024, count = 0, remain = 776, n = 128:
rd = 0, wr = 1232, count = 1232, remain = 320, n = 176:
rd = 1152, wr = 1152, count = 0, remain = 776, n = 128:
Which I take to mean that every other write to the fifo is pointing
to a start point of zero.
From an earlier discussion, I know that there is no problem with two dissimilar audio devices running together (thanks @HiFiPhile !), but after two days, I'm stumped.
I 'think' the information above might be enough to allow someone to give me a suggestion where to look, rather than ask someone to trawl through the descriptors, but they are attached anyway, apologies for the mess....
Thanks in advance...
Mike
files.zip
Beta Was this translation helpful? Give feedback.
All reactions