E90Post
 


Extreme Powerhouse
 
BMW 3-Series (E90 E92) Forum > E90 / E92 / E93 3-series Technical Forums > AUDIO/VIDEO + BLUETOOTH + Electronics/Alarm/Software > The quest for factory radio digital audio input



Reply
 
Thread Tools Search this Thread
      12-15-2020, 01:13 AM   #1
starfox5194
Private
22
Rep
50
Posts

Drives: 2007 E90 335i
Join Date: Aug 2020
Location: Connecticut

iTrader: (0)

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!
Appreciate 2
Kri1082.00
ptpending536.00
      12-15-2020, 12:44 PM   #2
ctuna
Lieutenant General
2045
Rep
13,363
Posts

Drives: 325xi 06 wagon MT
Join Date: Jan 2010
Location: Santa Cruz, Ca

iTrader: (0)

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
starfox5194
Private
22
Rep
50
Posts

Drives: 2007 E90 335i
Join Date: Aug 2020
Location: Connecticut

iTrader: (0)

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:
So you are saying it works in that last bit of code
Did it improve the sound as you expected?
I think there is still an issue with the I2S input, As you can probably hear in the video, the sound is still pretty staticky. At first I thought this was because the wire I was using was very thin. I tried using a well-insulated wire and saw no improvement. Now, I believe it is an issue with the way I implemented the I2S communication. I actually ended up soldering to the most upstream I2S pads I could find for this test - test pads where the signal is first generated on the CD drive itself. I initially tried the pins that are at the main DSP, but using those I get 100% static when I try to send a signal.

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:
Most standard solutions for better fidelity involve using the CDC option as and Input
or the USB .
Emulating the CDC would definitely allow for an (arguably) cleaner integration. MOST bus integration would have required substantially more capital investment that I wasn't ready to drop money on at the time. I may investigate this down the road, though. I really like the idea of making a custom UI - but it is not necessary at all since I have an android head unit about a foot above it lol.

Quote:
Maybe you should sell this as a product.
The demand is too small I think. Once I have something I am happy with, I might offer to mod a few head units for people to get some money that I can put towards this. A better application for selling a product would be the CD changer emulation. Like I said, maybe once I have a something that works well, I will start looking into the CD changer.

Quote:
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.
It's really funny that the Aux sound quality is poor (first hand experience and read on the forums), the documentation in the datasheet shows an almost flawless analog to digital conversion. Maybe the datasheets lie so more people will buy their chip.

Quote:
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.
Yeah, I'm not ready to tackle the MOST bus yet. I would at the very least need someone to donate a working CD changer.

Quote:
Can you get the digital Output off the Android Unit and Run it right into the CD inputs on the Radio.
...
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.
Yeah, this is something I could look into, but the problem is I would need some working hardware to test it. At the end of the day, I am pretty sure this would require the MOST bust to be hacked, too.


****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
ctuna
Lieutenant General
2045
Rep
13,363
Posts

Drives: 325xi 06 wagon MT
Join Date: Jan 2010
Location: Santa Cruz, Ca

iTrader: (0)

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-05-2021, 07:46 AM   #5
Toyman_R
Registered
0
Rep
3
Posts

Drives: e82 135i N54
Join Date: Jul 2021
Location: Moscow

iTrader: (0)

Hi! Are you still working on the project? I might offer some help/cooperation.
Pls PM me if you are interested
Appreciate 0
      07-06-2021, 03:03 AM   #6
starfox5194
Private
22
Rep
50
Posts

Drives: 2007 E90 335i
Join Date: Aug 2020
Location: Connecticut

iTrader: (0)

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
Toyman_R
Registered
0
Rep
3
Posts

Drives: e82 135i N54
Join Date: Jul 2021
Location: Moscow

iTrader: (0)

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-06-2021, 05:21 AM   #8
Toyman_R
Registered
0
Rep
3
Posts

Drives: e82 135i N54
Join Date: Jul 2021
Location: Moscow

iTrader: (0)

Btw, my sound system consists of third party MOST-Toslink converter, DIY DSP and an external amp. Sounds fantastic!
Appreciate 0
      07-11-2021, 11:58 AM   #9
starfox5194
Private
22
Rep
50
Posts

Drives: 2007 E90 335i
Join Date: Aug 2020
Location: Connecticut

iTrader: (0)

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
flyrr100
Enlisted Member
3
Rep
40
Posts

Drives: BMW 328i, F150 crew cab
Join Date: Oct 2019
Location: Oviedo, FL

iTrader: (0)

Quote:
Originally Posted by ctuna View Post
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.
Did you have to have the CDC activated, or did it come on as soon as it detected something in the socket?
Appreciate 0
      07-19-2021, 03:13 PM   #11
ctuna
Lieutenant General
2045
Rep
13,363
Posts

Drives: 325xi 06 wagon MT
Join Date: Jan 2010
Location: Santa Cruz, Ca

iTrader: (0)

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
Reply

Bookmarks


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT -5. The time now is 10:52 PM.




e90post
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
1Addicts.com, BIMMERPOST.com, E90Post.com, F30Post.com, M3Post.com, ZPost.com, 5Post.com, 6Post.com, 7Post.com, XBimmers.com logo and trademark are properties of BIMMERPOST