All times are UTC - 5 hours [ DST ]




Post new topic Reply to topic  [ 206 posts ]  Go to page Previous  1 ... 7, 8, 9, 10, 11  Next
Author Message
 Post subject: Re: WD2000JD problem
PostPosted: May 19th, 2013, 7:53 
Offline

Joined: July 18th, 2006, 3:05
Posts: 7474
Location: ITALY
@louis,

you want to connect let's say to J2 on 1477 boards ?


Top
 Profile  
 
 Post subject: Re: WD2000JD problem
PostPosted: May 19th, 2013, 8:27 
Offline

Joined: August 22nd, 2011, 15:43
Posts: 209
Location: Romania
I want to debug live the mcu. for personal study. find the compression alg for the rom image etc.


Top
 Profile  
 
 Post subject: Re: WD2000JD problem
PostPosted: May 19th, 2013, 8:40 
Offline

Joined: July 18th, 2006, 3:05
Posts: 7474
Location: ITALY
You didn't answer : it's like saying "I want to diagnose my car" - "Do you want to connect to OBD ?" - "I want to see what's the problem and the actual readings" : there are many ways to do what you want, some are feasible other not, other more or less are , some maybe work only (worked...) at factory level... but it's not necessary either to reinvent the wheel nor complicate life. You have RAM and ROM to work with but first you maybe have to RE some code !

Good luck, anyway - it remembers me some time ago when I was more interested in R&D... :D


Top
 Profile  
 
 Post subject: Re: WD2000JD problem
PostPosted: May 19th, 2013, 16:44 
Offline

Joined: August 22nd, 2011, 15:43
Posts: 209
Location: Romania
if you know other ways to debug a wd pcb, other than connecting through Con1, then your discussion make sense. :)

when u say..reinventing the wheel...first you must understand how the wheel works. I prefer to trust my own senses, not some guys which tell..don't do that..do that...and when u ask them why..the answer sounds like "because". many don't know that shifting left n pos 1 bit means 2^n but they are ready to learn u how to not reinvent the wheel..."with only 2 resistors" :) . they blindly apply things that they do not understand and the progress they deliver to the community it's a big 0. haven't read many topics here, but the most interesting topic I've read it's Dejan's Mcu jtagging. offcourse, there are some users here which really helps like fzabkar and spildit and perhaps others, but we have all to agree that gurus are very rare and they don't lost time answering stupid questions like ours/us :D

so, can u tell me, what u do with a wd VDT drive when the preamp it's dead. the original HSA has variable SPT per head per zone. u do a head swap, but the data it's written at a SPT that it's head dependent. I don't know for sure, I don't have any experience in DR but I assume that the last years this VDT drive option was a mass one in the fight for more&more higher capacities.


Top
 Profile  
 
 Post subject: Re: WD2000JD problem
PostPosted: May 19th, 2013, 18:13 
Offline
User avatar

Joined: September 8th, 2009, 18:21
Posts: 15532
Location: Australia
louis wrote:
... the most interesting topic I've read it's Dejan's Mcu jtagging.

Indeed, the most interesting by far. In fact that's a case where intelligence trumps experience. You can have 30 years of experience swapping boards and replacing heads, but sometimes the task requires fresh insight, innovation and an understanding of first principles. ISTM that the data recovery profession relies too much on rote learning and expensive tools.

As for the accessibility of the JTAG pins for the purposes of attaching wires, I see no problem in using the plug on its own, provided that you have good eyesight and reasonable soldering skills. In fact thirty years ago I used an ordinary, portable, temperature controlled soldering iron to replace a fine pitched QFP IC, in the field. In your case you just need some wirewrap wire and heatshrink tubing, plus practice.

_________________
A backup a day keeps DR away.


Top
 Profile  
 
 Post subject: Re: WD2000JD problem
PostPosted: May 19th, 2013, 18:24 
Offline

Joined: July 18th, 2006, 3:05
Posts: 7474
Location: ITALY
I change heads and if necessary fix the firmware if it has got damaged, and/or make some adjustment depending on drive. That's all. And it works 95% of times. I don't recommend other ways, but it is sure that at that point tools like a DDA and PC3000 do make a difference.


Top
 Profile  
 
 Post subject: Re: WD2000JD problem
PostPosted: June 5th, 2013, 13:26 
Offline

Joined: August 22nd, 2011, 15:43
Posts: 209
Location: Romania
Smart Attrib Table..it's a sector of 512 bytes. the drive firmware respond with it for an ATA command. WD holds some secret attributes. to see them we can download the module 21 and search for the smart sector deep inside. :)

here's a first screen from my gui app. according to ata specs, each smart attrib has an ID, a flag and the rest of columns u can see (12 bytes). there is one more table for threshold values. the flag's bit 1 tells that the attrib its vital (the odd flags). it turns to red when any of current or worst values became lower than threshold. the current and worst values are generated by firmware, based on the "raw value". let's say that the drive starts to make BADs...then the smart code in firmware..checks how many bads are, and lower the worst and current values using some scaling factor. I made yellow the bad related attribs to warn that something it's going bad. if you have any idea what to color in addition please let me know.

