Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
A Linux driver to connect PATA/IDE directly to GPIO (github.com/manawyrm)
146 points by crizzlenizzle on Aug 8, 2020 | hide | past | favorite | 25 comments


Going the other way, a PATA port in PIO mode can be used as GPIO: https://hackaday.com/2011/02/03/stk200-pocket-change-program...


When I saw the title, I thought it was going this way.

Or, more specifically, a driver to turn an IDE port into GPIO pins that PC programs can control. Closing the gap on making a feature-complete Windows 95 arduino core.


I think you can do this directly, the linked project just tells the kernel "this is a parallel port here", and it just uses normal I/O instructions. The IDE port is already exactly that, though I think the data-direction register controls the whole port at once, rather than one bit at a time.


there was even a project to do direct IDE drive emulation using pee https://hackaday.io/project/20774-netpi-ide sadly seems to have stalled


Using pee?


Never underestimate technology :)


You can also use a parallel port for similar purposes.


An interesting project I found on twitter. Interfacing PATA/IDE directly to Raspberry Pi’s GPIO is pretty trivial and manages to transfer 500 KiB/s. Enough to play CDs. The driver code is around 500 LOC.


This is a fun hack. FWIW, similar sorts of things can be used to add a PATA drive to a Cortex-M microprocessor like the STM32 series.

Who doesn't want a micropython board with gigabytes of code space ? :-)


It hadn't occurred to me that PATA/IDE could be so simple to speak. Now I'm excited about the possibility of being able to dump a 25 or 30-year-old IDE drive I have that my USB adapter doesn't want to talk to (via another SATA-to-IDE adapter).

The README says this option relies on the kernel's "ATA framework" (presumably for the protocol/non-interfacing logic?). Is that part of the "talking to a drive" stack very much to have to implement? Or do you know of any existing code for microcontrollers?


Depends on what you want to do :) If you just want to read/write sectors of 512 bytes at a time, it's pretty easy to implement even on a simple MCU.

There's a couple of registers which need to be set: https://wiki.osdev.org/ATA_PIO_Mode and you can then just read/write the data from the parallel lines.

Here's a similar project using an ATmega32: https://github.com/zwostein/idetrol (i used this code, ported to ARM to check my hardware before I wrote the kerneldriver)


How can this be so easy but talking to an SD card is an impossible task without implementing a billion vendor/type quirks.


ATA was implemented by engineers and then described in a spec.

SD was designed by committee and then implemented as best they could.


Ooh the hours lost trying to reverse the proper call sequence and frequency for my SD card, thanks for the reminder.


over 20 years ago using PIC16 microcontroller http://www.codepuppies.com/ben/sens/pic/mp3/


Wow, that's amazing. Nowadays a 3$ board from aliexpress can do the same (with SD card or USB drive instead) and much more - more formats supported, Bluetooth etc. How the technology progressed.


Ohhh, I remember that now! God the PIC16 is such a cursed architecture.


yeah AVR was like breath of fresh air.


I’ve got a dual Cortex-A7 rocking full Python3 and 4GB of eMMC code space.

But if I told you what it was, I’d get downvoted. So have fun with GPIO.


Those who would give up essential liberty, to purchase a little temporary karma, deserve neither liberty nor karma.


Please enlighten us, what chip / board are you using?


[flagged]


edit to remove because I'm a rude idiot. I'm sorry.


> Data transmission is well outside the design scope of libgpiod.

But it can do it, anyway. Lovely hack.


I was just watching ‘Anna’ on Hulu, and was thinking about IDE drives.

This does look really cool.


I wonder if you could implement a floppy interface the same way?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: