Skip to main content

Topics

This section allows you to view all Topics made by this member. Note that you can only see Topics made in areas you currently have access to.

Topics - AMX

1
Project logs / PK2DeviceFile.dat editing tool (cli)
Hello,

I wrote a small command line tool to modify device files that are used by
the pk2cmd tool. It can dump a device file like
Code: [Select]
./pk2dft -d PK2DeviceFile.dat dump
whereby it creates a directory structure that looks like
Code: [Select]
dump
 +- config.cfg
 +- devices
    +- 11LC010.dev
    +- 11LC020.dev
    ...
    +- PIC32MX460F512L.dev
    +- Unsupported Part.dev
 +- families
    +- Baseline.fam
...
+- PIC24.fam
+- PIC32.fam
 +- scripts
    +- 18F_26K80ChpErase.scr
    ...
+- MR_UsrIDWrInt.3.scr
+- MR_WrOSCCALInt.1.scr
It is then possble to edit files and recompile it:
Code: [Select]
./pk2dft -c dump pk2dev.dat
This gives a new device file named "pk2dev.dat".
I was able to dump and recompile the PK2DeviceFile.dat I am using and
checked that the files are identical using "diff". There are probably
still some bugs but I think it might be usable already.
I attached the source code, you need libconfuse to compile it and it
probaly wont work under windows natively (because the are some
system("mkdir ...") calls as well as "/" in filenames ...).
Code: [Select]
gcc pk2dft.c -lconfuse -o pk2dft

I still have some problems figuring out the instructions of the scripts. I know that they are documented (for example here: http://code.google.com/p/vak-opensource ... 2_commands) but looking at the script commads stored inside the PK2DeviceFile.dat the data doesnt make too much sense.
For example the script code from '32MX_DevIDRd.scr':
Code: [Select]
script        = {
 0xbb, 0xaa, 0x04, 0xbb, 0xbb, 0xaa, 0x01, 0xbb,
 0xb9, 0xaa, 0x00, 0xbb, 0x00, 0xbb, 0x00, 0xbb,
 0x00, 0xbb,
}
hexdump from original file:
0002ad80  65 64 2e f5 00 0c 33 32  4d 58 5f 44 65 76 49 44  |ed....32MX_DevID|
0002ad90  52 64 00 00 00 00 00 00  09 00 bb aa 04 bb bb aa  |Rd..............|
0002ada0  01 bb b9 aa 00 bb 00 bb  00 bb 00 bb 3c 53 65 6e  |............<Sen|
0002adb0  64 43 4d 44 28 4d 54 41  50 5f 53 57 5f 4d 54 41  |dCMD(MTAP_SW_MTA|
0xbb stands for JT2_SENDCMD and takes an additional parameter, but
this would mean that they next instruction is 0x04 which is invalid. Has somebody got
an idea how to interpret the above code? Maybe the byte order is messed up (stored as 16bit unsigned integers)?

--AMX
2
Pirate PIC programmer / Added Support for USBASP in picprog
Hi,

I added support for another programmer named usbasp (WoW.fischl.de/usbasp) to picprog.
If you have a USBASP programmer you need to download the attached modified firmware (make your own changes like assign USB and ISP pins, different clock?), build it and flash it into your usbasp.
The next step would be to checkout picprog from here: code.google.com/p/dangerous-prototypes-open-hardware/source/checkout
apply the attached patch, build it and test it.

(I had to encrypt urls party because: "Your post looks too spamy for a new user, please remove off-site URLs")

EDIT: for now only reading from the device works, but I will fix this asap
EDIT2: fixed and updated attachements. There is one issue: it seems like the write buffer doesnt get cleared to 0xff so if the length of the file mod 64 isn't 0 you get some garbage at the end.

Thanks!