Hi,
i use these functions:
static uint32_t iapCmd[5], iapRes[4];
uint32_t iapEEread(uint16_t eAdr, uint8_t *data, uint16_t bytes) {
iapCmd[0] = IAP_EEPROM_READ;
iapCmd[1] = (uint32_t) eAdr;
iapCmd[2] = (uint32_t) data;
iapCmd[3] = (uint32_t) bytes;
iapCmd[4] = SystemCoreClock / 1000;
LED_d3=1;
iap_entry(iapCmd, iapRes);
LED_d3=0;
return iapRes[0];
}
uint32_t iapEEwrite(uint16_t eAdr, uint8_t *data, uint16_t bytes) {
iapCmd[0] = IAP_EEPROM_WRITE;
iapCmd[1] = (uint32_t) eAdr;
iapCmd[2] = (uint32_t) data;
iapCmd[3] = (uint32_t) bytes;
iapCmd[4] = SystemCoreClock / 1000;
LED_d3=1;
iap_entry(iapCmd, iapRes);
LED_d3=0;
return iapRes[0];
}
Usually it is working properly, but sometimes (approximately 10 % if hundreds bytes writed, for example 353 bytes, but not if tens bytes writed, and 2 incidents in reading) a problem occurred:
Program stops at address 0xfffffffe, and LED stay ON.
iap_entry is from romapi_11u6x.h
builded in LPCXpresso v8.1.4 [Build 606] [2016-03-14]
SystemCoreClock is from startup set to 48000000.LPC11U68JBD100 is on custom board, blocked with 100n+10n 0805 capacitors on every supply pins, and two 22uF caps near. Supplied from 3,0V LDO.