microdrive, after 5 min of inactivity, ATA identify says the capacity is 0 byte - Page 1
Forum section: electronics / general

author: DiTBho
author_rank: Super Contributor
timestamp: March 04, 2025, 10:59:23 pm
content: Code:# diskprobepATA drive probing ... true00000000: 84 8a 00 00 00 00 00 10 7e 00 02 00 00 3f 00 3f | .............?.?00000010: 7f 23 00 00 34 31 30 38 42 33 30 39 36 20 20 20 | .#..4108B309600000020: 20 20 20 20 20 20 20 20 00 03 01 00 00 04 34 64 | ......4d00000030: 32 34 32 32 33 36 47 53 2d 4d 61 67 69 63 73 74 | 242236GS-Magicst00000040: 6f 72 20 31 30 32 32 43 20 20 20 20 20 20 20 20 | or 1022C00000050: 20 20 20 20 20 20 32 32 33 36 34 64 32 34 80 04 | 22364d24..00000060: 00 00 0e 00 40 00 00 00 00 00 00 03 00 00 00 10 | ....@...........00000070: 00 3f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | .?..............00000080: 00 01 00 78 00 78 00 78 00 78 00 00 00 00 00 00 | ...x.x.x.x......00000090: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................000000a0: 00 1e 00 13 74 63 41 04 40 00 70 62 00 04 40 00 | ....tcA.@.pb..@.000000b0: 00 00 00 ff 00 00 00 00 ff fe 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 17 00 00 00 40 00 80 00 10 00 10 00 78 04 00 | .....@.......x..00000110: 03 00 00 00 cf 21 00 3f 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: 00 00 00 00 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 | ................model number : GS-Magicstor 1022C 22364d2400000000block_size=512 (in use)Capabilities bits 00000e00is_LBA=trueLBA28={0..0} <------- disk capacity is ZERO byte?!? the CF device seems to be malfunctioning ...the returned block_n from the ATA cmd_identify is zeroCode:# diskstatstatus=0x50is_sr_rdy=trueis_sr_bsy=falseis_sr_err=falseis_sr_drq=falseThis Chinese Microdrive GS-Magicstor (2GB) is documented to run at 3.3V/5V.On a 3.3V router, ATA { identify, pio0_read, pio0_write } everything works as expected!However, after 5 minutes of inactivity, all IO-cmds fail and ATA identify says the disk capacity is now 0 bytes.Have you ever seen anything like this?Um, I checked with badblocks on a USB-CF for 2 hours (burn-in): no defects found!

author: DiTBho
author_rank: Super Contributor
timestamp: March 05, 2025, 04:00:47 pm
content: Code:outportb(io + ATA_REG_COMMAND, ATA_CMD_SPINSUP);Code:outportb(io + ATA_REG_COMMAND, ATA_CMD_SPINSDOWN);ATA_CMD_SPINSDOWN=0xE0ATA_CMD_SPINSUP=0xE1Code:# diskspin downdone, success# diskspin updone, success# diskprobe decodemodel number : GS-Magicstor 1022C 22364d24237f3f00block_size=0 (read)block_size=512 (in use)Capabilities bits 00000e00is_LBA=trueLBA28={0..4161314}disk_blocks=4161315disk_size~=2G 7M 512Kblock_n=3M 991K 803standby timer disabled: trueumm, the datasheet says that if the disk goes into standby, it can be resumed by a soft reset.I'm not sure of two things1) why the disk enters into standby if I disabled it2) why a simple softreset doesn't resume as saidanyway, the combination of these two commands seems to work.

author: coromonadalix
author_rank: Super Contributor
timestamp: March 05, 2025, 04:08:57 pm
content: disabled in the bios or in the windows power management ? both ?or the drive will enter this mode even if you disable it in bios or windows ?some hdd brand had utility looong time ago to disable the hdd controller sleep mode ...

author: DiTBho
author_rank: Super Contributor
timestamp: March 05, 2025, 04:15:08 pm
content: Quote from: coromonadalix on March 05, 2025, 04:08:57 pmThis is a firmware I am writing myself for a router.Long saga here on EEVblog, this time with a Chinese Microdrive.But, umm, Microdrives from IBM, Seagate, Hitachi and now GS-Magicstor ...... none of them fully comply with the ATA spec, each of them introduces some quirks.

author: DiTBho
author_rank: Super Contributor
timestamp: March 08, 2025, 05:16:47 pm
content: Code:00000000: 84 8a 10 20 00 00 00 10 7e 00 02 00 00 3f 00 3f | ... .........?.? 84 8a 00 00 00 00 00 10 7e 00 02 00 00 3f 00 3f | .............?.? true00000010: 7f 23 00 00 34 31 30 38 42 33 30 39 36 20 20 20 | .#..4108B3096 7f 23 00 00 34 31 30 38 42 33 30 39 36 20 20 20 | .#..4108B3096 false00000020: 20 20 20 20 20 20 20 20 00 03 01 00 00 04 34 64 | ......4d 20 20 20 20 20 20 20 20 00 03 01 00 00 04 34 64 | ......4d false00000030: 32 34 32 32 33 36 47 53 2d 4d 61 67 69 63 73 74 | 242236GS-Magicst 32 34 32 32 33 36 47 53 2d 4d 61 67 69 63 73 74 | 242236GS-Magicst false00000040: 6f 72 20 31 30 32 32 43 20 20 20 20 20 20 20 20 | or 1022C 6f 72 20 31 30 32 32 43 20 20 20 20 20 20 20 20 | or 1022C false00000050: 20 20 20 20 20 20 32 32 33 36 34 64 32 34 80 04 | 22364d24.. 20 20 20 20 20 20 32 32 33 36 34 64 32 34 80 04 | 22364d24.. false00000060: 00 00 0e 00 40 00 00 00 00 00 00 03 10 20 00 10 | ....@........ .. 00 00 0e 00 40 00 00 00 00 00 00 03 00 00 00 10 | ....@........... true00000070: 00 3f 7e 00 00 3f 00 00 7f 23 00 3f 00 00 00 00 | .?...?...#.?.... 00 3f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | .?.............. true00000080: 00 01 00 78 00 78 00 78 00 78 00 00 00 00 00 00 | ...x.x.x.x...... 00 01 00 78 00 78 00 78 00 78 00 00 00 00 00 00 | ...x.x.x.x...... false00000090: 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 | ................ false000000a0: 00 1e 00 13 74 63 41 04 40 00 70 62 00 04 40 00 | ....tcA.@.pb..@. 00 1e 00 13 74 63 41 04 40 00 70 62 00 04 40 00 | ....tcA.@.pb..@. false000000b0: 00 00 00 ff 00 00 00 00 ff fe 00 00 00 00 00 00 | ................ 00 00 00 ff 00 00 00 00 ff fe 00 00 00 00 00 00 | ................ false000000c0: 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 | ................ false000000d0: 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 | ................ false000000e0: 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 | ................ false000000f0: 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 | ................ false00000100: 00 1f 00 00 00 40 00 80 00 10 00 10 00 78 04 00 | .....@.......x.. 00 1f 00 00 00 40 00 80 00 10 00 10 00 78 04 00 | .....@.......x.. false00000110: 03 00 00 00 cf 21 00 3f b1 73 d3 f6 af dd fd 5d | .....!.?.s.....] 03 00 00 00 cf 21 00 3f 00 00 00 00 00 00 00 00 | .....!.?........ true00000120: 7c f8 ff d9 ed cf ed 63 8b d6 9f 3e 76 d7 e3 dd | .......c...>v... 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................ true00000130: 2c fa 00 00 fe b2 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 | ................ true00000140: 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 | ................ false00000150: 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 | ................ false00000160: 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 | ................ false00000170: 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 | ................ false00000180: 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 | ................ false00000190: 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 | ................ false000001a0: 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 | ................ false000001b0: 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 | ................ false000001c0: 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 | ................ false000001d0: 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 | ................ false000001e0: 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 | ................ false000001f0: 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 | ................ falseon the left: what the ATA Identify command disk returns when the disk is in active modeon the right: what the ATA Identify command disk returns when the disk is in standby modecomparing line by line, false means there are no difference, true means there is at leat one byte of difference

