inconsistent 'LOCKUP' reset when programming Flash Memory

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

inconsistent 'LOCKUP' reset when programming Flash Memory

816 Views
donweier
Contributor II

Hi everyone,

 

I'm using a MKL02Z32VFK4 in IAR embedded workbench.

 

I'm having some trouble with non-volatile memory. My project requires that I remember calibration values after a power cycle or a reset, so I am programming them into flash. The problem is, in programming the values to flash, I frequently, but without much pattern, cause a reset to occur to the ARM core. When this happens, the 'LOCKUP' bit in the RCM_SRS1 register is set.

 

There are some things that make this more likely to occur, but do not guarantee the error by any means. It is more likely that this will happen if I write in rapid succession, or if I have already written successfully a number of times since power was applied.

 

I used the provided code in the kinetis sample projects, and am erasing a block before programming it. I have attached the source code in case it helps.

 

Based on the values in memory when this reset is triggered, it does not seem to always occur specifically on the write or on the erase. I can tell this is the case because previously written values are sometimes intact after the reset, and at other times are erased. This indicates to me that the reset issue is not related to writing or erasing specifically, but simply issuing a flash command.

 

Is this a known bug? Or am I missing something else?

 

Thanks for any insight that can be offered.

 

Best,

 

Don

Original Attachment has been moved to: nonVolatileVars.c.zip

Original Attachment has been moved to: flash_FTFL.h.zip

Original Attachment has been moved to: flash_FTFL.c.zip

Labels (1)
0 Kudos
1 Reply

571 Views
mjbcswitzerland
Specialist V

Hi

The usual problem is that interrupts are not blocked when erasing and programming and the processor tries to take an interrupt vector from flash when it is being operated on (this can cause random failure since it depends on when the interrupt takes place).

In case you prefer a complete solution including internal file system and fail-safe parameter system you can get one at the link below.

Regards

Mark

Kinetis for professionals: http://www.utasker.com/kinetis.html
KL02: http://www.utasker.com/kinetis/FRDM-KL02Z.html
Internal file and parameter system: http://www.utasker.com/docs/uTasker/uTaskerFileSystem_3.PDF

0 Kudos