Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Thread

Flash write errors

Flash write errors

2006-01-25 by Guillermo Prandi

Hi. Are Flash write errors normal, i.e. a known issue? When 
programming my LPC2138 using the isp21lpc utility, every now and then 
I get a write error; a second attempt always succeed. This happens 
roughly once every 100 programming attempts. I thought it could have 
been a problem with my serial cable or some other hardware problem, 
but now I added an IAP function to my test program and I am getting 
errors too (i.e., saved data differs from the source data, although 
the IAP copy ram to flash command returns CMD_SUCCESS). I checked 
everything and I think I covered the normal requisites:

* Prepare the Flash sector for writing (for erase).
* Erase the intended block.
* Prepare the Flash sector for writing.
* Write a 256 bytes block.

At each IAP call I:

* Disable all interrupts.
* Provide the right clock in KHz to the IAP (10 MHz-->10000).

I am using an external 10 MHz crystal, and no PLL.

Even the power supply seems solid; for what I've seen with my 
osciloscope, VDD never gets below 3.3V (it is normally at 3.334V).

Oddly enough, I am NOT getting any dabt exceptions; I would have 
expected that reading from a corrupted sector of the flash memory 
would have raised a dabt exception, which doesn't seem to be the 
case. Also, reads from the flash are consistent; i.e., even when I 
get the wrong data in the flash sector, the 'wrong' data is stable 
until erased. Also, the 'wrong' data is *similar* to the 'right' 
data; i.e., if I want to save "HELLO", I might get "HELLO" (correct) 
or perhaps "H??L?" (incorrect).

Any ideas?

Guille

Re: [lpc2000] Flash write errors

2006-01-26 by Tom Walsh

Guillermo Prandi wrote:

>Hi. Are Flash write errors normal, i.e. a known issue? When 
>programming my LPC2138 using the isp21lpc utility, every now and then 
>I get a write error; a second attempt always succeed. This happens 
>roughly once every 100 programming attempts. I thought it could have 
>been a problem with my serial cable or some other hardware problem, 
>but now I added an IAP function to my test program and I am getting 
>errors too (i.e., saved data differs from the source data, although 
>the IAP copy ram to flash command returns CMD_SUCCESS). I checked 
>everything and I think I covered the normal requisites:
>
>  
>

There seems to be something goofy going on with those utils.  I tried 
using the lpc21isp (version 1.24) package on Linux, but it would 
sometimes error out at random locations.  Not sure why.

I finally had to write an ISP loader for an LPC2138 to program an 
LPC2106.  This loader source I then took an hung some RS232 routines 
onto it so I could also up load into the LPC2138 from Linux.  So far, my 
loader works flawlessly.

Go figure.

TomW


-- 
Tom Walsh - WN3L - Embedded Systems Consultant
http://openhardware.net, http://cyberiansoftware.com
"Windows? No thanks, I have work to do..."
----------------------------------------------------

Re: Flash write errors

2006-01-26 by Guillermo Prandi

That's interesting, Tom. That would explain the programming errors 
from my PC, but the IAP errors are still puzzling. I can live with 
lpc21isp errors (provided I can retry a couple of times until it 
works). The problem is IAP. My device is supposed to keep track of 
things in its Flash memory, and my file system code is to be much 
more complex if it has to take IAP false writes like these into 
account.

Guille