author: DiTBho
author_rank: Super Contributor
timestamp: March 08, 2025, 06:27:43 pm
content: So, the drive remains in idle mode for 5 seconds after power on.And if no command is received the drive will go to standby mode.Startup -> idle -> standbyThe problem now is: I cannot find a way to reprogram this behaviorTHe ATA set_feature(powermode) command is not supported.

author: DiTBho
author_rank: Super Contributor
timestamp: March 09, 2025, 12:54:55 am
content: Code:addr=0x0000 word=0x848aaddr=0x0002 word=0x1020addr=0x0004 word=0x0000addr=0x0006 word=0x0010addr=0x0008 word=0x7e00addr=0x000a word=0x0200addr=0x000c word=0x003faddr=0x000e word=0x003faddr=0x0010 word=0x7f23addr=0x0012 word=0x0000addr=0x0014 word=0x3431addr=0x0016 word=0x3038addr=0x0018 word=0x4233addr=0x001a word=0x3039addr=0x001c word=0x3620addr=0x001e word=0x2020addr=0x0020 word=0x2020addr=0x0022 word=0x2020addr=0x0024 word=0x2020addr=0x0026 word=0x2020addr=0x0028 word=0x0003addr=0x002a word=0x0100addr=0x002c word=0x0004addr=0x002e word=0x3464addr=0x0030 word=0x3234addr=0x0032 word=0x3232addr=0x0034 word=0x3336addr=0x0036 word=0x4753addr=0x0038 word=0x2d4daddr=0x003a word=0x6167addr=0x003c word=0x6963addr=0x003e word=0x7374addr=0x0040 word=0x6f72addr=0x0042 word=0x2031addr=0x0044 word=0x3032addr=0x0046 word=0x3243addr=0x0048 word=0x2020addr=0x004a word=0x2020addr=0x004c word=0x2020addr=0x004e word=0x2020addr=0x0050 word=0x2020addr=0x0052 word=0x2020addr=0x0054 word=0x2020addr=0x0056 word=0x3232addr=0x0058 word=0x3336addr=0x005a word=0x3464addr=0x005c word=0x3234addr=0x005e word=0x8004addr=0x0060 word=0x0000addr=0x0062 word=0x0e00addr=0x0064 word=0x4000addr=0x0066 word=0x0000addr=0x0068 word=0x0000addr=0x006a word=0x0003addr=0x006c word=0x1020addr=0x006e word=0x0010addr=0x0070 word=0x003faddr=0x0072 word=0x7e00addr=0x0074 word=0x003faddr=0x0076 word=0x0000addr=0x0078 word=0x7f23addr=0x007a word=0x003faddr=0x007c word=0x0000addr=0x007e word=0x0000addr=0x0080 word=0x0001addr=0x0082 word=0x0078addr=0x0084 word=0x0078addr=0x0086 word=0x0078addr=0x0088 word=0x0078addr=0x008a word=0x0000addr=0x008c word=0x0000addr=0x008e word=0x0000addr=0x0090 word=0x0000addr=0x0092 word=0x0000addr=0x0094 word=0x0000addr=0x0096 word=0x0000addr=0x0098 word=0x0000addr=0x009a word=0x0000addr=0x009c word=0x0000addr=0x009e word=0x0000addr=0x00a0 word=0x001eaddr=0x00a2 word=0x0013addr=0x00a4 word=0x7463addr=0x00a6 word=0x4104addr=0x00a8 word=0x4000addr=0x00aa word=0x7062addr=0x00ac word=0x0004addr=0x00ae word=0x4000addr=0x00b0 word=0x0000addr=0x00b2 word=0x00ffaddr=0x00b4 word=0x0000addr=0x00b6 word=0x0000addr=0x00b8 word=0xfffeaddr=0x00ba word=0x0000addr=0x00bc word=0x0000addr=0x00be word=0x0000addr=0x00c0 word=0x0000addr=0x00c2 word=0x0000addr=0x00c4 word=0x0000addr=0x00c6 word=0x0000addr=0x00c8 word=0x0000addr=0x00ca word=0x0000addr=0x00cc word=0x0000addr=0x00ce word=0x0000addr=0x00d0 word=0x0000addr=0x00d2 word=0x0000addr=0x00d4 word=0x0000addr=0x00d6 word=0x0000addr=0x00d8 word=0x0000addr=0x00da word=0x0000addr=0x00dc word=0x0000addr=0x00de word=0x0000addr=0x00e0 word=0x0000addr=0x00e2 word=0x0000addr=0x00e4 word=0x0000addr=0x00e6 word=0x0000addr=0x00e8 word=0x0000addr=0x00ea word=0x0000addr=0x00ec word=0x0000addr=0x00ee word=0x0000addr=0x00f0 word=0x0000addr=0x00f2 word=0x0000addr=0x00f4 word=0x0000addr=0x00f6 word=0x0000addr=0x00f8 word=0x0000addr=0x00fa word=0x0000addr=0x00fc word=0x0000addr=0x00fe word=0x0000(words, 16bit, returned by the ATA identify command)Code:1 XXXXh 2 Default number of cylinders2 0000h 2 Reserved3 0010h 2 Default number of heads4 7E00h 2 Number of unformatted bytes per track5 0200h 2 Number of unformatted bytes per sector6 003Fh 2 Default number of sectors per track7-8 XXXXh 4 Number of sectors per card (Word 7 = MSW, Word 8 = LSW)9 0000h 2 Vendor Unique10-19 ASCII 20 Serial number in ASCII (Right Justified)20 0003h 2 Buffer type21 XXXXh 2 Buffer size in 512 byte increments22 0004h 2 # of ECC bytes passed on Read/Write Long Commands23-26 ASCII 8 Firmware revision in ASCII. Big Endian Byte Order in Word27-46 ASCII 40 Model number in ASCII (Left Justified) Big Endian Byte Order in Word47 8004h 2 Maximum number of sectors on Read/Write Multiple command48 0000h 2 Double Word not supported49 0E00h 2 Capabilities50 0000h 2 Reserved51 0X00h 2 PIO data transfer cycle timing mode52 0000h 2 DMA data transfer cycle timing mode53 0001h 2 Translation parameters are valid54 XXXXh 2 Current numbers of cylinders55 XXXXh 2 Current numbers of heads56 XXXXh 2 Current sectors per track57-58 XXXXh 4 Current capacity in sectors (LBAs)(Word 57 = LSW, Word 58 = MSW)59 010Xh 2 Multiple sector setting60-61 XXXXh 4 Total number of sectors addressable in LBA Mode60-127 0000h 138 Reserved128 XXXXh 2 Security status129-159 0000h 64 Vendor unique bytes160 XXXXh 2 Power requirement(meaning of the words, 16bit, returned by the ATA identify command)I am really confused about this minidiskI found the manual and it seems that the standby behavior can only be reprogrammed if the firmware allows the functionality.The ATA Identify command returns word 49.It contains the "capabilities-bit", the word is set to 0x0e00.So, bit13 is set to 0, meaning the standby timer is vendor specific and cannot be changed.And this doesn't make sense to me, because the "power level1" commands are also not supported.What an application should be supposed to do here?It's not documented, but I found that if you send a "power-reset" command, the disk switches from idle to active.Unfortunately if no command is received the drive will go again to standby mode.When it goes into standby, the sector read/write stop to work, and the ATA identify commands returns LBA_MAX equal to zero.So, should you continuously send a "power-reset" command to keep the disk in "active mode" in order to keep "sector read/write" commands working?

