pATA disk responds to Identify but panics on any block_read attempts - Page 1
Forum section: electronics / general

author: DiTBho
author_rank: Super Contributor
timestamp: February 08, 2025, 08:34:48 pm
content: Code:ata1.00: CFA: ST650211CF, 3.04, max PIO4ata1.00: 9767520 sectors, multi 0: LBAata1.00: revalidation failed rno=-2)ata1.00: revalidation failed rno=-2)ata1.00: revalidation failed rno=-2)ata1.00: disable device(linux kernel v6.02)Code:my-mon/mips, v3.1, Feb 2025# cfpATA drive probing ... true00000000: 84 8a 25 da 00 00 00 10 7e 00 02 00 00 3f 00 95 | ..%..........?..00000010: 0a 60 00 00 20 20 20 20 20 20 20 20 20 20 33 4d | .`.. 3M00000020: 45 34 4e 58 59 43 20 20 00 03 01 00 00 04 33 2e | E4NXYC ......3.00000030: 30 34 20 20 20 20 53 54 36 35 30 32 31 31 43 46 | 04 ST650211CF00000040: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |00000050: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 80 10 | ..00000060: 00 00 0a 00 00 00 02 00 00 00 00 03 25 da 00 10 | ............%...00000070: 00 3f 0a 60 00 95 01 00 0a 60 00 95 00 00 01 00 | .?.`.....`......00000080: 00 03 00 00 00 00 00 78 00 78 00 00 00 00 00 00 | .......x.x......00000090: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................000000a0: 00 00 00 00 70 69 50 0c 40 00 70 69 10 0c 40 00 | ....piP.@.pi..@.000000b0: 00 00 00 00 00 00 40 40 00 00 40 0d 80 80 00 00 | ......@@..@.....000000c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................000000d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................000000e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................000000f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................00000100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................00000110: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................00000120: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................00000130: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................00000140: 81 4a 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | .J..............00000150: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................00000160: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................00000170: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................00000180: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................00000190: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................000001a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................000001b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................000001c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................000001d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................000001e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................000001f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................LBA28={0..9767519} blocksdisk_blocks=9767520disk_size~=4G 673Mmodel number : ST650211CF# de 0disk_read(LBA, block_n, mem_win_sizedisk_ata_read(),LBA=0disk_ata_piomode_block_get(),LBA=0disk_ans=false# cfno sign of life from CF drivepATA drive probing ... false#(my mon)I don't understand this pATA device. Bought qty=4 disks, all the same behavior.They all respond correctly to the ATA identify command (you can see what it responds to above), but they all fail every time it tries to read a block!I tried with the Linux kernel, but it returns a strange error, "revalidation failed rno=-2)" (what?!?)Also, after a read command, the disk goes crazy and doesn't respond at all. I have to power cycle it to get it back.Have anyone ever seen anything like this?

author: DiTBho
author_rank: Super Contributor
timestamp: February 08, 2025, 08:36:43 pm
content: being a ~5GB device, I am using LBA28bit.

author: DiTBho
author_rank: Super Contributor
timestamp: February 08, 2025, 08:58:24 pm
content: my mon uses ATA PIO with polling

author: I wanted a rude username
author_rank: Frequent Contributor
timestamp: February 09, 2025, 01:00:24 am
content: I once saw such a failure with an SD card (the flash had failed but the OS could still query the controller), however I suspect your issue is not that.Have you tried changing some of the variables? E.g.:Different IDE cableDifferent IDE controllerDifferent (ideally period-correct) motherboardOlder kernel

author: Nominal Animal
author_rank: Super Contributor
timestamp: February 09, 2025, 07:09:49 am
content: The error comes from the Linux kerneldrivers/ata/libata-core.c:ata_dev_revalidate(), anderrno -2 = -ENOENT. The-ENOENTmust come from libata-core.c:ata_dev_read_id() or libata-core:ata_dev_configure(), because all the other error cases return-ENODEV = -19.

