Controlling 5 1/4 inch floppy discs via digital logic and a CPU - Page 1
Forum section: electronics / projects

author: Banned 05.11.2017
author_rank: Contributor
timestamp: October 30, 2017, 04:46:55 am
content: Dear friends,I need to control a 5 1/4 inch floppy drive using either a CPU or digital logic.Well, basically I have CPU similar to an 8085, and I want to control the floppy with it. I have no idea how to start though. Could anyone reccomend me some literature that will get me there? Or could anyone help me achieve this?Thanks a lot...

author: xtech
author_rank: Regular Contributor
timestamp: October 30, 2017, 07:05:50 am
content: Use dedicated floppy controller. I've used in many 8-bit projects WD37C65. It's compatible with standard PC controller '765 so many code examples are available.

author: Ian.M
author_rank: Super Contributor
timestamp: October 30, 2017, 07:46:12 am
content: The first question would be what do you hope to achieve? 5 1/4" drives and media became obsolete in the first half of the '90s, and twenty five years later, you are going to have difficulty finding a good drive and even more difficulty finding good media. Also there are dozens of incompatible 5 1/4" floppy formats, most of which IBM compatible high density drives cant reliably access, or even read at all. If you need the even older 40 track double density drive for reading legacy media from the 8 bit computer era its even harder to find one. If you have legacy hard sectored disks you have a snow-flakes chance in hell of reading them without an original drive and controller card.

author: RoGeorge
author_rank: Super Contributor
timestamp: October 30, 2017, 07:54:47 am
content: The processor itself would not have enough computing power to decode the signals coming from the magnetic heads. If it is clocked at just a few MHz, as it use to be back in the days of the floppy era, then it can hardly cope with data transfer from a dedicated floppy disk controller to the memory (without using DMA).I designed a floppy interface for a Z80 computer running at 3.5 MHz (without DMA) but I used the Intel 8272 single/double density floppy disk controller. You can still find a lot of documentation online, this is the first link returned by Googlehttp://cpctech.cpc-live.com/docs/i8272/8272sp.htmIf you make it work with the 5 1/4 inch, then it will also work with 3 1/2 and with 7 inch floppy disk units, because the signals to drive a floppy disk unit are the same regardless of the disk size.If you don't already have the software for a file system, then you will have some serious programming work to do. To implement a file system is not trivial. To make it compatible with any standards is also not easy at all. Try to find some working example source code, then port it for your hardware, otherwise it could take many months, maybe years to do it all by yourself.Why do you want to build a floppy controller?

author: Kleinstein
author_rank: Super Contributor
timestamp: October 30, 2017, 10:15:45 am
content: Many old Comodore disk drives used a 6502 CPU to do the decoding, but the CPU was essentially busy with this. There is quite some information on the 1541 drive for the C64. However they use a proprietary rather slow format and low speed. To make things even more strange they used more sectors on the outer tracks, despite of the low recording density.A ready made controller FD chip is likely easier.

author: amyk
author_rank: Super Contributor
timestamp: October 30, 2017, 10:27:20 am
content: Quote from: RoGeorge on October 30, 2017, 07:54:47 amI guess you haven't heard of theCommodore 1541or other early floppy drives of that era?See also:http://www.linusakesson.net/programming/gcr-decoding/Decoding the raw magnetic signals is definitely doable on hardware like that, and also lets you do things that a more "standard" hardwired floppy controller can't.Edit: Kleinstein beat me to mentioning the 1541You might find more help in thehttps://www.eevblog.com/forum/vintage-computing/forum.

author: TK
author_rank: Super Contributor
timestamp: October 30, 2017, 10:30:07 am
content: If DOS format is not required, you can take a look at the Apple II disk. It only uses analog board on the drive and it is controlled by the Apple II 6502 CPU running @ 1MHz.

author: mikeselectricstuff
author_rank: Super Contributor
timestamp: October 30, 2017, 11:05:35 am
content: Quote from: amyk on October 30, 2017, 10:27:20 amBut possibly not for standard floppy formats.It's almost certainly doable on a modern reasonably fast MCU though.

author: glarsson
author_rank: Frequent Contributor
timestamp: October 30, 2017, 11:06:01 am
content: The Apple II used a custom floppy controller, the Integrated Woz Machine (IWM).

