Hello Allesandro, sorry about the delay, I've been busy. As for the copy_sec routine that simply reads 256 words from the data register, it doesn't do any setup, which is why you don't see the command sequence before it. I wrote it this way to allow for different types of ops to use the same routine (to save code space). Basically, after some startup init, the first activity on the IDE device is the EC command (identify drive). If you look at my detectIDE routine this is where everything begins. First off I poll the status register to see if the drive is ready, on a CF card this is pretty much instant after powerup, on real hard drives this can take a few seconds. After that I write 0xEC to the command register (address 7). It's after this point that I call the copy_sec routine which fetches the 256 words waiting and copies them to the I2C EEPROM. As for your problem I'm not sure what could be the cause. Your sequence looks pretty good. To begin try disabling LBA (change your write to register 6 to 0xA0), or simply remove that write to register 6 altogether, some cards simply don't work with LBA. I do all my stuff with CHS, complicates matters a little but seems to be a little more universal. I'm not offhand sure what else it could be. What I did to develop my routines was made it interactive, I set things up so that I could instruct the PIC over the serial port to write/read registers and do things like that in real time. Perhaps setting something like that up might help you debug this one. Sorry I couldn't be more of a help. TTYL ---------------------------------- Herbert's PIC Stuff: http://repatch.dyndns.org:8383/pic_stuff/ > -----Original Message----- > From: Alessandro Queri [mailto:piclist@tiscali.it] > Sent: February 27, 2004 04:56 > To: Herbert Graf > Subject: Private poting: [EE:] ATA controller with PIC18F452 > > > > Hello Herbert and many thanks for your reply. I still miss a bit: I saw in > your source file... > > // copy_sec routine - copies currently read register (by write of > 0x20 to reg 7) > > but then I was not able to see the writing sequence to that register. > > Mine is (from the beginning): > /reset = 0 (1 msec) /reset = 1 > wait till status.6 high > write to register 6 0xE0 (LBA MASTER) > write to register 7 0xEC (IDENTIFY COMMAND) > wait till status.7=1 and status.3=0 > read 256 words from register 0 > > Problem is that after writing anything the device gets busy > > Here is a dump: (the two > chars after DAtaReg0 are > Hi and Lo bytes being red) > > What am i missing? > > Many thanks again. > > Ale > ________________________________________________ > > Resetting(BUSY) > RdReg:07 CS0:1 CS1:0 Val:FFEE > READY > GETTING INFO > > > WrReg:06 CS0:1 CS1:0 Val:00E0 > RdReg:07 CS0:1 CS1:0 Val:FFEE > WrReg:07 CS0:1 CS1:0 Val:00EC > RdReg:07 CS0:1 CS1:0 Val:FFEE > Data... > RdReg:00 CS0:1 CS1:0 Val:FFEF o > RdReg:00 CS0:1 CS1:0 Val:FFEF o > RdReg:00 CS0:1 CS1:0 Val:FFEF o > RdReg:00 CS0:1 CS1:0 Val:FFEF o > RdReg:00 CS0:1 CS1:0 Val:FFEF o > RdReg:00 CS0:1 CS1:0 Val:FFEF o > RdReg:00 CS0:1 CS1:0 Val:FFEF o > RdReg:00 CS0:1 CS1:0 Val:FFEF o > RdReg:00 CS0:1 CS1:0 Val:FFEF o > RdReg:00 CS0:1 CS1:0 Val:FFEF o > RdReg:00 CS0:1 CS1:0 Val:FFEF o > RdReg:00 CS0:1 CS1:0 Val:FFEF o > RdReg:00 CS0:1 CS1:0 Val:FFEF o > RdReg:00 CS0:1 CS1:0 Val:FFEF o > > ________________________________ > > On Fri, 27 Feb 2004, Herbert Graf wrote: > > > > Hello folks. > > > > > > I guess if any of you had played with Compact Flash in ATA mode. I'm > > > trying to get something out of the beast but with no luck. > The aim is to > > > have direct I/O on the 18F452 pins: I use PORTC and PORTD for data > > > transfer and PORTA+PORTE for controlling /WR /RD A0..2 > /CS0..1 plus two > > > pins on PORTB for serial bitbanging. I saw there are many > project on the > > > net, but often based on the 8255 solution and additional > logic, no one of > > > them showing exactly what the initialization of the ATA device would > > > be. In particular, the controller on the disk (or CF) seems not to > > > understand even simple commands like "SpinDown" or "identify", also > > > if the i/O itself seems to work. Any advice is _really_ apreciated. > > > > http://repatch.dyndns.org:8383/pic_stuff/carmon > > > > While it uses a 16F877 it probably has most of what you > would need. TTYL > > > > ---------------------------------- > > Herbert's PIC Stuff: > > http://repatch.dyndns.org:8383/pic_stuff/ > > > > -- > > http://www.piclist.com hint: The list server can filter out subtopics > > (like ads or off topics) for you. See http://www.piclist.com/#topics > > > > -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics