Author Topic: What causes the tape data to be heard on the speaker on the CPC 464?  (Read 1937 times)

0 Members and 1 Guest are viewing this topic.

Offline llopis

  • Supporter
  • 464 Plus
  • *
  • Posts: 303
  • Country: es
    • Noel's Retro Lab
  • Liked: 191
  • Likes Given: 148
I'm working on a video that's a bit of a deep dive into the tape deck data/audio mod for the CPC 464 and I stumbled on a good question: How is the tape data sound heard on the regular speaker?

I did some investigation, disproved some theories, but failed to explain it, so I was going to leave it as an open question. But it would be awesome if someone knows about it and I can add the explanation (fully credited of course) before I publish the video.

I saw this topic covered a long time ago here: https://www.cpcwiki.eu/forum/amstrad-cpc-hardware/464-mod/25/

One theory is that the sound is sent to the PPI, it generates data for the AY, and it plays it back. That's very clearly not it because it wouldn't be able to do that with bad data, azimuth changes, etc, etc. So clearly there has to be some connection between the part reading/amplifying the data in the tape deck PCB and the part that amplifies the computer audio.

There is no visible connection between the part that does the tape reading and the part that does the audio amplification, that's the puzzling thing.

@Bryce speculated that the op-amps inside the same package had some crosstalk and that caused the tape audio to leak into the amplified audio. That the engineers stumbled on that and left it as a feature. Apart from being a really sucky quad op-amp, that's not the case because I've separated the amplification op amp into a separate IC and the same thing happens.

As a matter of fact, I can even disconnect the audio amplification op-amp COMPLETELY, and you still hear the tape sound.

I've traced the PCB checking for connections not reflected in that diagram and I came up completely blank. Looking at the PCB in the service manual is even better, but I do not see any connection whatsoever.

And because we know that the volume wheel affects the tape sound on the speaker and that the op-amp is not needed, there's a very limited range of places where that signal can get to. Yet I can't find that connection.

Anybody knows or has some theories or hints?

Edit: Just explaining this "out loud" like this made me think of another possibility: The connection happens on the 464 board. Maybe there's a capacitor/diode or something like that combining the two signals that is not shown in the usual schematics. Hmmm...

Edit2: Nope, pin 5 on the tape deck connector goes straight to the PPI without any connections anywhere else. So much for that theory.
« Last Edit: 21:24, 21 May 21 by llopis »

Offline RetroCPC

  • CPC664
  • ***
  • Posts: 140
  • Country: hk
  • Liked: 86
  • Likes Given: 85
(Ignoring the very possible unintentional parasitic coupling on the CPC464 mainboard) – I see no direct audio path between the tape replay and internal audio path on the mainboard.

The Single Layer paper PCB design of the CPC tape deck section is REALLY poor, so it could simply be due to the poor Grounding on the PCB – BUT I'd first confirm its not PSU modulation feed into the internal speaker Amp stage via R304.

 
As you have tired to bypass the LPF section on the Quad opamp – lift either end of R304 (22K) from the signal path (if its still in circuit)...

Ideally, one would split this resistor in half (so 11K / 11K or 10K / 12K) and add at the midpoint a 470uF capacitor to Ground (with its negative end connected to Ground), this will form a LPF which will attenuate the PSU rail noise thats being injecting into IC302 pin 12...

Adding the capacitor will also filter the audio input, so maybe from the +5V rail: 2K2, then 470uF to Ground, then 20K to the R303/R305 junction in place of R304...

If there's still “tape Noise” then its just simply due to poor Ground / PCB layout - the simple 1b data comparitor formed by the circuit around IC302 pins 8,9,10 will cause high peak current pulses when the output stage saturates - its never good design practice to allow opamps to intentually saturate... thats the difference between true comparitors and opamps - comparitors are designed to operate in (and out :) ) of saturation...
« Last Edit: 22:20, 21 May 21 by RetroCPC »

Offline RetroCPC

  • CPC664
  • ***
  • Posts: 140
  • Country: hk
  • Liked: 86
  • Likes Given: 85
OK, after some quick simulations I'm pretty certain that R304 is responsible for coupling power rail noise during load tape load into the CPC464's speaker output.

