From: Matt H. <mh...@me...> - 2011-01-31 08:22:15
|
I was thinking of attempting to modify usbpicprog to program the 18f45k22. The programming spec is similar, with minor differences, to the PIC18F2XXX/4XXX family: http://ww1.microchip.com/downloads/en/DeviceDoc/39622L.pdf vs http://ww1.microchip.com/downloads/en/DeviceDoc/41398B.pdf And I see many parts from that first family are on the tested list. Should something like this process work?: http://sourceforge.net/mailarchive/forum.php?thread_name=4C035FBD.9030506%40gmail.com&forum_name=usbpicprog-technical <http://sourceforge.net/mailarchive/forum.php?thread_name=4C035FBD.9030506%40gmail.com&forum_name=usbpicprog-technical> I guess I will have to create a new family. I'd appreciate any comments. Best, Matt |
From: Frans S. <fra...@gm...> - 2011-01-31 08:54:59
Attachments:
signature.asc
|
Dear Matt, I think the sourcecode of the PC application doesn't have to be altered for that, only the .xml files. Only in the firmware some small modifications will have to be done. Also the hardware can't just program these devices since it gives a VPP of 12V where the 18f45K22 has a maximum VPP of 9V. A very simple solution for this will be a 9V zener diode over the VPP pin so that it won't exceed this limit. I don't see any other problems for implementing this device. Kind regards, Frans Schreuder On 01/31/2011 09:06 AM, Matt Hirsch wrote: > I was thinking of attempting to modify usbpicprog to program the > 18f45k22. The programming spec is similar, with minor differences, to > the PIC18F2XXX/4XXX family: > > http://ww1.microchip.com/downloads/en/DeviceDoc/39622L.pdf > vs > http://ww1.microchip.com/downloads/en/DeviceDoc/41398B.pdf > > And I see many parts from that first family are on the tested list. > > Should something like this process work?: > http://sourceforge.net/mailarchive/forum.php?thread_name=4C035FBD.9030506%40gmail.com&forum_name=usbpicprog-technical > <http://sourceforge.net/mailarchive/forum.php?thread_name=4C035FBD.9030506%40gmail.com&forum_name=usbpicprog-technical> > > I guess I will have to create a new family. > > I'd appreciate any comments. > > Best, > Matt > > ------------------------------------------------------------------------------ > Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! > Finally, a world-class log management solution at an even better price-free! > Download using promo code Free_Logger_4_Dev2Dev. Offer expires > February 28th, so secure your free ArcSight Logger TODAY! > http://p.sf.net/sfu/arcsight-sfd2d > _______________________________________________ > Usbpicprog-technical mailing list > Usb...@li... > https://lists.sourceforge.net/lists/listinfo/usbpicprog-technical |
From: Matt H. <mh...@me...> - 2011-01-31 15:48:31
|
Frans, Thanks for the pointers. I noticed you use mcc18 to compile the firmware. (Or at least your Makefile is setup that way). Do you use the commercial version? Or will it be ok to use the lite version? I also see #defines for sdcc - is this a valid option to compile the firmware? Thanks, Matt On 01/31/2011 03:54 AM, Frans Schreuder wrote: > Dear Matt, > > I think the sourcecode of the PC application doesn't have to be altered > for that, only the .xml files. > Only in the firmware some small modifications will have to be done. > Also the hardware can't just program these devices since it gives a VPP > of 12V where the 18f45K22 has a maximum VPP of 9V. > A very simple solution for this will be a 9V zener diode over the VPP > pin so that it won't exceed this limit. > > I don't see any other problems for implementing this device. > > Kind regards, > > Frans Schreuder > > > On 01/31/2011 09:06 AM, Matt Hirsch wrote: >> I was thinking of attempting to modify usbpicprog to program the >> 18f45k22. The programming spec is similar, with minor differences, to >> the PIC18F2XXX/4XXX family: >> >> http://ww1.microchip.com/downloads/en/DeviceDoc/39622L.pdf >> vs >> http://ww1.microchip.com/downloads/en/DeviceDoc/41398B.pdf >> >> And I see many parts from that first family are on the tested list. >> >> Should something like this process work?: >> http://sourceforge.net/mailarchive/forum.php?thread_name=4C035FBD.9030506%40gmail.com&forum_name=usbpicprog-technical >> <http://sourceforge.net/mailarchive/forum.php?thread_name=4C035FBD.9030506%40gmail.com&forum_name=usbpicprog-technical> >> >> I guess I will have to create a new family. >> >> I'd appreciate any comments. >> >> Best, >> Matt >> >> ------------------------------------------------------------------------------ >> Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! >> Finally, a world-class log management solution at an even better price-free! >> Download using promo code Free_Logger_4_Dev2Dev. Offer expires >> February 28th, so secure your free ArcSight Logger TODAY! >> http://p.sf.net/sfu/arcsight-sfd2d >> _______________________________________________ >> Usbpicprog-technical mailing list >> Usb...@li... >> https://lists.sourceforge.net/lists/listinfo/usbpicprog-technical > > > ------------------------------------------------------------------------------ > Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! > Finally, a world-class log management solution at an even better price-free! > Download using promo code Free_Logger_4_Dev2Dev. Offer expires > February 28th, so secure your free ArcSight Logger TODAY! > http://p.sf.net/sfu/arcsight-sfd2d > > > _______________________________________________ > Usbpicprog-technical mailing list > Usb...@li... > https://lists.sourceforge.net/lists/listinfo/usbpicprog-technical |
From: Matt H. <mh...@me...> - 2011-02-20 11:17:05
Attachments:
45k22-usbpicprog.patch
|
diff -rupN firmware-0.4.2-beta-orig/prog.c firmware-0.4.2-beta/prog.c --- firmware-0.4.2-beta-orig/prog.c 2011-01-22 11:24:58.000000000 -0500 +++ firmware-0.4.2-beta/prog.c 2011-02-16 02:02:58.050744634 -0500 @@ -182,14 +182,26 @@ char bulk_erase(PICFAMILY picfamily,PICT pic_send(4,0x00,0x94A6); //BCF EECON1, WREN break; case P18F2XXX: //also valid for 18F4XXX + case P18F4XK22: + case P18LF4XK22: set_address(picfamily, 0x3C0005); - pic_send(4,0x0C,0x3F3F); //Write 3F3Fh to 3C0005h + if(pictype == P18F2XXX) + { + pic_send(4,0x0C,0x3F3F); //Write 3F3Fh to 3C0005h + } else { // // P18LF/F4XK22 + pic_send(4,0x0C,0x0F0F); //Write 0F0Fh to 3C0005h + } set_address(picfamily, 0x3C0004); pic_send(4,0x0C,0x8F8F); //Write 8F8Fh to 3C0004h pic_send(4,0x00,0x0000); //NOP lasttick=tick; pic_send(4,0x00,0x0000); //hold PGD low until erase completes - DelayMs(P11); + if(pictype==P18F2XXX) + { + DelayMs(P11); + } else { // P18LF/F4XK22 + DelayMs(P11K); + } break; case P18FX220: case P18FXX31: @@ -582,8 +594,12 @@ char write_code(PICFAMILY picfamily, PIC //} break; case P18F2XXX: + case P18F4XK22: + case P18LF4XK22: pic_send(4,0x00,0x8EA6); //BSF EECON1, EEPGD pic_send(4,0x00,0x9CA6); //BCF EECON1, CFGS + if((pictype == P18F4XK22)||(pictype == P18LF4XK22)) + pic_send(4,0x00,0x84A6); //BSF EECON1, WREN set_address(picfamily, address); for(blockcounter=0;blockcounter<(blocksize-2);blockcounter+=2) { @@ -967,6 +983,11 @@ char write_data(PICFAMILY picfamily, PIC pic_send(4,0,0x6EA7); //MOVWF EECON2 } pic_send(4,0x00,0x82A6); //BSF EECON1, WR + if((pictype==P18F4XK22)||(pictype==P18LF4XK22)) + { + pic_send(4,0x00,0x0000); //NOP, two NOPs required before polling + pic_send(4,0x00,0x0000); //NOP, write starts on 4th clock of this instruction + } //pic_send(4,0x00,0x0000); //NOP, when not polling for the WR bit, the PIC still needs at least 4 clocks lasttick=tick; do @@ -1114,8 +1135,12 @@ char write_config_bits(PICFAMILY picfami case P18F6X2X: case P18FXX2: case P18F2XXX: + case P18F4XK22: + case P18LF4XK22: pic_send(4,0x00,0x8EA6); //BSF EECON1, EEPGD pic_send(4,0x00,0x8CA6); //BSF EECON1, CFGS + if((pictype==P18F4XK22)||(pictype==P18LF4XK22)) + pic_send(4,0x00,0x84A6); //BSF EECON1, WREN if((pictype==P18FXX2)||(pictype==P18FXX31)||(pictype==P18FXX31)) { //goto 0x100000 @@ -1130,8 +1155,13 @@ char write_config_bits(PICFAMILY picfami //LSB first pic_send(4,0x0F,((unsigned int)*(data+blockcounter))|(((unsigned int)*(data+blockcounter))<<8)); pic_send_n_bits(3, 0); - PGC=1; //hold PGC high for P9 - DelayMs(P9); + PGC=1; //hold PGC high for P9 (or P9A for 4XF/LFK22 config word) + if((pictype==P18F4XK22)||(pictype==P18LF4XK22)) + { + DelayMs(P9A); + } else { + DelayMs(P9); + } PGC=0; //hold PGC low for time P10 DelayMs(P10); pic_send_word(0x0000); //last part of the nop @@ -1142,8 +1172,13 @@ char write_config_bits(PICFAMILY picfami set_address(picfamily, address+((unsigned int)blockcounter)+1); pic_send(4,0x0F, ((unsigned int)*(data+1+blockcounter))|(((unsigned int)*(data+1+blockcounter))<<8)); //load MSB and start programming pic_send_n_bits(3, 0); - PGC=1; //hold PGC high for P9 - DelayMs(P9); + PGC=1; //hold PGC high for P9 (or P9A for 4XF/LFK22 config word) + if((pictype==P18F4XK22)||(pictype==P18LF4XK22)) + { + DelayMs(P9A); + } else { + DelayMs(P9); + } PGC=0; //hold PGC low for time P10 DelayMs(P10); pic_send_word(0x0000); //last part of the nop diff -rupN firmware-0.4.2-beta-orig/prog.h firmware-0.4.2-beta/prog.h --- firmware-0.4.2-beta-orig/prog.h 2010-12-13 10:33:41.000000000 -0500 +++ firmware-0.4.2-beta/prog.h 2011-02-16 01:28:31.474548425 -0500 @@ -35,7 +35,7 @@ typedef enum _PICTYPE{ P16F7X,P16F7X7,P16F87X,P16F72,P16F87,P16F54,P16F57,P16F785,P16F59,P16F91X,P16F88X, P16C6XX,P16C55X,P16C7XX,P16C64x,P14000,P16C50X,P16C432,P17CXX,P17C7XX, P18FXX39,P18F6X2X,P18FXX80,P18F8410,P18F6XJXX,P18F45J10,P18F97J60,P18F1X30,P18FXX23,P18FXXK20, - P24FJXXXGA0XX,P24FJXXXGA1,dsP30F,dsP33F,P24H,P10F200,P10F202,P12F61X,P16F716,P18FXX31,P18FX220, + P24FJXXXGA0XX,P24FJXXXGA1,dsP30F,dsP33F,P24H,P10F200,P10F202,P12F61X,P16F716,P18FXX31,P18FX220,P18F4XK22,P18LF4XK22, I2C_EE_1,I2C_EE_2,P12F508,P24FXXKAXXX, UPP_INVALID_PICTYPE }PICTYPE; @@ -61,9 +61,11 @@ unsigned char read_data(PICFAMILY picfam // delay times according to programming specification for PIC18F: #define P9 2 +#define P9A 6 #define P10 1 #define P11 10 #define P11A 5 +#define P11K 16 // delay times according to programming specification for PIC16F: #define Tera 10 diff -rupN firmware-0.4.2-beta-orig/upp.c firmware-0.4.2-beta/upp.c --- firmware-0.4.2-beta-orig/upp.c 2011-01-07 06:43:16.000000000 -0500 +++ firmware-0.4.2-beta/upp.c 2011-02-04 01:59:53.576524142 -0500 @@ -522,7 +522,9 @@ unsigned char set_pictype(unsigned char* case P16F716: case P17C7XX:picfamily=PIC16;break; case P18F2XXX: - case P18FXX2:picfamily=PIC18;break; + case P18F4XK22: + case P18LF4XK22: + case P18FXX2: case P18FXX39: case P18F6X2X: case P18FXX80: |
From: Frans S. <fra...@gm...> - 2011-03-02 15:01:58
Attachments:
signature.asc
|
Dear Matt Hirsch, Thanks for the patches. I have reviewed the code and committed it to the git repository. Just made a few changes to your code: -The new pic families should be added to the end of the enum for backward compatibility. -I have removed the debugging cout lines. Regards, Frans On 02/20/2011 12:01 PM, Matt Hirsch wrote: > I finally gotten around to doing this. > > I've attached two patches against the 0.4.2 beta release, one for the > firmware source tree, and one for usbpicprog. I had to add new entries > to PicFamily, which is why usbpicprog needed to be updated. I've tried > to make the code changes minimally invasive, but please let me know if > there's anything that needs cleaning up. > > I've tested this as working with a 18f45k22 using a 9v regulator on > Vpp. The 18lf versions of these parts require a lower voltage (<3.6V) > Vdd/PGC/D. It looks like this should be possible, so I added an XML > file and entry for the LF part as well, but I think code changes to > the firmware will be necessary to provide the low voltage versions of > the PGC/D signals. > > My XML files are missing the C compiler tags, since I'm not sure where > you're pulling these from. I couldn't find an obvious place in the > MCC18 headers. The SDCC tags seem irrelevant, since SDCC doesn't > support the 18F4XK22 parts. > > Thanks, > Matt > > On 01/31/2011 10:48 AM, Matt Hirsch wrote: >> Frans, >> >> Thanks for the pointers. I noticed you use mcc18 to compile the >> firmware. (Or at least your Makefile is setup that way). Do you use >> the commercial version? Or will it be ok to use the lite version? I >> also see #defines for sdcc - is this a valid option to compile the >> firmware? >> >> Thanks, >> Matt >> >> On 01/31/2011 03:54 AM, Frans Schreuder wrote: >>> Dear Matt, >>> >>> I think the sourcecode of the PC application doesn't have to be altered >>> for that, only the .xml files. >>> Only in the firmware some small modifications will have to be done. >>> Also the hardware can't just program these devices since it gives a VPP >>> of 12V where the 18f45K22 has a maximum VPP of 9V. >>> A very simple solution for this will be a 9V zener diode over the VPP >>> pin so that it won't exceed this limit. >>> >>> I don't see any other problems for implementing this device. >>> >>> Kind regards, >>> >>> Frans Schreuder >>> >>> >>> On 01/31/2011 09:06 AM, Matt Hirsch wrote: >>>> I was thinking of attempting to modify usbpicprog to program the >>>> 18f45k22. The programming spec is similar, with minor differences, to >>>> the PIC18F2XXX/4XXX family: >>>> >>>> http://ww1.microchip.com/downloads/en/DeviceDoc/39622L.pdf >>>> vs >>>> http://ww1.microchip.com/downloads/en/DeviceDoc/41398B.pdf >>>> >>>> And I see many parts from that first family are on the tested list. >>>> >>>> Should something like this process work?: >>>> http://sourceforge.net/mailarchive/forum.php?thread_name=4C035FBD.9030506%40gmail.com&forum_name=usbpicprog-technical >>>> <http://sourceforge.net/mailarchive/forum.php?thread_name=4C035FBD.9030506%40gmail.com&forum_name=usbpicprog-technical> >>>> >>>> I guess I will have to create a new family. >>>> >>>> I'd appreciate any comments. >>>> >>>> Best, >>>> Matt >>>> >>>> ------------------------------------------------------------------------------ >>>> Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! >>>> Finally, a world-class log management solution at an even better price-free! >>>> Download using promo code Free_Logger_4_Dev2Dev. Offer expires >>>> February 28th, so secure your free ArcSight Logger TODAY! >>>> http://p.sf.net/sfu/arcsight-sfd2d >>>> _______________________________________________ >>>> Usbpicprog-technical mailing list >>>> Usb...@li... >>>> https://lists.sourceforge.net/lists/listinfo/usbpicprog-technical >>> >>> >>> ------------------------------------------------------------------------------ >>> Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! >>> Finally, a world-class log management solution at an even better price-free! >>> Download using promo code Free_Logger_4_Dev2Dev. Offer expires >>> February 28th, so secure your free ArcSight Logger TODAY! >>> http://p.sf.net/sfu/arcsight-sfd2d >>> >>> >>> _______________________________________________ >>> Usbpicprog-technical mailing list >>> Usb...@li... >>> https://lists.sourceforge.net/lists/listinfo/usbpicprog-technical >> >> >> ------------------------------------------------------------------------------ >> Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! >> Finally, a world-class log management solution at an even better price-free! >> Download using promo code Free_Logger_4_Dev2Dev. Offer expires >> February 28th, so secure your free ArcSight Logger TODAY! >> http://p.sf.net/sfu/arcsight-sfd2d >> >> >> _______________________________________________ >> Usbpicprog-technical mailing list >> Usb...@li... >> https://lists.sourceforge.net/lists/listinfo/usbpicprog-technical > > > ------------------------------------------------------------------------------ > The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE: > Pinpoint memory and threading errors before they happen. > Find and fix more than 250 security defects in the development cycle. > Locate bottlenecks in serial and parallel code that limit performance. > http://p.sf.net/sfu/intel-dev2devfeb > > > _______________________________________________ > Usbpicprog-technical mailing list > Usb...@li... > https://lists.sourceforge.net/lists/listinfo/usbpicprog-technical |