Recording digital data to analog tape... revisited

Hi all,

I'm trying to debug a problem - or even decide if I have a problem - in a system that records data to tape. (This is my camcorder-telemetry device, in a slightly different incarnation). This thing works very nicely on my digital camcorder. However I want to use the same circuit to lay down a data track on an audio cassette, and I'm encountering odd bit errors.

To describe the format very briefly: The system has a 6.250kHz interrupt handler which toggles a digital output, resulting in a nominal 3.125kHz square wave going out to the recorder. Every odd interrupt, a bit is taken off the head of the Tx queue. If that bit is '0', the toggle operation is skipped for this interrupt. IOW, the bit cell is bracketed by edges, and if there's an edge in the middle it's a '1' and if there is no edge in the middle, it's a '0'.

For those who want gory details, the actual format has another layer on top of this. The outbound data is divided into packets comprised of:

48 bits '1' - timing header 1 bit '0' - sync bit 48 x - 9-bit bytes (data byte followed by a '0' spacer) 2 x - 9-bit CRC bytes (data byte followed by '0' spacer)

The decoder listens for a burst of at least 10 consecutive "1" bits (which can't occur in the middle of a data stream). While acquiring this, it measures the bit cell timing. Once it has acquired enough "1"s, it keeps sampling until either an excessively out-of-time edge occurs (>25% of nominal bit cell deviation), or the sync bit is found. In the latter case, it gathers the incoming data, checks the CRC, and decides whether to pass the data on to the host.

Now the part where I'd like suggestions. When I record the above signal on my digital camcorder, the output waveform on playback looks almost exactly like the input waveform, except that it's understandably centered around the 0V line. When I record on a simple cheap cassette player, however, I get a very spiky waveform, which I guess (thinking about the physics of it) makes sense. Traces are at , sorry for the fuzzy photo.

This spiky waveform actually works quite well with the decoder, because the decoder only looks for edges, and misses the trailing edge of each spike due to interrupt latency. The higher BER I'm finding *could* be attributable entirely to the much lower quality tape and transport in the cassette unit.

But I am wondering what I can do to make the signal look more like what I expect. I'm wondering in particular if I should be doing something to the signal before sending it on to the recorder, or if the processing/interface circuit I need should be on the playback side. For instance, should I be trying to match the speaker impedance the recorder expects to see, probably 8 or 16 ohms? My input is very high-impedance.

Any comments/suggestions?

Reply to
Lewin A.R.W. Edwards
Loading thread data ...

I read in sci.electronics.design that Lewin A.R.W. Edwards wrote (in ) about 'Recording digital data to analog tape... revisited', on Sat, 2 Oct 2004:

Does it make sense? It looks as if the cassette recorder can't even handle the fundamental and low-order harmonics in your 3.125 kHz square wave. Can you try recording a 3 kHz sine wave?

You don't need to simulate the loudspeaker impedance at the output.

--
Regards, John Woodgate, OOO - Own Opinions Only. 
The good news is that nothing is compulsory.
The bad news is that everything is prohibited.
http://www.jmwa.demon.co.uk Also see http://www.isce.org.uk
Reply to
John Woodgate

Use a current to voltage converter on the head to receive. You'll be surprised at the difference.

-- KC6ETE Dave's Engineering Page,

formatting link
Microcontroller Consultant, specializing in Atmel AVR

Reply to
Dave VanHorn

An I-V amplifier for the read side will work wonders.

-- KC6ETE Dave's Engineering Page,

formatting link
Microcontroller Consultant, specializing in Atmel AVR

Reply to
Dave VanHorn

I read in sci.electronics.design that Rich Grise wrote (in ) about 'Recording digital data to analog tape... revisited', on Sat, 2 Oct 2004:

Sorry, that's not even wrong. You can certainly record 3 kHz without bias. The sensitivity is low and the waveform is noisy and distorted, but not that much. In fact, a low(ish)-frequency square wave comes out not too badly, because the higher harmonics actually act as bias.

Put your scope input on'AC' and see if you can see a 3 kHz square wave. How does the 'DC' in the horizontal parts get through the AC coupling? If you need to, think 'Fourier'; the fundamental and all (well, some) of those odd-order harmonics are all *sine waves* and induce currents in the playback head quite well.

--
Regards, John Woodgate, OOO - Own Opinions Only. 
The good news is that nothing is compulsory.
The bad news is that everything is prohibited.
http://www.jmwa.demon.co.uk Also see http://www.isce.org.uk
Reply to
John Woodgate

Lew> Hi all,

You should attenuate the digital signal into the cassette- you want

5Vpp->1Vpp or 1/5- so something like a 10k->2.2k ohms divider and the input should already have a DC block. Your waveform looks like what you see when you overdrive the cassette input amplifier through a capacitor- which then clamps to the rails, lowers the input impedance, and causes the input capacitor to charge especially fast. The preamp signal drops to zero when the capacitor is peak charge and this causes the spike in the opposite direction immediately after the leading edge spike. Your main problem is too much amplitude, attenuate it.
Reply to
Fred Bloggs

Consider remedial electronic training at the local community college.

Reply to
Fred Bloggs

Trying to do digital data on magtape, using an audio path, is fighting a loosing battle. Yes, it can be done, but at the expense of complexity and bandwidth.

You'll have a much easier time recording the data directly as manchester encoded (F/2F) flux reversals, and recovering them with an I-V amplifier directly from the head. The I-V amp pretty much squashes the head's self-resonances, and it's actually the right way to treat the transducer. The head's output current is proportional to the rate of change of the flux on the tape.

For recording, a V-I converter is best, but you can just feed the voltage to the head, and let the resistance do the rest.. You DO need a bipolar supply though. You'll have to experiment for how much current to use, it won't be much. Think uA rather than mA. When you have the receive circuit working, adjust the send current so that the amplitude of the recovered data begins to drop off (tape < saturation), then take it back just into saturation.

The great news is, you don't have to hack up the recorder much to do this, leave everything else alone, and just wire directly to the head.

You'll have to experiment to see what your best data rate works out to be, due to gap length, tape speed, and head inductance.

Although it's tough to get ahold of, Finn Jorgensen's "Handbook of Magnetic Recording" is a good reference.

--
KC6ETE  Dave's Engineering Page, www.dvanhorn.org
Microcontroller Consultant, specializing in Atmel AVR
Reply to
Dave VanHorn

Do you think this is necessary for a kHz data stream? It's analog right- so a simple lowpass schmitt should recover it nicely.

Reply to
Fred Bloggs

^^^^ 3kHz

Reply to
Fred Bloggs

Depends greatly on the tape recorder. Try recording white noise, then on playback, see what the response curve looks like. In order to get clean edges at 3kHz, you'll need at least 6kHz bandwidth. Otherwise, the output will be a triangle wave, at best.

What I'm proposing is really pretty simple, other than the manchester encode/decode.

--
KC6ETE  Dave's Engineering Page, www.dvanhorn.org
Microcontroller Consultant, specializing in Atmel AVR
Reply to
Dave VanHorn

Hi,

This is an interesting approach, but it's not appropriate. The aim is to treat the cassette recorder as a black box, exactly the same way I treated the camcorder as a black box. If I wanted to use a recorder specifically built for data recording, I would just use a Commodore C2N datassette, of which I have dozens :)

If the right way to get this thing working reliably is to drop down to lower frequencies, then I can do that. The reason I chose ~3kHz was from studying personal computers from the early 1980s. I limited my studies to computers that could or did use off-the-shelf audio cassette recorders. Observably, they solved this problem. They didn't use the full bandwidth by a long shot, but on the other hand they also had a whole lot less data redundancy.

Reply to
Lewin A.R.W. Edwards

Followup to: By author: Fred Bloggs In newsgroup: comp.arch.embedded

Well, it's sort of.

A very good format for recording to magnetic tape in the low kbps range is MFM; it's simple, quite robust w.r.t. speed differentials, and polarity-independent (unlike Manchester coding.)

MFM works like this:

For each bit time, at t = 0 there is an edge (toggle whatever level the output is at the time.) If the bit value at 1, at t = 0.5 there is another edge; otherwise the level stays the same.

During decode, use the first edge for synchronization; if there is another edge between t = 0.25 and t = 0.75 or so per your own clock, then record a 1 otherwise a 0. For higher bit rates you may want to try to produce a clock from the synchronization pulses instead of using your own "nominal" clock, but the error window is huge so it works well.

This was used by the ABC series computers used in Sweden 1978-1986; a full schematic of the ABC80 machine is at:

formatting link

The ABC80 used 700 bps; the later 800 machine used 2400 bps but the same modulation technique.

If you want higher bit rates you should start to consider some of the techniques used by modems, like quadrature decode and multilevel. The biggest issue about using those on a cassette tape is that you have nonlinear distortion due to speed differences; those are hard to analyze in the context of especially quadrature decode. An alternative is to use digital techniques which put in synchronization pulses in fewer places (if you remember RLL hard drives, that was one such technique.)

-hpa

Reply to
H. Peter Anvin

Is this not _exactly_ what I described? :) (Serious question. I can't see the difference between what you just wrote and what I described as being the actual encoding system in use).

That's exactly what I do. I calculate the average bit cell during the sync acquisition phase. There are several sources of clock instability - tape fluctuation is one, but also both the encoder and decoder are implemented on AVR micros using the internal RC oscillator, and the encoder at least can be subjected to temperature extremes. So I thought it best to adapt the decoder dynamically, since the signal clock rate will be drifting around more or less constantly.

Reply to
Lewin A.R.W. Edwards

It doesn't make sense it looks bloody awful.

The recorder is broken or you have some gross (ac and/or dc) overload of the front end or something strange with the way you have connected the output.

Is the trace you referenced even showing playback? Unless one of them is stored how can you show the recorded input and played back output on the same screen?

If the trace is monitoring the recorder output while recording then the spikes might be capacitive coupling from the fast edges on the input.

Are you just stuffing 5v TTL square waves into the recorder mic (or even line) input? that isn't gong to work.

Reply to
nospam

This is kind of like "The best way to ski, is to use skis, but I want to use a bathtub"..

FSK at a lower baud rate will probably work a lot better. You might get away with bell 202 encoding reasonably well.

What I described, is how data is recorded and recovered for credit card, and other sorts of magstripe data. Wildly varying and somewhat inconstant speed during a read, though not as bad as you might think. You can't accelerate your arm as much as you think. I spent a couple years developing this sort of thing for Verifone.

--
KC6ETE  Dave's Engineering Page, www.dvanhorn.org
Microcontroller Consultant, specializing in Atmel AVR
Reply to
Dave VanHorn

Sounds like what is used on bank cards, we always referred to it as F-2F

I never translated our rates into BPS, but the card speeds were pretty highly variable. I wouldn't be surprised if we went up around 2400BPS. The limit, once we figured out that you can't treat the head as a voltage source :) seemed to be the user's ability to keep the card in the track.