--- In lpc2000@yahoogroups.com, Tom Walsh <tom@o...> wrote:
>
> Guillermo Prandi wrote:
> 
> >Hi. Are Flash write errors normal, i.e. a known issue? When 
> >programming my LPC2138 using the isp21lpc utility, every now and 
then 
> >I get a write error; a second attempt always succeed. This happens 
> >roughly once every 100 programming attempts. I thought it could 
have 
> >been a problem with my serial cable or some other hardware 
problem, 
> >but now I added an IAP function to my test program and I am 
getting 
> >errors too (i.e., saved data differs from the source data, 
although 
> >the IAP copy ram to flash command returns CMD_SUCCESS). I checked 
> >everything and I think I covered the normal requisites:
> >
> >  
> >
> 
> There seems to be something goofy going on with those utils.  I 
tried 
> using the lpc21isp (version 1.24) package on Linux, but it would 
> sometimes error out at random locations.  Not sure why.
> 
> I finally had to write an ISP loader for an LPC2138 to program an 
> LPC2106.  This loader source I then took an hung some RS232 
routines 
> onto it so I could also up load into the LPC2138 from Linux.  So 
far, my 
Show quoted textHide quoted text
> loader works flawlessly.
> 
> Go figure.
> 
> TomW
> 
> 
> -- 
> Tom Walsh - WN3L - Embedded Systems Consultant
> http://openhardware.net, http://cyberiansoftware.com
> "Windows? No thanks, I have work to do..."
> ----------------------------------------------------
>

Re: [lpc2000] Re: Flash write errors

2006-01-26 by Tom Walsh

Guillermo Prandi wrote:

>That's interesting, Tom. That would explain the programming errors 
>from my PC, but the IAP errors are still puzzling. I can live with 
>lpc21isp errors (provided I can retry a couple of times until it 
>works). The problem is IAP. My device is supposed to keep track of 
>things in its Flash memory, and my file system code is to be much 
>more complex if it has to take IAP false writes like these into 
>account.
>
>  
>
My apologies, for some reason I get IAP & ISP mixed up and equate one 
with the other.  No, I haven't encountered problems with the IAP.  The 
one processor erases all but 80K of the flash and self programs 112K 
from the SD card.  This doesn't give any problems or errors, it just works.

TomW


-- 
Tom Walsh - WN3L - Embedded Systems Consultant
http://openhardware.net, http://cyberiansoftware.com
"Windows? No thanks, I have work to do..."
----------------------------------------------------

Re: [lpc2000] Flash write errors

2006-01-26 by Robert Adsett

At 07:42 PM 1/25/06 -0500, Tom Walsh wrote:
>Guillermo Prandi wrote:
> >Hi. Are Flash write errors normal, i.e. a known issue? When
> >programming my LPC2138 using the isp21lpc utility, every now and then
> >I get a write error; a second attempt always succeed. This happens
> >roughly once every 100 programming attempts. I thought it could have
> >been a problem with my serial cable or some other hardware problem,
> >but now I added an IAP function to my test program and I am getting
> >errors too (i.e., saved data differs from the source data, although
> >the IAP copy ram to flash command returns CMD_SUCCESS). I checked
> >everything and I think I covered the normal requisites:
> >
> >
> >
>
>There seems to be something goofy going on with those utils.  I tried
>using the lpc21isp (version 1.24) package on Linux, but it would
>sometimes error out at random locations.  Not sure why.
>
>I finally had to write an ISP loader for an LPC2138 to program an
>LPC2106.  This loader source I then took an hung some RS232 routines
>onto it so I could also up load into the LPC2138 from Linux.  So far, my
>loader works flawlessly.

I had some similar occurrences with the Philips utility as well.  They seem 
to have disappeared about the time I started using the automatic 
downloading and a good cabling setup on the last few centimeters.  I've not 
had a similar problem with the lpc21isp program and I've not tried 
IAP.  Mind you the write errors I was seeing were not verify errors but the 
protocol appearing to simply stop and it was rare enough that I couldn't be 
certain as to its source.

A quick question to verify my understanding of what you are seeing 
Guillermo, is your verification source the same buffer you just used to 
program via IAP or do you refresh it from elsewhere before you do the compare?

Just a little more grist for the mill.

Robert

" 'Freedom' has no meaning of itself.  There are always restrictions,   be 
they legal, genetic, or physical.  If you don't believe me, try to chew a 
radio signal. "  -- Kelvin Throop, III
http://www.aeolusdevelopment.com/

Re: [lpc2000] Flash write errors

2006-01-26 by Robert Adsett

My apologies if this shows up twice.  Every once in a while Yahoo decides 
it couldn't send a piece of mail my way several days in the past and shuts 
down delivery despite having sent mail successfully to the same address 
since many times.

