This is the continuation for the hardware part of https://www.diyaudio.com/community/threads/stm32-usb-to-i2s-multi-channel-log-ask-for-help.409771/
For active speakers, all DSP can be now done in the Host (Rpi with CamillaDSP, Windows), but are not that many options to output those multiple channels to DAC or amplifiers. So the objective is to provide an open "simple" USB to 4xI2S, so 8 channels, implementing UAC2 in Asynchronous mode.
I nthe end it looks as a simplified version of https://www.minidsp.com/products/usb-audio-interface/mchstreamer-lite (which I was not aware of when I started the project).
PCB will be designed with KiCAD. HW design and source code will be in Github at the end.
The project is strongly inspired from: https://www.diyaudio.com/community/threads/open-sourced-uac2-bridge-based-on-stm32.404656/ (credits to @slerpxcq) and will be based on a stm32 processor.
I want to keep it a simple device to ensure that the project will succeed (and avoid fitting all possible functions). Clear and realistic use cases are the key.
I'm not a pro and I'm a slow doer... so this is not for tomorrow ;-)
I'm missing many skills in hardware, so all advices are welcomed to achieve a sound design.
Specifications:
Specs of the USB to 4xI2S board:
Proof of concept working with stm32F746 Disco board:
In assembly perspective, source as many as possible components from JLCPCB (preferably Basic components)
On JLCPCB, there is a large choice of stm32H7 at reasonable prices (simlar to F4 and cheaper than F7). They offer higher process power. Interesting references:
STM32H723VGT6 MFR.Part # STM32H723VGT6 Package LQFP-100(14x14), Description 1MB 564KB FLASH 80 1.71V~3.6V 550MHz LQFP-100(14x14) Microcontroller Units (MCUs/MPUs/SOCs) ROHS
Typical and maximum current consumption should be in the 150-250mA. This looks OK for the SY8088 that can deliver up to 1A
First tentative BOM:
I will log progress, questions and so on here.
Best regards,
JMF
For active speakers, all DSP can be now done in the Host (Rpi with CamillaDSP, Windows), but are not that many options to output those multiple channels to DAC or amplifiers. So the objective is to provide an open "simple" USB to 4xI2S, so 8 channels, implementing UAC2 in Asynchronous mode.
I nthe end it looks as a simplified version of https://www.minidsp.com/products/usb-audio-interface/mchstreamer-lite (which I was not aware of when I started the project).
PCB will be designed with KiCAD. HW design and source code will be in Github at the end.
The project is strongly inspired from: https://www.diyaudio.com/community/threads/open-sourced-uac2-bridge-based-on-stm32.404656/ (credits to @slerpxcq) and will be based on a stm32 processor.
I want to keep it a simple device to ensure that the project will succeed (and avoid fitting all possible functions). Clear and realistic use cases are the key.
I'm not a pro and I'm a slow doer... so this is not for tomorrow ;-)
I'm missing many skills in hardware, so all advices are welcomed to achieve a sound design.
Specifications:
- One board USB to 4xI2S,
- then possible expansion boards (as examples ; connected with flat ribbon cables):
- 4 optical Toslink,
- 4 SPDIF
- 8xchannels DAC SE (ES9080 ; my personal objective),
- 8xchannels DAC Balanced (2xES9080)
Specs of the USB to 4xI2S board:
- USB 2.0 HS with UAC2
- Asynchronous feedback
- To 8xI2S or 8xSPDIF 24-32 bits up to 192k
- Connector identical or inspired from https://www.minidsp.com/products/usb-audio-interface/mchstreamer
- Audio Frequencies crystals for 44.1 and 48k audio families (TBC)
- few (ex 5x) Digital IO
- 1xAnalog input
- 1 or 2 xI2C (to possibly control connected devices like the ES9080 which is my primary objective)
- Serial line
- 1 or 2 xLed
- Powered from USB
- Exports 5V (and 3.3V) to Expansion boards?
Proof of concept working with stm32F746 Disco board:
- at 200 MHz
- Using For Stm32F7 test code for 192k 32bits: RAM: 140Ko and Flash: 108Ko
In assembly perspective, source as many as possible components from JLCPCB (preferably Basic components)
On JLCPCB, there is a large choice of stm32H7 at reasonable prices (simlar to F4 and cheaper than F7). They offer higher process power. Interesting references:
STM32H723VGT6 MFR.Part # STM32H723VGT6 Package LQFP-100(14x14), Description 1MB 564KB FLASH 80 1.71V~3.6V 550MHz LQFP-100(14x14) Microcontroller Units (MCUs/MPUs/SOCs) ROHS
Typical and maximum current consumption should be in the 150-250mA. This looks OK for the SY8088 that can deliver up to 1A
First tentative BOM:
- STM32H723VGT6 (MFR.Part # STM32H723VGT6 JLCPCB Part # C730142)(4.8$ extended)
- USB Phy USB3300 (USB3300-EZK-TR (MFR.Part USB3300-EZK-TR JLCPCB Part # C108383) (1.2$ extended)
- TYPE-C-31-M-12 (MFR.Part TYPE-C-31-M-12 JLCPCB Part # C165948) (0.2$ extended)
- USBLC6-2SC6 Manufacturer UMW(Youtai Semiconductor Co., Ltd.) MFR.Part # USBLC6-2SC6 JLCPCB Part # C2687116 (0.03$ extended)
- SY8088IAAC (Manufacturer Silergy Corp MFR.Part #SY8088IAAC JLCPCB Part #C479072 (0.05$ extended)
- Crystals NZ2520SDA for both sampling frequencies families (Digikey)
I will log progress, questions and so on here.
Best regards,
JMF
Even if not finished, to prepare the MCU configuration and pins layout, I share main ideas below. Feedback welcomed:
For clock frequencies like those targeted for stm32H7, it seems preferebal to implement a 4 layers PCB than a 2 layers one, from EMI perspective. High speed tracks need specific attention.
- SYS
- The USB needs a precise clock, which can't be achieved alone by the internal HSI oscillator, as it is not precise enough. The stm32H7 has a clock recovery system, CRS, to calibrate the HSI with the SOF signal. But it looks safer to use an external oscillator, as in the Nucleo board.
=> External 8MHz HSE, for a 544 MHz system clock - No LSE, will use the LSI
- CRS disabled
- Audio Clock Input (I2S_CKIN)
- Power parameters TBD?
- Time base on TIM6 as using USBX which needs Systick. Check clocking scheme for TIM6 for that purpose
- The USB needs a precise clock, which can't be achieved alone by the internal HSI oscillator, as it is not precise enough. The stm32H7 has a clock recovery system, CRS, to calibrate the HSI with the SOF signal. But it looks safer to use an external oscillator, as in the Nucleo board.
- Debug
- Trace Asynchronous SW <=> SWD + SWO for traces output
- USB_OTG_HS:
- Externel Phy - Device Only
- Activate_SOF unchecked (TBC). No use of SOF out of the stm32H7. The captures for the feedback values are done internally
- Activate VBUS is disabled as the board will be powered by the USB (AN4879 section 2.6). (TBD: as ULPI is used, no need to take care of requirements listed in https://community.st.com/t5/stm32-mcus/management-of-vbus-sensing-for-usb-device-design/ta-p/49485
- (TBC: no alternate pins for USB periph to UPLI connection)
- SAI (SAI1 and SAI4):
- The SAI clock will be generated from dedicated audio frequencies crystales through I2S_CKIN
- SAI will be possible to configure as:
- Either SAI1_A master with master clock out, SAI1_B Synchronous slave, External Synchro out (to control the SAI slaves), SAI4_A Synchronous slave, SAI4_B Synchronous slave,,
- Or 2xSPDIF each (total 4 SPDIF)
- TIM2
- Counting will be done on the Audio master clock, for best precision
- For the stm32H723, TIM2 can be synchronized to USB_OTG_HS_SOF and ITR5,
- On SOF, the capture function will be used and the Timer will be reset,
- Reset mode,
- Clock source = ETR
- Channel1 Input capture triggered by ITR5 (USB SOF)
- Check what is CubeIDE option "use ETR as clearing source"?
- I2C2:
- to be on opposite side compared to most USB ULPI pins
For clock frequencies like those targeted for stm32H7, it seems preferebal to implement a 4 layers PCB than a 2 layers one, from EMI perspective. High speed tracks need specific attention.
I'm working on the schematic:
Open questions:
Power section:
I consider an I2S/TDM header and a Misc header:
I2S/TDM:
Misc Header:
Open questions:
Power section:
- Primary design is for the board to be powered by the Host USB. The board won't perform D/A and have an Analog section => Is it needed to implement the possibility of an External 5V for the board? For which purpose?
- On open-sourced-uac2-bridge-based-on-stm32, the power section is based on a SY8088 DC-DC step down converter to deliver the 3.3V from the USB 5V. What would be the reasons not to use a simpler fixed 3.3V LDO like TLV1117-33 or AMS1117-33? (ex the coreh743 board uses an AMS1117)
I consider an I2S/TDM header and a Misc header:
I2S/TDM:
- Dupont 2x4 2.54 pitch connector for I2S and I2C
- 1 MCLK out ; 2 BCLK
- 3 LRCLK ; 4 I2S data out 1&2
- 5 GND ; 6 I2S data out 3&4
- 7 I2S data out 5&6 ; 8 I2S data out 7&8
Misc Header:
- Dupont 2x2 2.54 pitch connector Power (or 1x3):
- 1 5V Out ; 2 GND
- 3 3.3V ; 4 GND
- 5 I2C SCL ; 6 I2C SDA
- 7 I/O ; 8 I/O
- 9 I/O ; 10 I/O
- 11 I/O ; 12 I/O
IME external 5V is not needed. Linear 3.3V regulator is fine but I would use something better than AMS1117. E.g. TPS7A20 or NCV8165.
Unless you include RF connectors for I2S (e.g. U.FL) I would use the second row of I2S pin header for GND. In this way flat ribbon cable would have GND wire between all signal wires. But this would require 2x7 pin header.
Unless you include RF connectors for I2S (e.g. U.FL) I would use the second row of I2S pin header for GND. In this way flat ribbon cable would have GND wire between all signal wires. But this would require 2x7 pin header.
Thanks for the feedback Bohrock. Using a a better LDO would be to reduce noise on the crystals for the audio clock and possibly the I2S lines? I believed (which may be wrong) that this use case was not very sensitive to noise. I would be happy to learn.
By the way, for your similar boards, do you use 2 layers or 4 layers PCBs?
JMF
By the way, for your similar boards, do you use 2 layers or 4 layers PCBs?
JMF
I had a read to the discussions in https://www.diyaudio.com/community/threads/es9038q2m-board.314935/page-399 (and following pages) about the clocking possibilities for the Master Clock. Markw4 advocates a dedicated crystal near the DAC. In my case I always thought about putting the effort upstream on the stm32 and I'm following your advice of 2x good audio freq crystals to clock the SAI's.
What are the conditions to make this worthwhile and not have a too degraded MCLK reaching the DAC, so that the result is "similar" to having dedicated crystal near the DAC?
What are the conditions to make this worthwhile and not have a too degraded MCLK reaching the DAC, so that the result is "similar" to having dedicated crystal near the DAC?
I'm finalizing the schema for the board, trying to define references/requirements on most components. There are not so many, but I could not dedicate much time over the last weeks. And some effort went on understanding better the requirements for the HSE oscillators. Seems being half quite stringent with many requirements to check, and half "cooking" because of several uncertainties on significant parameters. I imagine that best is to go with components used already on ST H7 boards... of use HSI with CRS (Clock Recovery System), to calibrate the HSI with the SOF signal for the USB peripheral.
Still hope to upload a schematic soon.
Still hope to upload a schematic soon.
Hi,
I attach a v0_1 of the schema and the BOM. There is still work needed for the HSE crystal part, check if possible allocation of the alternate pins for PCB routing, adding few LEDs...
Comments very very welcomed 🙂
JMF
I attach a v0_1 of the schema and the BOM. There is still work needed for the HSE crystal part, check if possible allocation of the alternate pins for PCB routing, adding few LEDs...
Comments very very welcomed 🙂
JMF
Attachments
I did some quick simulation on JLCPCB, and the PCB and assembly should should be in the range of 20€ per board, for 5 boards:
This would give a sort of "Open multi-channels audio digital SOM" with stm32H7 MCU, USB HS, 2 SAI (could be 4 with another MCU), 44.1 and 48k good crystals for about 30€.
Does it looks interesting to you?
JMF
- if it can fit on 50mmx50mm 4 layers PCB (not sure),
- including shipping and taxes,
- but excluding the 2 audio NDK crystals. Both of them should be avaialble through a different circuit (you buy the parts through them, they store them and you can use for your assembly. They charge about 4€ each, and min quantities have to be checked.
This would give a sort of "Open multi-channels audio digital SOM" with stm32H7 MCU, USB HS, 2 SAI (could be 4 with another MCU), 44.1 and 48k good crystals for about 30€.
Does it looks interesting to you?
JMF
I have to decide between:
1) Go the PCB Assembly route for at least 5 boards, keep one and ship other 4 to persons interested in EU (too expensive and difficult otherwise) for board cost+shipping to EU (as first batch, there are risks on operation, but careful reviews and factory assembly should limit those)
2) Build manually the prototype for 1 board,
3) Stop the project as not enough interest for this type of device in the community.
Hence the question:
Are some of you interested by one board, for board cost+shipping to EU ?
Scope of the project described in #1
JMF
1) Go the PCB Assembly route for at least 5 boards, keep one and ship other 4 to persons interested in EU (too expensive and difficult otherwise) for board cost+shipping to EU (as first batch, there are risks on operation, but careful reviews and factory assembly should limit those)
2) Build manually the prototype for 1 board,
3) Stop the project as not enough interest for this type of device in the community.
Hence the question:
Are some of you interested by one board, for board cost+shipping to EU ?
Scope of the project described in #1
JMF
I'm interested in one, maybe two boards ... on the assumption that the boards are
- USB powered
- have clear facility connection to SPDif / AES connectors (raw i2s looks a bit tricky for me) ... am I right in thinking the plan is for daughter boards
The board is intended to be powered from the USB. The stm32 SAI peripheral can be configured to output in SPDIF format. I already did it in a past project, with only a cap-resistor-cinch. It seems that TOS link is also easy as there are modules for that that can be easily interfaced to the stm32. I don't know for AES.
The issue for shipping out of EU, on top of the substancial shipping fees, is that it needs custom declarations, which are not obvious to do for me, and possible cost/issues at reception. I imagine that it could be sent as "letter" but with the risk that it could be intercepted and pushed in the big administrative machine... Looks painful and risky :-(
JMF
The issue for shipping out of EU, on top of the substancial shipping fees, is that it needs custom declarations, which are not obvious to do for me, and possible cost/issues at reception. I imagine that it could be sent as "letter" but with the risk that it could be intercepted and pushed in the big administrative machine... Looks painful and risky :-(
JMF
So, decision is to go for "2) Build manually the prototype for 1 board". This board will allow to confirm all design choices and corectness. I'll try to fit on a 50x50mm 4 layers boards to keep JLCPCB costs downI have to decide between:
1) Go the PCB Assembly route for at least 5 boards, keep one and ship other 4 to persons interested in EU (too expensive and difficult otherwise) for board cost+shipping to EU (as first batch, there are risks on operation, but careful reviews and factory assembly should limit those)
2) Build manually the prototype for 1 board,
3) Stop the project as not enough interest for this type of device in the community.
Hence the question:
Are some of you interested by one board, for board cost+shipping to EU ?
Scope of the project described in #1
JMF
Browsing the different tutorials, it seems that for prototyping a stencil would not be mandatory. PCB alone are significantly cheaper than with the stencil.
The 50x50mm size is probably not worth pursuing at JLCPCB as the savings for 5 boards are about 5 EUR total. Stencils are expensive and not necessary especially in prototyping phase as layout changes may render the stencil useless.
Thanks you bohrok2610 for the advices and confirmations. They are very useful as always.
I would be very happy to have your feedback on the audio oscillators part in the schematic: dedicated LDO ok? Needs resistors to the MCU? Can I use the board GND? Other?
Best regards,
JMF
I would be very happy to have your feedback on the audio oscillators part in the schematic: dedicated LDO ok? Needs resistors to the MCU? Can I use the board GND? Other?
Best regards,
JMF
I2S MCK sent to dac should be the audio clock, not the generated SAI MCK. You should add a 1:2 clock buffer after audio clocks (e.g. LMK1C1102) so that one buffer output goes to MCU and the other to dac via pin header. Without isolators on I2S/I2C there is a risk of passing ground noise to dac but isolators are not trouble-free either. Easiest to start without isolators.
Thank you for the advice. I imagine that it is to keep MCLK sent to DAC as "pure" as possible.
In the case of the ES9080, there seems to be constraints on the ration between the MCLK and the Sampling Frequency, that would require a lower frequency MCLK for 44.1k and 48k, which would need a mean to devide the MCLK frequency. Using the SAI one would be a way to proceed. I'm not at ease with high speed signals. Can I put a jumper upstream for the MCLK out to the DAC to allow to select either the oscillator or the SAI MCLK? or is it a NO GO at 49MHz?
In the case of the ES9080, there seems to be constraints on the ration between the MCLK and the Sampling Frequency, that would require a lower frequency MCLK for 44.1k and 48k, which would need a mean to devide the MCLK frequency. Using the SAI one would be a way to proceed. I'm not at ease with high speed signals. Can I put a jumper upstream for the MCLK out to the DAC to allow to select either the oscillator or the SAI MCLK? or is it a NO GO at 49MHz?
It is better to send audio clock as is and use clock dividers on dac via I2C. In ES9080 clock divider is set in register 3.
- Home
- Source & Line
- Digital Line Level
- STM32 USB to I2S multi channel - Hardware part