We've got a project that was originally based on the MK22FN1M0AVLK12, but that we've backed out to the MK21DN512VLK5 because that was the only socket-compatible device we could find in inventory anywhere. The MCUXpresso toolkit only has an SDK for the MK21DN512AVLK5 (not the MK21DN512VLK5), so we rebuilt the project with that SDK, and after some debugging got it running properly.
On our first production build, we've discovered that about 10% of the units are unable to write the flash memory under program control (we can load the program to flash just fine via JTAG). When we step through the code on a failing unit, we see the calls to FLASH_Erase() and FLASH_Program() both returning kStatus_FLASH_Success, but examining the written sector (either via the emulator or program read) shows all FF's - no write occurred.
Note that on 90% of the units, we are able to reliably and repeatably write the flash - we've never observed a failure.
A review of the data sheet did not reveal any sector-locking features, or at least if they're in there I did not see them. Is there any configuration of the device that can inhibit write?
BTW - We checked the power supply - solid, clean 3.3V with plenty of bypass caps close to the device.
Any suggestions of where to look next would be welcome!
I checked errata and there do not appear to be any relevant issues. I can reliably reflash the part via MCUXpresso and the JTAG port - it is only writing by the program that fails.
Parts that fail and parts that work have the same mask level and date code. Parts that fail do so consistently - I've never seen the board I'm testing on working properly, though I have not done extensive testing on the ones that do work to see if they occasionally fail. Feedback from the fielded units suggest that they are consistently working reliably.
Please check if there is no any errata that affects the mask set that you are using
also you can try to reprogram the parts, what happed, are you able to reprogram the failed part?
All the failed part are from the same batch, those have the same body mark