author: TK
author_rank: Super Contributor
timestamp: October 30, 2017, 11:45:51 am
content: Quote from: glarsson on October 30, 2017, 11:06:01 amThe IWM was developed later as a single chip solution. The original implementation used only TTL logic + PROM. So it is totally possible... if you are Woz. Better go with the floppy controller WD1793. You can find schematics on an actual implementation like the Kaypro II (google for Kaypro Technical Manual 1984).

author: Kleinstein
author_rank: Super Contributor
timestamp: October 30, 2017, 11:48:53 am
content: The Amiga used the CPU and graphics HW for decoding standard (PC compatible if they want to, MFM coding) disks. However this is with extra HW support from the graphics part and a faster CPU. For the HD discs they still had to slow down the RPMs to make it work.

author: rstofer
author_rank: Super Contributor
timestamp: October 30, 2017, 04:12:23 pm
content: I have never worked with the 5-1/4" drives but when I did an 8" controller, there was quite a bit of analog circuitry which required a PLL to synchronize the data. I used the WD 1771.If I had to do this, I would just buy an old IBM PC complete.https://www.ebay.com/itm/Vintage-IBM-PC-5150-AMD-8088-intel-8087-Tested-Working-AST-SixPakPlus-Hercules/162722690584?hash=item25e3073618:g:eJgAAOSwnTdZ7ZZGI would grab what I could off the floppies but build a Compact Flash interface to my new project. This is a simple parallel port interface that will work in 8-bit mode and use programmed IO if DMA isn't available. I use CF on a lot of projects because it is simple.On at least one occasion, I built up an entire drive image and wrote it to the CF with Linux's 'dd' command. This command will become your new best friend when working with CF and oddball file systems.

author: Banned 05.11.2017
author_rank: Contributor
timestamp: October 30, 2017, 04:31:18 pm
content: Ideally I would like to build a controller myself, and control the drive directly.DMA is available on my CPU.If building the controller myself would be hard, then I would accept to use a controller in the market. Which one is the best to use ? The WD37C65 ?The reason I want to do this is because I have built an 8bit CPU from TTL and it runs at around 5MHz, and it has DMA and interrupt support. Totally built from TTL and proms.Now I am looking for a vintage storage option to add to it. Preferably 5 1/4 " floppies. An HDD interface is kinda too simple and it doesn't generate the "challenge" I am looking for. This is more like building a work of art for me.Could anyone please explain to me the procedure used for a CPU to talk to a floppy *controller*?How does it work? I don't need DOS formats, I could use my own format at first.Lets say the CPU wants to write a sequence of bits to a floppy. What are the steps necessary ? Notice I said a sequence of its and not a file. Is it necessary to first format the bits into a file ?So what are the steps? The CPU writes to a few of the controller registers, and the controller doer the job? But what does the CPU write to the registers? What are the commands?Is it possible to do this simply by polling ?

author: Kleinstein
author_rank: Super Contributor
timestamp: October 30, 2017, 04:56:26 pm
content: The FD controllers would be addressed just like other peripheral chips (e.g. UART, PIO etc.). So write values to the suitable registers at the right time. Data transfer may be via DMA or kind of polling from registers, depending on the controller. You would need a datasheet anyway.

author: khs
author_rank: Regular Contributor
timestamp: October 30, 2017, 05:09:32 pm
content: Here the link to a floppy controller.http://www.lupinek.com/soubory/wd2797.pdfThe controller reads and writes from/ to the floppy drive. You need some additional hardware to pre-process the data stream.You have to write commands to the controller and read/write floppy data from / to the controller. Please refer to the datasheet.Here the link to the German mc-cp/m computer..https://www.google.de/url?sa=t&rct=j&q=&esrc=s&source=web&cd=4&ved=0ahUKEwiT37bq6ZjXAhWFSRoKHXPACLEQFgg9MAM&url=http%3A%2F%2Foldcomputers.dyndns.org%2Fpublic%2Fpub%2Frechner%2Fndr-mccpm%2Fmccpm-bw_ger.pdf&usg=AOvVaw0k84xpB83GpEWBNpWXBCyFMaybe this helps you..

