LPC2294: IAP call #50 always fails for flash sector #17 (the last one) !!??

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPC2294: IAP call #50 always fails for flash sector #17 (the last one) !!??

875 Views
gtrevi
Contributor I

Hello all,

I'm experiencing a very nasty issue calling IAP function #50 (IAP_CMD_PREPARE_SECTORS_FOR_WRITE): simply, works like a charm for any flash sector interval as far as sector 17 (the last one for LPC2294) is not included, in that case I always get error #7 - INVALID_SECTOR (which does not make sense since LPC2294 *does* have sectore #17, which's address range is 0x0003 E000 - 0x0003 FFFF).

Here's my code:

#define BOOT_CPU_SYSTEM_SPEED_KHZ       (60000)

#define IAP_CLOCK_KHz (BOOT_CPU_SYSTEM_SPEED_KHZ)
#define IAP_ADDRESS 0x7FFFFFF1


unsigned int param_table[5] = {0,0,0,0,0};
unsigned int result_table[3] = {0,0,0};
typedef void (*IAP)(unsigned int [],unsigned int[]);
IAP iap_entry = (void (*)(unsigned int [],unsigned int []))IAP_ADDRESS;

#define IAP_CMD_PREPARE_SECTORS_FOR_WRITE   50

unsigned long iap_prepare_sector(unsigned long start_sector, unsigned long end_sector)
{
   if (end_sector < start_sector)
      return IAP_STA_INVALD_PARAM;

   param_table[0] = IAP_CMD_PREPARE_SECTORS_FOR_WRITE; 
   param_table[1] = start_sector;
   param_table[2] = end_sector;
   param_table[3] = IAP_CLOCK_KHz;
   iap_entry(param_table, result_table);

   

   return result_table[0];
}

Can anyone please help me explain why is this happening?

Many thanks!

G

Labels (1)
0 Kudos
3 Replies

557 Views
CarlosCasillas
NXP Employee
NXP Employee

Hi G,

 

Confirming with AE team, after double check the UM10114, LPC2294 do have sector 17, it is true and can be operate by IAP or ISP.  If you can't operate the sector 17 by any command, you could try the following:

   1) Check the IAP code is scattered to RAM area, make sure the beginning of RAM (should start@0x4000_0000 to 0x4000_0200) is keep dedicate for ROM API stack.

   2) If item1 isn't working, it seems that it's related to the timing problem explained on Errata (http://www.nxp.com/documents/user_manual/UM10114.pdf) section 3.1.

If this is the case, you could try running the MCU at 12Mhz and then test IAP prepare sector 17.

 
Hope this will be useful for you.
Best regards!
/Carlos
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

557 Views
gtrevi
Contributor I

Hello Carlos,

thank you for these useful tips!!

I'm not sure to have correctly understood your point 1: actually, here below is the memory configuration of my linker script (LPC2294 has 16K of RAM):

MEMORY
{
      FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x0003EFFF
      RAM (rwx) : ORIGIN = 0x40000000, LENGTH = 0x00004000
}

SVC_STACK_SIZE = 0x400;
IRQ_STACK_SIZE = 0x100;
FIQ_STACK_SIZE = 0x10;
ABT_STACK_SIZE = 0x10;
UND_STACK_SIZE = 0x10;

Nothing else runs but the "main" function, which does at most 2 nested calls to some IAP function wrappers (about 64 bytes each in the call stack).

Again EVERYTHING works perfectly, *except* when sector 17 becomes a parameter of the IAP #50 function.

What exactly should I check/do?

Thank you and sorry for my misunderstanding.

Best regards!

G

0 Kudos

557 Views
CarlosCasillas
NXP Employee
NXP Employee

Hi G,

Did you get my last email on your case number 00105410?

Best regards!

/Carlos

0 Kudos