At 07:42 PM 1/25/06 -0500, Tom Walsh wrote:
>Guillermo Prandi wrote:
> >Hi. Are Flash write errors normal, i.e. a known issue? When
> >programming my LPC2138 using the isp21lpc utility, every now and then
> >I get a write error; a second attempt always succeed. This happens
> >roughly once every 100 programming attempts. I thought it could have
> >been a problem with my serial cable or some other hardware problem,
> >but now I added an IAP function to my test program and I am getting
> >errors too (i.e., saved data differs from the source data, although
> >the IAP copy ram to flash command returns CMD_SUCCESS). I checked
> >everything and I think I covered the normal requisites:
> >
> >
> >
>
>There seems to be something goofy going on with those utils.  I tried
>using the lpc21isp (version 1.24) package on Linux, but it would
>sometimes error out at random locations.  Not sure why.
>
>I finally had to write an ISP loader for an LPC2138 to program an
>LPC2106.  This loader source I then took an hung some RS232 routines
>onto it so I could also up load into the LPC2138 from Linux.  So far, my
>loader works flawlessly.

I had some similar occurrences with the Philips utility as well.  They seem 
to have disappeared about the time I started using the automatic 
downloading and a good cabling setup on the last few centimeters.  I've not 
had a similar problem with the lpc21isp program and I've not tried 
IAP.  Mind you the write errors I was seeing were not verify errors but the 
protocol appearing to simply stop and it was rare enough that I couldn't be 
certain as to its source.

A quick question to verify my understanding of what you are seeing 
Guillermo, is your verification source the same buffer you just used to 
program via IAP or do you refresh it from elsewhere before you do the compare?

Just a little more grist for the mill.

Robert

" 'Freedom' has no meaning of itself.  There are always restrictions,   be 
they legal, genetic, or physical.  If you don't believe me, try to chew a 
radio signal. "  -- Kelvin Throop, III
http://www.aeolusdevelopment.com/

Re: [lpc2000] Flash write errors

2006-01-26 by Richard Duits

Because of the build-in ECC, the flash cannot update a block smaller 
than 16 bytes (aligned on a 16 byte boundary). This is not documented in 
the user manual. You can search this list for previous threads about this.

Richard.



Robert Adsett wrote:
Show quoted textHide quoted text
> My apologies if this shows up twice.  Every once in a while Yahoo decides
> it couldn't send a piece of mail my way several days in the past and 
> shuts
> down delivery despite having sent mail successfully to the same address
> since many times.
>
> At 07:42 PM 1/25/06 -0500, Tom Walsh wrote:
> >Guillermo Prandi wrote:
> > >Hi. Are Flash write errors normal, i.e. a known issue? When
> > >programming my LPC2138 using the isp21lpc utility, every now and then
> > >I get a write error; a second attempt always succeed. This happens
> > >roughly once every 100 programming attempts. I thought it could have
> > >been a problem with my serial cable or some other hardware problem,
> > >but now I added an IAP function to my test program and I am getting
> > >errors too (i.e., saved data differs from the source data, although
> > >the IAP copy ram to flash command returns CMD_SUCCESS). I checked
> > >everything and I think I covered the normal requisites:
> > >
> > >
> > >
> >
> >There seems to be something goofy going on with those utils.  I tried
> >using the lpc21isp (version 1.24) package on Linux, but it would
> >sometimes error out at random locations.  Not sure why.
> >
> >I finally had to write an ISP loader for an LPC2138 to program an
> >LPC2106.  This loader source I then took an hung some RS232 routines
> >onto it so I could also up load into the LPC2138 from Linux.  So far, my
> >loader works flawlessly.
>
> I had some similar occurrences with the Philips utility as well.  They 
> seem
> to have disappeared about the time I started using the automatic
> downloading and a good cabling setup on the last few centimeters.  
> I've not
> had a similar problem with the lpc21isp program and I've not tried
> IAP.  Mind you the write errors I was seeing were not verify errors 
> but the
> protocol appearing to simply stop and it was rare enough that I 
> couldn't be
> certain as to its source.
>
> A quick question to verify my understanding of what you are seeing
> Guillermo, is your verification source the same buffer you just used to
> program via IAP or do you refresh it from elsewhere before you do the 
> compare?
>
> Just a little more grist for the mill.
>
> Robert
>
> " 'Freedom' has no meaning of itself.  There are always 
> restrictions,   be
> they legal, genetic, or physical.  If you don't believe me, try to chew a
> radio signal. "  -- Kelvin Throop, III
> http://www.aeolusdevelopment.com/
>
>
> ------------------------------------------------------------------------
> YAHOO! GROUPS LINKS
>
>     *  Visit your group "lpc2000
>       <http://groups.yahoo.com/group/lpc2000>" on the web.
>        
>     *  To unsubscribe from this group, send an email to:
>        lpc2000-unsubscribe@yahoogroups.com
>       <mailto:lpc2000-unsubscribe@yahoogroups.com?subject=Unsubscribe>
>        
>     *  Your use of Yahoo! Groups is subject to the Yahoo! Terms of
>       Service <http://docs.yahoo.com/info/terms/>.
>
>
> ------------------------------------------------------------------------
>

