6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Fri May 10, 2024 3:41 am

All times are UTC




Post new topic Reply to topic  [ 11 posts ] 
Author Message
PostPosted: Thu Jul 21, 2022 10:59 am 
Offline
User avatar

Joined: Sun Dec 26, 2021 8:27 pm
Posts: 182
I made a data -> audio -> data interface to let me save data to my 1972 reel to reel tape deck.
It works perfectly at 1200 baud - even though the video doesn't really give that impression :)

Thank you to everyone here who helped with ideas and more! I would very much appreciate any feedback you have.

The project page gives a more complete impression - the video has a few demos of it in action, spinning reels and everything.

Project: https://hackaday.io/project/186309-simp ... rsal-modem

Video: https://www.youtube.com/watch?v=k8hlYr6N3Ls

_________________
---
New new new new new video out! Serial Bootloader for my 65uino
Also, check out: I2C on a 6502 Single Board Computer
and Complete hardware overview of my 6502 SBC R1 :)


Top
 Profile  
Reply with quote  
PostPosted: Thu Jul 21, 2022 12:51 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10800
Location: England
Nice work! Well done for seeing it through. I think I'm right in saying that the Apple 1 format similarly lacks any per-byte framing (or overhead) although I think it may have a 256 byte block structure.

You do mention error correction - but I think you must mean error detection, and perhaps you mean something like the per-block CRCs the Beeb uses, or perhaps a conventional checksum? (People sometimes try to flip a data bit or two to make the thing match, but I think it's rarely successful, so it's not practical error correction.)


Top
 Profile  
Reply with quote  
PostPosted: Thu Jul 21, 2022 3:18 pm 
Offline
User avatar

Joined: Sun Dec 26, 2021 8:27 pm
Posts: 182
Yeah, I’m mixing terms here. I meant error detection, parity or otherwise.
I would like to add options for more encodings so I need to look up the details.

_________________
---
New new new new new video out! Serial Bootloader for my 65uino
Also, check out: I2C on a 6502 Single Board Computer
and Complete hardware overview of my 6502 SBC R1 :)


Top
 Profile  
Reply with quote  
PostPosted: Thu Jul 21, 2022 4:35 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10800
Location: England
Oh, I meant to mention, your tape tone sounded to me like it was a bit variable, as if the tape speed wasn't well-regulated. That's not something which can happen over a phone line, of course, but it would affect transition timings.


Top
 Profile  
Reply with quote  
PostPosted: Thu Jul 21, 2022 8:41 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8433
Location: Southern California
Very nice!

I would bias the LM393's input below Vcc/2, because the input range of the LM393 includes ground but only goes up to Vcc-1.5V. The input range for a 5V supply is 0 to 3.5V, the center being 1.75V.

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Top
 Profile  
Reply with quote  
PostPosted: Fri Jul 22, 2022 6:40 am 
Offline
User avatar

Joined: Sun Dec 26, 2021 8:27 pm
Posts: 182
@BigEd - I think the tone is pretty spot on. After I fixed the motor cap the tone on music etc is perfect. I believe there was some amplitude variation in the recording though - but not more than the comparator could handle.

GARTHWILSON wrote:
Very nice!

I would would bias the LM393's input below Vcc/2, because the input range of the LM393 includes ground but only goes up to Vcc-1.5V. The input range for a 5V supply is 0 to 3.5V, the center being 1.75V.


Completely missed that in the datasheet, thank you! - comparators are a bit new to me. Why is it like that?

I don't want to bias the reference and the (inverting) input at same point because I want a defined reset voltage but I can't decide if I want the output to be normally low or high.

I guess I will bias the (inverting) input at 1.75V and bias the reference either a bit above or below, depending on .. empirical data. At least neither involves changing the PCB.

_________________
---
New new new new new video out! Serial Bootloader for my 65uino
Also, check out: I2C on a 6502 Single Board Computer
and Complete hardware overview of my 6502 SBC R1 :)


Top
 Profile  
Reply with quote  
PostPosted: Fri Jul 22, 2022 7:03 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8433
Location: Southern California
AndersNielsen wrote:
GARTHWILSON wrote:
Very nice!