author: RoGeorge
author_rank: Super Contributor
timestamp: October 30, 2017, 05:36:49 pm
content: Quote from: Engineer321 on October 30, 2017, 04:31:18 pmIf you don't care about compatibility with something like IBM, then it's pretty simple. You don't need a controller, and you can treat the floppy unit like a digital tape recorder.Google for the floppy disk connector pinout. The name of each pin will pretty much tell you its function.The idea is that you need to- select the floppy unit- drive the heads to the outer tracks until you reach track 0 (there is a signal that tells you when you reached "track0")- from there, you can drive the heads to the desire track. If you want to go to track 9, you give 9 impulses on the "step" line.- there is also a direction line, which tells the heads to which direction they will go when you send a pulse to the "step" line. "Dir" must be set before starting to send the "step" pulses.- once you positioned the heads to the desired track, you start to spindle the floppy disk, there is a signal for motor on, let's call it "moton"- there is a small round hole punched in the magnetic disk, that hole is call the index. The floppy unit can sense that hole, and it will output a "index" pulse at each turn made by the magnetic disk. The "index" signal helps you to detect the beginning of a track.- there are also "read" and "write" signals for the magnetic heads- once you arrived to the desired track and the spindle motor is on, start polling for the "index" signal. When you see it, start spitting your bits, or start reading themThat's the main idea. There are a few more details, you'll figure them later. Google will help a lot.The good part is that all signals are digital, so all you need is a few digital inputs and digital outputs to control the floppy unit. The rest is software. It won't be very easy, but it's doable without spending years.

author: timb
author_rank: Super Contributor
timestamp: October 30, 2017, 05:47:57 pm
content: Quote from: RoGeorge on October 30, 2017, 05:36:49 pmYou can build a simple interface around these signals. See Byte Magazine February 1978 (Volume 03 Issue 02) for a good article about interfacing to “minifloppy” drives, including a schematic.

author: Banned 05.11.2017
author_rank: Contributor
timestamp: October 30, 2017, 05:54:02 pm
content: Quote from: RoGeorge on October 30, 2017, 05:36:49 pmGeorge. Thank you so much for this in-depth explanation. That is so beautiful!I am very happy to have read this. So I don't actually need a controller and it's all digital ? That is amazing!Thanks for the step by step explanation.So it all can be done by software and polling... Fantastic. Why are there controllers around then? What do the controllers do afterall if it can be done by software ? Just to make things faster ?So right after the floppy sees the index hole, it gives a signal out saying the beginning of the track has been found. How do I actually use the RD and WR signals ? For example, once the disc is spinning on the right track. Does the CPU write to the floppy byte by byte or bit by bit ? If it's byte by byte, then does the CPU write the byte to a register inside the unit, and then pulses the WR signal? Is the WR signal edge sensitive or a level signal?Cannot thank you enough....

author: Banned 05.11.2017
author_rank: Contributor
timestamp: October 30, 2017, 05:57:24 pm
content: Just for curiosity, here is the 8bit "CPU" that will control the floppy controller or drive... It's made out of TTL and proms... and runs at a max of 5MHz...

author: RoGeorge
author_rank: Super Contributor
timestamp: October 30, 2017, 07:02:10 pm
content: That's a very nice CPU!A controller is necessary when you want to pack as many bits as possible on each track, with as less errors as possible. The IBM standard was using MFM encoding, and the data rate for high density standard was 500 kbit/s. A processor from the floppy disk era will not have enough speed to encode/decode on the fly at that data rate, to read the sync signals for each sector, to emulate a PLL, to serialize the bits, and so on.Since you don't need to be compatible with something else, you can simply put some pulses on each track at your own peace and your own encoding scheme. There is only one pulse read or written at a time. Transforming pulses in data bits, then later in bytes, it's up to you, and can be done entirely by software.Start from understanding the floppy disk unit pinout:http://lmgtfy.com/?q=floppy+disk+pinoutand look at the imagesFor the rest of your questions, this kind of manuals for floppy disk units will be very useful:http://hxc2001.com/download/datasheet/floppy/thirdparty/Teac/TEAC%20FD-05HF-8830.pdfhttp://jope.fi/drives/HW_HF_C929_C940_C991_Rev-A.pdf

author: TK
author_rank: Super Contributor
timestamp: October 30, 2017, 07:25:16 pm
content: Your homemade computer deserves a homemade floppy controller... take a look at how Wozniak did it with the Apple II disk

author: Banned 05.11.2017
author_rank: Contributor
timestamp: October 30, 2017, 08:15:19 pm
content: Quote from: RoGeorge on October 30, 2017, 07:02:10 pmSo do we write a byte at a time or a bit at a time George? It's a bit cloudy there for me. Put a byte in the floppy register and pulse WR ? Or is it actually a 16bit word in fact ?