author: DiTBho
author_rank: Super Contributor
timestamp: February 09, 2025, 03:52:12 pm
content: Quote from: Nominal Animal on February 09, 2025, 07:09:49 amkernel 6.02, libata-core -> ata -> CFbut umm, I don't understand this error.revalidate()? what?The thing that leaves me most surprised is that I wrote a low-level firmware, and I see that both the two seagate disks, two microdrives actually, respond to the Identify ATA command, but they panic as soon as I try to read a sector.My firmware works perfectly with Hitachi drives, for which Linux also works.With those two Seagate disks, Linux works exactly like my firmware: that is, it can identify the disk, it returns some information { serial number, model number of sectors, ... }, but then as soon as it tries to read sector 0 ... the disk freezes.

author: DiTBho
author_rank: Super Contributor
timestamp: February 09, 2025, 04:32:18 pm
content: I removed the Seagate disk from the router, and put it into a USB_CF adapter.Code:macmini2-intel ~ # hexedit /dev/sdd00000000 45 52 02 00 00 95 0A 60 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ER.....`................................00000028 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........................................00000050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........................................00000078 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........................................000000A0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........................................000000C8 73 75 70 70 61 20 74 65 73 74 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 suppa test..............................000000F0 64 6F 65 73 20 69 74 20 77 6F 72 6B 3F 3F 3F 3F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 does it work????........................00000118 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........................................00000140 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........................................00000168 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........................................it's successfully recognized, and registered as block device, /dev/sdd (SCSI emulation, pATA disk).I am able to read and write sectors on GNU/LinuxThis leads me to ask: what does the USB_CF adapter do? How do I initialize it?!?On the router the disk is connected directly to the IO port, which is memory mapped, so ...... I know exactly what information I'm sending and receiving through my monitor,and I know it panics as soon as I try to make it do a PIO_read command...Perplexed

author: DiTBho
author_rank: Super Contributor
timestamp: February 09, 2025, 04:33:49 pm
content: Code:macmini2-intel ~ # badblocks -svw /dev/sddChecking for bad blocks in read-write modeFrom block 0 to 4883759...let's stress and verify it ...

author: Nominal Animal
author_rank: Super Contributor
timestamp: February 09, 2025, 05:40:20 pm
content: CompactFlash – SDHC/SDXC mapsATA commandstoSecure Digital commands. They're not the same, but they map well enough.The error:When an ATA bus is found,drivers/ata/libata-core.c:ata_bus_probe()is called. The devices are probed and identified in a funky order (because of master/slave signaling and possible bridges). This initial identification usesata_dev_read_id(dev, &dev->class,ATA_READID_POSTRESET, dev->id).Next, thedrivers/ata/libata-eh.c:ata_set_mode()is called on each device, to set timings and issue SET FEATURES (ATA command 0xEF). If the ata port does not have its ownops->set_modefunction, thendrivers/ata/libata-core.c:ata_do_set_mode()gets called. It first sets transfer masks (seelibata-core.c:ata_dev_xfermask(),libata-core.c:ata_force_xfermask()), then PIO timings, then DMA timings, and finally updates their transfer mode by callingdrivers/ata/libata-core.c:ata_dev_set_mode(), which callsdrivers/ata/libata-core.c:ata_dev_revalidate(dev, ATA_DEV_UNKNOWN, 0). (Note thatata_class_enabled(ATA_DEV_UNKNOWN)is false, so the "fail early if" case will not trigger.)That function ends up callingdrivers/ata/libata-core.c:ata_dev_reread_id(dev, 0), which does the secondata_dev_read_id(dev, &dev->class,0, dev->id). (You might wish to change theata_dev_dbg()'s in it toata_dev_err(), so you get the exact reason.) The other possibility is that the-ENOENTis returned by the call todrivers/ata/libata-core.c:ata_dev_configure().Now, indrivers/ata/libata-core.c:ata_dev_read_id()we find an interesting comment about why theATA_READID_POSTRESETis needed: (SRST mode,) RESET, IDENTIFY, ..., and so on. Perhaps your Seagates are just crappy pre-ATA4, and require some woo-woo-special sequence to work?I would definitely changedrivers/ata/libata-core.c:ata_dev_read_id()toata_dev_printk(dev, KERN_ERR, "failed to IDENTIFY (%s, err_mask=0x%x)\n", reason, err_mask);unconditionally in theerr_out:error path, to pinpoint where the failure occurs.

