Open-sourced UAC2 bridge, based on STM32

Boards arrived today. I considered this project to be a good oportunity to also test JLCPCBs 6 layers & Via_in_Pad PCBs. They look great.
Waiting now for some little hobby-time to solder the parts.
 

Attachments

  • uac2_pcb.jpg
    uac2_pcb.jpg
    207.5 KB · Views: 189
Currently two. Theoretically the USB code can do more, but it would require external CPLD to handle channel splitting.
Hi, thanks for sharing your project.
So far I haven't been able to find anything DIY with more then 2 channels. The ct7601 looks promising but I couldn't find a simple board with it.
I am interested in a multichannel solution, minimum 5.1, ideally 7.1.4.
I am an expert in FPGA's and I can help you integrating a CPLD/FPGA and prepare some code for it.
 
For multi-channel audio no CPLD/FPGA is needed with STM32. With STM32 SAI (Serial Audio Interface) up to 16 channels is possible using TDM. Or if the MCU has 4 SAIs each with 2 independent audio blocks it is possible to have 16 I2S channels. IMO best to use STM32H7 MCUs as there isn't much price difference to STM32F4/F7.
 
Hello,

Thanks for sharing your project! I'm looking for a simple UAC implementation on STM32, looks like this project fit perfectly!
I will use a LQFP100 mcu, I use your project and vscode with stm32 genuine addon, portage was simple, it build :)I think will go on a prototype pcba to test it.
 
Hello, I'm trying an implementation on 100lqpf package (f446vet) and freertos.
Will share work one time it run, for that will do a simple pcba implementation with only the minimal (I think about mcu and dac, the same ak4490r).
For now I'm interogating about clock sheme you use, the .io cubemx file speak about a 24.546mhz as master xtal and there is a little bit of overcloking inside (sysclock@192mhz instead of 180, apb1&2 also few mhz upper than max). The kicad project show usage of a 12.288Mhz as master input clock.
Can you share more explanation about clock sheme you use ?

Have fun :)
 
I presume the hw project is from an earlier fw version. (f.e. LED3 circuit is also missing from hw)
As for the last fw version, the external xtal should be 24.576 MHz.
I am new on STM32, but as I have read, most of the chips F446 should work up to 240 MHz. I found no issues for oc them at 192 MHz (2 boards assembled&tested).
 
Hi, @slerpxcq

I was trying to use your project and after flashing my STM32F446RET6 with binary file, nothink happen, Windows, Linux and Machintosh don't detect any USB device. I try to reset the MCU : same.

Perhaps I do somethink wrong. (Note I could flash my STM32F446RET6 with another binaries and it work).

This is what I was doing :

1) I download the zip file from the github link
2) I unzip it
3) I open the c project with STM32 CUBE IDE - Version: 1.14.1 - Build: 20064_20240111_1413 (UTC)
4) I go to project menu / properties / C/C++ build/ settings / MCU Post build outputs/ and select : Convert to binary file - and click Apply and Close
5) I click on project / Build all

Build seem correct (only 1 warning).

6) I go to directory debug. I find the builded binary file (date and time is ok).
7) I flash via DFU the binary file. The sending is ok

Did I do somethink wrong ?

(Note when I open the project in STM32 CUBE MX, I could see some errors).

Could you check on your side and let me know ?

Best regards
 
Hi, @slerpxcq

I was trying to use your project and after flashing my STM32F446RET6 with binary file, nothink happen, Windows, Linux and Machintosh don't detect any USB device. I try to reset the MCU : same.
Yes, I got this issue, too, but it seems this is a Cube IDE bug:
PLLI2SCLK bug
Because of that there is no 24 MHz output, for USB 3300.
I have modified the clock config code in the original firmware, to avoid the bug above, but maybe there is any software patch to apply. I had no hobby-time, to look for it.
 
I have made the first audio tests yestarday, in Windows11+ Foobar:
  • all 44k family SRs play great (including 352k)
  • both DSD64/128 (DoP) -which are also 44k based- play great, but DSD128 has some stop playing issue (it freezes player in a short loop, reset button on the STM32 board doesn't work, but only disconnecting USB cable)
  • all 48k family SRs only play well for a few seconds only (WASAPI push), but after that LED1 starts blinking, then it continous lights, and also the sound becomes distorted accordingly. This LED is triggered by USBD_AUDIO_Sync function, in usbd_audio.c. (It also can be triggered ON by the Error_Handler function, but this is not the case). The sound is distorted from the begining in case of WASAPI event, even if the LED1 will go ON after a few seconds.
I wonder where the mistake could be. The audio buffer seems to be OK, so I have to further read the code and understand how feedback function was intended to work
 
I haven't studied this SW in detail but the asynchronous feedback mechanism looks a bit odd and IsoInIncomplete and IsoOutIncomplete callbacks are also not doing taks mentioned in STM reference manual. The issue with 48k SRs may well be due to buffer over/underruns caused by missing async feedback.
Here (and in further posts in that thread) is discussion of UAC2 async feedback with STM32.
 
  • Like
Reactions: 1 user
Hi, I did a physical implementation of this project on this thread (where you can find kicad project)
https://www.diyaudio.com/community/threads/es9038q2m-board.314935/page-399
Will also share cubemx and project on vscode one time it will work, this project use a 100lqfp stm32 instead of 64.
As I'm a hardware guy with very limited skill in embeded c programing hope you can find an issue on 48k family playing, otherwise fixing that will be a great way to learn for me but honestly it afraid me a lot :)
 
Hi, I'm neither a HW or SW guy (OK a bit more SW bias), but I'm looking at the code for a multichannel implementation. If I find something, I will share. I try to first adapt the code to my STM32F4 discovery board.

From what I read at the beginning of the thread, the board is designed first of all for 48k familly, and the clock ratio is adjusted for the 44.1k familly.

I'm just at the surface of the code at the moment.

JMF
 
I'm looking at the code, and it defines a maximum of 2 Configurations in the Device Descriptor. Normally, it is Max 1 Configuration. This is different from the Alternate Interfaces, where there are 2: one for 24 bits and one 32 bits.

Would you know what the second configuration is for?

@_BriKs_, a stupid question: did you kept the Crystal frequencies as per the initial project, or did you changed those? The HSE clock was aligned with the 48kHz familly. If you changed it, then it is not anymore.

Best regards,

JMF