Re: Flash write errors

2006-01-26 by Guillermo Prandi

Hi, Richard. This is an excertp of my test code:


#define IAP_LOCATION 0x7ffffff1

typedef void (*IAP)(unsigned int [],unsigned int[]);

static    unsigned    int    iapcmd[5];
static    unsigned    int    iapres[3];

#define    IAP_CMD_PREPARE_FOR_WRITE   50
#define    IAP_CMD_COPY_RAM_TO_FLASH   51
#define    IAP_CMD_ERASE_SECTORS       52
#define    IAP_CMD_CHECK_BLANK         53
#define    IAP_CMD_READ_PART_ID        54
#define    IAP_COMMAND                 0
#define    IAP_RESULT                  0
#define    IAP_PFW_START_SECTOR        1
#define    IAP_PFW_END_SECTOR          2
#define    IAP_CRTF_DST_ADDR           1
#define    IAP_CRTF_SRC_ADDR           2
#define    IAP_CRTF_BYTES              3
#define    IAP_CRTF_CCLK_KHZ           4
#define    IAP_ES_START_SECTOR         1
#define    IAP_ES_END_SECTOR           2
#define    IAP_ES_CCLK_KHZ             3
#define    IAP_CB_START_SECTOR         1
#define    IAP_CB_END_SECTOR           2
#define    IAP_CB_NON_BLANK_FIRST      1
#define    IAP_CB_NON_BLANK_WORD       2