author: DiTBho
author_rank: Super Contributor
timestamp: March 09, 2025, 12:57:24 am
content: here it is the GS-Magicstor 1022A URmy md is 1022C

author: DiTBho
author_rank: Super Contributor
timestamp: March 09, 2025, 01:08:29 am
content: Code:addr=0x0002 word=0x1020 0x0000addr=0x006c word=0x1020 0x0000addr=0x0072 word=0x7e00 0x0000addr=0x0074 word=0x003f 0x0000addr=0x0078 word=0x7f23 0x0000addr=0x007a word=0x003f 0x0000addr=0x0100 word=0x001f 0x0017addr=0x011a word=0xd7f6 0xd3f6addr=0x011c word=0xaddf 0xafddaddr=0x0124 word=0xedcf 0xefcfaddr=0x0128 word=0x4bde 0x0bdeaddr=0x012a word=0x9f3e 0x9f3aaddr=0x012c word=0x7753 0xf257addr=0x0134 word=0xeeb6 0xeeb3diff compare:- on the left the words (16bit) the ATA identify command returns when the disk is in active mode- on the right the words (16bit) the ATA identify command returns when the disk is in standby modeNote, words 60-61 contain the total number of sectors addressable in LBA Mode.And ... in case of standby mode, it's zero ...

