I2S switch with SN74HC157N

I have tried to design an i2s-swtich using SN74HC157N. I can switch between inputs but it is terrible backgound noise. So bad I can hardly hear that it is music there... As source I have Raspberry Pi and it sounds good when I connect it directly to DAC.
Originally I had the GND going thru the SN74HC157N, but I saw a switch on Internet where GND had a separate line outside the SN74HC157N so I tried that. No improvement. 🙁
I also tried to feed the SN74HC157N with battery. The Raspberry still have its original power supply but will be changed in the future. As the Raspberry sounds good when I connect it directly to the DAC I am thinking the power supply is not the issue.

On the same PCB I have the analog output from the DAC. I am thinking about trying to have separate PCBs for analog and digital. One reason is to get bigger space between the digital and analog signals, but it would also be easier to place inside my preamp. Before I order those PCBs I am asking for some advice:

EDIT:
//
I forgot to say I have seen schematics with and without 10k resistors between inputs and GND. What I have drawn is without this resistor.
//

1. Have anyone used SN74HC157N for i2s-switching audio and does it work as intended? If so, any ideas why mine sound that bad?

2. Schematics seems pretty easy, but do anyone have schematics to share? (I have made my own but it is not easy to follow from a screenshot as it is now included in bigger schematics.)

3. I am planning to have 3 inputs so I have drawn the outputs from one of the SN74HC157N to the input of the next SN74HC157N. Will it be ok to put the signal thru two SN74HC157N?

4. Any other suggested solution for switching thre i2s- input signals?

Cheers from Sweden.
 
Last edited:
I've used 74HC157 for switching between I2S sources (S/PDIF and USB inputs) and didn't experience any problems.

Without seeing your schematic I don't know why yours would sound bad. What power supply voltage are you using?

To switch between three I2S inputs it might be better to use a couple of 4way muxes, something like 74HC153.
 
UV101:
If I wire directly from Raspberry to DAC the preamp sounds good.

abraxalito:
I will try to clean up my schematis so I can post screenshot. 🙂 Nice to hear it worked for you. Meanwhile, here is maybe a better explanation

i2s-signals:
*I run BCK (1A/1B, out on 1Y), LRCK (2A/2B, out on 2Y)and DOUT(3A/3B, out on 3Y) from the Raspberry thru the SN74HC157N. Now when I am testing Raspberry is connected to the B-inputs. Nothing connected on the A-inputs. Y-outputs goes directly to DAC
*GND I am pulling seperatly with a wire from Raspberry to DAC.

Logic:
*VCC on SN74HC157N is connected to +5VDC. From the VCC-pin I have a 100nF to Ground/0VDC. I have tried a Raspberry Pi original power supply and a battery, no difference.
*GND on SN74HC157N is connected directly to Ground/0VDC.
*A/B is connected to the same +5VDC as VCC but thru a switch. It also have a pull-down-resistor of 220kOhm. Without a pull-down-resistor I cannot switch but I havnt tried different values of the resistor.
*G is connected to Ground/0VDC. I have tried both directly to Ground/0VDC and with a resistor.
 
I designed and built a 4-channel i2s switch with 74LVC125APW, operating off 3.3V supply, and it worked with no issues, up to 12.288MHz BCK at 192KHz sample rate. Did not test at higher sample rates.
PCB layout was done to minimize the physical size of the three common nodes by placing the three 74LVC125APW on opposing sides of the PCB. It is a 4-layer design.
Screenshot_20220818-073251.jpg


All input and output pins of 74LVC125APW are fitted with a 47K pulldown resistor, not shown in the above.
 
Connecting 'Y' signals (Y indicates an output) together is going to lead to trouble when they're neither open collector nor tristate output types. On HC157 they're just normal logic outputs. If you replace your HC157s with HC125s you'll be fine with tying outputs together.
Thanks, I will look into that. As a note I only had one Y as output earlier as it felt the safest, but I saw a solution where several Y where connected. Now I know I need to watch out. 🙂

bohrok2610:
I do, but I have a 6-way selector that also controls 5VDC relays. If I am to use 3.3VDC "all the way" I need to redesign that part also (wich today works perfect) or add more components. I will consider it though and thanks for the input A/B should not be higher than VCC.
 
I do, but I have a 6-way selector that also controls 5VDC relays. If I am to use 3.3VDC "all the way" I need to redesign that part also (wich today works perfect) or add more components.
I'm not sure I understand. What does 5VDC relays have to do with I2S levels? Your Raspberry has 3.3V GPIO as well as 74HC157 with 3.3V VCC and your DAC. So no need to change the relays or your selector as 5VDC is for the relay coil only.
 
I'm not sure I understand. What does 5VDC relays have to do with I2S levels? Your Raspberry has 3.3V GPIO as well as 74HC157 with 3.3V VCC and your DAC. So no need to change the relays or your selector as 5VDC is for the relay coil only.
I am considering changing logic, but this is about how I have it now (a bit simplyfied drawn here though).
Relay_1: RIAA
Relay_2: AUX
Relay_3: Analog from DAC
i2s: Chose i2s-input
Relay_4: Relay to control an external board for CD/DVD.

As I had 5VDC anyway for other things and to make use it does not draw to much power I made it like this. Raspberry is only one of the i2s-sources I have. I could use the 3.3v from Raspberry but then it needs to be powered on even if i listen to CD.

I am not sure I thinking correctly now, but maybe it would be easier if I used negative logic all over instead?

1660916069243.png
 
I was only talking about Raspberry I2S levels. What I mean is that if you make the change in post #12 that does not mean you have 5V at A/B if those are coming from Raspberry since Raspberry uses 3.3V levels on I2S/GPIO. Don't know if your other I2S sources are using 5V levels. Nowadays those are quite rare.