author: RoGeorge
author_rank: Super Contributor
timestamp: October 30, 2017, 09:00:27 pm
content: Since you were quoting one of my messages, I assume you were talking to me, so please stop calling me George.A floppy disk unit is a very dumb device. It has no registers inside, and it has no idea about bits, or bytes, or words. All it understand is just logic levels and pulses.Did you saw the floppy disk connector, with name and function for each wire? Did you found the description for each one? At the end of the manuals linked before there are some timing diagrams, did you saw them?

author: Banned 05.11.2017
author_rank: Contributor
timestamp: October 30, 2017, 09:17:32 pm
content: Quote from: RoGeorge on October 30, 2017, 09:00:27 pmTHe pinout has WriteData and WriteEnable, and Index. How do you write the bits using these? What speed do you write at? What rate should the data come out of the CPU ? Should I write the data till I see Index again ? Is writeData a bit ?

author: TK
author_rank: Super Contributor
timestamp: October 30, 2017, 09:21:12 pm
content: Quote from: Engineer321 on October 30, 2017, 09:17:32 pmHard to believe that these questions are coming from someone who built a CPU using TTL logic... Do you know how to google?

author: Banned 05.11.2017
author_rank: Contributor
timestamp: October 30, 2017, 09:32:16 pm
content: Quote from: TK on October 30, 2017, 09:21:12 pmYou have replied twice on this post, and both times you have said nothing that concerns the thread. Just so you know.

author: Leo Bodnar
author_rank: Frequent Contributor
timestamp: October 30, 2017, 09:33:41 pm
content: I will only join this fight if the are no HD disks in it. DD or bust.Leo

author: mikeselectricstuff
author_rank: Super Contributor
timestamp: October 30, 2017, 09:49:02 pm
content: Quote from: Engineer321 on October 30, 2017, 09:17:32 pmThis Teac floppy drive datasheet should have everything you needhttp://deramp.com/downloads/floppy_drives/teac/Teac%20FD-55BV.pdf

author: RoGeorge
author_rank: Super Contributor
timestamp: October 30, 2017, 10:32:31 pm
content: Quote from: Engineer321 on October 30, 2017, 09:17:32 pmYou didn't answered any of my questions, so I have no idea if you opened those 2 PDF's I linked before.You need to open those 2 PDF manuals and actuallyread themand look at the timing diagrams.If you will do so, then you will find point8.3.6and diagram8.3-2.Did you found them?

author: Banned 05.11.2017
author_rank: Contributor
timestamp: October 30, 2017, 10:38:37 pm
content: Quote from: RoGeorge on October 30, 2017, 10:32:31 pmArent those manuals for the 3.5 inch floppies? I am looking for the 5 1/4 ones... Or is the pinout the same ?

author: helius
author_rank: Super Contributor
timestamp: October 30, 2017, 10:45:49 pm
content: Quote from: Engineer321 on October 30, 2017, 10:38:37 pmThere were several different interfaces used for floppy disk units, but the most common IBM PC interface is exactly the same for 5.25 and 3.5 inch drives. It has to be, since they can both be placed on the same cable.I didn't expect to have to point this out, since it is something I thought was well-known, but you cannot control a floppy disk drive with only digital logic. The signals from the head are analog and need analog filtering, and the drive strength of the output signals must also be controlled.

author: RoGeorge
author_rank: Super Contributor
timestamp: October 30, 2017, 10:50:32 pm
content: Quote from: Engineer321 on October 30, 2017, 10:38:37 pmHey, I wrote the key items in bold. It is not nice from you to ignore a direct question.Did you found and read point 8.3.6 and looked at figure 8.3-2?Quote from: RoGeorge on October 30, 2017, 07:54:47 am

author: Banned 05.11.2017
author_rank: Contributor
timestamp: October 30, 2017, 10:52:48 pm
content: Quote from: RoGeorge on October 30, 2017, 10:50:32 pmI think you'd better leave it at that if you're getting annoyed. Thanks for everything.

author: mikeselectricstuff
author_rank: Super Contributor
timestamp: October 30, 2017, 10:55:56 pm
content: Quote from: helius on October 30, 2017, 10:45:49 pmThe drive signals are all digital -the drive electronics take care of the analogue-ness.The output data is sort-of analogue in the sense that it's not clocked, so you need to recover a clock to read the data ( depending on the encoding scheme), which could either be done digitally or with the aid of an analogue PLL.

