gnupic: New Command to picp


Previous by date: 6 Dec 2002 00:29:41 -0000 Restricted posts, Rick Mann
Next by date: 6 Dec 2002 00:29:41 -0000 Re: New Command to picp, Andrew Pines
Previous in thread: 6 Dec 2002 00:29:41 -0000 New Command to picp, Antonio Augusto Todo Bom Neto
Next in thread: 6 Dec 2002 00:29:41 -0000 Re: New Command to picp, Andrew Pines

Subject: Re: New Command to picp
From: Antonio Augusto Todo Bom Neto ####@####.####
Date: 6 Dec 2002 00:29:41 -0000
Message-Id: <1039134256.7951.24.camel@axc.lax>

Em Qua, 2002-12-04 às 22:58, Antonio Augusto Todo Bom Neto escreveu:
> I found the PicStart Plus command to erase flash device:
> 
> 0x8f
> 
> see bellow that it initialize a job to 16f873 and then just sends 0x8f
> and receive 0x8f 0x00.
> 
> The same was in a 12f629 operation, but it reads the oscall before and
> re write it after.
> 
> 
> 16f873 operation (just the end):
> 
> -----
> IRP_MJ_WRITE	Length 1: 00 
> IRP_MJ_WRITE	Length 1: 00 
> IRP_MJ_WRITE	Length 1: 74
> IRP_MJ_READ	Length 1: 00 --- until here, just the pic device init...
> 
> IRP_MJ_WRITE	Length 1: 8F --- erase flash device request
> 
> IRP_MJ_READ	Length 1: 8F --- reponses
> IRP_MJ_READ	Length 1: 00 	
> 
> --------
> 
> I will try to implement this to software, but I don't program "C".
> I am not sure if I can do it.


It's working OK!

	Below the dif file, please ignore my comments "included by Antonio" it
was just to my references when editing.

	I have been tested these changes, with pic16f873, pic16f876, pic12f629,
and is operating ok.

	The cool is that erase all the device is faster than a -ep.

	I implemented as -ef switch, please change it if wish.

	Excuse if is anything wrong, I don't program microcomputers yet, since
1992. I just program old friend Clipper Summer'87. eheh! And PICs.

	Now I will to know about read DATA EEPROM and read/write ID's, I need
these instructions to factory work.

	Thanks all, excuse for any boring mail.

----------- Cut Here -----------------
69,70c69
< //
< //	0.4d (20 February, 2001)
---
> //Do
152c151
< #define CMD_READ_ID			'e'				// read ID locations
---
> #define CMD_READ_ID		'e'				// read ID locations
161a161
> #define CMD_ERASE_FLASH		0x8f			// send a erase flash device command
1212a1213,1260
> // Execute a ERASE FLASH DEVICE operation
> static bool DoEraseFlash(const PIC_DEFINITION *picDevice)
> {
> 	bool
> 		fail;
> 	unsigned char
> 		theBuffer[2];
> 
> 	fail = false;
> 	theBuffer[0] = CMD_ERASE_FLASH;
> 	if(SendMsg(theBuffer,1,theBuffer,2))
> 	{
> 		if( (theBuffer[0] == CMD_ERASE_FLASH) && (theBuffer[1] == 0) )
> 		{
> 			if(verboseOutput)
> 			{
> 				fprintf(stdout,"Programmer response: ");							// if in quiet
mode, only the values will be returned
> 			}
> 			fprintf(stdout,"0x%02x%02x ",theBuffer[0],theBuffer[1]);
> 			fprintf(stdout," - Erase seems ok! ");
> 			fprintf(stdout,"\n");
> 			if(!DoBlankCheck(picDevice, BLANK_PGM))		// make sure it is now
blank
> 			{
> 				fprintf(stderr,"But failed to blank check!!!\n");
> 				fail=true;
> 			}
> 			else
> 			{
> 				fprintf(stderr,"And blank check was OK!\n");
> 				fail=false;
> 			}
> 		}
> 		else
> 		{
> 			fprintf(stderr,"failed to erase flash device\n");
> 			fail = true;
> 		}
> 	}
> 	else
> 	{
> 		fprintf(stderr,"failed to send erase command\n");
> 		fail=true;
> 	}
> 	return(!fail);
> }
> 
> 
> //--------------------------------------------------------------------
1387a1436,1439
> 						case 'f':					//
> 							fail = !DoEraseFlash(picDevice);	//
> 							break;					//
> 
------ Dont cut here, you'l break your monitor --------------


Best regards,

Antonio Augusto Todo Bom Neto
LAX Eletronica e Telecomunicacoes Ltda
gEDA-BR - Users Group - http://gedabr.projetos.etc.br


Chave Publica no Site 
www.keyserver.net chave de Antonio Augusto Todo Bom Neto
ou tente pelo ID 5F7C385C, ou pelo link abaixo:

http://search.keyserver.net:11371/pks/lookup?op=get&search=0x5F7C385C&template=netenextract,netennomatch,netenerror

Fingerprint = 10C2 FEF8 0462 A985 E1AF F28C C58E 4BA5 5F7C 385C 

[Content type application/pgp-signature not shown. Download]

Previous by date: 6 Dec 2002 00:29:41 -0000 Restricted posts, Rick Mann
Next by date: 6 Dec 2002 00:29:41 -0000 Re: New Command to picp, Andrew Pines
Previous in thread: 6 Dec 2002 00:29:41 -0000 New Command to picp, Antonio Augusto Todo Bom Neto
Next in thread: 6 Dec 2002 00:29:41 -0000 Re: New Command to picp, Andrew Pines


Powered by ezmlm-browse 0.20.