author: I wanted a rude username
author_rank: Frequent Contributor
timestamp: February 09, 2025, 05:48:50 pm
content: Quote from: DiTBho on February 09, 2025, 04:32:18 pmAdding to what Nominal Animal has said, this is highly relevant information ... should have been mentioned up front. Odds on that router was never designed to spin magnetic disks ... it's quite possible that it can't deliver the startup and/or seek current ... that would line up with the failure mode.Have you verified that when installed in the router, the drive's actually spinning?

author: DiTBho
author_rank: Super Contributor
timestamp: February 09, 2025, 08:07:11 pm
content: Quote from: I wanted a rude username on February 09, 2025, 05:48:50 pmMikrotik advertised their router as"On RB532 build you can also install a CompactFlash module orMicrodrive drivewhich can be used as an alternative boot device or an additional storage medium.Warning! It does not support hot insert of CompactFlash/Microdrive devices."Quote from: I wanted a rude username on February 09, 2025, 05:48:50 pmbut in this case, shouldn't the disk refuse to respond to the ATA "Identify command"?Say, the electronic is powered, but the motor doesn't have enough current to spin,in this case the electronic should notify the problem by reporting "diagnostic failure" or something?Isn't there a specific ATA "Diagnostic command" to know if the motor is spinning or not?Quote from: I wanted a rude username on February 09, 2025, 05:48:50 pmThe Hitachi 4G, which works perfectly, makes no noise when its disk spins, so umm dunno with the Seagate

author: DiTBho
author_rank: Super Contributor
timestamp: February 09, 2025, 08:13:51 pm
content: Quote from: Nominal Animal on February 09, 2025, 05:40:20 pmI am very confused. I cannot find a good complete document on the subject.I bought a book called "PC hardware bible".It explains something about pATA disks but in a very very superficial wayNo examples, no in-depth analysis.Worse still Googling you find tons of confused articles.Better information from blogs of people who implemented something for their vintage MPUs.But, once again, it's very basic.Quote from: Nominal Animal on February 09, 2025, 05:40:20 pmGood idea

author: DiTBho
author_rank: Super Contributor
timestamp: February 09, 2025, 08:19:43 pm
content: Code:macmini2-intel ~ # badblocks -svw /dev/sddChecking for bad blocks in read-write modeFrom block 0 to 4883759Testing with pattern 0xaa: doneReading and comparing: doneTesting with pattern 0x55: doneReading and comparing: doneTesting with pattern 0xff: doneReading and comparing: doneTesting with pattern 0x00: doneReading and comparing: donePass completed, 0 bad blocks found. (0/0/0 errors)The Seagate 5GB on the CF_usb adapter passed all the badblocks tests!Is there any CF-to-CF adapter you know of that provides an alternative way to supply power to the microdrive?

author: DiTBho
author_rank: Super Contributor
timestamp: February 09, 2025, 08:21:57 pm
content: cf spec, v1.4cf-spec-v1.4.pdf(637.22 kB - downloaded 96 times.)