author: RoGeorge
author_rank: Super Contributor
timestamp: October 30, 2017, 11:01:42 pm
content: Quote from: Engineer321 on October 30, 2017, 10:52:48 pmAgain, you ignored my question and start making assumptions.I am not annoyed. I need to be sure you located the figure, 8.3-2, so we can further talk about it, and explain with its help how you can save data on a floppy disk.

author: glarsson
author_rank: Frequent Contributor
timestamp: October 30, 2017, 11:02:54 pm
content: Quote from: RoGeorge on October 30, 2017, 07:54:47 amI have never seen a 7 inch diskette, but the 8 inch diskette is slightly different than the smaller diskettes.The signals is terminated with (if I remember correctly) 150 ohm to +5V for 5 1/4 inch and 80 mm diskettes and with 220 ohm to +5V / 330 ohm to ground for 8 inch diskettes.Also, the two smaller sizes has 80 tracks while the big one only has 77 tracks.

author: RoGeorge
author_rank: Super Contributor
timestamp: October 30, 2017, 11:21:52 pm
content: Good catch, that was a typo, it's 8 inch, not 7. I noticed and correct it only a few posts ago, when I was quoting myself.As far as I remember them, they were controlled in the same way as the smaller FDDs. There might be out there some other versions of FDDs, with different signals, but I don't know about them. Regarding the number of tracks, it doesn't matter, because the OP want to design a software controller, and it doesn't need to be compatible with other standards.

author: Banned 05.11.2017
author_rank: Contributor
timestamp: October 30, 2017, 11:23:10 pm
content: Quote from: RoGeorge on October 30, 2017, 11:01:42 pmYes I see the picture. So each time the pulse goes low it's a 1, and level is a 0 ? Is t1, t2, t3, etc the tracks? The timing gets larger with higher tracks ? Not sure I understand the diagram. What defines a 1 or a 0 ?Also someone said the signals are analogue coming out of the driver........

author: Banned 05.11.2017
author_rank: Contributor
timestamp: October 30, 2017, 11:25:37 pm
content: Quote from: RoGeorge on October 30, 2017, 11:21:52 pmAnd I see you used a floppy driver with your Z80 computer.... Did you use a controller ?

author: RoGeorge
author_rank: Super Contributor
timestamp: October 30, 2017, 11:54:10 pm
content: Quote from: Engineer321 on October 30, 2017, 11:23:10 pmt1-t3 are related to MFM encoding. Lets put them aside for a moment, and look at the magnetization trace only. Ignore all the 0s and 1s written in that figure.Let's look only at the traces "Magnetization on disk" and "WRITE DATA". Notice that each time you send a short 0 pulse on the "WRITE DATA" line, the magnetization of the disk is reversed. That is all the floppy disk can do. Change the polarity of the magnetic field at each pulse. In the diagram it's also given the required duration for a write pulse: between 0.2 and 1.1 us.Now, how we can save data with such a device? All we can do is record some magnetic pulses while the disk is spinning. We need to imagine ourselves anencoding scheme. There are many encoding schemes already available, MFM is one of them. Since you don't need to be compatible with some other floppies, then you can imagine your own encoding scheme. For example, when you need to save a 0 bit, you write 2 pulses spaced at 5us, when you need to save a 1 bit, you write 2 pulses spaced at 10us. Of course, you can invent another encoding scheme, or you can try to use an already existing encoding scheme, it's up to you.Regarding the analog signals from the heads, I never saw such a FDD.Do you already have the 5 1/4 floppy disk unit?In my Z80 computer I used an Intel 8272 controller, because I wanted to be able to read/write CP/M diskettes. i8272 is the other big 40 pins IC, the same size as the Z80.

author: Banned 05.11.2017
author_rank: Contributor
timestamp: October 31, 2017, 01:06:35 am
content: Quote from: RoGeorge on October 30, 2017, 11:54:10 pmI have the drivers yes.So all the pulses do is to reverse the magnetization? That's pretty strange. So every pulse swaps the direction of the magnetization and that's all it does? So assume the magnet is up, then leaving it up for another cycle could mean a 0. THen having it up and then down could mean a 1 ?So same polarity for 2 cycles means 0, different polarities mean a 1. Could this be an encoding scheme?