I would bias the LM393's input below Vcc/2, because the input range of the LM393 includes ground but only goes up to Vcc-1.5V. The input range for a 5V supply is 0 to 3.5V, the center being 1.75V.

Completely missed that in the datasheet, thank you! - comparators are a bit new to me. Why is it like that?

It's because of the configuration of the input transistors, which you can see in the (possibly simplified) schematic in the data sheet. When you get within about 1.5V of Vcc, these transistors and the current sources in their emitter circuits won't have enough voltage left on them to turn on. The output OTOH can swing the whole range, because it can pull all the way to ground, and you'll have a passive pull-up to Vcc.

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Top
 Profile  
Reply with quote  
PostPosted: Fri Jul 22, 2022 6:17 pm 
Offline
User avatar

Joined: Sun Dec 26, 2021 8:27 pm
Posts: 182
GARTHWILSON wrote:
AndersNielsen wrote:
GARTHWILSON wrote:
Very nice!

I would would bias the LM393's input below Vcc/2, because the input range of the LM393 includes ground but only goes up to Vcc-1.5V. The input range for a 5V supply is 0 to 3.5V, the center being 1.75V.

Completely missed that in the datasheet, thank you! - comparators are a bit new to me. Why is it like that?

It's because of the configuration of the input transistors, which you can see in the (possibly simplified) schematic in the data sheet. When you get within about 1.5V of Vcc, these transistors and the current sources in their emitter circuits won't have enough voltage left on them to turn on. The output OTOH can swing the whole range, because it can pull all the way to ground, and you'll have a passive pull-up to Vcc.


That confuses me - even if it clips, won’t the output be exactly the same no matter where the input is biased? Even if it was biased at 1V(and ref was too) and the swing is 2V, output should still be 0v under 1V and 5V over, right?

_________________
---
New new new new new video out! Serial Bootloader for my 65uino
Also, check out: I2C on a 6502 Single Board Computer
and Complete hardware overview of my 6502 SBC R1 :)


Top
 Profile  
Reply with quote  
PostPosted: Fri Jul 22, 2022 8:06 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8433
Location: Southern California
AndersNielsen wrote:
That confuses me - even if it clips, won’t the output be exactly the same no matter where the input is biased? Even if it was biased at 1V(and ref was too) and the swing is 2V, output should still be 0v under 1V and 5V over, right?

Yes; it's not mandatory for operation, just good practice, which is why I said, "I would bias the [...]" And as I seem to remember you implying, you'll need to mind the hysteresis and the voltage at the non-inverting input too. You probably don't need as much hysteresis as you have there though. Less hysteresis and good bias points will enable the circuit to work with a wider range of input amplitudes.

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Top
 Profile  
Reply with quote  
PostPosted: Sat Jul 23, 2022 2:43 pm 
Offline
User avatar

Joined: Sun Dec 26, 2021 8:27 pm
Posts: 182
GARTHWILSON wrote:
AndersNielsen wrote:
That confuses me - even if it clips, won’t the output be exactly the same no matter where the input is biased? Even if it was biased at 1V(and ref was too) and the swing is 2V, output should still be 0v under 1V and 5V over, right?

Yes; it's not mandatory for operation, just good practice, which is why I said, "I would would bias the [...]" And as I seem to remember you implying, you'll need to mind the hysteresis and the voltage at the non-inverting input too. You probably don't need as much hysteresis as you have there though. Less hysteresis and good bias points will enable the circuit to work with a wider range of input amplitudes.


Gotcha! Reliable operation sounds good for a "universal" modem :) Will bias -input at 1.75V and +input 100mv offset. Hysteresis I'm thinking of upping to a 5M resistor.

Thank you for the help - this is not where I shine, obviously :)

_________________
---
New new new new new video out! Serial Bootloader for my 65uino
Also, check out: I2C on a 6502 Single Board Computer
and Complete hardware overview of my 6502 SBC R1 :)


Top
 Profile  
Reply with quote  
PostPosted: Mon Nov 21, 2022 12:29 pm 
Offline
User avatar

