|
|
|
|
|
|
BMW Garage | BMW Meets | Register | Search | Today's Posts | Mark Forums Read |
|
BMW 3-Series (E90 E92) Forum
>
The quest for factory radio digital audio input
|
|
12-15-2020, 01:13 AM | #1 |
Private
22
Rep 50
Posts |
The quest for factory radio digital audio input
This will be somewhat of a project thread where I will hopefully update you guys on my progress hacking the 2007-2009 BMW CD73 head unit to receive a digital audio signal via I2S.
Full disclosure: I am a geneticist, not an engineer. I don't really know what I'm doing. Motivation: I have an AVIN 10.25" head unit that I cut a hole in my dash for. It works pretty well. My main issue is that audio enters the head unit via the aux cable and for some unknown reason, the audio quality is sub-par. Once I upgraded to an aftermarket audio system, this made the poor audio quality all the more noticeable. The current way I input audio to the head unit is like this: Android head unit -> USB DAC -> Ground loop isolator -> Aux port on head unit -> Head unit ADC -> Amplifier. The new way will be like this: Android head unit (digital signal) -> USB-I2S interface (digital signal) -> head unit (digital signal) -> amplifier. So instead of going from digital to analog to a noise suppressor and then from analog back to digital, we are remaining digital the whole time. Potential limiting sound quality factors? Clock jitter and potential ground interference. I think with a nice shielded cable I will be able to make these issues negligible. Ok, here are some highlights for what I have done so far. 1) Disassembled the radio, identified and labeled the important chips. 2) Identified the main chip that manages audio inputs. 3) Identified the I2S input. 4) Identified the I2C input. 5) Read almost the entire data sheet 10x on the chip that manages audio inputs. 6) Wrote a script to generate an I2S signal on a hobby board (ESP32) 7) Identified the magic hex values required to activate the register on the chip to input I2S audio. here is a video of the proof-of-concept: Here is a link to the chips and data sheets: https://docs.google.com/presentation...it?usp=sharing The main chip I am working on is this guy: https://www.nxp.com/docs/en/data-sheet/SAA7706H.pdf Python 3 code to activate CD I2S Input: Code:
from pyBusPirateLite.I2C import I2C i2c = I2C() i2c.speed = '400kHz' i2c.configure(power=True, pullup=True) #I don't think this is actually required. ### CD DUMP i2c.start() i2c.transfer([0x38, 0x1F, 0xFC]) #Read register 1FFC output=i2c.write_then_read(1,3,[0x39]) #Get three packets from 1FFC for i in range(3): print(hex(output[i])) #Print in readable hex format # SWITCH TO I2C INPUT HOLY F*** IT WORKS i2c.write_then_read(6,0,[0x38, 0x1F, 0xFC, 0x4, 0x27, 0x30]) If anyone knows more about this kind of stuff and wants to help out, that would be awesome! |
12-15-2020, 12:44 PM | #2 |
Lieutenant General
2045
Rep 13,363
Posts |
If you are a geneticist it means you can do and understand complex things.
You are already doing more than most of us do. That is pretty amazing you identified the chip and programmed it to. So you are saying it works in that last bit of code Did it improve the sound as you expected? Most standard solutions for better fidelity involve using the CDC option as and Input or the USB . Ala https://www.e90post.com/forums/showthread.php?t=1499808 which is a cheap Dension clone. Maybe you should sell this as a product. The Aux is a known low fidelity bottleneck there is suppose to be a cap in the line that is responsible for most of the signal degradation but not having to go through two D to A conversions is a superior solution. Another point you may be able to enable the cdc and usb inputs on the Radio through programming which would give you more Input choices. Though those come through the Most Bus and must be translated to digital or analog. The ideal thing would be digital to digital but I imagine those aftermarket head units don't have a digital out. Which would mean you digging into that device. Also this link which you may have already read on the Fidelity problems with Aux http://www.e90post.com/forums/showthread.php?t=1002984 Can you get the digital Output off the Android Unit and Run it right into the CD inputs on the Radio. That is what I would investigate. The chip has a block that says CMRR Cd Input for the BMW Radio. If you could use that somehow it might be avoid the digital to analog conversion portion of the chip. You might loose the CD but who cares you can put a lot of music on a usb stick. Last edited by ctuna; 12-15-2020 at 05:42 PM.. |
Appreciate
0
|
12-16-2020, 08:06 PM | #3 | ||||||
Private
22
Rep 50
Posts |
Thanks for the kind words and for the extra information and ideas. This is an evolving project, but for now I am going to take small baby steps so I can learn as much as I can.
I am mainly doing this for the learning experience. If I cared that much about sound quality, I would be much better off just buying a high-end aftermarket head unit. The goal of this project is CD-quality audio and for me to learn something. Quote:
I2S works using a clock, word select, and a data line. For some reason, there clock is always active at the main DSP chip on the main board, even though it is supposed to receive an external clock from another chip. I figured that with the CD drive unplugged, there would be no clock signal being sent, but alas, there is still a clock - no data or WS signal though. I think my test worked because the upstream test pads allowed the clock generated by my hobby board to partially "overpower" the other clock signal that is on the main board. Hence, audible sound, but lots of static. I need to do more testing if I want to be 100% certain about this though. Anyways, I think it is possible to have the hobby board act as a clock slave, but still send data and WS signals, but I need to mess with some code and object-oriented C++ is not my strong suit, so this will take me some time. So - I don't know if the sound has improved, but I am very confident that once everything is properly set up, this will be one of the best ways to get high fidelity audio into the head unit. Quote:
Quote:
Quote:
Quote:
Quote:
****EDIT/UPDATE----12/17/20**** I managed to run the ESP32 in I2S Slave mode. For it to work in slave, it needs BCLK AND WS, If it is only supplied BCLK, it will not work. If BCLK is normally 256*WS, then it should be able to derive WS from BCLK. Maybe this can be done in some code. Anyways, When the ESP32 runs in I2S Slave mode, it sounds fantastic. Unfortunately, in order for it to play audio using the pins on the CD drive in slave mode, it requires a CD in the drive. I may be able to hack into the chip on the CD Drive and trick it to think it has a CD in the drive.... More research is needed. I am not sure if this is the path I would like to go down though. There must be a way to send I2S to the chip on the main board. I just need to find the magic hex values to do this. this might be a bit challenging though, as I can not figure out how to get audio in to these pins through normal function, and the data sheet isn't very helpful. HMMMMMM. *****EDIT 2---------12/18/20*********** It's all working properly now in prototype phase. I just had to send a few more I2C codes. Not difficult at all. Anyways I'm waiting for a Teensy 3.2 to come in the mail so I can make a cheap single-chip solution. It should be pretty clean once all is done. Stay tuned. Last edited by starfox5194; 12-18-2020 at 11:14 PM.. |
||||||
Appreciate
0
|
12-17-2020, 04:09 AM | #4 |
Lieutenant General
2045
Rep 13,363
Posts |
One of the reason's the Aux is Bad is that it was mentioned they put in
noise suppressing component , either a cap or coil in the pod that the aux connector is in or in the that wire. Also the Aux is fed either to the back of the Radio or the Mulf module in later version. I am using that cheap Dension Clone device and it works well for usb playback ,sounds the same as stuff sourced from the CD, the fidelity is a little less on Bluetooth streaming but not bad. The way the cd player delivers 16 bit info involves synchronization and clocks. When you get the same info from a usb and sync it up to a DAC I am not quite sure how that works. |
Appreciate
0
|
07-06-2021, 03:03 AM | #6 |
Private
22
Rep 50
Posts |
Hey I ended up pretty distracted from the project because upgrading to a newer radio with aux input was working well enough and every radio I disassembled had a different chip layout. I was instead thinking of using the most bus and emulating a CD changer but there is soo little documentation and the fiber optic connection is proprietary.
I might revisit this again in a few months but honestly the aux signal in newer professional radios are good enough for me. |
Appreciate
0
|
07-06-2021, 05:19 AM | #7 |
Registered
0
Rep 3
Posts |
Thanks. I just opened a spare radio I had. The testing points you were mentioned, are they located on mini-pcb that is a part of cd drive assembly? They are marked data, lrck, bck and cdrst (not sure what this one is for)
Also, how did manage to find extra i2c codes needed to switch to cd input? My task is a bit simpler: I’d like to install i2s Bluetooth module inside the radio and avoid multiple digital-analogue conversion. So basically feed i2s signal from bt module directly to saa7706h dsp. |
Appreciate
0
|
07-11-2021, 11:58 AM | #9 |
Private
22
Rep 50
Posts |
Toyman_R
Sorry, For some reason I am not getting email notifications from this forum. I will try to change the settings for the future. The test points differ depending on the revision of the CD Drive. But the ones you are looking at sound like they would be correct. The issue is a little bit more complicated though. There is a DSP chip on the main board of the head unit. This controls which source the audio signal is coming from and has it's own I2S input. The problem is that this input can only be selected by the correct combination of I2C commands to switch the input on the DSP. I opted to find an I2S input on the CD drive itself, and then I was able to find the correct I2C commands by using a logic analyzer and seeing the register values when the drive was in CD mode. Work has been crazy lately, but in a few weeks things might settle down and I can dive back into this. There are two ideas I have: 1 - Get the I2S signal to be accepted by the DSP. 2 - Hack into the MOST bus and send the audio signal that way. |
Appreciate
0
|
07-19-2021, 01:00 PM | #10 | |
Enlisted Member
3
Rep 40
Posts |
Quote:
|
|
Appreciate
0
|
07-19-2021, 03:13 PM | #11 |
Lieutenant General
2045
Rep 13,363
Posts |
flyr100 you are dropping in on these conversations without reading them
and giving out advice that is not relevant to the content of these threads. |
Appreciate
0
|
Bookmarks |
Thread Tools | Search this Thread |
|
|