AnsweredAssumed Answered

IAP function to write into flash returns always 2

Question asked by Juan Abelaira on Jul 20, 2017
Latest reply on Jul 20, 2017 by Juan Abelaira

I want to write some data into a specific, not used by code, area of flash.

I'm using the functions included in the LpcOpen library v2.20,  Chip_IAP_PreSectorForReadWrite, Chip_IAP_EraseSector and Chip_IAP_CopyRamToFlash.

I can prepare and erase sectors, but when copying data into flash it always returns 2 and data is not written (checked that)

Yes, I have interrupts disabled

I'm working on LPC 1519


The offending line is:


while( 0 != Chip_IAP_CopyRamToFlash((uint32_t)0x00020000, (uint32_t *)UpBuffer, 0x400) );


And UpBuffer is (for test purposes) defined and set up as:


static uint8_t UpBuffer[1024];

for(j=0; j<0x400; j++) UpBuffer[j] = (uint8_t)j;


Any ideas?