AVR controlling five 3.5" floppy drives

Go To Last Post
36 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

(Okay, I may be cheating...it was a toss up as to whether this should have gone in the Off Topic forum :-) )

One of the jobs I have where I work is the 'setup' of embedded PC's (basically a PC on a 3/4 EISA size pc board). The setup consists of using 5 floppies to load the CMOS settings and our program code. You can imagine how boring it is just setting there waiting for one floppy to finish, inserting the next floppy and so on. So I had this idea...

What if I stacked 5 floppy drives together, placed all 5 diskettes in them and basically placed an AVR in between the PC and the floppies. I would also need a clock/calender (DS1307) and PC keyboard interface, both of which I have working code for.

I have done some research this afternoon regarding floppy drive interfacing. I noticed that some floppy ribbon cables do the swapping thing with the Drive SelectA, Drive SelectB, Motor EnableA and Motor EnableB signals. I also noticed there are quite a few more floppy interface signals such as Index, direction, read, write, etc.

My question is this: What exactly do the Drive SelectA/B signals do? Do they disable the other signals so that there is no contention between signals if (back in the old days) you really did have 2 disk drives installed? I don't want to switch 'all' those signals such that only 1 drive is physically connected at a time. I was wondering if I could have 5 port lines on an AVR controlling the Drive SelectA line for each individual floppy (obviously there would be another port pin used to read the Drive SelectA line from the PC floppy interface, the AVR would use that and other criteria to select the correct drive).

I realize there will be other 'issues' to deal with such as knowing when a floppy has finished loading but the thought of switching something like 10 signals to each of 5 floppy drives was a project killer to me. Apparently, according to some information I found, the NEC 765 controller was/is capable of sinking (or was it sourcing) around 40 or 50mA on some of those signals.

Anyway, I would be interested in knowing exactly what those Drive Select lines do as I could not find more detailed information.

Thanks,
Steve

P.S. If the moderator feels this belongs in the Off Topic forum please move it there, thanks!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
Drive SelectA/B signals do

They select drive A or B :-) the PC has only 2 max floppy drives. So you could use the drive select to enable any of the drives with some bits of a port. It's a long time since I worked with floppys thou :? gh

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

what are you going to read and write the data with? Just bitbang the 500kbit MFM stream?

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes, you should be able to expand the drive select lines to do this, and parallel all the other lines.a 74HCT138 (should be T as levels are TTL) would to the trick, the AVR supplying a 3-bit 'drive number' to the ABC inputs and the /select from the controller going to /G of the '138.

You need to figure out how the system detects the disc change - there is more then one way this may be done - I think there is a 'disc changed' signal on some drives, but it may also just regularly poll the drive, e.g. for index pulses.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Pin 1: input: HD/LD (on 5 1/4"), output: low = "no disk in drive"
Pin 34: disk change signal (low = no disk in drive)
Pin 10: DS0
Pin 12: DS1
Pin 14: DS2 (reserved/NC in modern el cheapo drives)
Pin 6: DS3 (reserved/NC in modern el cheapo drives)
Pin 16: motor on (active low)

to save a bit of (then expensive logic) IBM used in their implementation of Shugart's interface the 'motor on' signal for drive select, i.e. both floppy drives were hardwired (jumpered) to DS0. The twisted cable - pins 9-16 - exchanged the 'motor on' and 'DS0' signals for drive A and drive B.

With a twisted cable, the interface's DS0 = high and Motor On = low would select (and switch on) drive B, DS0 = low and Motor On = high (both bits toggled)would select and switch on drive A - actually, these are the signal combinations you'll get from a standard PC two drive floppy interface.

This layout saved IBM the expense of spending money to control the DS1 line (if two drives were the maximum to be provided).

The original NEC 765 and its direct successors could control 4 motor on and 4 drive select signals, but these signals were not wired onto the PC floppy interface (more recent adaptions of the old chip design actually omitted those options).

If you want to use a PC floppy interface / MCU to control more than 2 drives, some requirements come to mind:
1) PC HW and BIOS (still) must support 2 floppy drives ('A' and 'B' in setup), current chipsets are restricted to one 3 1/2" drive only
2) The PC floppy interface will only deliver the DS0 / Motor ON signals as 1/0 or 0/1 (1/1 or tristate if 'no drive selected', depends on the HW implementation).

I'd suggest to use the AVR to control your five drives via their DS0 and motor on inputs. Set up everything on the PC side for drive 'A' and use 'Disk Change' (pin 34, active low) to signal the PC interface that the next disk has been inserted.

The NEC765 had - IIRC - the usual fan-out of 10, so as long as your board HW is fully compatible to the original chip there should be no problem paralleling all other data and control lines (though personally I wouldn't count on that - I'm a coward - I'd buffer everything).

Edit: Requirement 1 above actually is bull if you go through an AVR (sorry)
HTH

Andreas

Last Edited: Wed. Aug 17, 2005 - 01:42 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

Thanks for the replies so far!!

@Bob
(If I am understanding your question correctly) The floppy drive controller built into the embedded PC will still control the communications with the floppy drive. What I am hoping to accomplish is to find a way to *steer* the communications to one of the five disk drives.

Each drive would always hold the same diskette and there is a preset order in which the diskettes are loaded onto the *harddrive* (32MB iDiskOnChip) of the embedded PC. My initial thinking is to make a disk drive ribbon cable with connectors for all 5 floppy drives and that cable, in turn, will plug into the floppy drive controller connector on the embedded PC. I realize that when the embedded PC goes to read/write a floppy all five floppy drives would try to respond. I was then looking for a way to select an individual floppy drive without *switching* ALL of the floppy drive control signals (some of which are apparently relatively high current...40-50mA). I then came across the information regarding the Drive Select and Motor Enable signals and wondered if the Drive Select and/or Motor Enable signals disconnected or tristated the other signals. If my wondering was correct I would then only have to control 2 signals to each floppy drive. I further wondered if I could monitor one of the motor or head control signals, wait for some period of inactivity to determine that that particular floppy drive was done and move on to the next floppy.

Of course, before today's research I knew nothing about floppy drives. Therefore my thinking may be out in the boonies somewhere :-). I apologize if I am not providing enough information but I am kind of thinking this through as I go and I also figure most people here don't want to have to wade through a book for a post.

Thanks again for all the replies so far...keep them coming :-))
Steve

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

@Andreas,

Thank you very much, that was very informative. You were posting your response while I was typing mine above.

The embedded PC HW and BIOS will not be affected in any way (at least that is my plan). I only want to *tie into* certain signals for monitoring purposes and *switch* certain other signals to the required floppy drive (whichever one of the five that needs to be accessed at that moment. The embedded PC cannot be modified in any way. This has to be something that is inserted between the embedded PC and the floppy drives and this is only temporary, just until the embedded PC can have its CMOS setup and software loaded. The embedded PC is then installed in our product minus my intended contraption.

[edit] I saw your edit and I think I am understanding better now :-) I think you are saying I can control as many floppy drives I want (within reason) with an external AVR. Of course I realize I need a way to determine when a floppy drive is finished before I move on to the next one.

Thanks again for your response.
Steve

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi, Steve -

Quote:
... need a way to determine when a floppy drive is finished ...

You perhaps could use pin 4 on the floppy interface ('in use', switches on the drive's LED, IIRC active high) - *if* your PC HW provides the signal :)

Andreas

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Historically, floopy drives had an open collector interface. That means the logic signals only pull to 0V and rely on 150ohm resistors to pull the signal high. So , if the required drive was not selected, it would not pull any of its signals low. So, I would expect that you can intercept the drive select signal and put your logic to select 1 of 5 floppy drives. Note that it has been many years that I have had to actually interface to a floppy so things may have changed in the meantime. Unfortunately I remember the time where having a paper tape reader was the bomb and floppies were nirvana.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hey Steve,

What other ports are on the computer to transfer files? Serial, parallel, IDE, memory card or ethernet? Perhaps a spare socket for Disk on Chip devices? There might be a better way to get the files to the board.

J.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

@Andreas
Yes, I was hoping that signal meant what I (and yourself) thought it meant. I will have to drag out the oscilloscope and start poking around while I am doing the setup the slow, boring ass way :-).

@Kartman
I was hoping that was the case and kind of figured it must be. Back in the old days when you either had 2 5.25" floppy drives or 5.25" and 3.5" floppy drives they would both have been hanging on all the signal lines from the floppy controller on the PC. I figured there must be a way to keep one drive inactive while accessing the other. Thanks for confirming my hopes.

@J.
I have considered other means and actually tried transferring the complete setup from one iDiskOnChip to another. I found an old DOS drive imaging program but couldn't get it to work (don't remember exactly what the problem was). The basic problem is I am unable to get extensive help from our Engineering department. They are pressed for time and this setup method is working so everything is honky dorry (or however the hell that is spelled). I am not an engineer thus I am scared to stray too far from the existing setup method. It would be my luck that no problems would show up until we had 50 units in the field and all of them would crap out because of something I did to save some time (and sanity :-) ). I am comfortable with the AVR, PC keyboard interfacing, DS1307 use and the floppy drive interface doesn't appear too intimidating. Don't get me wrong, I appreciate your input greatly.

Thank you all very much for your input !!! You all have confirmed to me that this might be something I can handle on my own.

Warmest regards,
Steve

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Check the floppys you intend to use, I seem to recall having to remove pull-up resistor packs on older floppy drives if you used more than one on a system. But of course that was back when floppys were truly floppy, only came in black, and cost a buck each.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

Thanks, I actually remember seeing something about that in the information I found yesterday afternoon. I had already forgotten about it though...oops.

Thanks again,
Steve

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Good luck, Steve, it sounds like a good idea to me...

Four legs good, two legs bad, three legs stable.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I guess as long as we're talking about floppies, if Igor can bitbang USB then I bet some clever avr programmer could bitbang mfm data and read and write a pc floppy. 18 sectors/track is about 9k x 5 revs/sec.... thats only 45K per sec... I think the data is about 500 kbits.... think thats bitbangable? Then you could have a little avr pda with a floppy and an mmc card. Yeah And write a z80 opcode interpreter and run cpm on it!

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

bobgardner wrote:
I guess as long as we're talking about floppies, if Igor can bitbang USB then I bet some clever avr programmer could bitbang mfm data and read and write a pc floppy. 18 sectors/track is about 9k x 5 revs/sec.... thats only 45K per sec... I think the data is about 500 kbits.... think thats bitbangable? Then you could have a little avr pda with a floppy and an mmc card. Yeah And write a z80 opcode interpreter and run cpm on it!

Not sure this is too practical. I implemented a MIDI file player which sources from a floppy. I used an FDC37C78 controller which I bitbanged. Normally this interfaced to a DMA controller. This was with an '8515 at 4Mhz. The code took over two years to develop and debug.

Most of my issues were with disk detection. As noted IBM and others did not connect some of the control signals. Drives used on XT systems do not have DISKCHNG. The only way to identify if a disk is in the drive is to read it! There is some code on the net called floppy.c from a POSIX build. This code shows how "Magic sectors" are read to determine what media is in the unit. The line is only active when the motor is on (drive selected.) un-selecting the drive causes this signal behave un-predictably. On old floppys this was actually the door open signal.

To make matters worse. When used in a non PC environment many drives have a strap which changes the DISKCHNG signal to a signal called !READY. PC-AT drives work one way XT another. Laptop drives sometimes have both DISKCHNG and !READY. Most modern replacement drives do not implement these signals at all.

Did I mention FAT12? that involves 12 bit words to implement in an 8 bit architecture. To save space, the extra 4 bits are packed into even/odd fields.

Still it is pretty neat to have an '8515 connected to a floppy, I got the driver into 2KW, which leaves another 2K words for RTOS, I/O, and about 800KW words for the application.

I have CF and SD/MMC versions of my file player on the drawing board. My current market (The over 68 crowd) still has floppys and that is what they want. Otherwise it is cheaper to purchace an iPod Shuffle.

Now what I want to see is a USB host controller that runs on AVR and can connect to *any* usb drive or memory stick. Now that would be impressive. 8)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Bob: I was actually going to try that to prove that it could be done (due to another discussion here or on the avr-chat), and that a floppy controller was not needed, but never completed it due to lack of time. I'm still pretty sure it can be done.

Steve: Do the PC have a IDE interface ? If so, what about using a CF-card (which is compatible to a hard-disk) instead to transfer the data ?

/Jesper
http://www.yampp.com
The quick black AVR jumped over the lazy PIC.
What boots up, must come down.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

@Jesper

