AVR HDD interface project
This project demonstrates the interface between an AVR ATMEGA32 and a IDE hard drive.
The source code accommodates both file and directory navigation creation and deletion. Both FAT16 and FAT32 (except long filenames at this stage) are supported.
Original workThe original sourceforge project by
Angelo Bannack and Giordano Bruno Wolaniuk
is located here using a ATMEGA128.
This project is a ATMEGA32 port, the reason being that I wanted to build a system on veroboard. Thanks to the great structure of Angelo and Giordano's work I only had to changed two files, the makefile and main.c.
Please not that this project uses WinAVR 20040404 and not WinAVR 20060421.
OverviewHere is a low resolution diagram of the entire system.
A higher quality circuit diagram can be downloaded here (19KB).
The system basically consists of a MEGA32, an IDE connector, a 232 level shifter and a power supply.
An ICP socket has been added but is not required.
CPU up close
Note that I used a 4MHz crystal in stead of the recommended 16MHz. At 16MHz the AVR is simply to fast for some older drives. Simply adding NOP statements where they were originally inserted was not enough. Timing boundaries are exceeded in other places. Further investigation as to where to add delays is required. If you are however using a "modern" drive with at least ATA66 and LBA, 16Mhz should be fine.
The IDE interface remains unchanged from the original. A simple CPU port and PSU connection.
The serial port interface consists of a RS232 converter and a IDC10 type box header. The IDC10 simplifies connectivity, as a DB9..ribbon..IDC10 cable was used. The only drawback is the rather unusual TX,RX and GND pin numbers.
PSU,RST and ICP
There's nothing special about the power supply, except that the hard drive's 5V is not to be drawn from VCC ( the currents are just to high for a 7805 ).
One could use the 5V HDD supply to feed the circuit, but that comes from a high current power supply. Any PSU related bugs in your prototype might then result in burned tracks!
Vin is the +12V that feeds the HDD.
The ICP(In Circuit Programming) port used is the ATMEL standard while the reset circuitry is a simple RC type.
I programmed my device using the SP12 programmer. The 100nF load on the reset doesn't seem to affect the programmer.
Firmware.Download (714KB) the entire MEGA32 compatible project and the original documentation.
Download (685KB) the code that this port was based on.
Note that the only files that has changed for the MEGA32 version is the makefile and main.c.
Serial setup.28800 baud. (when running on a 4MHz crystal)
115200 baud. (when running on a 16MHz crystal)
1 stop bit.
0 parity bits.