Re: IDE knowledge anyone?

2016-01-23 Thread Maciej W. Rozycki
On Sun, 24 Jan 2016, Maciej W. Rozycki wrote: > "Note: Previous ATA specifications were unclear about the error conditions > that this command may indicate. Some implementations do not indicate any > errors for this command even when the command fails. However, most of > these

Re: IDE knowledge anyone?

2016-01-23 Thread Maciej W. Rozycki
On Wed, 30 Dec 2015, Oliver Lehmann wrote: > Command 91h did the trick. Issueing this once before any > read/write commands makes the drive finally work! FYI, this is what ATA-2 has to say about this command: "Note: Previous ATA specifications were unclear about the error conditions that this

Re: IDE knowledge anyone?

2015-12-30 Thread Oliver Lehmann
OK, detatching the power cord of the disk from my PC while running FreeBSD and reattaching it also brings up error code 4 on the next access. This does not happen with other drives. So it must be some sort of initialisation the OS or BIOS does which readies up the drive. Oliver Lehmann

Re: IDE knowledge anyone?

2015-12-30 Thread Oliver Lehmann
I checked now with MS-DOS and issuing a simple "DIR D:\" command with a power cycled disk: Command: C4h (Read Multiple) -> 51h, 51h -> 04h Command: 10h (Obsolete???) -> 50h, 50h -> 04h Command: 91h (Initialize Drive Parameters) -> d0h, d0h, d0h, 50h Command: C6h (Set Multiple Mode) ->

Re: IDE knowledge anyone?

2015-12-30 Thread Paul Berger
On 2015-12-30 3:01 PM, Oliver Lehmann wrote: I checked now with MS-DOS and issuing a simple "DIR D:\" command with a power cycled disk: Command: C4h (Read Multiple) -> 51h, 51h -> 04h Command: 10h (Obsolete???) -> 50h, 50h -> 04h Command: 91h (Initialize Drive Parameters) -> d0h, d0h, d0h,

Re: IDE knowledge anyone?

2015-12-30 Thread Chuck Guzis
On 12/30/2015 11:01 AM, Oliver Lehmann wrote: Does anyone know what command 10h is? The documentation I have only states "obsolete". Command 1x is "recalibrate". The "x" used to be the stepping rate, but is ignored on most later drives. --Chuck

Re: IDE knowledge anyone?

2015-12-30 Thread Oliver Lehmann
OK, I just got my Logic Analysator and traced the communication on my PC while forcing it to do PIO instead of DMA. I then changed my AVR code to do the exact same commands and nearly the same timings and... nothing changed - the drive still responds with error code 0x04 after the read sector

Re: IDE knowledge anyone?

2015-12-14 Thread Oliver Lehmann
Marc Verdiell wrote: Danke sehr, Oliver! Is your implementation available online? Yes - here it is: https://github.com/OlliL/P8000_WDC_Emulator/tree/master/P8000_WDC_Emulator But right now I'm working on an enhanced version of it where I don't uses latches for the

Re: IDE knowledge anyone?

2015-12-12 Thread Oliver Lehmann
Chuck Guzis wrote: On 12/11/2015 05:02 PM, Oliver Lehmann wrote: Which is perfectly fine - I just want to see what is going on the drive interface + timings - to see what is going on differently from my implementation. If I've got the drive and it's working, at least

Re: IDE knowledge anyone?

2015-12-12 Thread Chuck Guzis
On 12/11/2015 04:35 PM, Oliver Lehmann wrote: Western Digital Caviar 31600 it is. I took a peek today and found that I've got a couple of AC31200 drives, but no 31600s. Do you think that the 31200 is close enough to your drive? --Chuck

Re: IDE knowledge anyone?

2015-12-12 Thread Oliver Lehmann
Chuck Guzis wrote: On 12/11/2015 04:35 PM, Oliver Lehmann wrote: Western Digital Caviar 31600 it is. I took a peek today and found that I've got a couple of AC31200 drives, but no 31600s. Do you think that the 31200 is close enough to your drive? Probably yes -

Re: IDE knowledge anyone?

2015-12-12 Thread Chuck Guzis
On 12/12/2015 03:38 PM, Oliver Lehmann wrote: No, I'm only polling the regular status register. The Interrupt pins are not connected. My application is single threaded anyway so polling is fine for me - I would wait anyhow until the interrupt occured. Hmmm, that could be the issue. I

