AnsweredAssumed Answered

inconsistent 'LOCKUP' reset when programming Flash Memory

Question asked by Don Weier on Nov 22, 2016

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

Outcomes