UAC2.0 on STM32

Hard to tell from that video what is going on but with 16-bit data the I2S frame will be half empty. Input LRCK to scope channel 1 and SD to channel 2 and view single pulses triggered by LRCK. If you repeat that a few times you should be able to see whether or not data is the same in every sample.
 
It is working now! 192 kHz @ 32 bits - pure sound! The reason of strange SAI behaviour was Data Cache. Just disabled Data Cache and sound distortions desapeared! SAI DMA is used in normal mode.
For those who may be interested in SAI behaviour with Data Cache enabled / disabled, what I tried explaining in the previous post, here are diagrams received by means of a logic analyzer.
1) Data Cache enabled. It is seen that data (line 2) are lost periodically
DataCacheEnabled.jpg
2) Data Cache disabled. It is seen that data are never lost, transmitted permanently.
DataCacheDisabled.jpg
3) Data Cache disabled, previous diagram is zoomed in, test data 0x0F are transmitted.
DataCacheDisabled_Zoom.jpg

@bohrok2610, thank you very much for your time and support! You helped me a lot!
 
  • Like
Reactions: 1 user
@bohrok2610, how do you play 384 kHz / 768 kHz audio? I have not managed to do that yet. Windows lists 384 kHz in audio device settings but when I choose for example 384 kHz @ 32 bit (or 384 kHz @ 24 bit) and then click play button in a player, player seems to be playing audio but via debugger I can see that no data are transmitted to audio device from PC.
I mean: what player do you use?
 
Hi,

If interested I have a working example of uac 2.0 (192khz&96khz) from ST, never released so go MP.
I had a look at the different readme information and key file headers. Most examples are related to 2 channels/stereo. I haven't seen examples/projects related to UAC2 multichannel features. So from this quick look, it is unfortunatly not demonstrated that USB multichannel audio would be easily achievable on the stm32 MCU.

The NXP IMXRT10xx range seems to be in a better position there. I downloaded their SDR, and looking at their examples, thay have some USB multichannel ones (5.1).

I really appreciate the stm32 and their Nucleo boards. We just miss a good USB UAC2.0 stack.

I have seen the tinyUSB and CherryUSB codes, but I don't know how mature they are for that application.
 
I do not know how what data layout stm32 requires for multichannel SAI, but in linux USB audio gadget the number of channels is just a parameter, used on a few places. The blocks of interleaved samples delivered by each USB packet are just copied to the output buffer. Sending more channels just means receiving a longer block of bytes.
 
Hi, Since 2015 I have identified all the potential of those SAI. They can also get a dedicated Cristal for the audio clock, to get clean 44.1k and 48k.

But it took m monthes to achieve a USB asynchronous mode, as it was not covered by the stm32 ST code, despite on the paper it was 100% feasible. Good Hardware, imcomplete software... For my part I won't dig in a new uncertain aventure here with my limited knowledge of USB standard and coding skills. I'm just good at adjusting almost good examples and integrating some ;-)

But NXP has the UAC2 stack. Could be easier to switch to those...

The fact that ST does not releases a UAC2 official stack is a no go for me unfortunatly...

JM