I just started whit a new project where I want to connect a HDD to my Mega16l wich is currently sitting firmly in my STK500.
I have hacked a 40 pin IDE cable to connect the HDD to the STK500.
It's wired like this:
PORTA <--> DD07:DD00 PORTB <--> DD15:DD08 PORTC: PIN7 <- IRQ PIN6 -> /Write strobe PIN5 -> /Read strobe PIN4 -> /C1 PIN3 -> /C0 PIN2 -> A2 PIN1 -> A1 PIN0 -> A0 PORTD: (Wired to the leds and buttons on the STK500) PIN7 <- SW0 PIN6 <- SW1 PIN5 -> LED0 PIN4 -> LED1 PORTE/AUX RST -> /Reset GND -- GND VCC -- DMARQ VCC -- DMACK
I have downloaded several IDE/ATA documents and also some sourcecode for different AVR based MP3 players, but I'm unable to extract even the most basic functions from it.
I tried to make a program that upon pressing a button, would read the status register and test the BSY flag, and if that was cleared, turn on LED0 and test the RDY flag, and if that was cleared, turn on LED1 and go on to put the HDD in sleep mode.
Short story: I couldn't make it work.
If I enabled pull-upps on the data busses, I never got a cleared BSY flag, and whit no pull-upps, I got the flags, but the command didn't work.
I know that the reset system is working, cause when I connected a CD-ROM and opened the tray (while everything was powered on), pushing the reset switch on the STK500 would close the tray again.
Anything beyond that, I haven't been able to work.
If someone could be so kind as to explain (in great detail) how I could make the HDD go into sleep mode (Turn off spindle motor for acoustic verification of desired operation) or any other basic and verifiable operation, I would be a very happy camper!