Attached is a schematic where R304 on the tape deck PCB is replaced by a 20K resistor (or 2x 10K resistors in series) and I added CX 470uf 6.3V and RX 2k2 on the lifted end of R304 that would normally go to the "5V Power " track on the Tape PCB.

The negative end of CX goes to Ground...  The value of CX is not so critical - as shown (470uF 6.3V) reduces injected PSU noise by about 80dB (x10,000) @1KHz. A larger value cap will result in more filtering, smaller capacitor value = Less filtering. The minimum capacitor working voltage is 6.3V - so a higher voltage such as 10V, 25V, 50V is Ok....

Indicated Resistor and Capacitor component ID should match the Component ID's on the CPC Tape deck PCB -  Note that "U1" on the schematic is just a "simulation" of one section of the Quad Opamp... Ignore U1 (its part of IC302 on the Tape PCB).

CX / RX forms a Low pass filter which will attenuate power rail modulation during tape loading caused by the saturated opamp stage comparitor and also I suspect help reduce some of the CPC464's speaker  "Whine" at higher volume levels (I dont have a working CPC464 to test and confirm).
« Last Edit: 02:15, 22 May 21 by RetroCPC »

Offline RetroCPC

  • CPC664
  • ***
  • Posts: 140
  • Country: hk
  • Liked: 86
  • Likes Given: 85
OK, scrub everything I wrote in my post above ^^^^^

The root cause of the Tape loading crosstalk into the CPC Speaker is PCB parastic coupling.

The output from the Tape comparitor section (IC302 Pin 8 which on my CPC goes to the Green wire), runs around the PCB - running next to the audio circuit (and not shown on the schematic) passes though 3 pins on the large selector switch - whose next 3 contact pins (also not shown on the circuit) pass the audio input from the CPC audio circuit - resulting in signal cross talk...

I confirmed by soldering the Green connector wire directly onto IC302 Pin 8, and isolating (by cutting the PCB track) and then Grounded the now unused PCB track that went from IC302 Pin8 to the Tape deck / CPC connector (To the connector Green signal wire indicated as "D" on the schematic).

The attached picture shows the modifications:

1. The Green "D" wire now soldered directly to IC302 pin 8

2. The PCB track from IC301 pin 8 is cut just to the RIGHT of the silk-screened marking "2"

3. Just to the Left of the silk-screened marking "2", you can see the large solder blob added to Ground to IC301 pin 11 the now disused PCB track.

With these modifications, only when holding the speaker next to ones ear can the loading tones be heard at full volume...
« Last Edit: 18:16, 23 May 21 by RetroCPC »

Offline llopis

  • Supporter
  • 464 Plus
  • *
  • Posts: 303
  • Country: es
    • Noel's Retro Lab
  • Liked: 191
  • Likes Given: 148
Great findings! One more mystery solved :-)
Do you mind if I quote you on that at the end of the video to explain the cause of that?

I'm still wondering if it was done on purpose, or the engineering team stumbled on that and decided to make it into a feature.



Offline TotO

  • 6128 Plus
  • ******
  • Posts: 4.008
  • Country: fr
    • ?area=showdonations;u=4
  • Liked: 3106
  • Likes Given: 1886
I think that nothing was hidden and you can see that into the service manual.
"You make one mistake in your life and the internet will never let you live it down" (Keith Goodyer)

Offline llopis

  • Supporter
  • 464 Plus
  • *
  • Posts: 303
  • Country: es
    • Noel's Retro Lab
  • Liked: 191
  • Likes Given: 148
I think that nothing was hidden and you can see that into the service manual.
The service manual explains how the tape data makes its way to the speaker? Where in the service manual is it? I missed it.

Offline Bryce

  • The Hardware Guy.
  • Supporter
  • 6128 Plus
  • *
  • Posts: 12.440
  • Country: wf
  • It's not broken, it just hasn't been fixed yet.
    • index.php?action=treasury
  • Liked: 4712
  • Likes Given: 487
OK, scrub everything I wrote in my post above ^^^^^

The root cause of the Tape loading crosstalk into the CPC Speaker is the PCB design.

The output from the Tape comparitor section (IC302 Pin 8 which on my CPC goes to the Green wire), runs around the PCB - running next to the audio circuit (and not shown on the schematic) passes though 3 pins on the large selector switch - whose next 3 contact pins (also not shown on the circuit) pass the audio input from the CPC audio circuit - resulting in signal cross talk...