Joined: Tue Aug 11, 2020 3:45 am
Posts: 311
Location: A magnetic field
BigEd on Thu 21 Jul 2022 wrote:
People sometimes try to flip a data bit or two to make the thing match, but I think it's rarely successful, so it's not practical error correction.


I had similar belief about 10 years ago. With further research, I found more effective techniques. Tape warble and bit-slip are lost causes but more advanced cases are surprisingly resilient.

I have 256 bit cell networking running on Auduino Due (84MHz Atmel SAM3E ARMv6) and this has been a good prototype for 8 bit implementation. Decoded cells are 24 byte. The wire format is unusual but allows multiple decode strategies. It can also be adapted for magnetic storage. In particular, payloads per marker can be increased or interleaved. The cells have 6854 style, 16 bit frame marker and 3*80 bit payloads which each use a standard Hamming code. This allows multiple bit flips per marker and one bit flip in each 80 bit payload. The test suite uses Unix pipelines to simulate, for example, drop-out and mains triac noise at different frequencies. The results are encouraging.

For 6502 tape storage, it is possible to convey 256 bytes as 16 sets of 128 bits. If the 16 bit-streams are interleaved then it is possible for any sequential run of 16 bit errors to be recovered - or any fortuitous arrangement where there is a maximum of one error per stripe. If bits are skewed towards zero and we always guess that a dropped bit is zero then we are more likely than average to not require error correction. A matching guess doesn't count as error. It is only *conflicting* bits which are errors. In AndersNielsen's case, that is the most problematic double wave. Therefore, we can fix one double wave per stripe and, optimistically, a maximum of 16 double waves per packet.

If additional bits are sent in each packet then it is possible to convey CRC32 with each page. CRC32 guarantees that three further bit flips will always be rejected while a greater number are improbable. The CRC is itself subject to Hamming correction. Therefore, in the most perverse case, everything in a packet may be sent correctly with the exception that 16 ones in the CRC are set to zero. This packet will be decoded correctly and the CRC will be valid. If block numbers are conveyed in the additional bits then it is possible to implement FEC [Forward Error Correction] and send redundant blocks. In the most trivial case, this works like RAID5 where N+1 blocks convey N blocks of data. In the most trivial case, bytes can be re-constructed in the manner that a total can be use to deduce a missing figure. In a more advanced case, the same Hamming correction algorithm can be applied longitudinally across bits in 128 pages. And then the same CRC32 can be applied to detect failure of the Hamming correction with high confidence. Most notably, data can be conveyed with more confidence than MicroSD.

Hamming encode requires more processing power than decode. However, it is not a problem if encode is slightly slower. Pauses in the bit-stream always occur in the correct places and packets will not be dropped due to poor timing.

Obviously, there is a catch to all of this (in addition to writing mind-bending, interrupt driven software). The algorithm is *huge*. A table for CRC32 is 1KB. The ARM implementation is approximately 5.5KB and I spent disproportionate effort to make the bit stuffing wire format work only with 32 bit left shift operations. This is guaranteed to be larger and slower on 6502. For reference, the first revision of the Commodore peripheral protocol was approximately 600 bytes. This covers floppy disk, hard disk, printer and plotter. Atari SIO is less than 400 bytes and is similarly flexible. 6000 bytes or more for tape is unacceptably large. That is why Hamming codes and similar were restricted to turbo tape loaders. The operating system's standard tape loading algorithm could be used to read the turbo loader and that could read the remainder of the tape faster and more reliably. The faster mechanism isn't default because it would require another 8KB ROM.

This isn't unique to 6502. The Z80 Galaksija is a very parsimonious Eastern European system. It looks as varied as the COSMAC ELF and has display similar to early Apple II text mode. Indeed, to reduce cost, the optional second ROM contains floating point and lower case ASCII. Like the Z80 Sinclair computers, it updates display in software. However, to reduce ROM, spare bits in display NOP operations hold the keymap. Unfortunately, to make everything fit into the base ROM, the developers had to drop their preferred tape encoding. Instead, it used a slower, inferior algorithm.

_________________
Modules | Processors | Boards | Boxes | Beep, Beep! I'm a sheep!


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 10 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: