PDA

View Full Version : MS-DOS driver for an SD card connected via a parallel port



profdc9
January 22nd, 2014, 03:53 PM
Hello,

I have written an MS-DOS driver to connect SD cards to the parallel port which is attached. Because floppy disks and floppy disk drives are hard to come by these days, this might help transfer data to or from your old PC, especially in large quantities. I have tried it on my IBM PC 5160 XT but nothing else. It is licensed under the GPL and source code is included. Be careful interfacing to your parallel port because you could damage it. If anyone gives it a try let me know. The README is below.

Best regards,

Dan




SD card driver for parallel port

I wrote this to simplify data transfer between my IBM PC and my laptop, because my laptop does
not have a 360k floppy drive but does have an SD card slot.

WARNING: I take **no responsibility** for any damage to your computer, parallel port, or SD
card, or any data. You use this driver at your own risk. It is highly recommended you use
an expendable parallel port card with your expendable SD card, and your expendable data.
It is recommended that you use a level converter IC with between your 5 volt parallel port
outputs and the SD card 3.3 volt inputs. This project is intended as a fun hack for hobbyists
and enthusiasts and not for serious work.

This driver is made available under the GNU General Public License version 2. It incorporates
modified code from ELM Chan Fat FS (http://elm-chan.org/fsw/ff/00index_e.html).

Usage:

In your config.sys file

DEVICE=SD.SYS /d /k /p=<partition #> /b=<port base index>

Loads and installs the SD card driver.

/d = debugging mode (displays copious debugging messsages)
/k = use card detect signal to inform dos that card is attached
/p = partition number (1-4) to partition in MBR to use. Default: first available.
/b = port base index of parallel port, one of
1=0x3BC, 2=0x378, 3=0x278, 4=0x3E8, 5=0x2E8
Default: 0x378

For best results, format your SD card with a FAT16 partition which is less than 32 MB in size.
NOTE: Many versions of DOS don't know how to handle FAT32, and many can't have FAT16 with a
partition size greater than 32 MB. Therefore, if you want to play with this, make your parition on
the card FAT16 and less than 32 MB. This assures the best compatibility. You can have multiple copies of the
driver loaded if there are multiple partitions on your SD card you want to use simultaneously.

I have used Adafruit's microSD adapter
(http://www.adafruit.com/products/254?gclid=CLH7l4iEkrwCFQPNOgod7BkAQA)
if you want a relatively simple way to interface your PC parallel port to
the SD card. The adapter provides the 3.3 volts needed to power the SD card, as well
as a the level shifting between the 5 volt parallel port output and the 3.3 volt input.
If you directly connect a 5 volt output to a 3.3 volt input, you risk latching up the
3.3 volt input and damaging the card or computer from exceesive current.
Some have used series resistors instead of the level converters, but I found this
to not be that reliable and still may have this problem. Also, some SD cards MISO/DO
outputs are unable to drive a TTL input of some parallel ports, so you may need to add
a buffer between the two as well. I have found quite a bit of variability in the drive
current required for the inputs of various parallel ports.

The driver uses the very slow serial peripheral interface (SPI) mode of the SD card. The
speed, which depends on your PC speed, could be as slow as 10 kilobytes/second. This is
not a replacement for your hard drive. Your parallel port should be configured for standard
mode (not bidirectional) if applicable.

The connections between the parallel port and the SD card are as follows:

Parallel port SD card

PIN 25 signal GND GND (Vss)
+3.3V Vdd (power)
PIN 2 signal D0 CMD / MOSI / DI (SPI data in)
PIN 3 signal D1 SCLK / CLK (SPI clock)
PIN 4 signal D2 DAT3 / CS (SPI chip select)
PIN 13 signal SELECT DAT0 / MISO / DO (SPI data out)
PIN 11 signal BUSY Card detect (if you SD card slot has one)

For similar setups, look up parallel port to JTAG adapters which are used for in circuit
programming and debugging.

Good luck and be careful!

pearce_jj
January 23rd, 2014, 08:33 AM
Thanks for posting this - it looks great! I feel another PCB coming out of this... What hardware would be needed to make it faster, presumably a shift register or something?

profdc9
January 23rd, 2014, 09:42 AM
Thanks for posting this - it looks great! I feel another PCB coming out of this... What hardware would be needed to make it faster, presumably a shift register or something?

It could be sped up in a couple of ways using shift registers:

If the standard parallel port pins are used, one could get 8 bits out and 4 bits into the parallel port at a time. Therefore latching the parallel port output to a 8-bit parallel-to-serial shift register to MOSI to clock data out, and shifting the MISO to a 4-bit serial-to-parallel register to clock data in would allow eight bits to be written and four bits to be read at a time. The hardware would have to handle clocking the SCLK line, which wouldn't be that difficult.

For bi-directional mode, a pair of 8-bit parallel-to-serial and serial-to-parallel registers would have to be used, appropriately tri-stated depending on the read/write condition.

It might be simplest just to implement this using an AVR because the SPI mode could just buffer the data in/out of the card, and then handle transfering data to the parallel port. No shift registers would be needed, just the microcontroller itself and the level shifters. The microcontroller could also be easily reprogrammed for various port configurations.

Dan

sorphin
February 24th, 2014, 11:56 AM
Did one of these on my Tandy 1000SX (used an additional parallel port card though). Works like a charm. Yeah, it's a bit slow, but hey, it's storage... I embedded it in the hood for a DB25 connector.

elektrownik
February 24th, 2014, 10:55 PM
I cant get this to work...

sorphin
February 25th, 2014, 08:44 AM
I cant get this to work...

It might help if you could be a bit more specific about what you've tried/not tried.

elektrownik
March 8th, 2014, 10:00 AM
I buyed arduino SD adapter, it works with 5V (with build-in converter). I copyed sd.sys to MS-DOS start FDD, Added line in config.sys, formated SD card (two 32m partitions). But there is message that "drive not connected or not powered". Thanks

profdc9
April 4th, 2014, 07:51 PM
The arduino level adapter doesn't have level shifters. This may be ok for the AVR but for the old school TTL inputs probably you need true 5 to 3.3V level shifters. Also, try a pull-down resistor to MISO (maybe about 2k) if the SD card is having trouble driving the parallel port input.

Dan


I buyed arduino SD adapter, it works with 5V (with build-in converter). I copyed sd.sys to MS-DOS start FDD, Added line in config.sys, formated SD card (two 32m partitions). But there is message that "drive not connected or not powered". Thanks

sorphin
April 6th, 2014, 11:16 PM
Hello,

I have written an MS-DOS driver to connect SD cards to the parallel port which is attached. Because floppy disks and floppy disk drives are hard to come by these days, this might help transfer data to or from your old PC, especially in large quantities. I have tried it on my IBM PC 5160 XT but nothing else. It is licensed under the GPL and source code is included. Be careful interfacing to your parallel port because you could damage it. If anyone gives it a try let me know. The README is below.

Best regards,

Dan



So, I've been using this on my Tandy 1000SX successfully with an external parallel port card.. I decided to try using the built in port (to regain a slot).. i built an adapter, bringing out pins 2,3,4, 11, 13 and 25 for gnd.. i tested all the pins and compared them to what i see on the card, they match.. however, it works on the card. on the tandy's port.. it acts like it's not even there? any thoughts or troubleshooting ideas? (my testing consisted of a resistor and an LED for the data lines, and a resistor to ground for the 2 input lines (BUSY and SELECT INPUT)) I should note, I'm using the listed Adafruit adapter, which does level shifting.

Thanks

elektrownik
April 6th, 2014, 11:24 PM
The arduino level adapter doesn't have level shifters. This may be ok for the AVR but for the old school TTL inputs probably you need true 5 to 3.3V level shifters. Also, try a pull-down resistor to MISO (maybe about 2k) if the SD card is having trouble driving the parallel port input.

Dan
In case of adapter - It have full level shifters, it is for arduino but it is not regular one which is most popular.
http://imall.iteadstudio.com/im120525008.html

It can work with 5V or 3.3V power supply, and both 5V/3.3V IO operation level. It can be controlled directly by a wide range of microcontrollers such as Arduino, AVR, PIC, ARM and MSP430.

sorphin
April 7th, 2014, 11:17 PM
I just noticed you had created a new post for an updated version of the driver... probably should either condense the posts or note the new version has it's own post.. for those of us that don't stalk the forums. :-)

gagaga
October 6th, 2016, 07:31 AM
I buyed arduino SD adapter, it works with 5V (with build-in converter). I copyed sd.sys to MS-DOS start FDD, Added line in config.sys, formated SD card (two 32m partitions). But there is message that "drive not connected or not powered". Thanks

Sorry for posting in this old Thread. ;)
I got the same problem as you, regardless which voltage i use. I have an "Schneider Euro PC". No matter what I try, it does not work.

paperinik77pk
March 12th, 2017, 01:59 AM
Hi all, I just bought all the needed stuff (card reader and parallel connector) and I'd like to build this interface. Only a question...are there any other components (e.g. resistors) to include or can I connect all parallel signals directly to the SD card adapter?

Thank you!
Davide