Open-sourced UAC2 bridge, based on STM32

Member
Joined 2018
Hello everyone, I am currently implementing UAC2 on STM32F446RE. Now it supports up to PCM 352.8k and DSD64(DoP). Please give it a shot if you are interested.
Source code
PCB
 
  • Like
Reactions: 6 users
Member
Joined 2005
Well done!
Couple of comments from quick glance:
  • Instead of PLL it would be better to use external clocks for MCK. STM32F466 allows this through I2S_CKIN (PC9).
  • SAI would probably be more future-proof than I2S as with F7 & H7 SAI is much more evolved and feature-rich than I2S.
  • The limits for async feedback at 44k1 (and multiples) are not symmetric as is the case with 48k (and multiples). This is not a huge issues as host just discards feedback that is not within limits.
  • I assume this is intended to be similar to Amanero. Still I would add isolators for all output signals.
 
Member
Joined 2005
Regarding SAI vs. I2S STM32F4/F7/H7 does not have synchronization between I2S interfaces so using 2 I2S interfaces for DSD output (one I2S per channel) may not work properly as the streams are not synchronized. With SAI synchronization is possible.
 
Member
Joined 2005
@bohrok2610 : IIUC the two I2S interfaces have their clock pins connected, and I2S3 is master while I2S1 is slave. The two interfaces should run synchronously if started closely to each other, IMO. Or can there be some race condition?
 
Member
Joined 2005
IIUC the two I2S interfaces have their clock pins connected, and I2S3 is master while I2S1 is slave. The two interfaces should run synchronously if started closely to each other, IMO. Or can there be some race condition?
Based on the reference manual I'm not sure if master and slave data (in this case DSDL and DSDR) is synchronized so there may be slight timing offset between DSDL and DSDR. That probably does not matter. But since SAI provides synchronization and I2S has no real benefits why not just use SAI.
 
Member
Joined 2018
Well done!
Couple of comments from quick glance:
  • Instead of PLL it would be better to use external clocks for MCK. STM32F466 allows this through I2S_CKIN (PC9).
  • SAI would probably be more future-proof than I2S as with F7 & H7 SAI is much more evolved and feature-rich than I2S.
  • The limits for async feedback at 44k1 (and multiples) are not symmetric as is the case with 48k (and multiples). This is not a huge issues as host just discards feedback that is not within limits.
  • I assume this is intended to be similar to Amanero. Still I would add isolators for all output signals.
Hi bohrok2610,
  • In a early version it is implemented as you said but I removed it as I did not think it is necessary. Maybe for lower clock jitter?
  • The first comes to my mind is indeed SAI. Unfortunately, on 64-pin devices it collides with ULPI signals.
  • As for synchronization between two I2S's, it is similar to I2S full duplex mode but the slave is also transmitting. The RM said in this case, they are synchronized by WS, as long as the slave is started before master. On oscilloscope I also did not observe any delay between two channels.
Thanks for your advice!
 
Member
Joined 2005
Ok, I did not notice that you are using audio frequency clock as HSE. With DS DACs external MCK via I2S_CKIN would probably work better as you can use the same MCK at DAC and I2S stream is synchronized. Otherwise reclocking of I2S may be needed.
 
Member
Joined 2005
@slerpxcq : IIUC from the USB POV adding ADC would mean implementing EP IN + configuration within the existing audio function (i.e. making the existing audio device duplex). Why composite device?
 
Member
Joined 2005
No composite device required but as I said 64-pin device with ULPI is out of suitable interfaces.
IMO best STM32 chip for this purpose would be 100-pin STM32F723VETx. It has built in HS PHY so no ULPI required. Also 2 SAI interfaces (SAI1_A, SAI2_B) available at one side of the chip for audio duplex operation (DAC & ADC). Cost of STM32F446 with ULPI is about the same but the chip is less capable.

Actually I would have preferred to use STM32F723VETx when I made my first USB-I2S bridge in 2021. Unfortunately back then it was not available so I had to use the 144-pin STM32F723ZETx which just wastes PCB real estate and leaves loads of GPIOs unused.
 
Member
Joined 2018
Ok, I did not notice that you are using audio frequency clock as HSE. With DS DACs external MCK via I2S_CKIN would probably work better as you can use the same MCK at DAC and I2S stream is synchronized. Otherwise reclocking of I2S may be needed.
This is easily achievable as I2S_CKIN and RCC_MCO2, which is used as MCK output, are the same pin.
 
Member
Joined 2013
Hi, @slerpxcq
Thanks for sharing this project!
I have seen that you already updated fw project files, so it supports now 768k & DoP DSD256.
I can't wait to test it.
 
Top