in the picture I opened a 21 mod file..(royal drive), and parsed it with my code. in addition I could get the smart sector from the drive with an ata command, but it will miss some hidden attibs.

so a drive it's failing if an attrib with odd flag has the current/worst values lower than threshold.

the wd mod 0x21 seems to have a shadow copy(not seen in directory mod 01)...named mod 0x20


Attachments:
smart.png
smart.png [ 277.68 KiB | Viewed 19056 times ]
Top
 Profile  
 
 Post subject: Re: WD2000JD problem
PostPosted: June 5th, 2013, 15:44 
Offline
User avatar

Joined: September 8th, 2009, 18:21
Posts: 15532
Location: Australia
I notice that you don't issue warnings for hidden attributes, eg attribute 0xC3.

BTW, flag bit #7 appears to determine whether the attribute is hidden.

Hidden SMART attributes in WD HDDs:
http://malthus.zapto.org/viewtopic.php?f=59&t=127&p=155

_________________
A backup a day keeps DR away.


Top
 Profile  
 
 Post subject: Re: WD2000JD problem
PostPosted: June 5th, 2013, 23:32 
Offline

Joined: August 22nd, 2011, 15:43
Posts: 209
Location: Romania
if we can see those hidden...attribs..then it doesn't matter what bit 7 is :) wanted to let the column header clicks sort the items by flag. inserting your H there will screw the data. :)

the log you posted in your link it's from a parser made by u?


Top
 Profile  
 
 Post subject: Re: WD2000JD problem
PostPosted: June 6th, 2013, 2:22 
Offline
User avatar

Joined: September 8th, 2009, 18:21
Posts: 15532
Location: Australia
louis wrote:
the log you posted in your link it's from a parser made by u?

Yes. I'm not just a hardware guy. :-)

_________________
A backup a day keeps DR away.


Top
 Profile  
 
 Post subject: Re: WD2000JD problem
PostPosted: June 6th, 2013, 4:56 
Offline

Joined: August 22nd, 2011, 15:43
Posts: 209
Location: Romania
tried to edit the smart table and upload it to SA. it doesn't work :mrgreen:

the write mod 21 ends fine, with no error..but when I read it back...it doesn't reflect the modifications. perhaps that table it's only a reflection of the data stored in another places and gets overwritten back as soon as I change it.


Top
 Profile  
 
 Post subject: Re: WD2000JD problem
PostPosted: June 6th, 2013, 9:17 
Offline
User avatar

Joined: September 8th, 2009, 18:21
Posts: 15532
Location: Australia
IIRC, MODs 20, 21, and 22 store the SMART data. If you compare the raw values of the Total LBAs Read and Written attributes, I believe you will see that one MOD is updated before the others.

_________________
A backup a day keeps DR away.


Top
 Profile  
 
 Post subject: Re: WD2000JD problem
PostPosted: September 7th, 2013, 20:36 
Offline

Joined: August 22nd, 2011, 15:43
Posts: 209
Location: Romania
WD6400AAKS with some stuff on it :)

no soldering, just some elastic rubber bands.

this cpu has 2 TAPs (test acces ports) not quite like in Dejan's sample. to build a working script we must auto-probe the TAPs and add all to the feroceon.cfg to be able to halt or debug. newest CPU's have more TAPS, each one controlling something (cores etc)

I used OpenOCD with a usb jtag debugger, wired to a mictor breakout. the jtag con1 fellows this arm cpu specs.

basically with this setup a new firmware can be written to ram which is just what we need to temporary start the pcb, access it with a software and flash the internal rom. of course you could study the firmware's flash_write code, write a injector which then flashes the rom as soon as it is executed.

however I couldn't manage to connect to the PCB for which this thread exists :) ..maybe the con1 has other wire scheme for old pcb's, or the contacts are not quite well.

meantime I found another donor somewhere in France. what I need now it's a clean room and some practice with head replacement technique.


Attachments:
20130908_024118.jpg
20130908_024118.jpg [ 1.89 MiB | Viewed 18863 times ]
20130908_024036.jpg
20130908_024036.jpg [ 1.9 MiB | Viewed 18863 times ]
Top
 Profile  
 
 Post subject: Re: WD2000JD problem
PostPosted: September 7th, 2013, 21:01 
Offline

Joined: August 22nd, 2011, 15:43
Posts: 209
Location: Romania
wow. I managed to hook also the wd2000jd. (it seems to be from the contacts) the TAP it's like dejan's :)

