From: scottlivingston Date: Sat, 25 Sep 2010 18:49:21 +0000 (+0000) Subject: Add note about another tested PIC target: PIC24FJ64GA002 X-Git-Url: http://git.rot13.org/?p=goodfet;a=commitdiff_plain;h=ea94279f763800d71e86d9bb25d140bf78dfb4ea;hp=803a81c7aa96d7ca0333c7dfa5e662036758dfd1 Add note about another tested PIC target: PIC24FJ64GA002 New PIC app command: "reset". Causes the PIC target to start! This is only useful in special cases and may be removed from the app later. PIC client dictionary of known targets expanded to include several PIC24FJxxGAxxx chips. git-svn-id: https://svn.code.sf.net/p/goodfet/code/trunk@732 12e2690d-a6be-4b82-a7b7-67c4a43b65c8 --- diff --git a/client/goodfet.pic b/client/goodfet.pic index 282e88b..7fb9e9e 100755 --- a/client/goodfet.pic +++ b/client/goodfet.pic @@ -9,7 +9,7 @@ # # Scott Livingston # -# March, April 2010. +# March-June 2010. import sys @@ -26,7 +26,25 @@ MONITORAPP = 0x00 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", @@ -246,6 +264,7 @@ if len(sys.argv) == 1: 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] @@ -256,7 +275,8 @@ if len(sys.argv) == 1: 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() @@ -292,6 +312,9 @@ if sys.argv[1] == "devid": #0x81 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, # diff --git a/firmware/apps/pic/dspic33f.c b/firmware/apps/pic/dspic33f.c index bc02e39..12af364 100644 --- a/firmware/apps/pic/dspic33f.c +++ b/firmware/apps/pic/dspic33f.c @@ -5,7 +5,7 @@ \brief dsPIC33F programmer application for the GoodFET. Structure and style is somewhat modeled after avr.c - \date March, April 2010 + \date March-May 2010 */ @@ -65,6 +65,12 @@ void pichandle( unsigned char app, txdata(app,verb,2); break; + case PIC_RESET33F: + CLR_MCLR; + delay_ms(20); + SET_MCLR; + break; + case PIC_START33F: pic33f_connect(); txdata(app,verb,0); diff --git a/firmware/include/dspic33f.h b/firmware/include/dspic33f.h index b6549ea..be66990 100644 --- a/firmware/include/dspic33f.h +++ b/firmware/include/dspic33f.h @@ -7,7 +7,7 @@ non-standard 2-wire SPI; hence, I do not use the existing GoodFET SPI routines. - \date March, April 2010 + \date March-June 2010 */ @@ -16,7 +16,10 @@ 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 @@ -88,5 +91,6 @@ void pic33f_trans8( unsigned char byte ); 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)