UAC2.0 on STM32

I've said it before but STM32s are general purpose MCUs not specifically targeted at audio so to me it is understandable that they do not offer out-of-the-box solution to UAC. It takes time but once you get UAC working with STM32 there is no need to turn away. And the new STM32 MCUs (e.g. with 2 cores) look very promising. The only issue with STM32 is availability which has not really improved at all in the last 2 years.
 
  • Like
Reactions: 1 user
Hi,
So if I want start with UAC1.0 only (stereo up to 96khz/24bit) what is the best way with a STM32 MCU ?
I need to implement also a freertos with very few tasks (mainly leds controls, one rotary encoder and one SPI for a digital volume control IC).
I would like also use the STM32 for SPDIF to I2S conversion.
I also would like use external crystal to get right frequency for both 44.1 and 96khz samplerate.
I don't have good skill in fw dev, I only know STM32, I'm able to use it for simple task but not to go deeper in UAC code for example.
I read starting with ST example of UAC1.0 is not easy because very complicated, but is there any alternative ?
 
I don't promote myself as an expert on that topic, but had to dig in stm32 programming some years ago. I would say: rewarding but not easy.

You need knowledge in C, understand the structure of the stm32 libraries and how they work together. The IDE, at least few years ago, was effective, but not so easy to master set set well with right links to all librairies ans variables...

Then you need to start small, an ramp up slowly: Blink, led...

The stm32 examples and application notes are your best hope to move forward. If your application is an existing example, your are saved. If not, the journey will be longer.

At some point you will have to cope with the Cube tool pin definition and clock scheme. Important but not obvious...

For what you want to do, you won't need freertos. What you want to do is basically a ring buffer filled on one side by the spdif input, with data pulled on the other side to the DAC. With a mean in between to get a "feedback" to avoid under or over runs. All works with interrupts. I did something similar here:

I did not touched stm32 since 7 years... so don't expect lot more answers...

I would have been happy to find a good book to help me on the learning curve. Maybe some exists...

JMF
 
Hello,

I told about freertos because I've already a stm32 on my design runing under freertos, I use it to make simple tasks like led management, control volume IC, rotary encoder reading and some GPIOs to drive my analog parts. The certainly possible but not easy for me would be to have a single MCU on my design who run my freertos with my taks and also a UAC1.0 and also a SPDIF to I2S (UAC and SPDIF don't run same time it's UAC or SPDIF). The design I speak about is a digital board for a hifi amplifier.
Here is the board I speak about:
1684740756422.png

Today a STM32 for the basics tasks and a XMOS for digital audio.
I would like to move only on STM32 :)

So I know a little about C and STM32 lib, I write the fw myself with Keil IDE (there is a free license for STM32 with M0 core only) and I'm afraid about the IDE from ST based on Eclipse (I don't like it) necessary for dev on more powerfull core like M4/M7.

I think redesign the board with a single STM32F446 but before I will test on a nucleo board, first task will be to try the implement of UAC1.0 but with external clock (certainly a PL611 who generate clock for 44.1 and 48/96) to be frequency accurate. After I will try to do the SPDIF to I2C also with external clock also.

Maybe it's more reasonable to pay a skilled a developer if I want unrisk my project.
 
Can't stop thinking of "MCU + USB3300" device working on HS with polling interval of 1 microframe to get maximum data throughput. So, have replaced stm32f722 by stm32h743 for tests, but have not succeeded, USB3300 does not work at all with stm32h743 by now.
I have made a new version of my USB-I2S board using STM32H723 and USB3343. I have not seen any issues with play & record up to 768k/DoP256/DSD512 so even at these speeds ULPI is not an issue for UAC2. Not much difference in performance since Synopsys FW works with interrupts but the 2.5x higher processing speed should leave more time for other duties (display, encoder etc.).
 
  • Like
Reactions: 2 users
Hi EvSap, Just wondering where you are up to with your aims at a UAC2.0 on STM32. Have you managed to solve all the issues involved?
Unfortunately I did not succed with external PHY (MCU + USB3300). I tried stm32h743 in 100-pin package but it turned out that it is impossible to use it with external USB PHY - pin multiplexing issue. And I have no other hardware to try.
 
Is your DSD implementation based on SAI?
Yes, one SAI is master (provides DCLK & DSDL) and another is synchronous slave to that (DSDR). I2S and DSD use same output connectors (BCLK-DCLK, SD-DSDL, LRCK-DSDR). I've also modified my STM32F723 board in same way but due to limitations in clock generation it works only up to DoP128/DSD256 with 45M/49M clocks. I haven't implemented an ASIO driver so only DoP on Windows.
 
  • Like
Reactions: 1 user
I haven't implemented an ASIO driver so only DoP on Windows.
For my personal use and tests I changed USB VID/PID to values belonging to USB sound cards that had ASIO driver, for example XMOS or JLsounds. So my card is recognized by PC as one of mentioned devices and works under ASIO driver. ASIO requirements for device can be found here https://www.thesycon.de/eng/usb_audiodriver.shtml under "Device and Firmware Requirements".
 
Hello

Somebody have experience with stm32 usb audio in mic mode(IN)? My device is detects, requests come from host. I send data, but on computer side i get only clicks. I have checked with usb sniffer and see that packet have only 4 bytes size. I am sending fixed data so can definitely saw. Instead of 288 bytes come only 4 bytes. Somebody had this issue?

Thx
 
My boards have both UAC2 OUT & IN. Here is the source code for UAC2 IN for STM32F723E_DISCO board:
https://www.diyaudio.com/community/threads/uac2-i2s-input-on-stm32f723e-disco.393702/
Thank you! It's look very close to my realization.
I am new on this forum so can't write PM. Uploaded files here.
My problem that is in even device in IDLE and send the dummy buffer - it length only 4 byte.
I am filled the dummy array with 0x88 for debugging. DataIn callback working stable.
If i send real data it also send only 4 byte length.

1694420886768.png
 

Attachments

  • mic_in.zip
    11.1 KB · Views: 57