Differing phase delay at different frequencies, will also give you some pretty interesting grief.

--
KC6ETE  Dave's Engineering Page, www.dvanhorn.org
Microcontroller Consultant, specializing in Atmel AVR
Reply to
Dave VanHorn

It does look like you need WAY less signal to the mic input. I'd expect a distorted square wave, but not the pulse per edge.

Mic level is something like 20mV IIRC.

--
KC6ETE  Dave's Engineering Page, www.dvanhorn.org
Microcontroller Consultant, specializing in Atmel AVR
Reply to
Dave VanHorn

It's more like saying "the best way to race cars is to buy F1 racing cars, but if you want to open the sport to the common man, you establish a category for regular commuter cars". It is a design requirement to use off-the-shelf equipment, just like it was a design requirement for those

80s computers.

I've since had a very stupid discovery ("breakthrough"), which I'm going to post as soon as I can take a pic of the trace - my camera is charging as we speak.

Reply to
Lewin A.R.W. Edwards

I read in sci.electronics.design that Rich Grise wrote (in ) about 'Recording digital data to analog tape... revisited', on Sun, 3 Oct 2004:

Everyone knows that they use magic.

You can get analogue 625/50 video down 5 km of it. You need an equalizer at each end. Been there, done that, but as assistant consultant I didn't get to wear the T-shirt.

--
Regards, John Woodgate, OOO - Own Opinions Only. 
The good news is that nothing is compulsory.
The bad news is that everything is prohibited.
http://www.jmwa.demon.co.uk Also see http://www.isce.org.uk
Reply to
John Woodgate

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.