Joined
·
88 Posts
This is my build thread for creating a box that takes the SPDIF (digital audio) and CAN (volume control) from the Factory Head Unit and will give a line out (RCA) that has volume control for use with external amplifier(s). This will eliminate the need to tap the rear speaker output in order to hook up subs or allows for a complete removal of the DSP/Amp box by using separate amps for all speakers.
--SPDIF--
The digital audio from the Head Unit is standard coaxial spdif. In the past (I posted on velostor.org somewhere about this) I took the SPDIF signal from pins 18/19 of Connector A on the DSP to the back of my old Yamaha 5.1 receiver's Coax audio input and it decoded the signal just fine. I was able to get full stereo sound. It is a 48KHz PCM signal. The problem was that the signal was a constant amplitude and the volume control on the head unit did not change it in any way. this is why you also need the CAN bus interface of the DSP/Amp box (pins 5/6 of connector A)
--CAN--
You can look this up on wikipedia, but is is Controller Area Network and it was made by Bosch for stuff like cars. This bus is not part of the OBDII system and runs at a different speed and voltage level. It is a low speed CAN running at 100Kbps and should not be terminated. I was able to use a CAN to USB converter from work to sniff the packets on the bus and determine where Hyundai is putting the volume control information. Packet 0xF is the magic packet and is sent out to any time a setting is changed, such as turning the volume knob. The packet contains the volume, balance, fader, bass, mid, and treble values set with the head unit. It does not change the audio or have anything to do with the audio on the SPDIF line.
The factory DSP/Amp box takes both of these signals then does the DSP part (Digital Signal Processing). Basically, the unit will split up the stereo SPDIF signal into the 8 channels using the volume, fader, balance, bass, mid, and treble commands to determine exactly how to do it. For a first version this project I want to just have volume control on an analog stereo output working because I think a lot of people would be happy with it, myself included.
--Building it--
Right now, my plan is to use a dev kit with a microcontroller and Cirrus logic DAC to get started. This is the kit I have in mind because of price and convenience (I have one on hand).
dev kit
The only things missing are a CAN Transciever (to deal with the differential voltage signals) and an SPDIF to I2S converter. The CAN Transceiver is easy and just needs to be wired to the dev kit. I still need to figure out what SPDIF to I2S convert I will use and I will post once I have decided.
Ultimately, I think it would be nice to just build a second board that mates with this dev kit to make it so people don't have to do much soldering except for the actual wires to the car. For now my first version will just be cobbled together to prove the concept.
--Software--
The first version of software will be pretty simple. It will have to listen to the 0xF packet on the CAN bus to get the volume control and basically forward the I2C from the SPDIF to I2C converter to the cirrus logic chip on the board. The cirrus logic chip also has the volume control so the software will take the requested volume from the radio and turn it into a volume control setting for the cirrus logic chip. This allows for the volume to be remapped since the number the board will be getting is exactly what is on the screen (0 to 31 I think) so this can map to the volume any way desired. However, I will probably try to closely match the current DSP/Amp box so that the this unit and the DSP/Amp box will play nice.
Ok, I think that is all for tonight. I will try not to draw out the design time of this too long. I am not sure how things will work if people want better packages solutions but I will just get something working first the worry about those details later.
--SPDIF--
The digital audio from the Head Unit is standard coaxial spdif. In the past (I posted on velostor.org somewhere about this) I took the SPDIF signal from pins 18/19 of Connector A on the DSP to the back of my old Yamaha 5.1 receiver's Coax audio input and it decoded the signal just fine. I was able to get full stereo sound. It is a 48KHz PCM signal. The problem was that the signal was a constant amplitude and the volume control on the head unit did not change it in any way. this is why you also need the CAN bus interface of the DSP/Amp box (pins 5/6 of connector A)
--CAN--
You can look this up on wikipedia, but is is Controller Area Network and it was made by Bosch for stuff like cars. This bus is not part of the OBDII system and runs at a different speed and voltage level. It is a low speed CAN running at 100Kbps and should not be terminated. I was able to use a CAN to USB converter from work to sniff the packets on the bus and determine where Hyundai is putting the volume control information. Packet 0xF is the magic packet and is sent out to any time a setting is changed, such as turning the volume knob. The packet contains the volume, balance, fader, bass, mid, and treble values set with the head unit. It does not change the audio or have anything to do with the audio on the SPDIF line.
The factory DSP/Amp box takes both of these signals then does the DSP part (Digital Signal Processing). Basically, the unit will split up the stereo SPDIF signal into the 8 channels using the volume, fader, balance, bass, mid, and treble commands to determine exactly how to do it. For a first version this project I want to just have volume control on an analog stereo output working because I think a lot of people would be happy with it, myself included.
--Building it--
Right now, my plan is to use a dev kit with a microcontroller and Cirrus logic DAC to get started. This is the kit I have in mind because of price and convenience (I have one on hand).
dev kit
The only things missing are a CAN Transciever (to deal with the differential voltage signals) and an SPDIF to I2S converter. The CAN Transceiver is easy and just needs to be wired to the dev kit. I still need to figure out what SPDIF to I2S convert I will use and I will post once I have decided.
Ultimately, I think it would be nice to just build a second board that mates with this dev kit to make it so people don't have to do much soldering except for the actual wires to the car. For now my first version will just be cobbled together to prove the concept.
--Software--
The first version of software will be pretty simple. It will have to listen to the 0xF packet on the CAN bus to get the volume control and basically forward the I2C from the SPDIF to I2C converter to the cirrus logic chip on the board. The cirrus logic chip also has the volume control so the software will take the requested volume from the radio and turn it into a volume control setting for the cirrus logic chip. This allows for the volume to be remapped since the number the board will be getting is exactly what is on the screen (0 to 31 I think) so this can map to the volume any way desired. However, I will probably try to closely match the current DSP/Amp box so that the this unit and the DSP/Amp box will play nice.
Ok, I think that is all for tonight. I will try not to draw out the design time of this too long. I am not sure how things will work if people want better packages solutions but I will just get something working first the worry about those details later.