EEVblog Electronics Community Forum
Electronics => Beginners => Topic started by: digik on October 14, 2022, 12:00:49 pm
-
just a very simple question: is possible to connect two ADC just by wiring the i2s wires in parallel, so that you can mix two input audio signals?
-
It depends on the specific devices and your setup. Often I2S devices would have a separate input that defines if they should respond in a left or the right channel slot. Sometimes for more complicated devices there is a separate I2C configuration channel where you can select the channel for each device.
-
The question wasn’t about selecting, but mixing, and there’s not a snowball’s chance in hell you can do that by just paralleling two signals onto one input.
-
Well, yes, If by "mixing" OP means actual audio mixing into one channel, then there is no chance of doing that just through an electrical connection.
-
You should read about PCM time slot functionality.
-
by mixing I mean adding another analog input to an existing i2s system. I din't want to play both sources simultaneusly of course
-
FYI, at least in English, “mixing” is the word that specifically means (at least in the case of audio) playing multiple sources at the same time, as opposed to selecting.
-
so, will it work?
-
You still can't just parallel everything. You would need to switch the data line from two sources. Everything else can be parallel, since they all are inputs for the ADC.
-
will a simple dpdt relay do the job?
-
Yes, sure. But that also assumes that both ADCs are configured the same way (number of channels, bit depth).
We may be able to help you better if you actually describe what you want to do.
-
assuming that they are not, i will then need to switch everything with a 3 pole dt relay
-
I2S is not a universal interface. Transmitters and receivers must have the same configuration. If your other source is not the same, then there is nothing you can do without also reprogramming the receiver.
-
ok so i want to use one of that cheap pcm1802 module to add an aux in input to an existing car radio that does not have it. Those module seems quite universal. But I don't know how the receiver is configured an it's quite difficult since there is no service manual available. maybe whit those universal modules a little bit of trial and error would help?
-
PCM1802 implements a subset of all possible I2S configurations and even then you can see that there is a number of modes and data formats that can be configured. In order to make any progress you would have to figure out what format is used by the radio and see if it matches anything that PCM1802 supports.
But also, how would you even find I2S interface on the radio? Is there even one? Why does car needs existing I2S ADC if there are no inputs?
If you can identify any analog input, it is far easier to mix at the analog level.
-
the tuner is connected to the receiver via I2s. i want to connect my adc between tuner and receiver so that i can switch my analog aux in when i need. I know that there are easyer ways, but I don't want to loose tone controls and fader
-
Your first step would be to identify parameters of the existing interface. You would need to capture the data using a logic analyzer or a scope. Master clock in I2S can be quite high, so cheap logic analyzers may not sample it correctly, but all you need from it is measure the frequency roughly. It would be some multiple of the WS clock, typically 256*WS, but other values are used as well.
After you know parameters of the existing system, you will know if PCM1802 can match that and what settings need to be used.
-
you said that the module can handle all possible combinations, so it's just a matter of trying before finding the correct combination. I don' t have logic analyzer or oscilloscope
-
I never said that it can handle all possible combinations. I said that it can handle a subset.
How do you even know they use I2S? Have you identified the connections and how they map into I2S signals?
You can try, but without any equipment there is a good chance you will break something before you get anything to work..
-
the amp chip is an ST FDA450LV. the datasheet is here: https://datasheet.octopart.com/FDA450LV-STMicroelectronics-datasheet-16347043.pdf. The amp takes only digital input, so this is why I have assumed that the tuner is (must be) i2s. it says that is "configurable via i2c bus" what does it mean? do I have to program it via pc? is this the (squalid) future of audio technology? I just want to add an aux in so i can connect everything I want
-
I2C bus configures the modes of operation. This is something main MCU in they system would use to configure the chip on power up. This would include configuration of the I2S/TDM interface.
Your ADC would need to take I2S-CLK and I2S-Sinc signals and it would output the data, which you need to connect to the I2S-Data1 amd/or I2S-Data2 instead of the original source. Your ADC needs to be connected in a slave mode and you would have to guess on the frame format.
One huge issue here is that PCM1802 needs the system clock (SCKI input), which must be 256*fS, 384*fS, 512*fS, or 768*fS. And this DAC does not use system clock, so it would not be present anywhere on the master outputs. This is something that is not easy to solve.
-
and so this is the future apparently. everything is just a piece of code, either a 0 or 1. no customization possible: your car manufacturer decides what inputs you will have and there's nothing you can do. a classic analog input is unbeatable in terms of flexibility and quality, but suddently someone decided that it has to go. I will certainly try to make my adc work and if not i will opt for another adc. any suggestion?
-
Yes, the future is digital because it is objectively better. Customization is possible, it just involves digital mods rather than analog ones. And from my perspective it is far easier to do a digital mod. But this has nothing to do with your car/radio vendor deciding to not put analog inputs. This is just a bad design and vendor to be avoided in the future.
Most devices will need the master clock. This DAC is sophisticated enough to generate its own. I personally would use a small micro to fake this clock based either on the serial clock, or just free-running clock of a necessary frequency. But I also would start from getting a logic analyzer and learning more about the system I'm trying to mod.
You would probably need a micro anyway to control the switching logic. Using long wires to mechanical switches is not the best idea.
-
and so this is the future apparently. everything is just a piece of code, either a 0 or 1. no customization possible: your car manufacturer decides what inputs you will have and there's nothing you can do. a classic analog input is unbeatable in terms of flexibility and quality, but suddently someone decided that it has to go. I will certainly try to make my adc work and if not i will opt for another adc. any suggestion?
Analog audio certainly does not surpass digital audio in general, it’s clear you don’t have much experience with car audio, because the automotive environment is an extremely noisy one, electrically speaking, and getting clean analog audio was often quite challenging. It is really common to have to use isolation transformers to eliminate nasty ground loops, lest you get all sorts of noise (for example, buzzing that changes frequency with engine RPM).
I actually agree that the trend towards highly-integrated car audio systems makes aftermarket modifications very difficult. (For example, many cars now use the stereo system for the car’s various chimes, blinker clicking, and in a few cases even for active engine noise cancellation.) But in exchange, the stock car stereos have gotten much, much better. It’s rather surprising that it doesn’t have an auxiliary input, either as analog aux, USB, or Bluetooth.
What make and model and year is it?
-
sorry to bore all you guys again, but now that we are here can you explain me a little bit bettere what's the deal with this master clock.
You said "Most devices will need the master clock. This DAC is sophisticated enough to generate its own. I personally would use a small micro to fake this clock..."
If the amp is already generating is master clock WHY i would ever need another master clock in my ADC? does this mean that the master clock is required by both ADC and AMP?
I thought that an ADC was an "output only" device.
how do you know that the amp has his own master clock?
-
If the amp is already generating is master clock WHY i would ever need another master clock in my ADC? does this mean that the master clock is required by both ADC and AMP?
All devices in the system need this clock one way or the other. It is very typical to just get it from the master/controller device.
I thought that an ADC was an "output only" device.
It still needs external high speed clock to operate.
how do you know that the amp has his own master clock?
Because there is no input for it according to the product brief.
-
I've found a board based on a WM8782 chip. It says that it has his own master clock, so no need of external sh*t to generate his frequency. But now I'm concerned for the fact that the amp supports also TDM i2s and I don't know if the radio sets the amp in TDM. Will it work anyway? (I think no).
BTW the fact that even an amp nowadays requires a mcu to operate is trurly scary. really, not good at all.
-
What are you trying to connect together? First you said ADC, then DAC.
You can only connect multiple i2s devices if they're receivers and have identical protocol, in that case yeah, they will simply receive the same data and generate the same output, no sense at all as you won't be mixing anything, the signals will be identical.
But mixing two digital streams together (Ex. from two ADC outputs) in an analog-like way where they will mix together? That would simply corrupt the data and generate unusable trash.
-
I have a car radio with a ST FDA450LV amp that accepts only digital input via i2s, so as i need a classic analog AUX in I want to add my own ADC that accepts my AUX in and outputs i2s that I intended to connect directly on the i2s via a relay to switch my aux IN or the defaut source. But apparently is not so easy as I tought. I need the same clock as the internal amp dac but I can't get it from it, so I need something external to generate it. Since I hate mcu and the simple idea that I MUST code to even run a fu**ing amp i'm now asking if the WM8782 board is good since it has his own master clock.
But as I said there is one more problem: the AMP also supports TDM i2s and I don't know if it's using it. So even if yes, will it work anyway with my adc?
-
I2S works at pretty high frequencies, forget about air wiring it over 1m like a simple analog audio, signal paths must be short.
You must isolate all i2s signals! MCK, BCK, LRCK and DATA!
They all are master signals coming from the MCU/ADC, connecting any from two masters would cause a collision.
Using relays won't be a good idea there, noisy and bulky, a better approach would be to use two 4066 cmos switches.
Did you read the complete fda450lv datasheet (https://datasheet.octopart.com/FDA450LV-STMicroelectronics-datasheet-16347043.pdf)? (ST doesn't have it for some reason)
As always, maybe yes, maybe not. The amp is not a simple receiver, it's i2c-configurable, so go figure what the master cpu does with it...
-
(ST doesn't have it for some reason)
The reason is that they don't want you to mod anything. Only the elected can insert in your car whathever he wants and you have no control over it, beside you have paid the product.
The amp is not a simple receiver, it's i2c-configurable, so go figure what the master cpu does with it...
We arrived at a point whare anyone except you can do whatever he wants with your products.
forget about air wiring it over 1m like a simple analog audio
never said that, all the wiring will remain short and inside the unit
anyway do you think is it worth a try?
-
You can always try disconnecting the i2s signals and wiring them to the ADC.
As far as I know, the cpu has no way of knowing whether the i2s signal is getting there or not.
It will just configure the i2c regs, then check there's no overload/clipping/etc whatever the i2c interface reports.
If you have a fast scope you could peek at the i2s signals to see the format, but needs to be able store the wave still, a simple analog scope will see chaos.
Depending on the DAC, it typically requires around 256-384 clocks per word, so for 44100*2ch it'll be around 22-33MHz.
For 48/96KHz/192KHz, it'll get up to 36/72/144MHz. I doubt a car stereo uses more than 44.1-48KHz but you never know :)
-
I have a car radio with a ST FDA450LV amp that accepts only digital input via i2s, so as i need a classic analog AUX in I want to add my own ADC that accepts my AUX in and outputs i2s …
I wish you’d share what car it is so we can learn more about its audio system.
Anyhow, are you even sure the amp is doing input selection? I suspect that it’s far more likely that the I2S stream is not coming from the audio source directly, but from a DSP that is doing source selection, volume control, sound adjustment (bass/treble, balance, etc), and mixing of sources (like navigation prompts, chimes, etc) before sending a “final” mix to the power amp.
-
I wish you’d share what car it is so we can learn more about its audio system.
it's a stupid mercedes but I don't know the exact model (one of the relatively new with those big ugly and useless displays, without AUX in). I have the stereo only
Anyhow, are you even sure the amp is doing input selection?
no, to be honest
I suspect that it’s far more likely that the I2S stream is not coming from the audio source directly, but from a DSP that is doing source selection, volume control, sound adjustment (bass/treble, balance, etc), and mixing of sources (like navigation prompts, chimes, etc) before sending a “final” mix to the power amp.
very possible.
-
You can always try disconnecting the i2s signals and wiring them to the ADC.
As far as I know, the cpu has no way of knowing whether the i2s signal is getting there or not.
It will just configure the i2c regs, then check there's no overload/clipping/etc whatever the i2c interface reports.
to be fair this is what I intended to do from the beginning, so a simple connection will work? But the clock must be always the same as the source?
-
Because there is no input for it according to the product brief.
and what does pin 53 (datasheet page 6)? It's a clock input, so why not just connect a wire from there to PCM1802 SCK and have the clock?
-
You could, but remember it's generated by the radio processor, it might stop when there's no audio playing.
-
You could, but remember it's generated by the radio processor, it might stop when there's no audio playing.
And how the hell would the processor know if there is no audio playing?
-
Because the processor is what makes the is2s signals in the first place, including that master clock?
And if for whatever reason it decides to disable the i2s peripheral that clock will probably fly away?
You'll have to check yourself.
Perhabs the i2s peripheral never stops and the mute is made by sending a "mute" command through i2c.
I very much doubt you'll find a service manual explaining anything at such low level.
Two years back I did something similar to my integrated multimedia system, can't be replaced because it controls everything, so I analyzed the tape & CD signals, reverse engineered them, made some truth tables and finally interfaced a bluetooth module using a blue pill board that also allowed me to use the native controls.
Took a loong time, but the wasn't much to do during the lockdown :D
-
I've found a board based on a WM8782 chip. It says that it has his own master clock, so no need of external sh*t to generate his frequency.
Where does it say so? It has MCLK input and the datasheet talks a lot about requirements for this signal.
But now I'm concerned for the fact that the amp supports also TDM i2s and I don't know if the radio sets the amp in TDM. Will it work anyway? (I think no).
2 channel TDM is compatible with I2S.
BTW the fact that even an amp nowadays requires a mcu to operate is trurly scary. really, not good at all.
You are easily scared. It is fine.
-
and what does pin 53 (datasheet page 6)? It's a clock input, so why not just connect a wire from there to PCM1802 SCK and have the clock?
Because this is just a serial clock, which is at a bit rate. You have to connect it for things to work at all. The master clock is typically 256 * serial clock, and it is a separate clock.
-
I wish you’d share what car it is so we can learn more about its audio system.
it's a stupid mercedes but I don't know the exact model (one of the relatively new with those big ugly and useless displays, without AUX in). I have the stereo only
Anyhow, are you even sure the amp is doing input selection?
no, to be honest
I suspect that it’s far more likely that the I2S stream is not coming from the audio source directly, but from a DSP that is doing source selection, volume control, sound adjustment (bass/treble, balance, etc), and mixing of sources (like navigation prompts, chimes, etc) before sending a “final” mix to the power amp.
very possible.
It’s from a late-model luxury car? Then it almost certainly has aux and USB inputs. They’re just not on the front panel, but rather somewhere else in the car. The inputs likely come in via the wiring harness, and it wouldn’t surprise me if there’s some kind of plug detection, such that those inputs only appear in the menus if something is actually plugged in.
-
Because this is just a serial clock, which is at a bit rate. You have to connect it for things to work at all. The master clock is typically 256 * serial clock, and it is a separate clock.
But the datasheet of PCM 1802 says that once you connect the SCK it will generate the clock "alone" via his internal oscillator
-
Yes, will take the master clock, then create the other clocks based on it.
But it doesn't contain any internal oscillator.
Watch the direction of SCK. Without SCK nothing will work.
-
But the datasheet of PCM 1802 says that once you connect the SCK it will generate the clock "alone" via his internal oscillator
Exactly. That's is the problem. Because all other devices you are considering need this clock. And the main MCU does not generate it, because PCM 1802 does not need it. So to make any other device you want to add work, you need to generate that master clock externally.
Scratch that, I'm confusing all the TI products here.
PCM 1802 has pin 15 (SCKI), which must be fed "System clock input; 256 fS, 384 fS, 512 fS, or 768 fS ". Where does it say that anything is generated internally? The word "oscillator" is not present on the datasheet.
The only thing it says that it will automatically determine if you are feeding 256, 384,512 or 768 * fS and add a divider.
-
The master clock is typically 256 * serial clock, and it is a separate clock.
and where should I feed in this separate clock if the pin 15 is already occupied by the SCK?
-
SCKI is the master clock.
The clock that goes to the DAC is BCK.
-
and what if I use this cheap board to generate the clock? https://www.aliexpress.com/item/1005003152118356.html?spm=a2g0o.productlist.0.0.1c3e606cpaeXYP&algo_pvid=6c1d7877-46c9-4c96-9c2a-7436d33b13f6&algo_exp_id=6c1d7877-46c9-4c96-9c2a-7436d33b13f6-0&pdp_ext_f=%7B%22sku_id%22%3A%2212000027609441966%22%7D&pdp_npi=2%40dis%21EUR%212.14%212.14%21%21%211.61%21%21%402100bddf16662522230103189e7677%2112000027609441966%21sea&curPageLogUid=pTZaNXctUcZl (https://www.aliexpress.com/item/1005003152118356.html?spm=a2g0o.productlist.0.0.1c3e606cpaeXYP&algo_pvid=6c1d7877-46c9-4c96-9c2a-7436d33b13f6&algo_exp_id=6c1d7877-46c9-4c96-9c2a-7436d33b13f6-0&pdp_ext_f=%7B%22sku_id%22%3A%2212000027609441966%22%7D&pdp_npi=2%40dis%21EUR%212.14%212.14%21%21%211.61%21%21%402100bddf16662522230103189e7677%2112000027609441966%21sea&curPageLogUid=pTZaNXctUcZl)
But I suspect that I must program it with i2C, so can I re-use the i2C wires that goes into the amp or do I have to program it? is there some other solution to generate the clock without program?
-
I don0't think you can get the required accuracy.
You would need, depending on the ADC modes, values like these:
- 256*sample = 256*44100*2=22.579.200Hz
- 384*sample = 33.868.800Hz
I don't think a little difference will matter, your're sampling an analog signal.
Both ADC and DAC run with the same clock, thus sampling at 44000, 44100, 44200Hz won't make a noticeable difference in the final sound output.
This would be a a problem if you were playing samples from a file, it would play faster or slower.
Check it out, if both support 512*sample at 48KHz (Or 256*96KHz), then simply use a plain 24.576MHz oscillator, it's a common value.
-
so can I re-use the i2C wires that goes into the amp or do I have to program it?
This device is just not suitable here. But even if it was, you would still need something to do the I2C commands. I don't see how you can reuse existing bus. You would still need another MCU to program this generator.
is there some other solution to generate the clock without program?
Just use an MCU and generate clock from it.