author: Nominal Animal
author_rank: Super Contributor
timestamp: February 09, 2025, 09:25:41 pm
content: ATA = "AT Attachment" is developed by Technical Committee T13 atwww.t13.org; the latest standard is ACS-5,ISO/IEC 17760-105:2024.SD card standards are managed by SD Association atwww.sdcard.org.Quote from: I wanted a rude username on February 09, 2025, 05:48:50 pmST650211CF = 5 GBSeagate ST1, a miniature 1" HDD in CompactFlash II form factor (CF itself using parallel ATA, aka IDE);datasheet(PDF). It draws less than 350mA at 3.3V or 5.0V (averaged over 10ms), which theRB532Ashould be able to handle fine, given good enough DC supply brick.Quote from: DiTBho on February 09, 2025, 08:19:43 pmYou could kludge one together, using 0.050" = 1.27mm pitch 2×25-pin male-female connectors.Pins 13 and 38are the VCC, but it could be either 3.3V or 5.0V. (You'll want to check your CF card socket, as otherwise you can burn sensitive I/O pins.)For example, using a short length of 50-wire 0.025"/0.635mm pitch flat cable (like 3M 3749/50) with Harwin M50-3302542 and M50-3802542 IDC connectors.For the RB532A, consider using the higher supply voltage setting, and a higher voltage DC supply. It's supposed to have pretty beefy DC-DC converters; the two watts shouldn't be a problem.

author: DiTBho
author_rank: Super Contributor
timestamp: February 11, 2025, 10:00:44 pm
content: Does anyone happen to have the datasheet of the Hitachi HMS360404D5CF00?I'd like to see the supported ATA commands, in details

author: DiTBho
author_rank: Super Contributor
timestamp: February 11, 2025, 10:05:53 pm
content: The Hitachi HMS360404D5CF00 works very wellCode:# cf_probeata_disk_initpATA drive probing ... true00000000: 84 8a 1f 00 00 00 00 10 7e 00 02 00 00 3f 00 7a | .............?.z00000010: 10 00 00 00 20 20 20 20 20 20 20 20 20 20 20 20 | ....00000020: 4e 32 4c 48 55 45 59 41 00 03 01 00 00 04 44 4e | N2LHUEYA......DN00000030: 34 4f 43 41 32 41 48 4d 53 33 36 30 34 30 34 44 | 4OCA2AHMS360404D00000040: 35 43 46 30 30 20 20 20 20 20 20 20 20 20 20 20 | 5CF0000000050: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 80 20 | .00000060: 00 00 0e 00 00 00 02 00 00 00 00 03 1f 00 00 10 | ................00000070: 00 3f 10 00 00 7a 01 00 10 00 00 7a 00 00 00 00 | .?...z.....z....00000080: 00 03 00 00 00 00 00 78 00 78 00 00 00 00 00 00 | .......x.x......00000090: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................000000a0: 00 1e 00 12 70 68 50 0c 40 00 70 48 10 0c 40 00 | ....phP.@.pH..@.000000b0: 00 00 00 00 00 00 40 60 00 00 00 00 00 00 00 00 | ......@`........000000c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................000000d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................000000e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................000000f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................00000100: 00 00 00 02 00 00 01 11 00 00 00 00 00 00 00 00 | ................00000110: 00 00 00 00 00 64 00 00 00 00 00 00 00 00 00 00 | .....d..........00000120: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................00000130: 00 00 00 00 00 00 00 00 00 00 00 00 04 b0 00 01 | ................00000140: 81 00 80 01 00 00 00 00 00 00 00 00 00 00 00 00 | ................00000150: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................00000160: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................00000170: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................00000180: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................00000190: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................000001a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................000001b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................000001c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................000001d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................000001e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................000001f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................LBA28={0..7999487} blocksdisk_blocks=7999488disk_size~=3G 834Mblock_n=7M 644Kmodel number : HMS360404D5CF00adv PIO mode 00000300Features/Command sets supported(1) 00006870Features/Command sets supported(2) 00000c50Features/Command sets supported(3) 00000040Features/Command sets supported(4) 00004870Features/Command sets supported(5) 00000c10Features/Command sets supported(6) 00000040Ultra DMA support and current mode 00000000Advanced power management value 00006040CFA power mode(1) 00000081Capabilities bits 00000e00 -> is_LBA_capable=trueblock_size=0 ??? assuming 512bytewtf? sec size(1) 00000000wtf? sec size(2) 00000000added more checksCode:# partsfound mac-part, blocksize=512, scanning ... donePartition map..................... 32bit 1 63 31K 512bootstrap......................... 32bit 64 1600 800Kkernel............................ 32bit 1664 65536 32Mswap.............................. 32bit 67200 524288 256Mrootfs............................ 32bit 591488 7408000 3G 545M 192K#added mac-part, this part works wellI will go back with the Seagate ST1.

author: DiTBho
author_rank: Super Contributor
timestamp: February 14, 2025, 11:46:08 pm
content: Quote from: Nominal Animal on February 09, 2025, 09:25:41 pmSo the datasheet says.QuoteHowever, on the wikipedia, this describes exactly what I seeCode:Certain bus-powered CF card readers lack the power needed to run a Microdrive although they do take CF II cards.When using such a device, it will usually be detected by the host, but errors will occur once the user attempts to access the drivedetected -> ATA command "identify": successaccess the drive -> ATA command "read_sector": failure, drive panic!Today I noticed on the back of the MD a little label that says "5V" ...

author: Nominal Animal
author_rank: Super Contributor
timestamp: February 15, 2025, 12:33:57 am
content: Interesting. If I'm not horribly mistaken (see RB500 series User Manual), the RB532A miniPCIe slots are powered by a (common) 3.3V 4.25A supply.

author: DiTBho
author_rank: Super Contributor
timestamp: February 15, 2025, 01:53:42 pm
content: Yup, the rb532a miniPCI is 3.3V onlyI checked, the 5V power is not implemented.The manual doesn't say if the CF module is 3.3V or 5V.I suspect it's 3.3V ... Can't measure at the momentBut umm ... that also means some MicroDrives are OEMOEMs are 5V only, and are true-IDE-only.

author: DiTBho
author_rank: Super Contributor
timestamp: February 15, 2025, 02:10:32 pm
content: Quotelook at the Seagate ST1it perfectly works with the USB_CF adapter, which operates at 5V. Badblocks passed, zero error reportedit panics on the rb532a at every ATA command that involves the spinning motor and heads (sector_read, sector_verify, etc ...), but it responds to the ATA identify command, which only involves the control board of the microdrive but not the spinning motorMy guess...the rb532a CF module must be 3.3V.Ordered a 2GB microdrive made by GS Magicstor. Paid 10 euro on eBay.Magicstor is a Chinese manufacturer subsidiary of GS Magic, Inc..The datasheet of their microdrives says- 2GB 3.3V/5V- 4GB 3.3V-onlyAccording to Google, there is no OEM version.With Hitachi... it's hell:not only there are also OEM versions,but also custom IBM-made versions for their MIPS WinCE-v1.0 laptop (only sold in Japan),marked "IBM Microdrive" but made with Hitachi parts,who also made the Apple iPod drive,and whatever Apple, IBM or Hitachi microdrive you look at ...... they are not easy to identify as "OEM" or "non-OEM", as there is no indication on the label!Some Hitachi microdrives made for Apple iPod have a log on the front,usually the Apple logo, which means it is an OEM drive, 5V only, True-IDE only,but other Hitachi microdrives have no indication at all.The datasheet is very vague, and reports approximate things compared to what I observe!

author: DiTBho
author_rank: Super Contributor
timestamp: February 15, 2025, 02:19:07 pm
content: The CF specs say CF cards "should" have to comply with ATA specs, and work with both 3.3V and 5V.Not respected by OEM.Not respected by Hitachi and SeagateSeagate doesn't say it in the datasheets, but when it says 5V on some microdrives, well ..... well coincidentally those are the ones that don't work on 3.3V only machines, like the RB532A.