Accessing an SD card through a parallel port, just because

[Vinod] sent in a very cool build he says is somewhat of a ‘mad project': he mounted an MMC and SD card under Linux using the parallel port on his computer. Even though parallel ports are getting rarer these days, we absolutely love [Vinod]‘s dedication and willingness to dig around the Linux kernel.

The hardware portion of the build is very simple – just an SD/MMC header and a few resistors wired up to a parallel port. The software side of the hack gets pretty interesting with [Vinod] building a kernel module, something we rarely see on Hackaday.

We’d have to agree with [Vinod]‘s ‘mad project’ sentiment, if only because of the terrible throughput of [Vinod]‘s adapter; it takes him more than a minute to transfer a 1.5 MB file onto the SD card – terribly slow, to put it mildly. Nevertheless, we’ve got to respect [Vinod] for pushing the limits of uselessness and still building something cool in the process.

Comments

  1. mkb says:

    I would argue that this is actually pretty useful: a lot of industrial boxes still use floppies and parallel ports.

  2. MrRimmer says:

    Looks like it could be really useful for me – I have a 8Gb SDHC card that got scrambled when it was taken out of a Nokia phone at the wrong time and nothing can reformat it. I have read that the only thing that can descramble it is a Nokia N95 phone as it talks to the SD card directly rather than through a controller. maybe this hack would allow the card to be unlocked and reformatted or even better allow me to retrieve the data that is stuck in it.

  3. Hirudinea says:

    He should send the module to the people at Tiny Core Linux, or any other small distro.

    • wojtekka says:

      Oh come on, OpenWRT guys have been doing this (mmc-over-gpio in particular) for ages. Besides, there already is an mmc-spi driver in the kernel, there are spi-bitbang and spi-gpio drivers, so what we see here seems a bit overengineered.

  4. Gdogg says:

    Great way to learn SD protocol and how to write linux drivers. I guess he was just bit banging it?

  5. toxict0ast says:

    It should be “a SD card” right?

    • Mental2k says:

      No, and being a grammar nazi makes you look like an ass, doubly so when you get it wrong.

      “An” precedes words which begin with a vowel sound. “s” is pronounced “ess” which begins with a vowel sound.

      If English isn’t your first language and that is a sincere question I apologise and please disregard the first sentence, it’s obviously meant for me.

      • Nardella says:

        I think he was asking a question. You replied like he was being over critical and treated him rudely.

      • Nardella says:

        This could be useful to get small files on and off a device without a USB port.

      • Mental2k says:

        That’s why I put in the apologetic/self deprecating third paragraph.

      • toxict0ast says:

        Thanks for explaining it, I didn’t know so thats why I asked. I was not trying to be rude. I thought it was only “an” if it was a vowel. I didnt know it included ones that sould like vowels too. Thanks.

      • Mental2k says:

        Well in that case I apologise again.

        In the vein of helpfulness, words which start with a consonant sound should be preceeded with an “a” even though they may start with a vowel. For example “a university”.

        Certain words which start with “h” complicate things further. I’m probably going to miss a criteria here but I’ll give it a go. Polysyllabic words, beginning with “h” which is unaspirated and followed by a vowel sound can take either “an” or “a” as it pleases the user. It’s easier to remember these as words which commonly drop the h at the start: hotel, hospital, etc.

      • tyco says:

        This particular rule confuses many English speakers, even native speakers, and that last example illustrates that very well. The H sound in “hotel” and “hospital” is only dropped in some dialects of English, at which point you’d use an “an” in front of them. If the H sound is pronounced, however, then an “a” belongs in front of it.
        The easiest way to figure it out is to try to say it. If you can say it with “a” and string the words together without a stop, it’s probably right. If you can’t, then it needs the N sound from “an” to allow you to string it together.

        Extra information: I’m an American English speaker so I don’t know if this is correct, but I’ve observed that British English speakers insert an R sound when a word ending in a vowel is followed by a word beginning with a vowel, though this is only in the spoken form, not the written form. For example: “The data on the card is corrupted” would have an R sound between “data” and “on.” In American English, this transition creates either a clumsy stop, or a muddy transition, depending on the speaker. The R sound smooths the transition.

      • Mental2k says:

        The “r” thing is largely accent based, sounds south western English, like Cornwall. Most English accents are non rhotic so they tend to drop “r”s in words like water and daughter with a hard r at the end.

  6. Thesandlord says:

    Can someone explain why transferring a file causes the computer to hang? From the website it seems that it is because it uses up a lot of CPU time? So a more powerful or multithreaded CPU can get around this? Or is it some sort of blocking issue caused by the kernel module? I know almost nothing about kernel programming.

    • Erik Johansson says:

      Interrupts? Using some kind of built in SD card reader from 2003 locks up my computer as well bit banging->no buffering-> no dma tends to do that I guess?

      • Gdogg says:

        I think that’s pretty much it. With no UART they have to operate the driver on strict timing. Everything else be damned.

      • tyco says:

        I’m not familiar with SD cards, but it appears they can be interfaced with SPI, which is then insensitive to timing as you are creating each clock pulse. To bit-bang on SPI, put the data, pulse the clock high, then pulse the clock low, repeat. The endpoint device generally won’t care how far apart the clock high and clock low pulses are, as long as they aren’t faster than the device can handle.
        As a result, perhaps the driver could be written in such a way that other tasks can still happen, as long as they aren’t using the parallel port?

  7. barryronaldo says:

    Very cool! Nice work! A great way to keep those older machines useful and humming along :) Love some parallel port. Keep up the great work!

  8. NewCommentor1283 says:

    1) awesome, thanks for the inspiration

    2) as for temporary lock ups…
    remember regular FLOPPY on win98 on aN old(er) computer?
    cant play MP3’s at the same time as formating floppy…
    DMA channel not fast enough to multitask…

    aka forget about playing MP3’s(floppy bitrate)
    _from_ a floppy ;) XD

  9. AussieTech says:

    Neat hack, and thanks to Vinod for proof of concept. It should be noted that this could also be done using the RS-232 serial port data and control lines.

    When he says “hang” he seems to mean that it is fully occupied with the SD task and is ignoring keyboard &c inputs until it is done; not “crashed”.

    “Only” 1.5Mb/min has to be seen in the context of the Centronics printer transfer speed of 5kbytes/sec. I can think of lots of useful applications within this speed limitation.

  10. Galane says:

    Must not be using EPP or ECP mode, which are capable of 2.0 and 2.5 megabytes per second data transfer.

    At over a minute to transfer 1.5 megabytes, this lash up must be using the SD card’s serial transfer mode.

  11. Aaron says:

    You need to break out an FPGA to convert the SPI signal to ECP so it’s not so slow.

  12. blacky says:

    Is it possible to do the same with a com port ?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 96,597 other followers