First, thank you very much for your ideas !!

As far as I know the embedded PC has a IDE interface. I think that is what the iDiskOnChip (what we use for a harddrive) plugs into. To be honest I don't know anything about CF-cards...I am assuming that is a Compact Flash card. I have never used or even looked at them.

The thing that worries me (because I am under educated in this area) is that we do not use DOS (or Windows) as the OS. Our Engineering department uses some other RTOS (but DOS will run fine on this embedded PC). When I am loading the software on the embedded PC I see messages about RAM drives and such and I am not really familiar with all that and thus am not comfortable with how to properly go about copying the complete file system from a *master* harddrive to the harddrive on each new embedded PC. I don't feel comfortable asking our Engineering department for help because they have pretty much said: "yeah, we know it is a crappy way to setup this embedded PC but we don't have time to make it better".

So, I started looking for ways (that I am comfortable with and can accomplish without the help of our Engineering department) to automate the present process.

Thanks again,
Steve

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hey! I have one of those little Msys diskonchip ISA pc cards for programming the diskonchips. They're only $25

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
I bet some clever avr programmer could bitbang mfm data and read and write a pc floppy.

I believe that the NEC floppy controller is being used for the 'bitbanging', the AVR will just do some disk manipulations as far as I can tell. Never used the NEC controller, last time I used one it was a Western Digital chip, I think it is still working on my Signetic 2650 computer driving 2x5.25" floppies (100Kb each!) and of course the whole disk controller is on veroboard :-)

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have a 4MHz Z80 S100 system with two 8" floppies. Giant 20amp transformer. What can I do with it?

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
and about 800KW words for the application.

Hmmm, where did you buy those 8515's ????

/Jesper
http://www.yampp.com
The quick black AVR jumped over the lazy PIC.
What boots up, must come down.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
I have a 4MHz Z80 S100 system with two 8" floppies. Giant 20amp transformer. What can I do with it?
Press leaves ?

/Jesper
http://www.yampp.com
The quick black AVR jumped over the lazy PIC.
What boots up, must come down.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I dare say it would be easy to bit bang FM (single density), but there may be an issue doing MFM in regards to precompensation. A little extra hardware would help, but then just adding a controller chip would solve the problem! I could understand jporter's problem with using a 4Mhz clock, a faster AVR should pee it in - I used to do it with a 1mhz 6809 as programmed i/o.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

jesper wrote:
Quote:
and about 800KW words for the application.

Hmmm, where did you buy those 8515's ????

Ooops. That should have been 800W. :oops: Or more like 720 instructions. You can probably see why I do not like LDS and STS instructions. That I fit all the code in the '8515 without going to a Mega 162 was satisfying.

-jP

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kartman wrote:
I could understand jporter's problem with using a 4Mhz clock.

The clock MHz was never a problem. The main issue is the el-cheepo drives I am using do not have any sort of DISKCNG or !READY signal. Not a problem because in a Pee-Cee the user initiates all drive transfers. The AT uses these lines to cache a copy of the directory and FAT.

