IAP write problem - using the same memory bank for bootloader and application

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Nov 18, 2016 by pon alagappan
Content originally posted in LPCWare by joaopaulosm on Mon May 30 07:35:08 MST 2016
Hello friends,

I'm having a problem trying to implement a bootloader. The scenario is that follows: a LPC4357 (using only the M4 core) with a bootloader that occupies the first 128 kB of the FLASH A BANK (sectors 0 to 8). The main firmware image is located at an external SPIFI memory. I want to write this image on the following sectors of the on-chip flash (sectors 9 to 14) at the same bank.

The problem is when I try to write the flash using the IAP calls (prepare, erase, prepare, write) the core raises a hardfault. The odd issue is that when I use the exactly same code changing the "destination" to the on-chip flash BANK B, the whole procedure works fine. I've already checked the content of the FLASH B after running the boot loader, and it's fine.

So, is there any issue on using IAP commands affecting the same BANK which your code is running?

Thanks in advance,