A normal computer send instructions and receives data through the 40 pin(not using all 40 afaik). Is it documented anywhere which of those pins need to be high in order to move the head to a position and read the data from it for example? I want to use the Pi's gpio to access the conents of an hdd, not for any practical reason, it's more like that I want to understand how these things work.

1 Answer 1


The hardware level of parallel ATA is certainly documented. There is also plenty of documentation on the web about projects interfacing ATA disks (and CF flash cards which are similar to some extent) from microcontrollers (search "ata microcontroller" or the like) - quite entertaining. You will have to implement the low-level disk services, see Int 13h how it has been done in the olden days. That is to write to the control registers (essential are: Command, Sector Count, Data, Status, Error, LBA low, LBA mid, LBA high, Device registers) of the hard drive to make it read or write from/to a specific sector (so it's a little more complicated than "toggle a pin high to move the head). Doing all this from software the resulting limited GPIO speed might be somewhat slow.

On top of that you will have to implement the file system (if you care to have one). Petit FAT File System Module is a place to start learning what that comprises. It's written for small microntrollers.

A word of warning, do not connect a P-ATA hard drive to the Pi just because both happen to have a header connector with 40 pins! Not only would the pins not match but the voltage levels differ too - 3.3V on the Pi's side and 5V TTL on the hard disk. So voltage level converters are necessary.

A minimal setup will require 24 pins (16 data lines, 5 address lines (/CS0, /CS1, ADDR0-2), read/write (/DIOW, /DIOR), Reset) - so a Pi might do.

Read more:

  • I've read everything you've linked and told me to search for but I seem to be too inexperienced for this. I now understand it being more than just setting pins to high but I'm afraid I still don't get what are the exact commands and how I can send the data required to the registers and execute commands. Probably shouldn't have chosen this as my next project after making a fricking clock. Commented Jul 23, 2017 at 17:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.