IAP in lpc1768

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

IAP in lpc1768

1,314 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by dariush_abbasi868 on Sat Aug 23 23:42:28 MST 2014
Hello,
I am going to write in lpc1768 by iap by IAR COMPILER.
But when I use erase function it return OK and I want to see  sector by flash magic and it is not erased !!
Labels (1)
0 Kudos
12 Replies

648 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by LabRat on Wed Aug 27 04:36:03 MST 2014

Quote: dariush_abbasi868

Quote:
Did you reserve RAM for IAP Flash Programming?


can you help me , what exactly i have to do for this ?



Sorry, I don't use IAR... It's described for LPCXpresso here:

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


Quote: dariush_abbasi868

Quote:
Did you disable all interrupts?


I do it by __disable_irq(); and __enable_irq();
is it ok?


Yes  :)
0 Kudos

648 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by dariush_abbasi868 on Tue Sep 16 22:13:17 MST 2014



[img=220x150]http://i59.tinypic.com/2d8nu5v.jpg[/img]


[img=50x70]http://http://i62.tinypic.com/2r5u8h0.jpg[/img]

[img=220x150]http://i62.tinypic.com/122292b.jpg[/img]


I want to be my application firmware in sector 10 (0xa000) what I HAVE TO DO FOR VECTORES?
0 Kudos

648 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by dariush_abbasi868 on Wed Sep 10 04:12:29 MST 2014
I saw that. but I can not do it!
pls help me how I can jump to an address in program ?
0 Kudos

648 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by LabRat on Tue Sep 09 20:59:23 MST 2014
AN 10866 is showing how a bootloader is working:

http://www.lpcware.com/content/nxpfile/an10866-lpc1700-secondary-usb-bootloader
0 Kudos

648 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by dariush_abbasi868 on Tue Sep 09 20:44:19 MST 2014
Now I want to write my hex file by myself to the sctores,
which sectores I have to write in it,
I wan to upgrade my firmware without flash magic but like it .
my new hex file will be send from a gprs port and receive in lpc1768 and replace the old.
can I set the adders for satart program ??
0 Kudos

648 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by dariush_abbasi868 on Mon Sep 01 21:35:14 MST 2014
thanks a lot   DF9DQ
0 Kudos

648 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by DF9DQ on Mon Sep 01 00:03:20 MST 2014
A return value of 9 means the sector is unprepared for erase/program.

You don't show us what value you are passing to the IAP call in the "command" structure, but it looks like you are using a wrong address in flash, so you have prepared a different sector (20)! Sector 20 is at flash offset 0x30000, and I can't find that value in the code you posted.

P.S.: This #define assumes all sectors are 4K, but sectors 16 and above are 32K!
#define CONFIG_FLASH_SECTOR (CONFIG_FLASH_OFFSET >> 12)
0 Kudos

648 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by dariush_abbasi868 on Sat Aug 30 20:37:32 MST 2014
Hi LabRat
I want to write in flash memory from ram .
I want to use it to upgrade my firmware by my own commands ,
I can not find Stack Offset field that you told , in IAR  would any one help?
erase is ok.
but the function iap_copy_ram_to_flash(&demo,(char *)CONFIG_FASH_OFFSET, 256); return 9 and dosn't work.
0 Kudos

648 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by dariush_abbasi868 on Tue Aug 26 21:51:19 MST 2014
thank you LabRat,

Quote:
Did you reserve RAM for IAP Flash Programming?


can you help me , what exactly i have to do for this ?



Quote:
Did you disable all interrupts?



I do it by __disable_irq(); and __enable_irq();
is it ok?
0 Kudos

648 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by LabRat on Tue Aug 26 20:52:04 MST 2014
Did you reserve RAM for IAP Flash Programming?

Did you disable all interrupts?
0 Kudos

648 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by dariush_abbasi868 on Tue Aug 26 20:39:34 MST 2014
thank you sir,
It is OK,
Now I can erase any sector
but when I want to write anything in this sector is not ok and it return 9 ;
and some times it is in hank !
this is my code:

  txt_len=iap_prepare( TARGET_SECTOR, (TARGET_SECTOR));
      txt_len=iap_erase_sector( TARGET_SECTOR, TARGET_SECTOR);
      txt_len=iap_prepare( TARGET_SECTOR, TARGET_SECTOR);
       txt_len=iap_copy_ram_to_flash(&demo,(char *)CONFIG_FASH_OFFSET, 256);

that :
/* Flash offset where the configuration is stored */
#define CONFIG_FASH_OFFSET    0x1000
#define CONFIG_FLASH_SECTOR            (CONFIG_FLASH_OFFSET >> 12)
#define CONFIG_FLASH_SECTOR_SIZE    1
#define     TARGET_SECTOR  20
  unsigned char demo[]="     dariush abbasi   pw co    ";


0 Kudos

648 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mc on Mon Aug 25 11:50:34 MST 2014
Hi Dariush,
In IAP commands you are required to pass frequency parameter. Please note that that parameter should be SystemFrequency/1000.
0 Kudos