author: Nominal Animal
author_rank: Super Contributor
timestamp: March 09, 2025, 01:34:18 am
content: Quote from: DiTBho on March 09, 2025, 12:54:55 amIt is possibly a physical issue. Consider the case where a capacitor is used to retain internal SRAM state when Suspended, and that capacitor has lost its capacitance and no longer can keep the SRAM on the microdrives internal controller powered, clearing it down to zero.Let's consider workarounds.What happens if after every command, when you have no other commands queued, you send 97h or E3h (Idle) with Sec Cnt = 12h, so that it should remain Idle for one minute? What about other wait times?I suppose an alternative would be to keep track of accesses to this drive, and either send suitable Idles (or perhaps DEh Unlocks) at half-elapsed intervals –– essentially inserting suitable Idles to your command queue when there are no other commands within half of the idle-to-standby interval, or simply keep track of when the last command was sent, and if exceeding the idle-to-standby interval, send a power-reset command. If this is not a power-during-suspend issue on the microdrive and is really a "feature", that would be just the kind of thing that was done back then to work around HW bugs.

author: DiTBho
author_rank: Super Contributor
timestamp: March 09, 2025, 01:10:54 pm
content: Quote from: Nominal Animal on March 09, 2025, 01:34:18 amCode:/** value result* ------------------------------------------------------* 0 disable* 0x01-0xf0 auto-timer set to 5 sec * value* 0xf1-0xfb auto-timer set to 30 min * (value - 0xf0)* 0xfc auto-timer set to 21 minutes* 0xfd auto-timer set to 8 hours* 0xfe auto-timer set to 5 milliseconds x value* 0xff auto timer set to 5.25 hours*/Tried "Force idle with timeout=0 -> disabled" (register cnt = 0): does nothing, it seems not supported.Note the ATA Identify command reports "standby timer" vendor defined in the Capability bits.Code:Capabilities=0x0e00cap.standbytimer=false <--------------- does this mean you cannot set the standbytimer?!?cap.DMA=false <--------- DMA not supportedcap.IORDY_supported=truecap.packet=falseVendorUnique=0x0000 <---------- this looks wrong if the unit has "vendor defined" fields ...PowerRequirement=0x0000 <------------- this is simply wrong ... it should have a power req field set != 0x00cap.Power_VLD=falsecap.Power_XP=false <-------------- do these mean power level commands are not supported?cap.Power_XE=false <-------------- "This commands does not set the timer, but it puts the disk into "idle mode".Code:/** with feature = 0x05* powermode mode* 0x01..0x7f up to standby mode* 0x80..0xfe up to low power idle mode* 0xfe disable adv power manager* 0x60 default, at startdup*/Also tried the command "set power mode" ( 0x05) */ with powermode=0xfe (disable adv power manager).But again it's not supported: does nothing, I think it's executed as "NOP".Quote from: Nominal Animal on March 09, 2025, 01:34:18 amThat's why I am perplexed.With GNU/Linux ... this microdrive doesn't work because the disk goes into standbyand the ata driver is not able to reset it like I am doing on my monitor, even if ... it's still an hack.So what? For what was it supposed to be used? Camera with special firmwares?Really perplexed