I confirmed by soldering the Green connector wire directly onto IC302 Pin 8, and isolating (by cutting the PCB track) and then Grounded the now unused PCB track that went from IC302 Pin8 to the Tape deck / CPC connector (To the connector Green signal wire indicated as "D" on the schematic).

The attached picture shows the modifications:

1. The Green "D" wire now soldered directly to IC302 pin 8

2. The PCB track from IC301 pin 8 is cut just to the RIGHT of the silk-screened marking "2"

3. Just to the Left of the silk-screened marking "2", you can see the large solder blob added to Ground to IC301 pin 11 the now disused PCB track.

With these modifications, only when holding the speaker next to ones ear can the loading tones be heard at full volume...

So essentially they've created a very long thin capacitor on the PCB that can easily pass the tape audio through to the speaker.

Bryce.

Offline BSC

  • 464 Plus
  • *****
  • Posts: 349
  • Country: de
  • CPC 464 aspirant
    • my (Android) mobile game
  • Liked: 494
  • Likes Given: 461
Who would have thought that there be hardware secrets left to be uncovered nearly 40 years later. Great read, even though I only understood half of it.

Reading this somehow reminded me of the double-layered PCB technology used by the Psychlo in Battlefield Earth (must have read that Book in the late 80s).
Anyone else know that book? https://en.wikipedia.org/wiki/Battlefield_Earth_(novel)

Offline RetroCPC

  • CPC664
  • ***
  • Posts: 140
  • Country: hk
  • Liked: 86
  • Likes Given: 85
Great findings! One more mystery solved :-)
Do you mind if I quote you on that at the end of the video to explain the cause of that?

I'm still wondering if it was done on purpose, or the engineering team stumbled on that and decided to make it into a feature.
Sure, I looked into the issue following your opening post so I'd be happy for these findings to be part of your video :)

Attached below is the Tape section PCB overlay - with the Red Tracks indicating the Tape Data Out(put) signal path - with the Green tracks indicating the CPC's internal speakers audio path - measurements on the PCB indicates that the worst cross coupling occurs between the PCB tracks in the vicinity of R302 47K as this track is a high impedance node at almost 100K across the audio band - this tracks high impedance allows the physically close Data Out(put) PCB signal track which approximates a fast edged – high level 5V digital signal to easily couple into the high impedance speaker output audio signal path.

Also 3 FFT plots measured at the CPC internal Speaker (FFT 0dB is scaled to Max speaker output level):

FFT1   Speaker amp noise floor with no Tape data modulation (no CPC mainboard connected*)
FFT2   Unmodified CPC speaker output with Tape loading modulation
FFT3   Measurement after PCB modifications

* Tape PCB audio input terminated to Ground via a 3K3 resistor to simulate the CPC's mainboard audio output impedance.

After PCB modifications, the unwanted signal coupling is reduced by about 40dB – or x100 times lower...

I suspect during testing the CPC's designers found the unintended signal coupling / crosstalk “beneficial” and maybe subjected to production time and re-design cost pressures decided to leave as a “Feature” :)
« Last Edit: 20:03, 23 May 21 by RetroCPC »

Offline RetroCPC

  • CPC664
  • ***
  • Posts: 140
  • Country: hk
  • Liked: 86
  • Likes Given: 85
Heres a scope shot of the CPC464 Tape sections Data slicer ("Comparator" output) IC302 pin 8 - showing the data slicers 18uS rising & falling edges which can be considered "fast" by audio standards - this data slicers output PCB track (indicated in Red on the PCB overlay I posted earlier) runs physically next to the CPC's Speakers high impedance audio path highlighted in Green (~100K impedance) – this allows the neighbouring PCB track to capacitively and magnetically coupled into each other resulting in signal crosstalk – the output from the tape's data slicer's “fast edged" digital signal is an undesirable neighbour to a high impdance audio track :)
« Last Edit: 02:21, 24 May 21 by RetroCPC »

Offline Bryce

  • The Hardware Guy.
  • Supporter
  • 6128 Plus
  • *
  • Posts: 12.440
  • Country: wf
  • It's not broken, it just hasn't been fixed yet.
    • index.php?action=treasury
  • Liked: 4712
  • Likes Given: 487
