1768 IAP - erase sectors returns success but does not erase sector

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

1768 IAP - erase sectors returns success but does not erase sector

932 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by david.harper on Thu Jul 31 11:51:36 MST 2014
I'm using IAP functions to write flash on a 1768.

The IAP_CMD_ERASE_SECTORS command is indicating successful completion (IAP_STA_CMD_SUCCESS) but the flash contents are not being erased. If I use the Keil uVision download functionality I can erase the sector so I don't think it's a hardware problem. A subsequent write to the erased sector works fine.

Any ideas?
Labels (1)
0 Kudos
11 Replies

851 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by david.harper on Fri Aug 01 18:12:42 MST 2014
I'll check this. I haven't done anything special with the stacks but I don't know where RTX places them.

Thanks for the suggestion.
0 Kudos

851 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by LabRat on Fri Aug 01 18:07:31 MST 2014
Stack Offset?

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

0 Kudos

851 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by david.harper on Fri Aug 01 17:50:42 MST 2014
I think so. My scatter file has the code executing the iap routines low in RAM (10000000h-10008000h).
0 Kudos

851 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by LabRat on Fri Aug 01 17:43:32 MST 2014

Quote: david.harper
Any ideas?



Reserved 32 bytes of space in the top portion of the on-chip RAM for execution?
0 Kudos

851 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by david.harper on Fri Aug 01 17:35:58 MST 2014
Believe so.

__disable_irq();

__enable_irq();

encapsulate the call to the iap entry point.
0 Kudos

851 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by david.harper on Fri Aug 01 17:35:55 MST 2014
Believe so.

__disable_irq();

__enable_irq();

encapsulate the call to the iap entry point.
0 Kudos

851 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by LabRat on Fri Aug 01 17:32:23 MST 2014

Quote: david.harper
Any ideas?



Interrupts disabled?
0 Kudos

851 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by david.harper on Fri Aug 01 16:57:30 MST 2014
I believe my 1768 is running at 100MHz. My frequency parameter is set to (100*1000UL).
0 Kudos

851 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mc on Fri Aug 01 16:53:14 MST 2014
Hi David,
Can you please check the frequency parameter in your code? This parameter should be equal to SystemFrequency/1000.
0 Kudos

851 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by david.harper on Fri Aug 01 16:35:39 MST 2014
Did not try the bootloader example directly - my scenario is a bit different - but the flash related code is very similar. I've looked at all of the examples of flash programming code I can find - not much variation and all similar/equivalent to mine.

I "know" the erase isn't working by checking the flash contents at the page I'm trying to program. I look at it before erase, after erase, and after writing. When I do the erase, the contents are unchanged. When I have the Keil tool do the erase, I see 0xff as expected and I see my write modify the bytes as expected.

I don't dump the entire flash space so I could be erasing a different sector than I think I am - that would be a surprise since I've checked the sector value, it seems correct, and I'm using the same sector number for the write which is showing up where I expect it to show up.

I guess a next step could be to do a diff on the entire flash address space.
0 Kudos

851 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mc on Fri Aug 01 16:07:55 MST 2014
Hi david,
Could you please provide detail information? Did you try below secondary bootloader example?
http://www.lpcware.com/content/nxpfile/an10866-lpc1700-secondary-usb-bootloader
How do you know that sector is not erased?
0 Kudos