I learned MIDI on a 1MHz Apple][ with a 6502. With 4 Mhz one has all the time in the world.

-jP

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

Quote:
Hey! I have one of those little Msys diskonchip ISA pc cards for programming the diskonchips. They're only $25

I did not know anything like that existed. I will have to go check it out. That sounds, on the surface, to be a great solution. I take it I can find it on the Msys web site?

Thanks bunches Bob !!!

Steve

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I think so (been a couple years now...)

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

@Bob

It looks like the device you are referring to is called the DiskOnChip PIK. An End of Life for that device was issued back in 2000. I found some information that seems to indicate the PIK was replaced by the DiskOnChip-EVB but I cannot seem to find anything on the M-Systems site about it. I would be surprised if the EVB worked with the iDiskOnChip as the iDiskOnChip is made to plug directly into the IDE connector while the regular DiskOnChips are made to plug into a DIP socket.

Thanks anyway,
Steve

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

So summarize the current pc hw and the procedure that involves feeding 5 floppies into the thing... I assume you are repeatedly copying the contents of these 5 floppies to 'somewhere'. I guess my first question is why not make 5 floppy image files and a bat file to copy them? So you fill in the problem to be solved and all us self proclamed smart guys will think of a faster cheaper simpler way to do it.

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

http://cgi.ebay.com/ws/eBayISAPI...

first item on froogle search for diskonchip

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Steve,

Is this a custom built embedded PC you are configuring? I doubt it, if you are loading it with floppys. Rather than leave everyone who is trying to help you guessing, why not post something like: I am trying to load files on a XXXX model embedded computer that is running the XXXX RTOS. It has a spare XXX port and an unused XXX slot and the files are stored on a XXXX DiskonChip that it is plugged into a socket, with a spare socket next to it.

John

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Embedded PC I refer to can be found here, the picture down the page under Highlights is the exact board we use (the picture at the top of that page doesn't look like the one we use). We do not use the DIP DiskOnChip shown in the lower picture though, we use an iDiskOnChip that plugs directly into the EIDE connector at the top of the board.

http://www.protech-ipc.com/ipc/p...

[edit] iDiskOnChip is here:

http://www.m-systems.com/site/en...

The exact model number of the iDOC is MD1160-D32 (32MB).

The above board is plugged into one of the 4 slots of a backplane board with EISA connectors. The backplane board is connected to appropriate power supplies.

A 15" VGA monitor is connected to the VGA monitor connector on the embedded PC board

A PS/2 keyboard is plugged into the keyboard connector on the embedded PC board.

One each 3.5" floppy drive is connected to the FDD connector at the top of the embedded PC board via standard floppy drive ribbon cable.

The setup procedure goes as follows:
1. Insert CMOS-Save/Restore utility diskette into floppy drive
2. Apply power to VGA monitor and backplane
3. When prompted type in date and time
4. At A:\> prompt type 'Go', this is a batch file I wrote that runs the CMOS save/restore utility which "restores" the CMOS settings we use
5. At A:\> prompt, replace CMOS save/restore diskette with what we call our 7E System Disk(ette).
6. Type Ctrl+Alt+Del key combination, upon rebooting this disk performs the FDISK and FORMAT functions and installs the RTOS and our program files on the iDiskOnChip. There are several keyboard selections to be made during this process and the PC is rebooted once
7. When prompted, replace the 7E System Disk with the first of 3 diskettes containing our Help Graphics files. It does not matter in which order these Help Graphics diskettes are copied. The contents of these 3 disks are copied to the iDiskOnChip.
8. When prompted replace the first Help Graphics disk with the second.
9. When prompted replace the second with the third disk
10. When prompted, remove the third disk, hit any key (except h) and the system reboots into our software

The problem is that I have to pay attention so I know when to change a diskette to the next one. Another problem is having to always put in the date/time and the repeating of the same keystrokes over and over and over (I absolutely hate monotonous, repetitive, boring ass work like that...that is just the way I am I guess). That is when I came up with the idea of using a DS1307 with an AVR that also emulates the PC keyboard. I then went further with that idea and wondered if I could have the AVR somehow monitor when the disks needed changing, add 4 more floppy drives to the above fixture and have the AVR automatically increment to the next drive when it detects it is time to do so.

Anyway, I am not sure I have adequately described things. Let me know what questions you have.

[edit] I was writing the above and did not see John's post until after I posted the above. The RTOS is The FreeDOS Project by Pasquale J. Villani. That is all the information I have, that information is shown when the embedded PC boots up.

Thanks,
Steve

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

SteveN wrote:
we use an iDiskOnChip that plugs directly into the EIDE connector at the top of the board.

Configure a "Golden" iDiskOnChip, use this program http://www.acronis.com/homecomputing/products/trueimage/features-cloning.html?ad=A01010311 to clone it on any pc with a spare connector on the IDE cable. Use the batch file to set up the CMOS and you are done.

Total cost, $49.00 + one "configuration PC", which you can use to log on to avrfreaks in all the spare time you will have.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

Thanks John, I will go check out the Acronis software.

I apologize for my previous lack of detail. My OP question was answered in the first few posts. I did not think there would be continued interest in this thread so I did not want to bore people with the details of my problems. Obviously I was wrong and again I apologize. I truly appreciate everyone's interest, help and ideas !!!

Warmest regards,
Steve

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have to do a similar procedure. We use 'GHOST' to image the diskonchip but still require a floppy to setup the ethernet config etc. At least imaging the diskonchip will save you a lot of floppy swapping!