author: Banned 05.11.2017
author_rank: Contributor
timestamp: October 31, 2017, 01:08:16 am
content: Quote from: RoGeorge on October 30, 2017, 11:54:10 pmOr is it the frequency of pulses that determines 0 or 1 ?See, I didn't understand what defines a 0 or 1. Frequency of the downward pulses? Or their distribution ?

author: amyk
author_rank: Super Contributor
timestamp: October 31, 2017, 01:46:11 am
content: I believe a brief introduction to the principles of magnetic recording is in order here.Please readhttp://info-coach.fr/atari/hardware/FD-Hard.phpand post here if you have any more questions.The IBM PC/AT Technical Reference also contains schematics of the analogue electronics of a floppy drive, from the pins on the interface to the coils on the heads.For some more interesting discussion on separating MFM data from the clock, search the Internet for the phrase "phase-jerked loop"...

author: texaspyro
author_rank: Super Contributor
timestamp: October 31, 2017, 05:46:21 am
content: Quote from: RoGeorge on October 30, 2017, 11:54:10 pmThe Intel 8272 is pretty much a clone of the NEC uPD765. Way back in the last millennium I worked for a mini-computer company. They required all devices used to have a second source. I was the first person in the US to use either chip... and uncovered all their dirty little secrets. BTW, they cost $35 each in 1000+ quantities. I used a bipolar PROM based state machine to do the data separation instead of a PLL. It had some novel features... the company was too cheap to file a patent on it.Also, my floppy disk exerciser program never met a floppy drive it could not destroy within a day. It sent lots of drive manufacturers back to the drawing board. Spindle clamps (that clamped the diskette to the spindle) were a particular problem. I think everybody just ripped off the same clamp design which was faulty.And if you are doing your own controller, bone up on write pre-comensation... at both the bit level and track level.

author: tooki
author_rank: Super Contributor
timestamp: October 31, 2017, 06:28:10 am
content: Quote from: glarsson on October 30, 2017, 11:06:01 amFYI, the only Apple II to use it was the Apple IIgs. But it, or its successor, was used in all Macs with floppy drives.

author: tooki
author_rank: Super Contributor
timestamp: October 31, 2017, 06:39:20 am
content: Quote from: Engineer321 on October 30, 2017, 10:52:48 pmFor someone who's asking for help, you sure are uncooperative and unfriendly! Besides, I think you could have answered most of your questions yourself with just a bit of googling. There's tons of info out there on how these things work.

