5 ms·
A Linux driver to connect PATA/IDE directly to GPIO
- crizzlenizzle 6y agoAn 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.
- h2odragon 6y ago> Data transmission is well outside the design scope of libgpiod. But it can do it, anyway. Lovely hack.
- myself248 6y agoGoing the other way, a PATA port in PIO mode can be used as GPIO: https://hackaday.com/2011/02/03/stk200-pocket-change-programmer/ https://hackaday.com/2011/02/03/stk200-pocket-change-program...
- flingo 6y agoWhen 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.
- myself248 6y agoI 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.
- rasz 6y agothere was even a project to do direct IDE drive emulation using pee https://hackaday.io/project/20774-netpi-ide https://hackaday.io/project/20774-netpi-ide sadly seems to have stalled
- sebazzz 6y agoYou can also use a parallel port for similar purposes.
- ChuckMcM 6y agoThis 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 ? :-)
- jack12 6y agoIt 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?
- manawyrm 6y agoDepends 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 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 https://github.com/zwostein/idetrol (i used this code, ported to ARM to check my hardware before I wrote the kerneldriver)
- dillonmckay 6y agoI was just watching ‘Anna’ on Hulu, and was thinking about IDE drives. This does look really cool.
- awiesenhofer 6y agoI wonder if you could implement a floppy interface the same way?
- effnorwood 6y agoYou could have done so much more with your life.