Philips SAA70xx to SPDIF converter
or how my CD-104 became a transport
Where to start ... to be honest the story starts back in the days when I was about 15 years old. Some friends and me had parties at a friend's shed where we listened to music and drank warm tea ;-)
At that time we still went to school, so we had lots of time but were short on money so we didn't want to buy a cd player for our party location. Fortunately a friend's aunt worked in the electronics repair business and one day we went to her shop and salvaged some broken stuff which would otherwise be thrown to the junk. One item we got was a rather heavy cd player, still in working condition but already in these days somewhat "vintage". We took the player to our party location and there it served us playing music. Already back then I was amazed by the cd player: A heavy piece of metalwork with a big huge heatsink on its back. Even the tray was made of metal! Unfortunately it suffered from an awful tendency to decline the early bluish CD-R's (which had rather low reflection).
As time passed by we lost contact and I guess the player got scrapped as cheap cd players marked "China Export" got rather ubiquitous these days.
Time leap! Now, 15 years later, I can afford hifi electronics indeed, but I have a lack of time due to work ;-) I guess you know exactely what I mean! One day I searched the web for some electronics stuff and happened to open a webpage showing some ancient cd player technology, namely the 1st generation player CD-100 from Philips, below the CD-103, and beneath the... the... THE CD-104! There we had it! This was not only the same type of player as I was familiar with from my past, but it was the exactely same model, same front bezel, same colors. What a beauty! Some research showed me it was manufactured back in 1984 and as 1984 is an excellent year (yep, you're right, I'm born in '84 ^^) I wanted to have one and searched the big auctioneers with the magic four letters for it. A few days later I received my CD-104, exactely the model from the past:
My livingroom Philips CD104 !
Of course it showed the typical symptoms of failing vias on the servo pcb, but regardless of that it worked flawlessly. After 31 years! Will there be any consumer electronics manufactured these days working in 30 years? Some soldering later I had this great player from 1984 back in working condition.
I assume that you're familiar with the CD-104 when you've made it up to here on my page but I want to list at least some features of this machine.
As Philips was the inventor of the compact disk system there were quite a few cd players from different companies using exactely the same hardware as the CD-104 as there was no other manufacturer building
his own chipsets yet. I assume Sony did their own ones soon but they often failed and there are only a very few ones existing today.
When I put the player on my hifi bench I realized that it doesn't have a SPDIF connector. I searched the service manual and web for information and recognized that neither SPDIF nor I2S were invented yet when the player was developed, so it wouldn't be that easy to interface it to modern digital interfaces.
What time is it? Hacking time! I just WANTED it to have SPDIF for no reason and I decided to have a play with the SPDIF protocol. But I didn't want to ruin my CD-104 which is in very mint condition, so I decided to get another, somewhat worn one, the lab machine.
Block diagram of the CD-104, clock distribution and servo circuits omitted
The CD-104 consists of the (very?) first chipset developed for compact disc players:
As there was no standard like I2S yet, the chipset uses a "proprietary" way to transfer audio samples between the different ic's, something very similar to SPI interfaces.
There is one signal called CLCF which is the data clock for the two audio data lines. There is one signal for the left (DLCF) and another one for the right (DRCF) audio channel. The data is transferred in bursts with a clock of roughly 2MHz and latched by a strobe signal (STR1). One audio burst consists of 16 bits and the bursts are equally spaced with a repetition rate of 44.1kHz. What a surprise :)
Waveforms at the input of the SAA7030 as it comes from the cd, before any oversampling stuff happens
CLOX: 4.2336MHz master clock, CLCF: data clock, D*CF: audio data, STR1: latching signal
These signals would be perfect to tap off the audio information! No editing, no oversampling, just pure demodulated and error corrected audio samples. Just the way as the inventors of the CD wanted it to be!
The modified block diagram looks like this:
New block diagram of my CD104
Now we are able to get access to each sample of audio data but how can we get this into a SPDIF bitstream?
My first attempt was to use a FPGA but soon I realized that this would require a fancy external clock management, many different voltages and lots of effort to create (as it would have been my first real FPGA project). So I decided to go another way and try to use a microcontroller to generate SPDIF. The controller family of my chioce is the PIC32MX series as I have used them in quite a lot of projects over the past few years. They're fast, easily available and well documented.
My first goal was to use the hardware SPI module to generate SPDIF audio signals as this peripheral permits the generation of synchronous bitstreams with bitrates at roughly 6Mbps.
There are many resources on the web how SPDIF works, in short it uses different header patterns to define the beginning of a new audio frame and adds some status and parity information. One frame consists of 64 bits of data (20 bits left channel, 20 bits right channel, headers, status, parity and some other stuff).
These 64 bit frames get encoded with a biphase mark code (BMC) which makes clock regeneration on the receiver side possible but doubles the data rate: (44.1kHz * 64 data bits for both channels * 2 due to BMC encoding) = 5.6648MHz
In my design this clock is derived from the cd player's internal 4.2336MHz reference oscillator:
uC core clock = 4.2336MHz * 16 = 67.7376MHz
The core clock gets divided by 12 which results in exactely 5.6448MHz for the SPI clock!
This means the SPDIF clock can be generated without any resampling, oversampling or reclocking of the audio signal at all!
As the microcontroller's reference clock is the cd player clock itself it doesn't matter whether the player clock is off a few Hz as the SPDIF has the same reference and "follows", this means no jitter, no skew, no lost or added samples as it would be with systems which have to synchronize to a different clock.
Basically the controller is just grabbing audio samples at a given rate, reordering them and shifting them out via SPDIF without any editing.
As a conclusion this extension board delivers the genious performance of the CDM-1 drive mechanism to your modern audio equipment - now you can use your SAA70xx cd player AS A TRANSPORT!
This is a photo of my very first working prototype, still attached to my PicKit3 programmer :)
On the top you can see the 8way Molex connector connecting to the CD104 (+5V, GND, audio clock, audio strobe, audio left, audio right, preemphase control, master clock 4.2336MHz). The 3way Molex connector on the bottom connects to the Toslink transmitter (+5V, GND, SPDIF TTL data). You could also connect a transformer and connect to coaxial SPDIF systems, of course. For prototyping the optical solution was more convenient due to no problems due to bad grounding or accidentially putting 12V on the input of my MiniDisc-Deck serving as SPDIF sink.
And this is the whole setup, a CD-014 playing a CD which is being encoded to SPDIF and output over a Toslink optical cable. The Toslink cable connects to the SPDIF input on my Sony MDS-501 MiniDisc deck which has a DAC-Mode and shows whether the incoming SPDIF data stream is compliant or not.
The SPDIF encoder lies on top of my "lab CD-104" and beneath is a Sony MDS-501 MiniDisc deck doing SPDIF-to-Analog-conversion
(c) Thomas Gulden, 10/2015