Re: IDE knowledge anyone?

2015-12-12 Thread Oliver Lehmann
Chuck Guzis wrote: On 12/12/2015 12:23 PM, Oliver Lehmann wrote: http://files.pofo.de/20151212_212051.jpg http://files.pofo.de/20151212_212105.jpg I also have newer Caviars 26400 and 23200 which are working fine. Nope--green line and the PCB doesn't look like yours.

Re: IDE knowledge anyone?

2015-12-11 Thread Oliver Lehmann
Hi Chuck, Chuck Guzis wrote: I found the section "400 nsec delays" an interesting read, particularly the bit about reading the status register five times. http://wiki.osdev.org/ATA_PIO_Mode --Chuck You are completely right, but the drive is selected always as this is

Re: IDE knowledge anyone?

2015-12-11 Thread Oliver Lehmann
Oliver Lehmann wrote: Chuck Guzis wrote: On 12/11/2015 12:04 PM, Oliver Lehmann wrote: This is the question... what is the "correct data"? Would I be able to see the cyl/sector/head information I've set before in that buffer? I didn't understand

Re: IDE knowledge anyone?

2015-12-11 Thread Chuck Guzis
On 12/11/2015 01:26 PM, Oliver Lehmann wrote: I now tried something different. I issued a "format track command" and sent 512 bytes afterwards as described in the ata spec. The drive does not respond with an error, and when I read the sector buffer right afterwards, it contains the exact data I

Re: IDE knowledge anyone?

2015-12-11 Thread Chuck Guzis
On 12/11/2015 05:02 PM, Oliver Lehmann wrote: Which is perfectly fine - I just want to see what is going on the drive interface + timings - to see what is going on differently from my implementation. If I've got the drive and it's working, at least I've got some x86 code that can drive it

Re: IDE knowledge anyone?

2015-12-11 Thread Chuck Guzis
On 12/11/2015 04:35 PM, Oliver Lehmann wrote: Western Digital Caviar 31600 it is. I'm waiting for a 32Port-LA (might take up to a month). When it is there I'll continue debugging that issue and see what a MS-DOS does different from what I do. MS-DOS uses the native BIOS for hard disk

Re: IDE knowledge anyone?

2015-12-11 Thread Oliver Lehmann
Chuck Guzis wrote: On 12/11/2015 04:35 PM, Oliver Lehmann wrote: Western Digital Caviar 31600 it is. I'm waiting for a 32Port-LA (might take up to a month). When it is there I'll continue debugging that issue and see what a MS-DOS does different from what I do. MS-DOS

Re: IDE knowledge anyone?

2015-12-11 Thread Chuck Guzis
On 12/11/2015 03:45 AM, Oliver Lehmann wrote: You are completely right, but the drive is selected always as this is a "one drive only" implementation. The same drive-selection-magic would otherwise also apply to the "Read Sector Buffer" command which works without any error. Hmmm, another

Re: IDE knowledge anyone?

2015-12-11 Thread Oliver Lehmann
Hi Chuck, Chuck Guzis wrote: If you issue a "read sector buffer" right after the LBA read sector aborts, do you get the correct data back? This is the question... what is the "correct data"? Would I be able to see the cyl/sector/head information I've set before in that

Re: IDE knowledge anyone?

2015-12-11 Thread Chuck Guzis
On 12/11/2015 12:04 PM, Oliver Lehmann wrote: This is the question... what is the "correct data"? Would I be able to see the cyl/sector/head information I've set before in that buffer? I didn't understand what the sector buffer really is by reading the docs. Well, ideally, this contains the

Re: IDE knowledge anyone?

2015-12-11 Thread Oliver Lehmann
Chuck Guzis wrote: On 12/11/2015 01:26 PM, Oliver Lehmann wrote: I now tried something different. I issued a "format track command" and sent 512 bytes afterwards as described in the ata spec. The drive does not respond with an error, and when I read the sector buffer right

Re: IDE knowledge anyone?

2015-12-11 Thread Marc Verdiell
>> Just going by what you write...BTW, what are you using as a reference? > I've used ftp://ftp.seagate.com/acrobat/reference/111-1c.pdf a lot. > Also other IDE implementations on ATMegas. Do you mind providing links to any good implementations of IDE on ATMega you know of? Marc