Really great analysis @RetroCPC . I looked into this issue a long time ago, but not as deeply as you have. My initial suspicion was crosstalk within the quad op-amp, but your research shows the obvious design flaw.

Bryce.

Edit: One last point that often comes up here and needs to be always kept in mind- As with many other design decisions made during the development of the CPC, the goal the engineers were given was to design (in a very short time) a low-cost, affordable feature rich home computer that would have moderate success in the market of the day. They weren't asked to create Hi-Fi quality, nor future-proof cutting edge graphics, nor a memory packed super computer. They definitely achieved their goal and that is supported by the fact that we still enjoy using this computer today. So all of the "why didn't they do this", "why didn't they do that" are all down to the fact that that wasn't what they were asked to do.
« Last Edit: 21:23, 23 May 21 by Bryce »

Offline llopis

  • Supporter
  • 464 Plus
  • *
  • Posts: 303
  • Country: es
    • Noel's Retro Lab
  • Liked: 191
  • Likes Given: 148
Here's the video that prompted me to look into this in the first place, along with the great detective work of @RetroCPC :

https://youtu.be/-cacZqQf4Go


Offline smayk11210

  • CPC464
  • **
  • Posts: 5
  • Country: fr
  • Liked: 0
  • Likes Given: 2
Here's the video that prompted me to look into this in the first place, along with the great detective work of @RetroCPC :

https://youtu.be/-cacZqQf4Go
where can we get it? thank you.

Offline smayk11210

  • CPC464
  • **
  • Posts: 5
  • Country: fr
  • Liked: 0
  • Likes Given: 2
nobody looks at this topic anymore?  :o

Offline SerErris

  • CPC464
  • **
  • Posts: 11
  • Country: de
  • Liked: 2
  • Likes Given: 0
Hi, reading this very interesting post and actually watching @llopis video I asked myself:


Why is no one creating a arduino tape mod, that directly interfaces to the PIO. Shoulnt that be very easy and simple compared to going through the tape audio and all the electronics in between?


Instead of outputting it into the audio cirquit, ensure you output 0 or +5v and attach a line directly to the PIO (maybe via the connector on the tape drive).


That should be very possible ... and you then have a replacement that can go very high speeds as there is no high frequency filtering anymore (actually as high as the cpc can process).


Anyone have ever attempted it? I am looking at the sourcecode of txarduino to find where it it converted to audio, but maybe this is done in hardware? are there any hardware diagrams available (e.g. schematics?).

I only now find that the project is managed on facebook and mega.nz which I personally find a pitty ... it is open source, so I would actually prefer to keep it under git. but anyhow... not the main point here.

Offline SerErris

  • CPC464
  • **
  • Posts: 11
  • Country: de
  • Liked: 2
  • Likes Given: 0
Oh ... intersting find:

In this project https://github.com/arananet/TzxDuino-Reloaded I found out that intersting detail:
Quote
Audio Amp
Since it is not very clear if an output amplifier is necessary, I have added a little DPDT, one position switch to bypass or enable the D9 signal to the AMP LM386. The other position will connect the D9 signal directly to the 3.5mm jack. If the volume of the output is higher than expected, you can change the value of the R5 resistor from 1kΩ to 10kΩ.

So does it mean that the feature I am looking for is already implemented (put the switch to bypass) and that then the arduino is outputting its +5V directly? So that would then simply connect the output to the PIO instead anywhere to the Cassette. Also I think connecting it still to the cassette part (just next to the header) would still bring out the sound of the "cassette" to the speaker.

Offline llopis

  • Supporter
  • 464 Plus
  • *
  • Posts: 303
  • Country: es
    • Noel's Retro Lab
  • Liked: 191
  • Likes Given: 148

The short answer is that the Arduino already outputs 0-5V, so yes, you can hook it up after the opamps with a bypass capacitor (it just won't work for a smartphone probably).


But it's interesting that you bring that up because that's the topic of my next video (coming up this Thursday). I started with the premise that we have a perfect tape playback, so how fast could we make things go? It got pretty fast, but I know I can make it even faster than that, so there's enough interesting bits for another time.


You can see a preview here:
https://twitter.com/NoelsRetroLab/status/1423639147495964677



Hi, reading this very interesting post and actually watching @llopis video I asked myself:

Why is no one creating a arduino tape mod, that directly interfaces to the PIO. Shoulnt that be very easy and simple compared to going through the tape audio and all the electronics in between?

Instead of outputting it into the audio cirquit, ensure you output 0 or +5v and attach a line directly to the PIO (maybe via the connector on the tape drive).

Online SkulleateR

  • 464 Plus
  • *****
  • Posts: 460
  • Country: de
  • Liked: 225
  • Likes Given: 129
@llopis


> slightly off topic here


Great vid about THE VIC20, enjoyed it alot  8)


> back on topic


Just for interest : wouldn't it be possible to just use a Pi Zero with a Bare Metal mp3/wav Player connected over the GPIO pins for this ?




Offline llopis

  • Supporter
  • 464 Plus
  • *
  • Posts: 303
  • Country: es
    • Noel's Retro Lab
  • Liked: 191
  • Likes Given: 148
Just for interest : wouldn't it be possible to just use a Pi Zero with a Bare Metal mp3/wav Player connected over the GPIO pins for this ?
Yes, I imagine you could as well. The problem with a recording is the sampling rate. It's fine for "normal" audio files, but as soon as you start going faster, 48KHz starts not being enough. That's the beauty of TZX/CDT files: They encode the timings, so they're able to generate the audio waves from that (or at least, in theory, which as I found out, it doesn't always agree with the real world).

Online SkulleateR

  • 464 Plus
  • *****
  • Posts: 460
  • Country: de
  • Liked: 225
  • Likes Given: 129
Hmmm, okay, then you could use https://github.com/tcat-qldom/PlayTZX ... should compile on the Pi and run as well :)


Maybe I'll give it a go, got a lot of Pi Zeros here waiting for orders :D

Offline Bryce

  • The Hardware Guy.
  • Supporter
  • 6128 Plus
  • *
  • Posts: 12.440
  • Country: wf
  • It's not broken, it just hasn't been fixed yet.
    • index.php?action=treasury
  • Liked: 4712
  • Likes Given: 487
Also I think connecting it still to the cassette part (just next to the header) would still bring out the sound of the "cassette" to the speaker.

You wouldn't hear the cassette sounds if you were injecting digital data directly into the main pcb.

Bryce.

Offline SerErris

  • CPC464
  • **
  • Posts: 11
  • Country: de
  • Liked: 2
  • Likes Given: 0
Oh this board is crap, I need to write the same article now the third time ...  :picard:


@Bryce, thanks you are right. However I thought connecting the output of the arduino not directly to PIA, but instead to PIN8 of the OpAmp on the Cassette. That would lead to the signal taking the same (crude) path and still having the crosstalk in place.

However that may not work, as the feedbackloop of the OpAmp might influence the signal.


@llopis
Quote
The short answer is that the Arduino already outputs 0-5V, so yes, you can hook it up after the opamps with a bypass capacitor (it just won't work for a smartphone probably).


Why do we need a bypass capacitor? Where should I put it and what is the intend? Yes I want to put it after the OpAmps but the output is digital and you do not want a capacitor in between). It should not work with a SmartPhone as this is a mod specifically to remove as much as problems in between the signal generator (the Arduino creates more or less perfect square edges), and the PIA.

Obviously the best connection would be directly to the PIA, but as Bryce turned out, that would be loosing the Audio out.

Offline Bryce

  • The Hardware Guy.
  • Supporter
  • 6128 Plus
  • *
  • Posts: 12.440
  • Country: wf
  • It's not broken, it just hasn't been fixed yet.
    • index.php?action=treasury
  • Liked: 4712
  • Likes Given: 487
No, there is nowhere for the current to go (resistance on the path to ground is too high), so practically no (about 87nA) current would flow towards pin 8. However, you may create a feedback loop that will effect the digital signals, so you might need to remove the connection to pin 8 anyway (ie: connect on the main PCB side and remove that wire from the connector).

The bypass capacitor is to stop power rail noise from the CPC effecting the Arduino or noise from the Arduino effecting the CPC.

Bryce. 
« Last Edit: 15:22, 10 August 21 by Bryce »

Offline SerErris

  • CPC464
  • **
  • Posts: 11
  • Country: de
  • Liked: 2
  • Likes Given: 0
Thanks for sharing the insights.


So where would I then put the bypass capacitor ? From PIO input PIN to GND? And what dimension would be right?