New Version of Code
FULL SUPPORT FOR “SMART INPUT SWITCHING”
I finally tested the “Smart Input Switching” for the Sabre DAC as proposed here: [link] and implemented in QuangHao’s DAC-END R [link]. I connected the Amanero USB board and also a Toslink SPDIF source to the DAC, and had both sources live at all times.
The DAC-END R connects the Toslink through SPDIF #3 as shown in this diagram (borrowed from here: [link])
Had to fix the code in order to make it work. I discovered a couple of things on how the Sabre32 DAC chip behaves:
- When switching from SDPIF input to Serial input, it is not sufficient to switch the input format. One must also switch the SPDIF MUX to an input that does not have a live SPDIF signal (I switched it to SPDIF#1 which is shared with the I2S connections). If you do not do this step, the status register will report an SPDIF data stream even though you are receiving an I2S stream, and the sample rate calculation will be completely wrong. However, this has no effect on the sound.
- “Auto SPDIF detection” must also be set in the registers when using any of the SPDIF inputs. It is not sufficient to just select the SDPIF input port. If you do not do this step, the DAC will not receive the SPDIF data stream.
||Reg17: Auto SPDIF
|SPDIF to I2S/DSD||I2S/DSD||Off||Select SPDIF #1|
|I2S/DSD to SPDIF||SPDIF||On||Select SPDIF channel|
The code shows the implementation and register settings. “Smart Input Switching” has great appeal because no additional components such as relays or solid state muxes are required resulting straight wire input for any of the sources.
CLEANER CODE FOR DUAL MONO
Recognizing that for the most part changes in register values for one chip in dual mono configuration are the same as for the other chip, I modified the register writing routines to write the same value to both chips even in dual mono. After all the values are written, register 17 is changed for “right channel” and the value is written to the RIGHT chip. This greatly simplifies the programming for dual mono configurations.
Note: not yet tested since I do not have a dual mono configuration.
CODE AVAILABLE IN THE “CODE” TAB
The code is available in the usual place.
NOISE IN I2C: ARDUINO FREEZES
When using the HiFiDuino controller with DAC-END R, I experienced the Arduino controller freezing shortly after power-on. Eventually I traced the problem to the I2C library code in Arduino, which freezes when there is noise in the I2C lines (the functions never return, hanging the micro controller). During experimentation, I tried different things:
- Added smaller pull-up resistors. This improves the I2C waveforms [link]. I used 1.5K pull ups
- Added bypass capacitors to the 5V and 3.3V right at the level shifter board
- At first I forgot to ground the DAC chip reset line. So I grounded the reset line
- Twisted the I2C lines for noise immunity
…but the improvement were very small. The controller would still freeze a few minutes after power on.
It turned out that the noise was caused by the I2S wires crossing the DAC chip as shown in the photo below. The bitclock is twisted with the ground wire, but the data and LRCK lines are just twisted with each other. Another confirmation that it is a good thing to shield the DAC as I previously discovered [link]
Proper wiring is (as usual) required for proper operation.
Even after uncovering the problem, the above enhancements to the I2C lines (pull-up, bypass, etc) are still worthwhile to do to ensure clean I2C signals.