....
} else if( !strnicmp( command, "iapw ", 5 ) )
{
    static    char   buf[256];
              char*  txt = &command[5];
              int    res;

    memset( buf, 0, sizeof(buf) );
    strcpy( buf, txt );

    do {    // Not a loop

    res = IAP_CheckBlank( 22, 22 );

    if( res != IAP_CMD_SUCCESS )
    {
        printf( "Sector is not blank. Blanking sector...\r\n" );

        res = IAP_PrepareForWrite( 22, 22 );

        if( res != IAP_CMD_SUCCESS )
        {
            printf( "IAP_PrepareForWrite() returns error %
d\r\n", res );
            break;
        }

        res = IAP_EraseSectors( 22, 22 );

        if( res != IAP_CMD_SUCCESS )
        {
            printf( "IAP_EraseSectors() returns error %d\r\n", res );
            break;
        }

        printf( "Sector blanked.\r\n" );
    }

    printf( "Writing onto flash...\r\n" );

    res = IAP_PrepareForWrite( 22, 22 );

    if( res != IAP_CMD_SUCCESS )
    {
        printf( "IAP_PrepareForWrite() returns error %d\r\n", res );
        break;
    }

    res = IAP_CopyRAMToFlash( buf, (void*) 0x00078000, sizeof(buf) );

    if( res == IAP_CMD_SUCCESS )
    {
        printf( "Flash memory written successfully.\r\n", res );

        if( memcmp( buf, (void*) 0x00078000, sizeof(buf) ) )
        {
            printf
( "Flash and RAM buffer contents do NOT match.\r\n" );

        } else {

            printf( "Flash and RAM buffer are now identical.\r\n" );
        }

    } else {

        printf( "IAP_CopyRAMToFlash() returns error %d\r\n", res );
        break;
    }

    } while(0);
}

....

///////////////////////////////////////


int IAP_PrepareForWrite( int start_sector, int end_sector )
{
    taskENTER_CRITICAL();
    iapcmd[IAP_COMMAND] = IAP_CMD_PREPARE_FOR_WRITE;
    iapcmd[IAP_PFW_START_SECTOR] = start_sector;
    iapcmd[IAP_PFW_END_SECTOR] = end_sector;
    IAP    iap_entry = (IAP) IAP_LOCATION;
    iap_entry( iapcmd, iapres );
    int    res = (int) iapres[IAP_RESULT];
    taskEXIT_CRITICAL();
    return res;
}

int IAP_CopyRAMToFlash( void* src_addr, void* dst_addr, int bytes )
{
    taskENTER_CRITICAL();
    iapcmd[IAP_COMMAND] = IAP_CMD_COPY_RAM_TO_FLASH;
    iapcmd[IAP_CRTF_SRC_ADDR] = (unsigned long) src_addr;
    iapcmd[IAP_CRTF_DST_ADDR] = (unsigned long) dst_addr;
    iapcmd[IAP_CRTF_BYTES] = bytes;
    iapcmd[IAP_CRTF_CCLK_KHZ] = GetCCLKKHz();
    IAP    iap_entry = (IAP) IAP_LOCATION;
    iap_entry( iapcmd, iapres );
    int    res = (int) iapres[IAP_RESULT];
    taskEXIT_CRITICAL();
    return res;
}

int IAP_EraseSectors( int start_sector, int end_sector )
{
    taskENTER_CRITICAL();
    iapcmd[IAP_COMMAND] = IAP_CMD_ERASE_SECTORS;
    iapcmd[IAP_ES_START_SECTOR] = start_sector;
    iapcmd[IAP_ES_END_SECTOR] = end_sector;
    iapcmd[IAP_CRTF_CCLK_KHZ] = GetCCLKKHz();
    IAP    iap_entry = (IAP) IAP_LOCATION;
    iap_entry( iapcmd, iapres );
    int    res = (int) iapres[IAP_RESULT];
    taskEXIT_CRITICAL();
    return res;
}

int IAP_CheckBlank( int start_sector, int end_sector )
{
    taskENTER_CRITICAL();
    iapcmd[IAP_COMMAND] = IAP_CMD_CHECK_BLANK;
    iapcmd[IAP_CB_START_SECTOR] = start_sector;
    iapcmd[IAP_CB_END_SECTOR] = end_sector;
    IAP    iap_entry = (IAP) IAP_LOCATION;
    iap_entry( iapcmd, iapres );
    int    res = (int) iapres[IAP_RESULT];
    taskEXIT_CRITICAL();
    return res;
}



Guille


--- In lpc2000@yahoogroups.com, Robert Adsett <subscriptions@a...> 
wrote:
>
> My apologies if this shows up twice.  Every once in a while Yahoo 
decides 
> it couldn't send a piece of mail my way several days in the past 
and shuts 
> down delivery despite having sent mail successfully to the same 
address 
> since many times.
> 
> At 07:42 PM 1/25/06 -0500, Tom Walsh wrote:
> >Guillermo Prandi wrote:
> > >Hi. Are Flash write errors normal, i.e. a known issue? When
> > >programming my LPC2138 using the isp21lpc utility, every now and 
then
> > >I get a write error; a second attempt always succeed. This 
happens
> > >roughly once every 100 programming attempts. I thought it could 
have
> > >been a problem with my serial cable or some other hardware 
problem,
> > >but now I added an IAP function to my test program and I am 
getting
> > >errors too (i.e., saved data differs from the source data, 
although
> > >the IAP copy ram to flash command returns CMD_SUCCESS). I checked
> > >everything and I think I covered the normal requisites:
> > >
> > >
> > >
> >
> >There seems to be something goofy going on with those utils.  I 
tried
> >using the lpc21isp (version 1.24) package on Linux, but it would
> >sometimes error out at random locations.  Not sure why.
> >
> >I finally had to write an ISP loader for an LPC2138 to program an
> >LPC2106.  This loader source I then took an hung some RS232 
routines
> >onto it so I could also up load into the LPC2138 from Linux.  So 
far, my
> >loader works flawlessly.
> 
> I had some similar occurrences with the Philips utility as well.  
They seem 
> to have disappeared about the time I started using the automatic 
> downloading and a good cabling setup on the last few centimeters.  
I've not 
> had a similar problem with the lpc21isp program and I've not tried 
> IAP.  Mind you the write errors I was seeing were not verify errors 
but the 
> protocol appearing to simply stop and it was rare enough that I 
couldn't be 
> certain as to its source.
> 
> A quick question to verify my understanding of what you are seeing 
> Guillermo, is your verification source the same buffer you just 
used to 
> program via IAP or do you refresh it from elsewhere before you do 
the compare?
> 
> Just a little more grist for the mill.
> 
> Robert
> 
> " 'Freedom' has no meaning of itself.  There are always 
restrictions,   be 
> they legal, genetic, or physical.  If you don't believe me, try to 
chew a 
Show quoted textHide quoted text
> radio signal. "  -- Kelvin Throop, III
> http://www.aeolusdevelopment.com/
>

Re: [lpc2000] Flash write errors

2006-01-26 by Mauricio Scaff

I cannot talk about the IAP errors, but the ISP errors sometimes are 
related to unsupported baud rates for your selected crystal.
Here I use 12.000Mhz and it works fine @ 38400. but if I raise to 57600 
I get frequent errors in the middle of the process.
By the way. Is it possible with the lpc2isp (maybe with a simple 
modification in the source code) to use non standard baud rates ?
The ISP works fine @14.7456Mhz with 115200 or even 230400 (datasheet 
information)
So if my crystal is 12.000 would be possible to talk with the ISP @ 
93750bps or 187500bps.

Mauricio

Re: Flash write errors

2006-01-26 by Guillermo Prandi

Sorry, guys, my mistake.

I was not checking the sector for being blank after my 
IAP_EraseSectors() function, and there was a typo in that function 
that prevented the correct CPU clock from getting through the IAP 
command.

It was a weird thing to watch the erase sectors command take almost 
no time, when it was supposed to take 400 mS!

Thanks everybody.

Guille


--- In lpc2000@yahoogroups.com, "Guillermo Prandi" 
<yahoo.messenger@m...> wrote:
>
> Hi, Richard. This is an excertp of my test code:
> 
> 
> #define IAP_LOCATION 0x7ffffff1
> 
> typedef void (*IAP)(unsigned int [],unsigned int[]);
> 
> static    unsigned    int    iapcmd[5];
> static    unsigned    int    iapres[3];
> 
> #define    IAP_CMD_PREPARE_FOR_WRITE   50
> #define    IAP_CMD_COPY_RAM_TO_FLASH   51
> #define    IAP_CMD_ERASE_SECTORS       52
> #define    IAP_CMD_CHECK_BLANK         53
> #define    IAP_CMD_READ_PART_ID        54
> #define    IAP_COMMAND                 0
> #define    IAP_RESULT                  0
> #define    IAP_PFW_START_SECTOR        1
> #define    IAP_PFW_END_SECTOR          2
> #define    IAP_CRTF_DST_ADDR           1
> #define    IAP_CRTF_SRC_ADDR           2
> #define    IAP_CRTF_BYTES              3
> #define    IAP_CRTF_CCLK_KHZ           4
> #define    IAP_ES_START_SECTOR         1
> #define    IAP_ES_END_SECTOR           2
> #define    IAP_ES_CCLK_KHZ             3
> #define    IAP_CB_START_SECTOR         1
> #define    IAP_CB_END_SECTOR           2
> #define    IAP_CB_NON_BLANK_FIRST      1
> #define    IAP_CB_NON_BLANK_WORD       2
> 
> ....
> } else if( !strnicmp( command, "iapw ", 5 ) )
> {
>     static    char   buf[256];
>               char*  txt = &command[5];
>               int    res;
> 
>     memset( buf, 0, sizeof(buf) );
>     strcpy( buf, txt );
> 
>     do {    // Not a loop
> 
>     res = IAP_CheckBlank( 22, 22 );
> 
>     if( res != IAP_CMD_SUCCESS )
>     {
>         printf( "Sector is not blank. Blanking sector...\r\n" );
> 
>         res = IAP_PrepareForWrite( 22, 22 );
> 
>         if( res != IAP_CMD_SUCCESS )
>         {
>             printf( "IAP_PrepareForWrite() returns error %
> d\r\n", res );
>             break;
>         }
> 
>         res = IAP_EraseSectors( 22, 22 );
> 
>         if( res != IAP_CMD_SUCCESS )
>         {
>             printf( "IAP_EraseSectors() returns error %
d\r\n", res );
>             break;
>         }
> 
>         printf( "Sector blanked.\r\n" );
>     }
> 
>     printf( "Writing onto flash...\r\n" );
> 
>     res = IAP_PrepareForWrite( 22, 22 );
> 
>     if( res != IAP_CMD_SUCCESS )
>     {
>         printf( "IAP_PrepareForWrite() returns error %d\r\n", res );
>         break;
>     }
> 
>     res = IAP_CopyRAMToFlash( buf, (void*) 0x00078000, sizeof
(buf) );
> 
>     if( res == IAP_CMD_SUCCESS )
>     {
>         printf( "Flash memory written successfully.\r\n", res );
> 
>         if( memcmp( buf, (void*) 0x00078000, sizeof(buf) ) )
>         {
>             printf
> ( "Flash and RAM buffer contents do NOT match.\r\n" );
> 
>         } else {
> 
>             printf( "Flash and RAM buffer are now identical.\r\n" );
>         }
> 
>     } else {
> 
>         printf( "IAP_CopyRAMToFlash() returns error %d\r\n", res );
>         break;
>     }
> 
>     } while(0);
> }
> 
> ....
> 
> ///////////////////////////////////////
> 
> 
> int IAP_PrepareForWrite( int start_sector, int end_sector )
> {
>     taskENTER_CRITICAL();
>     iapcmd[IAP_COMMAND] = IAP_CMD_PREPARE_FOR_WRITE;
>     iapcmd[IAP_PFW_START_SECTOR] = start_sector;
>     iapcmd[IAP_PFW_END_SECTOR] = end_sector;
>     IAP    iap_entry = (IAP) IAP_LOCATION;
>     iap_entry( iapcmd, iapres );
>     int    res = (int) iapres[IAP_RESULT];
>     taskEXIT_CRITICAL();
>     return res;
> }
> 
> int IAP_CopyRAMToFlash( void* src_addr, void* dst_addr, int bytes )
> {
>     taskENTER_CRITICAL();
>     iapcmd[IAP_COMMAND] = IAP_CMD_COPY_RAM_TO_FLASH;
>     iapcmd[IAP_CRTF_SRC_ADDR] = (unsigned long) src_addr;
>     iapcmd[IAP_CRTF_DST_ADDR] = (unsigned long) dst_addr;
>     iapcmd[IAP_CRTF_BYTES] = bytes;
>     iapcmd[IAP_CRTF_CCLK_KHZ] = GetCCLKKHz();
>     IAP    iap_entry = (IAP) IAP_LOCATION;
>     iap_entry( iapcmd, iapres );
>     int    res = (int) iapres[IAP_RESULT];
>     taskEXIT_CRITICAL();
>     return res;
> }
> 
> int IAP_EraseSectors( int start_sector, int end_sector )
> {
>     taskENTER_CRITICAL();
>     iapcmd[IAP_COMMAND] = IAP_CMD_ERASE_SECTORS;
>     iapcmd[IAP_ES_START_SECTOR] = start_sector;
>     iapcmd[IAP_ES_END_SECTOR] = end_sector;
>     iapcmd[IAP_CRTF_CCLK_KHZ] = GetCCLKKHz();
>     IAP    iap_entry = (IAP) IAP_LOCATION;
>     iap_entry( iapcmd, iapres );
>     int    res = (int) iapres[IAP_RESULT];
>     taskEXIT_CRITICAL();
>     return res;
> }
> 
> int IAP_CheckBlank( int start_sector, int end_sector )
> {
>     taskENTER_CRITICAL();
>     iapcmd[IAP_COMMAND] = IAP_CMD_CHECK_BLANK;
>     iapcmd[IAP_CB_START_SECTOR] = start_sector;
>     iapcmd[IAP_CB_END_SECTOR] = end_sector;
>     IAP    iap_entry = (IAP) IAP_LOCATION;
>     iap_entry( iapcmd, iapres );
>     int    res = (int) iapres[IAP_RESULT];
>     taskEXIT_CRITICAL();
>     return res;
> }
> 
> 
> 
> Guille
> 
> 
> --- In lpc2000@yahoogroups.com, Robert Adsett <subscriptions@a...> 
> wrote:
> >
> > My apologies if this shows up twice.  Every once in a while Yahoo 
> decides 
> > it couldn't send a piece of mail my way several days in the past 
> and shuts 
> > down delivery despite having sent mail successfully to the same 
> address 
> > since many times.
> > 
> > At 07:42 PM 1/25/06 -0500, Tom Walsh wrote:
> > >Guillermo Prandi wrote:
> > > >Hi. Are Flash write errors normal, i.e. a known issue? When
> > > >programming my LPC2138 using the isp21lpc utility, every now 
and 
> then
> > > >I get a write error; a second attempt always succeed. This 
> happens
> > > >roughly once every 100 programming attempts. I thought it 
could 
> have
> > > >been a problem with my serial cable or some other hardware 
> problem,
> > > >but now I added an IAP function to my test program and I am 
> getting
> > > >errors too (i.e., saved data differs from the source data, 
> although
> > > >the IAP copy ram to flash command returns CMD_SUCCESS). I 
checked
> > > >everything and I think I covered the normal requisites:
> > > >
> > > >
> > > >
> > >
> > >There seems to be something goofy going on with those utils.  I 
> tried
> > >using the lpc21isp (version 1.24) package on Linux, but it would
> > >sometimes error out at random locations.  Not sure why.
> > >
> > >I finally had to write an ISP loader for an LPC2138 to program an
> > >LPC2106.  This loader source I then took an hung some RS232 
> routines
> > >onto it so I could also up load into the LPC2138 from Linux.  So 
> far, my
> > >loader works flawlessly.
> > 
> > I had some similar occurrences with the Philips utility as well.  
> They seem 
> > to have disappeared about the time I started using the automatic 
> > downloading and a good cabling setup on the last few 
centimeters.  
> I've not 
> > had a similar problem with the lpc21isp program and I've not 
tried 
> > IAP.  Mind you the write errors I was seeing were not verify 
errors 
> but the 
> > protocol appearing to simply stop and it was rare enough that I 
> couldn't be 
> > certain as to its source.
> > 
> > A quick question to verify my understanding of what you are 
seeing 
> > Guillermo, is your verification source the same buffer you just 
> used to 
> > program via IAP or do you refresh it from elsewhere before you do 
> the compare?
> > 
> > Just a little more grist for the mill.
> > 
> > Robert
> > 
> > " 'Freedom' has no meaning of itself.  There are always 
> restrictions,   be 
> > they legal, genetic, or physical.  If you don't believe me, try 
to 
Show quoted textHide quoted text
> chew a 
> > radio signal. "  -- Kelvin Throop, III
> > http://www.aeolusdevelopment.com/
> >
>

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.