EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

lpc2368 IAP Blank check sector(s) corrupts ram when sector not blank

Started by john bougs January 8, 2008
I was wondering if anyone else has had this problem or have any
suggestions? Thanks in advance, any help would be appriciated.

I am having problems with the IAP...when I call the blank check sector
(s) command and the sector is blank I have no problems. If I call it
and it is not blank it seems to corrupt RAM. I have not had any
problems with any of the other IAP commands.

typedef void (*IAP)(u32 [],u32 []);
static const IAP iapEntry = (IAP) IAP_LOCATION;
#define wd_feed() ;
#define iap_entry(command, result) wd_feed(); irq_cli(); iapEntry
(command, result); irq_restoreFlags(interruptsOnEntry); wd_feed();
#define iap_setup irqFlags interruptsOnEntry; irq_saveFlags
(interruptsOnEntry);

ebsp_status iap_blankCheckSectors(u32 sectorStart, u32 sectorEnd, u32
*offset)
{
iap_setup;
command[0] = 53;
command[1] = sectorStart;
command[2] = sectorEnd;
iap_entry (command, result);
*offset = result[1];
return (iap2ebsp(result[0]));
}

.
.
.
result = iap_blankCheckSectors(sector, sector, &var);
sPuts("blankCheckSectors status = ");
bin2Hex(buffer, result);
sPuts(buffer);
sPuts("\r\n");
sPuts("offset = ");
bin2Hex(buffer, var);
sPuts(buffer);
sPuts("\r\n");

An Engineer's Guide to the LPC2100 Series

I found the same problem, Blank check sector(s) will return 2
parameters with 1 status code. But in datasheet, they define the
outcoming of IAP_Entry to "unsigned long result[2];"
Or it should be "unsigned long result[3];"?
After Blank check command, result[0] is status code, result[1] is
offset to the first dismatched WORD, and result[2] is the value of the
WORD according to datasheet.

The 2024 Embedded Online Conference