#
# Scott Livingston <slivingston at caltech.edu>
#
-# March, April 2010.
+# March-June 2010.
import sys
NOK = 0x7E
dev_table = { 0x00EE : "dsPIC33FJ128GP708",
0x00EF : "dsPIC33FJ128GP710",
- 0x080A : "PIC24HJ12GP201" }
+ 0x080A : "PIC24HJ12GP201",
+ 0x080B : "PIC24HJ12GP202",
+ 0x0444 : "PIC24FJ16GA002",
+ 0x044C : "PIC24FJ16GA004",
+ 0x0445 : "PIC24FJ32GA002",
+ 0x044D : "PIC24FJ32GA004",
+ 0x0446 : "PIC24FJ48GA002",
+ 0x044E : "PIC24FJ48GA004",
+ 0x0447 : "PIC24FJ64GA002",
+ 0x044F : "PIC24FJ64GA004",
+ 0x0405 : "PIC24FJ64GA006",
+ 0x0408 : "PIC24FJ64GA008",
+ 0x040B : "PIC24FJ64GA010",
+ 0x0406 : "PIC24FJ96GA006",
+ 0x0409 : "PIC24FJ96GA008",
+ 0x040C : "PIC24FJ96GA010",
+ 0x0407 : "PIC24FJ128GA006",
+ 0x040A : "PIC24FJ128GA008",
+ 0x040D : "PIC24FJ128GA010" }
cfg_table = { 0xF80000 : "FBS",
0xF80002 : "FSS",
0xF80004 : "FGS",
print "%s read 0x$addr" % sys.argv[0]
print "%s dump $foo.hex [0x$start 0x$stop] [pretty]" % sys.argv[0]
print "%s config" % sys.argv[0]
+ print "%s reset" % sys.argv[0]
print "%s program $foo.hex" % sys.argv[0]
print "%s verify $foo.hex" % sys.argv[0]
print "%s write 0x$address 0x$value" % sys.argv[0]
print "%s regout" % sys.argv[0]
print """
Note: use - for stdout.
-Warning: only supports dsPIC33F/PIC24H (maybe)...
+Warning: only formally supports dsPIC33F/PIC24H,
+ but read/write flash memory works with PIC24F ...
"""
sys.exit()
print "revision: 0x%04X"% hwrev
#print "\n(Note that -1 indicates failure to read a value.)"
+elif sys.argv[1] == "reset":
+ client.writecmd( PICAPP, 0x87, 0 )
+
elif sys.argv[1] == "config": # Dump configuration registers
prep_cmd_li = [0x040200, # GOTO 0x0200
0x000000, #
non-standard 2-wire SPI; hence, I do not use the existing
GoodFET SPI routines.
- \date March, April 2010
+ \date March-June 2010
*/
dsPIC33F/PIC24H Flash Programming Specification). Note that the
ICSP key is in bit-reversed order, since it is the only thing that
is sent MSb first (hence, we flip the bit order and use our usual
- LSb-first routines). */
+ LSb-first routines).
+
+ Per the dsPIC33F/PIC24H and PIC24F flash programming
+ specifications, the ICSP key is 0x4D434851. */
#define ICSP_KEY_LOW 0xC2B2
#define ICSP_KEY_HIGH 0x8A12
#define APPID_ADDR 0x8007F0
then executes them over ICSP session
with target dsPIC33F/PIC24H chip. */
+#define PIC_RESET33F 0x87 // Reset attached dsPIC33F/PIC24H chip.
#define PIC_START33F 0x84 // Start ICSP session
#define PIC_STOP33F 0x85 // Stop ICSP (basically, drop !MCLR pin and pause briefly)