UAC2.0 on STM32

Additional info : stereo, 24bit 48kHz, packet length = (48000 /1000 ) * 2 *3 = 288 (0x120)
So offsets in packet are right, but length 4 instead 288
1) How is IN Endpoint initialized? If you are using STM libs there is something like "USBD_LL_OpenEP" function
USBD_LL_OpenEP(pdev, AUDIO_IN_EPNUM, USBD_EP_TYPE_ISOC, AUDIO_IN_PACKET_MAX);
where AUDIO_IN_PACKET_MAX is the max packet size, check this value.

2) In USB descriptor check max endpoint size
//Standard AS Isochronous Audio Data Endpoint Descriptor
AUDIO_DESC_STD_AS_ISO_EP_LEN, // bLength
USB_DESC_TYPE_ENDPOINT, // bDescriptorType
AUDIO_IN_EPNUM, // IN endpoint
USBD_EP_TYPE_ISOC | ISO_EP_ATT_ASYNCHRONOUS, // attributes
LOBYTE(max endpoint size), // max endpoint size
HIBYTE(max endpoint size),

EP_BINTERVAL_VALUE, // bInterval
 
Hi! I am very new to this. For the longest time I ran simple speakers, but recently I've got a not bad pair of headphones (KZ ZSN proXs), and they eclipse anything I've had before. Just running off a laptop. I am very much looking forward to building a proper USB DAC/AMP to go higher end. I've looked at some dac pcbs, and all of them require I2S. I am not aware of the STM32's limits regarding I2S. I want to try 32bit 384khz (or even 768khz but that's a stretch). I will pair it with a PCM5102A Dac (AK4493SEQ in a Final iteration).

Questions -

1.Which STM32 should I get for this?

2.Can it match (at least for the price) an XMOS’s XU208?

3. Does anyone have example code, or even complete code?

Thanks a lot for any help given and best of luck with your own projects!
 
Do you want to try DSD when you get to AK4493? Reason I ask is IME the AKM dacs I have tried sound better in DSD mode, rather than PCM. However, don't know if STM32 solutions support DSD at this point. OTOH, Amanero and or I2SoverUSB can work quite well with it.
I would like to, yes. My preferred music is metal, clarity, dynamics means everything there. For now I wish to build a very very well sounding yet still cheap dac amp. Hence why I did not go for the XMOS. For now I wish to put more money into the dac and the amp part of this, so keeping the usb to i2s bridge cheap is key for price/performance. I also think that if the implementation is good, DSD and PCM should sound about the same. Any idea which STM32 to go for?

Thanks for helping out, much appreciated. Best regards.
 
Hi, you could start from there: https://www.diyaudio.com/community/threads/open-sourced-uac2-bridge-based-on-stm32.404656/

There are other UAC 2.0 stm32 projects on Github.

Be prepared to spend some time there. This is feasible and demontrasted to work well, but not copy/paste stuff.
Interesting, thank you! I will take a look as soon as I got time. While I have not done much coding in years, I was working with micro-controllers extensively in the past, I hope I can manage here as well.
 
For now I wish to put more money into the dac and the amp part of this, so keeping the usb to i2s bridge cheap is key for price/performance.
That would make sense of the I2S bridge were only being used for data. However it many cases it is also clock source for the dac, which is a critical analog (not digital!) time reference that the dac requires for good operation. Similarly all dacs need an analog voltage reference which is also critical to dac performance.
 
That would make sense of the I2S bridge were only being used for data. However it many cases it is also clock source for the dac, which is a critical analog (not digital!) time reference that the dac requires for good operation. Similarly all dacs need a voltage reference which is also critical to dac performance.
If all goes well and this project works out I will use a FIFO reclock. Also I will make sure to make good linear psus for low noise.
 
cheap dac amp. Hence why I did not go for the XMOS.
Do you think it will be cheaper?

XMOS XUF208 Digikey price is ~$15 (for 1pc).
One of the most suitable for UAC2 operation STM32F723 - $11-15 (for 1pc).

Yes, the power supply for STM will be a little simpler and cheaper, but is the difference so big?

P.S. Why I choose XUF208 and F723 for comparison?
Because XUF208 have internal flash and because F723 have internal USB PHY.
For XU208 you will need external flash chip and for many other STM - external PHY chip ( which is no so easy to make good PCB layout, because of a 60MHz parallel bus)

Alex.
 
If all goes well and this project works out I will use a FIFO reclock.
You do not need FIFO for good USB interface!
"Good", I mean working in asynchronous mode, i.e. - receive the external MCLK from the oscillator (usually dual frequency for 44x/48x). All XMOS, Amanero, most PIC32 and STM32 solutions works like this.
Also it is highly recommended, that these oscillators physically located close to the DAC chip, because only DAC clock jitter is important, and not MCLK going to the USB chip.

Alex.
 
Do you think it will be cheaper?

XMOS XUF208 Digikey price is ~$15 (for 1pc).
One of the most suitable for UAC2 operation STM32F723 - $11-15 (for 1pc).
So far I was thinking of this pcb If I do go XMOS.
https://www.diyinhk.com/shop/audio-...oa_cable/153-optical_spdif_output_socket-null

I assumed that the STM32 solution will be as good or simply alike and can be done on a simple dev board with some modifications. Such as this for example.
https://aliexpress.ru/item/10050066...x.productlist.search_results.0.53d95b32M37Aqu

Do forgive in case I am missing things. I really wish to make a cheap dac/amp that's worth it.

Regarding the psu situation - I will make use of a computer psu, 3.3v, 5v, and 12v. For the output stage which requires differential supply use a rail Splitter ic TPS65130 (4 in parallel) to create Positive and negative rails just a volt above target, and linearly stabilize it with LT3045 (or comparable) chips. Use different LT3045s to make the voltage spat out by the pcu clean for the dac and the I2s device.

Assuming an average implementation, would that be good enough?