author: DiTBho
author_rank: Super Contributor
timestamp: March 09, 2025, 01:26:45 pm
content: weird ....force idle immediate ---> does not resume from standby mode, sounds executed as "NOP"set idle immediate and set the standby timer ---> does not set the standby timer (capability bits says "vendor specific), but it resumes from the standby mode?W!!T??F!

author: DiTBho
author_rank: Super Contributor
timestamp: March 09, 2025, 10:55:39 pm
content: if you issue a "sector read" command when the drive is in standby, the result is- bit_error set in the status register- operation abortedjust found that if in this case you issue a "powermode check" command the drive goes back into active modeit could be embedded into disc_block_read()- issue the "sector read" command- if it returns bit_error=1, then try to wake-up (by issuing a "power-mode check" command)- re-tryanyway, it's just crazy ...

author: DiTBho
author_rank: Super Contributor
timestamp: March 13, 2025, 07:13:16 pm
content: Code:# diskread 1io_piomode0_wait_for ibit=7 errordisk in standby? wakeup and retry ...disk_ans=true00000000: 50 4d 00 00 00 00 00 04 00 00 00 01 00 00 00 3f | PM.............?00000010: 41 70 70 6c 65 00 00 00 00 00 00 00 00 00 00 00 | Apple...........00000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................00000030: 41 70 70 6c 65 5f 70 61 72 74 69 74 69 6f 6e 5f | Apple_partition_00000040: 6d 61 70 00 00 00 00 00 00 00 00 00 00 00 00 00 | map.............00000050: 00 00 00 00 00 00 00 3f 00 00 00 33 00 00 00 00 | .......?...3....00000060: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................00000070: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................00000080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................00000090: 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 | ................000000b0: 00 00 00 00 00 00 00 00 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 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: 00 00 00 00 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 | ................Code:private ata_disk_ans_t io_piomode0_block_get(p_ata_disk_t p_ata_disk,p_this_t p_mem,uint32_t LBA /* LBA28 */){my_id_t fid[] = "io_piomode0_block_get";ata_disk_ans_t ans;ata_disk_feedback_t feedback;ans = io_piomode0_block_get2(p_ata_disk, p_mem, LBA);feedback = ans.feedback;switch (feedback){case ata_disk_feedback_is_ok:break;case ata_disk_feedback_is_err_wtf:print_string("disk in standby? wakeup and retry ...", "", "\n");io_wakeup(p_ata_disk);ans = io_piomode0_block_get2(p_ata_disk, p_mem, LBA);break;case ata_disk_feedback_is_err_eot:print_string("disk in stall? reset and retry ...", "", "\n");disk_ata_reset(p_ata_disk);ans = io_piomode0_block_get2(p_ata_disk, p_mem, LBA);break;default:panic(module, fid, "disk unknown err, dunno what to do");break;}workaround, makes the microdrive working, but ... it's a very dirty hack

author: DiTBho
author_rank: Super Contributor
timestamp: March 14, 2025, 08:33:36 am
content: The wakeup function is ... the ugliest part of the hack.Although I have to say that if it's ugly it's because of the ATA command specifications that don't provide any sensible command to understand what operating mode the disk is in, that is, there's no way to explicitly ask if it's { idle, standby, active }, of this part only two SMART commands work, but if SMART is not supported then there is no solution.The only ATA command that would have made sense is "Check PowerMode", but as it is described in the specification ... then it is implemented in an embarrassing way, that is, like thisCode:/** check power mode command (0x98, 0xe5)* if the drive is in, going to, or recovering from the Standby mode,* the drive* sets BSY to 1* sets the Sector Count register to 00H* clears BSY* generates an interrupt* if the drive is in the Idle mode* the drive* sets BSY to 1* sets the Sector Count register to FFH* clears BSY* generates an interrupt** mode[]={ active, idle, standby }* Known values include* 0x00 Standby* 0x80 Idle* 0xff Active/Idle*/for me, it's useless ... and does not make any sense, however, even if it is not documented, it does a useful thing: it wakes up the disk!I suspect, this is a fw bug with these damn Chinese Microdrives ...I cannot test with Hitachi's because they don't work this way.

author: DiTBho
author_rank: Super Contributor
timestamp: March 14, 2025, 08:34:58 am
content: (it's useless for me, because it always returns 0xff ...)