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.
In summary:
Switching | Reg8: Source |
Reg17: Auto SPDIF |
Reg18: MUX |
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.
Thanks so much for sharing! is it possible to assign the function of the push button of the rotary encoder, to the menu button on the apple remote ?
Yes it is, when I get home I’ll post something
The code section is probably a bit long to put here, so I will try a different approach. In Void Loop, you need to copy the code that is below; if((digitalRead(SELECTPIN)==LOW)&&((millis()-debounceMillis)>INTERVAL_SWITCHBOUNCE)) {
and above
}
// For the rotary encoder. The control depends whether in display mode or select mode
if(rotating)
and put it in the Case statement that contains the Menu Button code. I hope that makes sense. You will then use the Menu button to get into the selection mode & cycle through the sections & the rotary encoder to toggle between selection choices.
could you please identify the Case statement that contains the Menu Button code?
i created a case 1: and removed the debounce,
then i was able to toggle the select mode with the remote, i will try to adjust your code to use the left and right buttons tomorrow
You could also use an I2C isolator like you recommended to me for my LCD piggyback controller solution. That way the DAC will also benefit from it by keeping the uC’s noise away.
In this case, since it seemed the I2C noise was coming from the DAC (or the I2C communication was corrupted near the DAC), the isolator may or may not work. But using an isolator is always a good idea…
Can you help me to implement in the DAC32 code the change of phase and filter change ?
in-phase
write_ext_eeprom(13,0b11111111);
write_ext_eeprom(19,0b11111111);
out-phase
write_ext_eeprom(13,0bxxxxxxxx);
write_ext_eeprom(19,0bxxxxxxxx);
Hi,
This may help:
Register 13
DACx Polarity
Defines the polarity of DACx relative to its input. This may sound obvious but it is not so obvious if the input of a DAC is internally remapped to take its input from another DAC. When the input is remapped, the phase applied propagates to the other (remapped) DAC. This has the following implications:
– When using “in-phase” then there is nothing to worry, all dacs whether with inputs remapped or not will all be in-phase
– When using “anti-phase”, then the phase is also propagated to the remapped DAC so that the phase setting in the remapped DAC is also applied to the propagated phase
Example: In register 14: remap the source of DAC3 to be DAC1. In register 13: set polarity of DAC1 and DAC3 to be “anti-phase. The output of DAC1 will be “anti-phase”; the output of DAC3 will be “in-phase”: the anti-phase from DAC1 has been propagated to DAC3 and DAC 3 applied “anti-phase” to “anti-phase” resulting in “in-phase”
Register 19
DACBx Polarity. Register 19 is used in conjunction with register 13
Defines the polarity of DACBx in relation to DACx (thus it does not define absolute polarity). In normal operation, all DACBx should be in anti-phase relation with DACx Thus:
– If DACBx is set to “anti-phase”: flipping the polarity of DACx will automatically also flip the phase of DACBx
– If DACBX is set to “in-phase”: DACBx will always follow the polarity of DACx
You can send me mail at hifiduino *at* Yahoo *dot* com
Hifiduino give me your email
Hi,
I try the new code in dual mono setup, there is only one problem about sample rate display.
Now the ‘ nominal sample rate’ show half value half than former version.
How about the exact rate?
I checked the exact rate.
Now I play DSD256 file with synchronous clocking dual mono,
the exact rate shows ‘121xxxxx’ to ‘125xxxx’.and a number is
displayed by the left of ‘PL’.
so, sum ‘the exact rate’ and the number displayed by the
left of ‘PL’, ‘real’ sample rate is not wrong, I think.
Oh, I found the HIFIDUINO code is limited by DSD6.1 MHz.
So, the sample rate display is no problem, sorry.
I will upgrade the code when I get a chance to test higher frequency DSD. The number displayed at the left of PL is just the line overflow when the number is larger than the available space. Thanks for reporting…
Should the code be remembering what input was selected, so that when you turn the dac back on you are still on the previously selected input?
It does…
Hello,
My 2nd hand BIII is arrived and I’d like to use HIFIDUINO, but I’ve one question: how I must wire the board for the “SMART INPUT SWITCHING”.
Where I can find an electric schematic of the connections?
Thanks
Guglielmo
Found!
Thanks
Guglielmo
Good. I admit it is not easy to find information in the blog because it already has over 200 posts. The best solution, even for me is to use google to search the keyword plus the word “hifiduino” for example “hifiduino smart swtiching”
Can you please explain what the Notch filter is suppose to do & which setting you have found to be the best.
I have no idea. The only reference I’ve found is this: http://www.diyaudio.com/forums/digital-line-level/117238-ess-sabre-reference-dac-8-channel-79.html#post1520837
”
Hey guys,
I have a couple DACs running now (and 4 different I/V stages so far), so I can A/B pretty easily.
I can’t really tell much difference sound wise between 6-bit/true differential, and 9-bit pseudo differential. That is to say they both sound great, but that’s not the end of the story. The HF noise coming out of the DAC in 6bit mode is noticeably more than it is in 9 bit mode. And this does not seem like a small amount either.
One other note. In 6 bit mode to get the best performance you should use the n/64 notch delay.
What I have noticed, is that in the 9bit(pseudo differential) mode that DAC output seems to require less filtering while still sounding very sweet. The amount of digital garbage(quantization noise I guess) that makes it out of the analog inputs seems to be much reduced.
Running the analog section with a less aggressive filter has some nice benefits (better slew rate etc) to the final audio.
If you plan a little you can use the output impedance of the Sabre to your advantage. You can create a low pass RC filter to the input of a fully differential output stage. I have had my best sounding results so far using this scheme. It results in a not exactly orthodox I/V scheme, but it is a very effective one and it keeps the components in the signal path to a minimum.
One thing is for sure, you must filter out the quantization noise. This DAC requires more attention at the I/V stage than a PCM1794A to be sure. This is especially true in the stereo mode!!! 4 times the noise per channel, and unfortunately its not all common mode.
Cheers!
Russ
“
Thanks
I looked around and couldn’t find anything.
I was wondering what your preferred filter settings are for the Amanero?
Can’t really tell (with my ears). Right now I up-sample to 192K in the computer (which means I like those filters instead of the filters applied to the 44.1k sample rates)
Yer sorry I should have been more specific, it made sense when I typed it. I meant the filter setup for the BIII/BII that you use with the Amanero, DPLL FIR etc
yes, that is what I understood. The FIR filters are different for different sample rates, those I can distinguish, but within a sample rate, I can’t hear differences (or not tried hard enough) between the different filters.
With the Amanero I have to set the Oversampling to off to stop the dropouts, is this normal?
I then realised that the Oversampling doesn’t stay set for each input, should it?
I need the Oversampling on for the SPDIF input or I get no signal at all.
Ok so the codes not suppose to save the oversampling setting against each input, finally worked that out.
Is it normal for the Amanero to need the OS off?
Why would you normally turn the OS off?
OS off would be used if your clock cannot handle input sample frequency such as 352K. However OS off with lower sample rates sound horrible (looses all the HF content). It kind sounds right with high sample rates, but I have not listened carefully. I leave it ON all the time…
Yes I assumed you left it on given the Default thing. I’m not sure whats causing the dropouts. I can’t really tell sound quality yet as I’m playing through a couple of drivers I had laying around.
Can you let me know how to make the ‘smart wiring’ on $99 ES9018 DIY DAC BOARD?
Some of the inputs are tied together. You need to cut the traces first to allow access to each pin.
I would like to bring attention to two code items.
In the handling routing for the rotary encoder, the code does not use constants for pins, i.e. (“if (digitalRead(4) == digitalRead(2)” should be perhaps “if( digitalRead(VOLUPPIN) == digitalRead( VOLDOWNPIN))”.
The variable ‘rotating’ should be declared volatile and access to it in the ‘loop’ should be within a block with disabled interrupts, i.e.
uint8_t oldSREG = SREG;
noInterrupts();
int localRotating = rotating;
SREG = oldSREG;
if( localRotating){
…
oldSREG = SREG;
noInterrupts();
rotating=false; // Reset the flag
SREG = oldSREG;
}
The interrupts changes are based upon Nick Gammon material at http://www.gammon.com.au/forum/?id=11488
I’m running both of the above changes
hi GLT,
thanks for sharing the code.
I’m using 11f version and cannot put spdif input with over sampling bypass the result always mute. But for USB input (amanero, playing dsd) I can use oversampling bypass…
Could be a limitation of the chip. Are you using 192KHz spdif source? The datasheet says it needs external 8x oversampling if the internal OS filter is bypassed
Hello GLT,
I made the dual mono configuration in 11f software version, but I need to have a dual stereo. Any suggestion how to change the code for that. Here is the explanation of the problem I have:
Now that both DACs are in mono mode, my crossover software (Pure Music on Mac) does not allow a single channel assignment, it is always in pairs. I am sending 4 channels to DACs (USB to I2S converter with 4 channels} and in software, channels 1 and 2 are always, lets say low pass and channels 3-4 are always lets say high pass. Now in dual mono I will have only two low pass signals from left channel and two high pass right channel signals. Obviously I need Low pass and High pass from each channel.
Is there possibility to have a dual stereo configuration in your code? When I was trying to use just a stereo configuration, code controls only one DAC and not the second one, because it has to properly address the second one.
Any help is greatly appreciated
Thank you very much
AR2
Hello AR2, Please take a look at: https://hifiduino.wordpress.com/other/
It is based on an earlier version of the s/w, but fully functional.
Hello GLT,
Thank you very much! That did it. Works perfectly! I owe you a lot. I also looked at your code in 11f and found differences between the two, than replaced with dual stereo portions and it works perfectly. I will be happy to send you that code if you need – 11f Dual Stereo.
dvd labeling software
assistir tv online