ec51f2658c72e2480827e1b813dc2641d13aca34
[goodfet] / firmware / apps / pic / README.txt
1 PIC programmer
2 March, April 2010.
3
4 Scott Livingston <slivingston AT caltech.edu>
5
6
7 Currently targeted at dsPIC33F/PIC24H chip family and tested on
8
9 dsPIC33FJ128GP710,
10 dsPIC33FJ128GP708
11
12 (i.e. similar chip, differing in footprint: former is 100-TQFP, latter
13 is 80-TQFP).
14
15 For the 14-pin GoodFET port (size 2x7), the pinout is
16 3 -> PGD
17 5 -> !MCLR
18 7 -> PGC
19 2 -> Vcc
20 9 -> GND
21
22 Programming is done over a protocol similar to 2-wire SPI (i.e., MOSI
23 and MISO are combined into a single data line), where the GoodFET is
24 the master. Currently only ICSP is supported, i.e., the programming
25 executive (similar to a bootstrap loader in other architectures) is
26 ignored, if present. Note that dsPIC33F/PIC24H chips seem to ship
27 without the programming executive present. Confer Microchip document
28 "dsPIC33F/PIC24H Flash Programming Specification" (DS70152G).
29
30 When receiving from (resp. replying to) host, data on the PGD line is
31 latched (resp. written) by the dsPIC33f/PIC24H chip on the rising edge
32 of PGC. A statement to this effect appears as a note in section 5.3,
33 Chapter 5, of the dsPIC33F/PIC24H Flash Programming Spec.
34
35 In the dsPIC33F/PIC24H flash programming spec, there is a typo
36 regarding verification of the presence of the programming
37 executive. In Section 5.11, it is stated that an Application ID of
38 0xBB indicates the programming executive is resident. As of 4 April
39 2010, the correct App ID is 0xCB, as listed later in the spec
40 document, Section 7 "Device ID". To dump the device and application
41 IDs and hardware revision number of an attached dsPIC33F/PIC24H chip,
42 use the goodfet.pic client:
43
44 $ ./goodfet.pic devid
45
46
47 Much more documentation is needed for the programmer and is
48 forthcoming along with more common tools (e.g. verify programming
49 results). For now, here are some quick examples. To bulk erase program
50 memory (this is necessary before programming),
51
52 $ ./goodfet.pic erase
53
54 Then to program the device with a code file, foo.hex,
55
56 $ ./goodfet.pic program foo.hex
57
58
59 A quick visual check of results might be a dump of the first few
60 instruction words.
61
62 $ ./goodfet.pic - 0x200 0x220 pretty
63
64 This command prints (24-bit width) contents of program memory at
65 addresses 0x200 through 0x220 to stdout.
66
67
68 For setting up your development environment, I suggest matt's article
69 on installing Microchip's GCC port for dsPIC/PIC24 microcontrollers
70 under GNU/Linux (and almost certainly extends to other Unix-like
71 environments):
72
73 http://www.electricrock.co.nz/blog/2009/08/installing-microchips-c-compiler-for-pic24-mcus-and-dspic-dscs-c30-on-ubuntu-9-04/
74
75 The port is called C30 by Microchip.