author: RoGeorge
author_rank: Super Contributor
timestamp: October 31, 2017, 09:15:13 am
content: Quote from: Engineer321 on October 31, 2017, 01:06:35 amThat is very good. I was asking about it because it's very important to know if your FDD (Floppy Disk Drive - note that it is named "drive", not driver, by "driver" people usually refer to the software) have the usual IBM interface. Most probably your FDD is IBM compatible, but there is a small chance to be some rare older model that is not IBM compatible. You need to check by looking at your FDD connector, maybe place a photo of the FDD and the connectors here. Also, each FDD model have it's own specifications and performance. For example, some 5 1/4 models have only 40 tracks, other can do 80 tracks, some are single sided, other are double sided, some can have a track to track time as fast as 2 ms, others are much slower, and so on. The exact model of your FDD, maybe the user manual too, will be very useful. Yet, if you don't have these, a picture and a few tests can be enough.Quote from: Engineer321 on October 31, 2017, 01:06:35 amYes, a pulse reverses the magnetization, that is all a FDD can do. FDD does not know about cycles. You send a pulse, FDD will reverse the magnetization. You send another pulse, and the FDD will reverse the magnetization again. You will never know which was North and which was South. All a FDD can do is to put a magneticflux reversalon the magnetic disk each time you send a write pulse.Same thing at reading: when the magnetic heads will detect a magnetic reversal on the disk, the FDD will output a read pulse for you.Deciding the distance in time between magnetic reversals it's your job (or the controller's jobs if you use a dedicated IC). Deciding what a "cycle" is and how long a cycle should be, is also your job. Measuring the distance between pulses, is also your job.Now, this is just the main idea.- In practice, you will notice that you can not send two write pulses very close to each other. The magnetic heads and the magnetic media have their own limitations. If you want to go deeper into the rabbit hole of magnetic pulses, you need to read from pages 13 to 17 in this document:http://info-coach.fr/atari/hardware/_fd-hard/sright-technote.pdfPlease note that the "time chunks" marked with dashed lines on the time axis are arbitrary units, FDD does not know about them, so there are no time "cycles" for the FDD.- Also, you can not put two write pulses too far either.- There are a few more details, like i.e. precompensation, but we will ignore other details for the moment. We will talk about them later.If I were you, I will try to:0. post here a pic of the FDD and another one with the FDD conectors1. identify the FDD model2. find the FDD datasheet if possible3. power the FDD4. try to spindle the motor and move the heads- For point 3 you will need 5Vcc and 12Vcc. (If you will ever decide to use a smaller 3 1/2 inch FDD, then you will need only 5Vcc)- For point 4 you will need to generate some logic levels and some pulses.Can you generate the pulses that move the heads? Is your CPU functional and programmable, or you plan to use some other method to generate the pulses? Would you like to take the approach from the above steps 0...4, or do you have other plans?Offtopic: It is not necessary to quote my full message each time you want an answer from me. You can use the nickname, RoGeorge, anytime you want. It's just that I don't like when people cut out pieces of it, like when you used George instead of RoGeorge.

author: Banned 05.11.2017
author_rank: Contributor
timestamp: October 31, 2017, 05:53:22 pm
content: Hi RoGeorge,Thank you again. Hold on, I will take a few photos and try getting the model and datasheet. Just a few minutes and I be back!

author: Banned 05.11.2017
author_rank: Contributor
timestamp: October 31, 2017, 06:01:57 pm
content: My floppy is a TEAC FD-54A-00-U model made in Japan. It comes from an old Sanyo computer.Seems the link you sent me is for a model similar to this one ?http://hxc2001.com/download/datasheet/floppy/thirdparty/Teac/TEAC%20FD-05HF-8830.pdfI can't see to find the datasheet for this specific model!Seems only 55A datasheets are available. Photos coming.

author: RoGeorge
author_rank: Super Contributor
timestamp: October 31, 2017, 09:18:23 pm
content: I hope you'll like this:ftp://ftp.mindcandydvd.com/pub/drivers/Tandy/Tandy_1000_Technical_Reference_Manual.pdfBetween pages 290-468 is the full service manual for your TEAC-FD-54, including the schematic diagrams.Very important: you will find in that service manual a lot of procedures about cleaning, adjustments and calibrations. Do NOT try to clean or adjust anything. Some adjustments, like e.g. mechanical head alignments are very hard to do without a reference disk and some other dedicated tools.

author: Banned 05.11.2017
author_rank: Contributor
timestamp: October 31, 2017, 10:08:37 pm
content: Seriously? That's simply fantastic !! Thank you so much for finding this. You're the magic man!I will read it all, and try to understand the operation. I see you are very enthusiastic about vintage computers and floppies, and the Z80 system you built had a 5 1/4 drive as well! I also prefer the 5.25 ones than 3.5 ones. The 3.5 are so boring looking.It seems very complicated to get a floppy working.... If I were to use a controller like the wd2797, would things become as easy as polling a few registers?

author: texaspyro
author_rank: Super Contributor
timestamp: October 31, 2017, 10:20:11 pm
content: Quote from: Engineer321 on October 31, 2017, 10:08:37 pmIf your processor can poll or process an interrupt, read/write some registers, transfer and store data faster than say 15 microseconds per byte. Otherwise you will need to use something like DMA to get data out of the chip.

author: glarsson
author_rank: Frequent Contributor
timestamp: October 31, 2017, 10:50:03 pm
content: As far as I remember a 4MHz Z80 can't keep up with a controller reading or writing a double density disk. Mine did it using a Z80B running at 7.3MHz.For lower frequencies it is possible to use WAIT input for each data byte read or written (or use DMA).

author: texaspyro
author_rank: Super Contributor
timestamp: November 01, 2017, 12:19:23 am
content: Quote from: glarsson on October 31, 2017, 10:50:03 pm500,000 bits per sec / 8 bits per byte -> 62,500 bytes per second -> 16 us per byte (less a little for overhead and sloppy timing). A lot of the early floppy controllers had register access / cycle times around a microsecond. It was rather difficult transferring data using programmed I/O. To do it reliably usually required DMA or external FIFO chips. Also, the processor was basically unavailable for other stuff when servicing the floppy. Ahhh, the good ole days... you youngins don't appreciate life in the slow lane.

author: Ian.M
author_rank: Super Contributor
timestamp: November 01, 2017, 12:35:01 am
content: Z80 auto-repeating INIR and OTIR block I/O transfer instructions only take 21 T states per byte transferred, so with appropriate hardware assistance to insert wait states to sync with the FDC, and a block of INIR or OTIR instructions as each can only transfer up to 256 bytes, its possible to stream data fast enough to keep up with a 500Kbps floppy format as long as the clock speed is above 1.3MHz and the controller only needs a single byte access to handle eight bits of the bitstream. Worst case, if it cant handle the timing for rewriting sectors 'on the fly', you may have to implement Amiga style Track at once disk handling, which copies a whole track to/from a RAM buffer, including all headers etc. in a single uninterruptable transfer.Blocking for 3.33ms to read/write a track shouldn't be an issue on any 8 bit system that isn't doing other hard realtime processing.

author: texaspyro
author_rank: Super Contributor
timestamp: November 01, 2017, 12:47:27 am
content: A major problem with using the block I/O instructions is what can happen if the operation has errors and you wind up waiting forever for a sector transfer that does not complete. With DMA you can poll the status reg and know something went wrong. You can't do that using I/O instructions without some extra logic to timeout the operation, etc.

author: Ian.M
author_rank: Super Contributor
timestamp: November 01, 2017, 01:25:09 am
content: Yes, you'd need logic to assert NMI if the transfer needed to be aborted. The NMI handler can then check the return address and if its on a INIR or OTIR in the floppy driver, patch the return address to effectively force a jump to an error handler within the driver.

author: RoGeorge
author_rank: Super Contributor
timestamp: November 01, 2017, 02:10:55 am
content: Quote from: Engineer321 on October 31, 2017, 10:08:37 pmDefinitely yes.We were talking about write pulses and an eventually DIY encoding scheme because you said you'll be happy with just a stream of bits saved no matter how, and because the title is "via digital logic and a CPU", so no controller chip.At 5 MHz there will be no problem to feed the controller, especially when you have DMA. With my Z80 it was possible to secure the data throughput for double density 512 bytes sectors without DMA, using just interrupts, a few nasty assembler tricks and, of course, keeping track of each and every CPU clock during FDD transfers. The CPU was clocked at 3.5MHz.A dedicated IC controller will be the proper choice. It will solve a lot of issues, like finding the sector, syncing the PLL, applying proper precompensation, applying the encoding scheme, treating magnetic errors, calculating the CRC, managing the index signal, generate step timings, formatting the disk, managing general logic like write protect, disk change, door open, and so on and so forth, many other critical details that you won't need to deal with by yourself.Even more, using a standard controller will let you the opportunity to make your computer compatible with other file systems and other FDD units. This will be a great advantage for future FDD upgrades, and especially for reusing the already existing software from other i8080 based computers.Regarding the type of controller, I remember i8272 was newer and better than wd2797. You will need to compare the datasheets and see which one you want more.

author: Banned 05.11.2017
author_rank: Contributor
timestamp: November 01, 2017, 06:24:45 am
content: Quote from: RoGeorge on November 01, 2017, 02:10:55 amSo I will use a controller at first, just to get a better feeling for how everything works, and when I know enough I can start building my own with analogue components and digital logic. Days ago I purchased a wd2797 controller, so I guess I'll use that unless the i8272 is much better ?

author: cj
author_rank: Contributor
timestamp: November 01, 2017, 09:07:43 am
content: The Dutch Elektuur november 1982 has a floppy controller circuit diagram using TTL chips and 6850 ACIA and 6821 PIA.https://archive.org/details/Elektuur229198211GenI don't think it's compatible with any other floppy format. Back in the 1980s I build this circuit and used it in my home build computer. It also works with the more modern 3.5" floppy drives.CJ

author: Banned 05.11.2017
author_rank: Contributor
timestamp: November 01, 2017, 11:25:40 pm
content: Quote from: cj on November 01, 2017, 09:07:43 amShame I don't speak Dutch

author: chicken
author_rank: Frequent Contributor
timestamp: November 02, 2017, 04:12:20 am
content: Quote from: Engineer321 on November 01, 2017, 11:25:40 pmGrab the link to the text and throw it at Google translate or similar service.

author: RoGeorge
author_rank: Super Contributor
timestamp: November 02, 2017, 05:22:19 pm
content: Quote from: Engineer321 on November 01, 2017, 06:24:45 amMost probably a wd2792 will be OK, but since I never used a wd2792, I can not tell if i8272 is much better, or what is the difference between the two of them.