Quote:
Open On-Chip Debugger 0.4.0 (2010-11-23-14:20)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.berlios.de/doc/doxygen/bugs.html
1500 kHz
trst_and_srst separate srst_gates_jtag trst_push_pull srst_open_drain
jtag_nsrst_delay: 200
jtag_ntrst_delay: 200
Info : clock speed 1500 kHz
Info : JTAG tap: feroceon.cpu tap/device found: 0x259663d3 (mfg: 0x1e9, part: 0x5966, ver: 0x2)
Info : Embedded ICE version 6
Info : feroceon.cpu: hardware has 1 breakpoint/watchpoint unit
Error: unexpected Feroceon EICE version signature
Info : accepting 'telnet' connection from 0
target state: halted
target halted in Thumb state due to debug-request, current mode: Supervisor
cpsr: 0x800000f3 pc: 0xffff0e70
MMU: disabled, D-Cache: disabled, I-Cache: disabled


MCU 88i6540-lfh1
MDL: WD2000JD-60KLB0

this would be nice to debug, since the bootstrap it's quite small. the unpacking code etc.


Attachments:
20130908_040254.jpg
20130908_040254.jpg [ 2.25 MiB | Viewed 18859 times ]
Top
 Profile  
 
 Post subject: Re: WD2000JD problem
PostPosted: September 13th, 2013, 0:04 
Offline

Joined: August 22nd, 2011, 15:43
Posts: 209
Location: Romania
I'm trying to figure out what's the compression algorithm for the firmware's blocks and I think I got something. I'm doing IDA debugging but it doesn't work to well since it seems it doesn't handle well instructions stepping; also the "touch only" connections seems unstable and I'm loosing control frequently. right now I'm debugging first block of the firmware which it's a loader which unpack and map all the remaining blocks.

I found that the second byte (the first it's the block number) in each block's header has the first bit indicating if the block it's compressed.
Code:
KLOAD:FFF1F1B6 LDRB    R0, [R0,#1]     ; gest second byte in header
KLOAD:FFF1F1B8 LSLS    R0, R0, #0x1F   ; test bit 0
KLOAD:FFF1F1BA BEQ     loc loc_F1C6


Top
 Profile  
 
 Post subject: Re: WD2000JD problem
PostPosted: September 13th, 2013, 11:38 
Offline

Joined: August 22nd, 2011, 15:43
Posts: 209
Location: Romania
the uncompressed size of rom blocks it's made from 2 words in header. the lower word it's at offset 0x1C in block's header. also if you scroll at the block start in rom image, you will find the the uncompressed size also there, the first dword. :)

the decoding/uncompressing routine it's in the first block (ID it's 5A aka block Z), which it's not compressed and it's executed by the bootstrap (code built in MCU which loads the firmware);

you could analyze the first block with an arm disassembler.

from what I've found it's seems that the algorithm it's a sort of LZAH

Code:
// initialize arrays
         foreach (i in [0 .. 0x139])
         {
            weights[i]       = 1;
            parents[i+0x273] = i;
            children[i]      = i + 0x273;
         }
         foreach (j in [0x13A .. 0x272])
         {
            def i = (j - 0x13A) * 2;
            weights[j]     = weights[i] + weights[i + 1];
            parents[i]     = j;
            parents[i + 1] = j;
            children[j]    = i;
         }


Attachments:
inith.png
inith.png [ 24.49 KiB | Viewed 18778 times ]
romhd.png
romhd.png [ 76.6 KiB | Viewed 18778 times ]
Top
 Profile  
 
 Post subject: Re: WD2000JD problem
PostPosted: September 13th, 2013, 23:21 
Offline

Joined: August 22nd, 2011, 15:43
Posts: 209
Location: Romania
Here we go. The first version of the firmware unpacker :)


Attachments:
wdupk.zip [33.87 KiB]
Downloaded 962 times
Top
 Profile  
 
 Post subject: Re: WD2000JD problem
PostPosted: September 14th, 2013, 18:00 
Offline

Joined: August 22nd, 2011, 15:43
Posts: 209
Location: Romania
I have extracted the rom blocks from a firmware and unpacked them using the tool. Attached the zipped files. When the drive starts clicking and the fails with "WDC-ROM SN# XYZ----" "WDC ROM MODEL-BUCCANER-"..look at the unpacked block 6 => bk6_up.bin :)

btw. I've finished the packing option too. The tool it's now complete for "rom modding" :lol:


Attachments:
testrom.zip [306.57 KiB]
Downloaded 789 times
Top
 Profile  
 
 Post subject: Re: WD2000JD problem
PostPosted: September 20th, 2013, 23:33 
Offline

Joined: August 22nd, 2011, 15:43
Posts: 209
Location: Romania
seems that wd switched to mictor 40 on newest hdd models.


Top
 Profile  
 
 Post subject: Re: WD2000JD problem
PostPosted: November 1st, 2013, 17:47 
Offline

Joined: November 1st, 2013, 17:39
Posts: 2
Location: Floridia
louis - Did you finish the compression option for your unpacker? The version posted says unimplemented. I'm very interested in this exploration.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 206 posts ]  Go to page Previous  1 ... 7, 8, 9, 10, 11  Next

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: Google Adsense [Bot] and 133 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group