IAP example works, but a copy of the project always hard faults.

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

IAP example works, but a copy of the project always hard faults.

1,133 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by MX21 on Tue Oct 14 17:09:39 MST 2014
I'm using LPCXpresso 7.1.1_125. 
If I run the periph_flashiap example, it works and is able to erase and program sector 14.
I copied the project to a new directory and imported it.
When I run the new project (same exact code), it hangs in the Chip_IAP_EraseSector function.  If I break, it looks like it's in some sort of hard fault handler (assembly).

The projects are identical, other than the name.  How can this affect IAP???

Labels (1)
0 Kudos
13 Replies

936 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by LabRat on Tue Oct 14 21:54:14 MST 2014

Quote: MX21
The projects are identical...



Really ?

http://www.lpcware.com/content/faq/lpcxpresso/reserving-ram-iap
0 Kudos

936 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by MX21 on Thu Oct 16 13:03:04 MST 2014
The iap_init returns result[0] = 0x1A000BC3.  There is no result code of 0xC3. 

But if I let that pass, it now seems to erase and program ok with the Z1 project (thanks!), although it hard faults when it calls Chip_FMC_ComputeSignatureBlocks.  I can probably live without FMC, but I'd like to know why it hard faults.

Also, the iap_18xx_43xx.h file contains no command definition for IAP Init, nor a function prototype.  Was this left out for some reason?

I don't know why the example works without the iap_init, but an identical copy of the project does not work.
0 Kudos

936 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mc on Thu Oct 16 12:08:00 MST 2014
Hi MX21,
I looked your code and did not see IAP init code. Looks like it is not there in LPCOpen example.
Can you please also add below IAP init code in your project?

[color=#00f]uint8_t Chip_IAP_init(void)
{
uint32_t command[5], result[4];
command[0] = 49;
iap_entry(command, result);
return result[0];
}[/color]

int main(void)
{
int i=0;
uint8_t ret_code;

SystemCoreClockUpdate();
Board_Init();

[color=#00f]__disable_irq();
ret_code = Chip_IAP_init();
/* Error checking */
if (ret_code != IAP_CMD_SUCCESS) {
DEBUGOUT("Command failed to execute, return code is: %x\r\n", ret_code);
}[/color]
....
....
....

/* Re-enable interrupt mode */
__enable_irq();


0 Kudos

936 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by MX21 on Thu Oct 16 11:38:42 MST 2014
I don't know what happened to your last reply, it just disappeared while I was typing a response.

Power to the board is obviously good, since the periph_flashiap project always works.
0 Kudos

936 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by MX21 on Thu Oct 16 10:45:20 MST 2014
What board are you using?

I tried again.  The periph_flashiap project works every time.  The copied project always hangs at the erase function.
0 Kudos

936 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Thu Oct 16 10:05:37 MST 2014
I tried your project on my board, and it works OK.
0 Kudos

936 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by MX21 on Thu Oct 16 09:53:20 MST 2014
LPC1857 on a Hitex LPC1850EVA. 

It's all in the project:
   MCU is set to LPC1857
   Include path has "lpc_board_hitex_eva_1850/inc"
   Linker library has "lpc_board_hitex_eva_1850"
0 Kudos

936 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Thu Oct 16 03:17:21 MST 2014
What is your target? Which board and which LPC?
0 Kudos

936 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by MX21 on Wed Oct 15 12:48:20 MST 2014
Project Z1 attached.
0 Kudos

936 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by TheFallGuy on Wed Oct 15 12:32:00 MST 2014
Post the non working project, so we can see what is wrong with the project settings.
0 Kudos

936 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by MX21 on Wed Oct 15 11:09:21 MST 2014
lpcopen_2_12_lpcxpresso_hitex_eva_1850
0 Kudos

936 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mc on Wed Oct 15 10:02:44 MST 2014
Hi MX21,
Which code base  are you using?  Are you using LOPCopen version 2.12?
0 Kudos

936 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by MX21 on Wed Oct 15 09:58:07 MST 2014
Really, really.

Copied all the files from periph_flashiap, changed the name, and re-imported.

The example periph_flashiap project does not reserve the top 32 bytes and it works.
I tried it with and without the reserved bytes for my copy of the project and it doesn't work.
0 Kudos