Flash Write on LPC1114/333 causing hang

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

Flash Write on LPC1114/333 causing hang

626 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by george.thaliath on Fri May 09 01:09:01 MST 2014
Hi all,
I have been trying to write data to the flash memeory sector 13 to 13(0xD000) using IAP funtions provided by NXP.
But while trying to do so, on multiple wirttes the microcontroller hangs.

I have a uart running on interupt which is disabled while a flash write occours.

The other thing that has been happening is, it not nessasarley hang strait, but probabaley after 20 writes at a gap of 35 seconds between them.
The other main thing is when it hangs, it looks like the flash is getting corrupted as the data that was stored in the memory is lost.

It would be greateley appreciated if some  could suggest, why or what could cause this.

I am eracing and preparing the sector before  a write is operated.

Looking forward to hearing from you guys soon.
Regards
George

Labels (1)
0 Kudos
9 Replies

577 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by nxp_apps on Fri May 16 16:50:43 MST 2014
Hi,

As mentioned by other members, interrupts must be disabled.

Maybe using a secondary bootloader would help?
Please see app note below.

http://www.nxp.com/documents/application_note/AN10995.pdf

Thanks.

nxp_support
0 Kudos

577 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by george.thaliath on Mon May 12 19:27:11 MST 2014
Hi dave,
Thanks for that information.
I shall have a crack at it.

will let you know how we go.
Regards
George
0 Kudos

577 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mubes on Mon May 12 00:52:18 MST 2014

Quote: george.thaliath

It could not possibly be power as the system is always turned On and the power on board was design for lot more modules to be attached. So we are looking at a buffer of about 300mA more avilable.



George,

How many times has a problem of mine turned out to be something it 'could not possibly be'?  :bigsmile:

I would start off by disabling all interrupts for the duration of the flash write (__disable()) as, IIRC, that is a reccomendation, and certainly the flash writing process has time criticalities in it which you don't want to disturb.

I would then look at the power with a scope at the point at which the write is comitted (e.g. set a pin just before you enter the flashwrite routine and use that to trigger a scope to look at the power at that time) and look for droops or noise....are you doing anything that is corrolated with the flash which is power-affecting (e.g. turning on a LED, changing the state of a perhiperal etc.?).  On the 812's you certainly _can_ run from flash while flashing a different area of the chip, but it is worth checking the manual carefully to ensure that this is acceptable on the chip you're using.

Good luck, and please post your findings so we can all learn.

DAVE
0 Kudos

577 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Sun May 11 15:18:18 MST 2014
Could be useful if you reduce your project to the flash problem and post it...
0 Kudos

577 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by george.thaliath on Sun May 11 15:07:38 MST 2014
Hi,
I believe I have the code in on chip fllash which is address 0x0000 to 0xC000.

I am writting data into SRAM sector 13(0xD000 to 0xDFFF).

Regards
George
0 Kudos

577 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by TheFallGuy on Sat May 10 01:47:05 MST 2014
Are you running from RAM?
0 Kudos

577 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by george.thaliath on Fri May 09 18:05:02 MST 2014
Hi all,
I been trying to dissable the interupts that I know which are
ADC/system interrupt and UART

the system still hangs or gets a flash corruption.

what else could possibly effect flash write.
I have set the Offset on the stack to 32 and also enabled flash read protect.
0 Kudos

577 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by george.thaliath on Fri May 09 15:43:41 MST 2014
Thanks Dave,

I will look into the interrupt in the system.
It could not possibly be power as the system is always turned On and the power on board was design for lot more modules to be attached. So we are looking at a buffer of about 300mA more avilable.

Thanks all the inforamtion, much appreciated.

Regards
George
0 Kudos

577 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mubes on Fri May 09 02:23:27 MST 2014
I had not dissimilar problems on a LPC812 where I was using the flash for log storage that might be relevant. If a flash write fails mid cycle (e.g. On power fail) then my hypothesis is that the ECC bits aren't getting updated and the ROMMed flash write routines lose their marbles.

In my case the fix was to enable the BOD 'warning' level to set a flag, then don't embark on a flash update if that flag is set....the logic being that the decoupling on the board should give you enough 'runway' to complete a write if the BOD isn't already active...obviously you'll need to clear that flag at some point too!

Other things to check are that your power supplies are good (flash takes a fair bit of juice) and switch off all interrupts (__disable()) while you're calling the rom routine.

Good luck.

Dave
0 Kudos