IAP not to work?

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

IAP not to work?

1,587 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by LeonCorleone on Sat Feb 07 11:13:22 MST 2015
Hello all
I don't know what to do with this big problem.
If you can please help me.I takes me too much.   :(
I want to write some data from Sram into flash by IAP. Actually I don't know why IAP doesn't work in debug mode of Keil?In debug it doesn't write anything into flash.
my code is the same as below.
thanks. :)

#include <lpc17xx.h>//lpc17xx.h
#include <absacc.h>/absacc.h

unsigned char IAP_Write(unsigned char *string);
unsigned char a[5] __at(0x10000200);

#define IAP_ADDRESS  0x1FFF1FF1
unsigned int command[5];
unsigned int result[5];
typedef unsigned int (*IAP)(unsigned int[], unsigned int[]);
static const IAP iap_entry = (IAP) IAP_ADDRESS;

int main(void)
{
unsigned char i=0;

for(i=0;i<5;i++)
a=i;
IAP_Write(a);
}
unsigned char IAP_Write(unsigned char *string)
{
command[0]=50;
command[1]=8;  //Start sector number is 8
command[2]=8;  //Finish sector number is 8
  iap_entry(command,result);
if(result[0]!=0)
{
return 0;
}
command[0]=51;
command[1]=0x00008100;  //Addrees of Flash
command[2]=0x10000200;  //Addrees of Sram
command[3]=256;  //How many bytes want to transfer
command[4]=12000;  //Frequency in khz
iap_entry(command,result);
if(result[0]!=0)
{
return 0;
}
else
{
return 1;
}
}
Labels (1)
0 Kudos
Reply
10 Replies

1,497 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by LeonCorleone on Mon Feb 16 23:52:37 MST 2015
Hi xianghuiwang.
You have told me to reference to LPCOpen IAP sample. But I couldn't find the project for IAP.:(
Could you help me about it,please?
Thanks
0 Kudos
Reply

1,497 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by xianghuiwang on Mon Feb 09 15:45:58 MST 2015
Hi, R2D2,

If you are using LPC1759/69, just set FLASHTIM based on its UM requirement.
Sorry previous information is for LPC177x/8x - should not have assumed.
regards,
0 Kudos
Reply

1,497 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Mon Feb 09 15:40:54 MST 2015

Quote: xianghuiwang
Hi,

please reference LPCOpen IAP sample project.
http://www.lpcware.com/content/nxpfile/lpcopen-software-development-platform-lpc17xx-packages

If the CPU is operating at 60MHz and above, please make sure ROM_LAT in register MATRIXARB is set to 1. If the CPU is operating at 120MHz, please make sure BOOST bits in register PBOOST is set to 3 and FLASHTIM is set to 5 in register FLASHCFG.

regards,



:~

Are we talking about LPC177x/8x here  :quest:
0 Kudos
Reply

1,499 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by xianghuiwang on Mon Feb 09 14:50:01 MST 2015
Hi,

please reference LPCOpen IAP sample project.
http://www.lpcware.com/content/nxpfile/lpcopen-software-development-platform-lpc17xx-packages

If the CPU is operating at 60MHz and above, please make sure ROM_LAT in register MATRIXARB is set to 1. If the CPU is operating at 120MHz, please make sure BOOST bits in register PBOOST is set to 3 and FLASHTIM is set to 5 in register FLASHCFG.

regards,
0 Kudos
Reply

1,499 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Sun Feb 08 03:15:32 MST 2015
As mentioned already above it's a good idea to start with 'simple' IAP functions ('Read serial number = IAP58) to test your IAP function.
Flash functions are more dangerous because RAM (top 32 bytes) has to be reserved and interrupts have to be disabled...
0 Kudos
Reply

1,499 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by LeonCorleone on Sun Feb 08 01:43:23 MST 2015
Hi capiman.
Thanks to answer for my problem.
Yes I think IAP routine is read but it doesn't work and result[0] always returns 0.
Actually I have not tested in release mode. but I think it also doesn't work .
Thanks again.
0 Kudos
Reply

1,499 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by LeonCorleone on Sun Feb 08 01:39:00 MST 2015
Thanks R2D2
Yes the data in Sram is O.K, but I think IAP function is read but doesn't work,
I have another question of you , I want to ask my question online if it's alright ,sorry when are you usually Online?
Thanks again.
0 Kudos
Reply

1,499 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Sat Feb 07 12:48:18 MST 2015
BTW: There's a Keil sample for IAP  :)

http://www.nxp.com/documents/application_note/AN11071.zip
0 Kudos
Reply

1,499 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by capiman on Sat Feb 07 12:42:48 MST 2015
Have you checked if your function return 0 or 1?
Have you checked if one of the IAP functions failed?
If one failed, what result[0] is reported?
You are talking about "debug mode". Is it working in release mode?
0 Kudos
Reply

1,499 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Sat Feb 07 12:41:39 MST 2015
Did you check your data in RAM, did you check correct pointer settings before IAP functions are called and did you erase sector 8 before :quest:

Start with reading the Serial number to confirm that IAP is working, then prepare / erase / blank check your sector before you write...

(BTW: Please use Code tags...)
0 Kudos
Reply