Re: IDE knowledge anyone?

2015-12-11 Thread Oliver Lehmann
Chuck Guzis wrote: On 12/11/2015 12:04 PM, Oliver Lehmann wrote: This is the question... what is the "correct data"? Would I be able to see the cyl/sector/head information I've set before in that buffer? I didn't understand what the sector buffer really is by reading the

Re: IDE knowledge anyone?

2015-12-11 Thread Oliver Lehmann
Marc Verdiell wrote: Just going by what you write...BTW, what are you using as a reference? I've used ftp://ftp.seagate.com/acrobat/reference/111-1c.pdf a lot. Also other IDE implementations on ATMegas. Do you mind providing links to any good implementations of IDE

Re: IDE knowledge anyone?

2015-12-10 Thread Oliver Lehmann
Chuck Guzis wrote: On 12/10/2015 12:18 AM, Oliver Lehmann wrote: for LBA: while ( pata_bsy() ) {} write_io_register ( PATA_RW_SECTOR_COUNT_REGISTER, 1 ); write_io_register ( PATA_RW_SECTOR_NUMBER_REGISTER, 0 ); write_io_register ( PATA_RW_CYLINDER_LOW_REGISTER, 0 );

Re: IDE knowledge anyone?

2015-12-10 Thread Chuck Guzis
On 12/10/2015 12:18 AM, Oliver Lehmann wrote: for LBA: while ( pata_bsy() ) {} write_io_register ( PATA_RW_SECTOR_COUNT_REGISTER, 1 ); write_io_register ( PATA_RW_SECTOR_NUMBER_REGISTER, 0 ); write_io_register ( PATA_RW_CYLINDER_LOW_REGISTER, 0 ); write_io_register (

Re: IDE knowledge anyone?

2015-12-10 Thread Oliver Lehmann
Chuck Guzis wrote: On 12/09/2015 09:58 PM, Oliver Lehmann wrote: And this is whst I do/did. The drive supports LBA. I also tried CHS with it and oft course i used cyl 0, head 0 and sector 1 without success. I now ordered a cheap chinese LA When you say that you get an

Re: IDE knowledge anyone?

2015-12-10 Thread Chuck Guzis
On 12/10/2015 01:37 PM, Oliver Lehmann wrote: OK - but those drives should also work on non-PATA-6 systems but with reduced capacity - right? As I recall (it's been at least a decade and a half), that's true--you just don't get the full drive. How are you handling 16-bit data port

Re: IDE knowledge anyone?

2015-12-10 Thread Chuck Guzis
On 12/10/2015 12:21 PM, Oliver Lehmann wrote: right - This is what I do in the code - I was writing "from memory". Just going by what you write...BTW, what are you using as a reference? Seagate still has a lot of interesting stuff on their ftp. OK - good to know. I only tested ranges 260MB

Re: IDE knowledge anyone?

2015-12-10 Thread Oliver Lehmann
Answering your other notes now - sorry for skipping them in my earlier mail ;) Chuck Guzis wrote: On 12/10/2015 12:21 PM, Oliver Lehmann wrote: right - This is what I do in the code - I was writing "from memory". Just going by what you write...BTW, what are you using as

Re: IDE knowledge anyone?

2015-12-10 Thread Oliver Lehmann
Chuck Guzis wrote: ABRT set in the error register basically indicates that the drive isn't ready or that there's something wrong with the command. You may want to insert some debug code that displays exactly what's being written to the drive registers. Did that -

Re: IDE knowledge anyone?

2015-12-10 Thread Jules Richardson
On 12/10/2015 03:19 PM, Oliver Lehmann wrote: 3 -> i already tried delays everywhere without success I think you mentioned that you tried an old '486 machine and the drive was OK there - how hard is it to compile your code for x86 and essentially try testing your exact same code on the

Re: IDE knowledge anyone?

2015-12-10 Thread Chuck Guzis
I found the section "400 nsec delays" an interesting read, particularly the bit about reading the status register five times. http://wiki.osdev.org/ATA_PIO_Mode --Chuck

Re: IDE knowledge anyone?

2015-12-10 Thread Oliver Lehmann
Chuck Guzis wrote: On 12/10/2015 01:37 PM, Oliver Lehmann wrote: OK - but those drives should also work on non-PATA-6 systems but with reduced capacity - right? As I recall (it's been at least a decade and a half), that's true--you just don't get the full drive. More

Re: IDE knowledge anyone?

2015-12-09 Thread Joseph Lang
Since identify and read buffer return consistent data, timing would appear to be ok. I would change the parameters used for read. iIRC you used chs =0/0/0. Try chs=1/1/1 Joe > On Dec 8, 2015, at 4:38 PM, Oliver Lehmann wrote: > > > Oliver Lehmann

Re: IDE knowledge anyone?

2015-12-09 Thread Alexandre Souza
A proper HP16500C or better (series 17000) is way cheap nowadays. Myself use a 16500C with lots of accessories (thank you, you know who you are!!!) and a 16505A. Maybe it can help you. I don't know if there is an IDE analyser for it (I have it for SCSI) but you can look for it. Or write a module

Re: IDE knowledge anyone?

2015-12-09 Thread Philip Pemberton
On 06/12/15 20:57, Oliver Lehmann wrote: > Right after power up and after the disk got ready, I issue the IDENTIFY > command and read the data back which works perfectly. After that I > read sector 0 and this fails. I thought the first valid sector on an IDE disk was sector 1, CHS 0:0:1? --

Re: IDE knowledge anyone?

2015-12-09 Thread Chuck Guzis
On 12/09/2015 02:14 PM, Philip Pemberton wrote: I thought the first valid sector on an IDE disk was sector 1, CHS 0:0:1? Yes; it's only 0 in LBA mode. If you'd like, I can jump in here, having done a bunch of IDE software back in the bad old days. Anyone remember the glitches in the

Re: IDE knowledge anyone?

2015-12-09 Thread Chuck Guzis
On 12/09/2015 09:58 PM, Oliver Lehmann wrote: And this is whst I do/did. The drive supports LBA. I also tried CHS with it and oft course i used cyl 0, head 0 and sector 1 without success. I now ordered a cheap chinese LA When you say that you get an error, exactly what is the error (status

Re: IDE knowledge anyone?

2015-12-09 Thread Oliver Lehmann
Chuck Guzis wrote: On 12/09/2015 02:14 PM, Philip Pemberton wrote: I thought the first valid sector on an IDE disk was sector 1, CHS 0:0:1? Yes; it's only 0 in LBA mode. And this is whst I do/did. The drive supports LBA. I also tried CHS with it and oft course i

Re: IDE knowledge anyone?

2015-12-08 Thread Toby Thain
On 2015-12-08 2:16 AM, Oliver Lehmann wrote: Hi Warner, hi Brad, ... I don't intend to use this harddrive anyway, I just fear that I made a misstake in my circuit or the code and others intending to use my emulator also experiencing problems with their drives too. Well, it's certainly

Re: IDE knowledge anyone?

2015-12-08 Thread Oliver Lehmann
Oliver Lehmann wrote: Toby Thain wrote: On 2015-12-08 2:16 AM, Oliver Lehmann wrote: Hi Warner, hi Brad, ... I don't intend to use this harddrive anyway, I just fear that I made a misstake in my circuit or the code and others intending to use

Re: IDE knowledge anyone?

2015-12-08 Thread Steven Hirsch
On Tue, 8 Dec 2015, Oliver Lehmann wrote: I checked it now with an old 486-DX50 EISA+VLB board (rare combination ;)) with a Goldstar Prime 2 and an Acer M5105 ISA Controller. Both detect and work fine with this harddisk. No idea what mode they work but I guess it is PIO 0-whatever only - no DMA

Re: IDE knowledge anyone?

2015-12-08 Thread Oliver Lehmann
Toby Thain wrote: On 2015-12-08 2:16 AM, Oliver Lehmann wrote: Hi Warner, hi Brad, ... I don't intend to use this harddrive anyway, I just fear that I made a misstake in my circuit or the code and others intending to use my emulator also experiencing problems with

Re: IDE knowledge anyone?

2015-12-08 Thread Oliver Lehmann
Oliver Lehmann wrote: Oliver Lehmann wrote: Toby Thain wrote: On 2015-12-08 2:16 AM, Oliver Lehmann wrote: Hi Warner, hi Brad, ... I don't intend to use this harddrive anyway, I just fear that I made a misstake in my

Re: IDE knowledge anyone?

2015-12-07 Thread Oliver Lehmann
Hi Warner, hi Brad, I have an old russian 50MHz dual-beam osciloscope but without any storage functionality. -> http://files.pofo.de/P1070427.JPG I guess it would not be that easy to actually display the whole communication cylce. I could see how good the flanks are, but I guess my AVR does it

Re: IDE knowledge anyone?

2015-12-07 Thread Joseph Lang
Try sector count=1 Joe > On Dec 6, 2015, at 3:57 PM, Oliver Lehmann wrote: > > Hi, > > I've built a Harddisk-Controller-Emulator for my system which accesses > a IDE (PATA) harddisk with an ATMega in PIO mode. It works like a charm > except for one WD harddisk. The

Re: IDE knowledge anyone?

2015-12-07 Thread Oliver Lehmann
Joseph Lang wrote: Try sector count=1 Good eyes! :) Unfortunally it was just a type I made in the mail. Sector count is of course 1. Regards, Oliver

Re: IDE knowledge anyone?

2015-12-07 Thread Warner Losh
On Mon, Dec 7, 2015 at 4:35 PM, Brad Parker wrote: > On 12/7/15 6:52 AM, Oliver Lehmann wrote: > > I don't have much to offer, but I have done PIO IDE accesses on lots of > cpu's, including small ARM cpu's. I would put the code into a "read loop" > and "write loop" and look at

Re: IDE knowledge anyone?

2015-12-07 Thread Oliver Lehmann
And regarding timing... even this drive works without any problem: === P8000 WDC Emulator 0.93 === INFO: PATA init start INFO: PATA disk has been found INFO: Number of logical cylinders: 1001 INFO: Number of logical heads: 15 INFO: Number of logical sectors per logical track: 34 INFO: Serial

Re: IDE knowledge anyone?

2015-12-07 Thread Brad Parker
On 12/7/15 6:52 AM, Oliver Lehmann wrote: I don't have much to offer, but I have done PIO IDE accesses on lots of cpu's, including small ARM cpu's. I would put the code into a "read loop" and "write loop" and look at the signals with a scope. Make sure they look good - i.e. clean edges and

Re: IDE knowledge anyone?

2015-12-07 Thread Oliver Lehmann
Hi, OK, i tried now to set Drive/Head first before I set all the other registers. No success. I then added a 10ms delay after the data is set for each register, disable /WR and then wait another 10ms before I execute the next register. I also added status checks after each register setting. It

Re: IDE knowledge anyone?

2015-12-06 Thread Oliver Lehmann
Jon Elson wrote: On 12/06/2015 02:57 PM, Oliver Lehmann wrote: Hi, I've built a Harddisk-Controller-Emulator for my system which accesses a IDE (PATA) harddisk with an ATMega in PIO mode. It works like a charm except for one WD harddisk. The harddisk itself works

IDE knowledge anyone?

2015-12-06 Thread Oliver Lehmann
Hi, I've built a Harddisk-Controller-Emulator for my system which accesses a IDE (PATA) harddisk with an ATMega in PIO mode. It works like a charm except for one WD harddisk. The harddisk itself works fine with MS-DOS 6.22 and FreeBSD but refuses to work with my ATMega. On reading or writing a

Re: IDE knowledge anyone?

2015-12-06 Thread Toby Thain
On 2015-12-06 4:14 PM, Oliver Lehmann wrote: Jon Elson wrote: On 12/06/2015 02:57 PM, Oliver Lehmann wrote: Hi, I've built a Harddisk-Controller-Emulator for my system which accesses a IDE (PATA) harddisk with an ATMega in PIO mode. It works like a charm except for

Re: IDE knowledge anyone?

2015-12-06 Thread Jon Elson
On 12/06/2015 02:57 PM, Oliver Lehmann wrote: Hi, I've built a Harddisk-Controller-Emulator for my system which accesses a IDE (PATA) harddisk with an ATMega in PIO mode. It works like a charm except for one WD harddisk. The harddisk itself works fine with MS-DOS 6.22 and FreeBSD but

Re: IDE knowledge anyone?

2015-12-06 Thread Oliver Lehmann
Hi Toby, Toby Thain wrote: I think Jon is probably on to something. You can check out the delays in my PIO bit-banging code here: http://www.telegraphics.com.au/svn/picide/trunk/ I tested it on a few drives & spent a lot of quality time with the spec...of course