how to jtag your 900/900c


if your 900 or 900c suddenly stops powering up, maybe after a system crash or just on its own after a reboot,
then it probably has a corrupt bootloader image, but otherwise perfectly working hardware.
or if you flashed the device in the wrong way (oops) that resulted in corrupt bootloader...
well, here's the ultimate last chance solution.


what you need:
- PC with windows (98 or later), or linux works too, but this description applies to windows
- if you are on windows, then also cygwin from http://cygwin.com
- parallel port on PC
- jtag cable, schematics for a working example (very simple!!) here: http://hpcmonex.net/nec900/files/jtag/900c_jtag.jpg
note, this emulates a wiggler cable... you can also order some more serious type of wiggler but that costs more.
- soldering iron and the right screwdriver to disassemble the 900c
- bootloader file http://hpcmonex.net/nec900/files/jtag/bootloader410_nolockcheckmsbin_jtagONLY.zip
- jtag tools 0.5.1, here's a version compiled for cygwin: http://hpcmonex.net/nec900/files/jtag/jtag900cfinal.zip


steps:
1. after you got all the above, disassemble the 900c, hpcnec has a disassembly guide here: http://hpcnec.com/cgi-bin/hpcnec.cgi?fid=15&topic_id=1204570453
2. solder the jtag cable to the jtag pins on the 900c like this: in this picture and sort out the LPT end on the PC too.
NOTE: an alternative jtag header and pinout exists on the motherboard, for more information refer to the hpcfactor thread linked at the bottom of this page.
3. now to make the software work... assuming you are on windows, download and install cygwin from http://cygwin.com. when it gets to ask you about which packages to download,
leave all that on default except for an extra package you need, it's ioperm under Devel packages.
4. using cmd.exe, cmd into cygwin\bin and run this command: ioperm -i
5. after that, here is the already compiled jtag tools for cygwin in windows: jtag900cfinal.zip. download and unzip that to cygwin\home\yourusername\jtag. then copy the jtag folder within usr\local\share from jtag900cfinal.zip into cygwin\usr\local\share\jtag now it's all ready...
to start jtag tools, run cygwin from the cygwin icon on desktop or start menu, and from the cmd it opens, issue this command: cd jtag, then issue this command: cd src, finally issue this: ./jtag
6. connect the 900c if you haven't already, and power it up by simply inserting the battery and putting it on AC power as well! type this command: cable parallel 0x378 WIGGLER
(check if your parallel port is indeed on 0x378, in device manager, lpt port, resources) it should say Initializing ...
of course, if you have a non wiggler cable that is supported by jtag tools then use the name of that instead.
7. then type this command: detect
this should tell you your CPU is a PXA255A0.
if it doesn't return anything, make sure the device is on AC properly / battery is fully charged. the point is that the board must be powered on for detect to work.
8. next command is: detectflash
that should return lots of info on the flash
9. now try reading your current bootloader image: readmem 0x0 0x80000 filename
you can check its contents or compare it to saboot.nb0 bootloader image to see if it is the same... if not then it's probably corrupt and you have a good chance to revive the device.
10. now flash the file you extracted from the bootloader download: flashmem msbin saboot.xip
if verification is ok, then you are almost finished now.
11. disconnect from the PC, remove power from 900c, and try reinserting battery and powering up. it should boot up now! if not then maybe something went wrong, try jtag again. note, it's fine if it doesn't boot to OS, just bootloader. you jtagged bootloader 4.10 in, so feel free to just reflash an OS!



troubleshooting:
1. if you had a 900 running hpc2000 OS then the above posted bootloader will not boot the OS. but the solution is simple: you can choose to keep hpc2000 or upgrade to cenet.
if you want hpc2000, then just download and flash this hpc2000 image compatible with cenet bootloader. if you want ce.net then download stock cenet rom from my download page (select any of the options except "Not listed").
then, flash the image from CF card using C+F method (how to described at this link).
2. if cygwin won't run jtag tools then read more for a solution: 1) extract jtag900cfinal.zip somewhere else on your PC outside cygwin folder. 2) take the cygwindlls folder from the extracted jtag900cfinal.zip and copy the dlls from it into \src folder. 3) then copy the jtag folder within usr\local\share from jtag900cfinal.zip into cygwin\usr\local\share\jtag. 4) then, simply (using windows cmd.exe) cmd into the \src folder where you copied the cygwindlls folder contents too and type the command jtag to run jtag tools. hopefully that works.
3. for more information, you can read the original 900c jtag thread at: http://www.hpcfactor.com/forums/forums/thread-view.asp?tid=9529&posts=36
this also describes an alternative pinout for jtag, but as a sumup it is: on the white JTAG connector under the modem: test - 8, nTRST 9, TCK 1, TMS 3, TDI 5, TDO 10, A1-DC3,3V