<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>LPC MicrocontrollersのトピックRe: Is there a chance to meet the malfunctioning flash memory?</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/Is-there-a-chance-to-meet-the-malfunctioning-flash-memory/m-p/1843592#M55839</link>
    <description>&lt;P&gt;&lt;FONT color="#0000FF"&gt;&lt;EM&gt;&amp;gt; With the LPC devices I'm not sure that the "erased" state of the flash memory is "0xFF". Actually, the freshly erased page is read as "0x00".&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I just have personal experience with a small range of LPC devices, and those I know use to have 0xFF in erased state. This would be the "default", resulting from the physical implementation of the cell.&lt;BR /&gt;Although I know other devices that return 0x00 in the erased state. One example would be Infineon XC228x MCUs my company uses for some devices. While hardly any vendor reveals details, this would be easily achieved with logical inverters.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT color="#0000FF"&gt;&amp;gt; Especially because it was actually a "fresh" chip, which did not undergo any significant usage, so the flash had no chances to "wear off". Oh, and it is a "lab" sample, so no harsh environments as well.&amp;nbsp;&lt;/FONT&gt;&lt;LI-EMOJI id="lia_slightly-smiling-face" title=":slightly_smiling_face:"&gt;&lt;/LI-EMOJI&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;As mentioned, perhaps it was pre-damaged to an extend that did not become during factory testing (supposing that happens on an individual base ...).&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I would try to write that cell during the "normal" flashing process, i.e. not from IAP code.&lt;BR /&gt;Perhaps by placing constant data at that location in your code, and flash it with a debug pod.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 10 Apr 2024 05:28:49 GMT</pubDate>
    <dc:creator>frank_m</dc:creator>
    <dc:date>2024-04-10T05:28:49Z</dc:date>
    <item>
      <title>Is there a chance to meet the malfunctioning flash memory?</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Is-there-a-chance-to-meet-the-malfunctioning-flash-memory/m-p/1839710#M55807</link>
      <description>&lt;P&gt;Hi, everyone.&lt;/P&gt;&lt;P&gt;Recently, I encountered an issue with the product I'm currently working on. The product uses a piece of the flash memory to store the user's data. It is organized as a very primitive file system, where each "file" uses a page (512 bytes). The MCU is LPC5528 running at clock speed is 96 MHz.&lt;/P&gt;&lt;P&gt;At a certain moment a sample just refused to boot up. The review uncovered, that it was caused by the initialization failure, which comprises the creation of certain "files" and their population with data. More specifically, the "&lt;EM&gt;FLASH_VerifyProgram&lt;/EM&gt;" function returned the code &lt;EM&gt;117&lt;/EM&gt;, which in the user manual is described as "&lt;EM&gt;kStatus_FLASH_CompareError&lt;/EM&gt;" (see "&lt;EM&gt;Chapter 9 - Flash API&lt;/EM&gt;")&lt;/P&gt;&lt;P&gt;The further study pointed to the byte &lt;EM&gt;0x0007B6C2&lt;/EM&gt; to be in charge of the issue. Its expected value was &lt;EM&gt;0x00&lt;/EM&gt; while in fact it was &lt;EM&gt;0x02&lt;/EM&gt;. The sequence used to write data is presented below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;#include &amp;lt;fsl_iap.h&amp;gt;
#include &amp;lt;fsl_iap_ffr.h&amp;gt;

flash_config_t flashInstance;
uint8_t flashBuffer[512];
uint8_t flashCheckBuffer[512];

void flashTest(void)
{
  status_t result;
  uint32_t failedAddress = ~0;
  uint32_t failedData = ~0;

  FLASH_Init(&amp;amp;flashInstance);
  flashInstance.modeConfig.readSingleWord.readWithEccOff = 
    kFLASH_ReadWithEccOff;

  memset(flashBuffer, 0, sizeof flashBuffer);
  memset(flashCheckBuffer, 0, sizeof flashCheckBuffer);

  /* The user's data region occupies the 0x0007B600 - 0x0007FFFF
     region, 18.5 KBytes in total. */
  result = FLASH_Erase(&amp;amp;flashInstance, 0x0007B600, 0x4A00, 
                       kFLASH_ApiEraseKey);
  if (result != kStatus_Success) {
    while(1);
  }
   
  result = FLASH_Program(&amp;amp;flashInstance, 0x0007B600, 
                         flashBuffer, sizeof flashBuffer);
  if (result != kStatus_Success) {
    while(1);
  }

  result = FLASH_VerifyProgram(&amp;amp;flashInstance, 0x0007B600, 
                               sizeof flashBuffer, flashBuffer,
                               &amp;amp;failedAddress, &amp;amp;failedData);
  if (result == kStatus_Success) {
    while(1);
  }

  result = FLASH_Read(&amp;amp;flashInstance, 0x0007B600, 
                      flashCheckBuffer, sizeof flashCheckBuffer);
  if (result != kStatus_Success) {
    while(1);
  }

  for (size_t byte = 0; byte &amp;lt; sizeof flashCheckBuffer; ++byte) {
    if (flashBuffer[byte] != flashCheckBuffer[byte]) {
      // Here the execution stops, because byte 0xC2 is not zero
      while(1);
    }
  }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Above I'm completely erasing the user region and performing a test write to the first page. Despite the fact that the data is just all zeros, the byte &lt;EM&gt;0x0007B6C2&lt;/EM&gt;&amp;nbsp;obtains the &lt;EM&gt;0x02&lt;/EM&gt; value. If I try to put the &lt;EM&gt;0xA0&lt;/EM&gt; value there, the outcome will be &lt;EM&gt;0xA2&lt;/EM&gt;. It feels like a single bit is corrupted and swapped upon every&amp;nbsp;program attempt.&lt;/P&gt;&lt;P&gt;My little questions:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;How common are cases like this? Considering a sample encountered no stresses like overvoltage/overheating, etc.&lt;/LI&gt;&lt;LI&gt;Is it a permanent damage or it can be somehow tweaked by software? (Not likely, I know)&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;If the risk is significant, then more efforts must be put in to guarantee the integrity of the data.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Apr 2024 23:30:01 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Is-there-a-chance-to-meet-the-malfunctioning-flash-memory/m-p/1839710#M55807</guid>
      <dc:creator>GlebPlekhotko</dc:creator>
      <dc:date>2024-04-02T23:30:01Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a chance to meet the malfunctioning flash memory?</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Is-there-a-chance-to-meet-the-malfunctioning-flash-memory/m-p/1843190#M55834</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/221417"&gt;@GlebPlekhotko&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;All of your chips have this problem? Or just one?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;Alice&lt;/P&gt;</description>
      <pubDate>Tue, 09 Apr 2024 13:10:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Is-there-a-chance-to-meet-the-malfunctioning-flash-memory/m-p/1843190#M55834</guid>
      <dc:creator>Alice_Yang</dc:creator>
      <dc:date>2024-04-09T13:10:13Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a chance to meet the malfunctioning flash memory?</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Is-there-a-chance-to-meet-the-malfunctioning-flash-memory/m-p/1843199#M55835</link>
      <description>&lt;P&gt;&lt;EM&gt;&lt;FONT color="#0000FF"&gt;&amp;gt; The further study pointed to the byte&amp;nbsp;0x0007B6C2&amp;nbsp;to be in charge of the issue. Its expected value was&amp;nbsp;0x00&amp;nbsp;while in fact it was&amp;nbsp;0x02.&lt;/FONT&gt;&lt;BR /&gt;...&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&lt;SPAN&gt;&amp;gt; Despite the fact that the data is just all zeros, the byte&amp;nbsp;&lt;/SPAN&gt;0x0007B6C2&lt;SPAN&gt;&amp;nbsp;obtains the&amp;nbsp;&lt;/SPAN&gt;0x02&lt;SPAN&gt;&amp;nbsp;value. If I try to put the&amp;nbsp;&lt;/SPAN&gt;0xA0&lt;SPAN&gt;&amp;nbsp;value there, the outcome will be&amp;nbsp;&lt;/SPAN&gt;0xA2.&lt;/FONT&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;This seems to indicate that one bit in one Flash cell is damaged.&lt;BR /&gt;Take into account that the equilibrum state of Flash cells ("unprogrammed") is 1, i.e. 0xFF per byte. It seems the cell / gate cannot hold the programmed charge anymore.&lt;BR /&gt;The working principle of Flash is, you tunnel electrons via a higher voltage into a floating gate of a MOSFET, until the MOSFET safely switches through. High-energy radiation (Alpha, UV) can discharge it. The process of erasing/programming slowly destroys the isolation via electro-migration, which often takes millions of cycles... unless the cell was pre-damaged.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;I once had a similiar issue with Cortex M3 devices from a different manufacturers. One out of 5 prototypes consistently reported a correctable Flash ECC error after IAP programming. Which means, it was detected and corrected through the integral ECC.&lt;BR /&gt;With thousands of such devices in the field now, I never heard of any issue relating to this problem.&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Apr 2024 13:31:01 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Is-there-a-chance-to-meet-the-malfunctioning-flash-memory/m-p/1843199#M55835</guid>
      <dc:creator>frank_m</dc:creator>
      <dc:date>2024-04-09T13:31:01Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a chance to meet the malfunctioning flash memory?</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Is-there-a-chance-to-meet-the-malfunctioning-flash-memory/m-p/1843291#M55837</link>
      <description>&lt;P&gt;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/27788"&gt;@Alice_Yang&lt;/a&gt;, currently it is just a single encounter. But I am just a developer, so there are not many samples in my possession. I'm quite sure this is not a ubiquitous case, but still an interesting observation. Especially because it was actually a "fresh" chip, which did not undergo any significant usage, so the flash had no chances to "wear off". Oh, and it is a "lab" sample, so no harsh environments as well. &lt;LI-EMOJI id="lia_slightly-smiling-face" title=":slightly_smiling_face:"&gt;&lt;/LI-EMOJI&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/137574"&gt;@frank_m&lt;/a&gt;, thank you for sharing your experience. With the LPC devices I'm not sure that the "erased" state of the flash memory is "0xFF". Actually, the freshly erased page is read as "0x00". Though, the API reports the ECC error in this case. Usually I just ignore or turn this option off. Maybe these "zeros" are issues by the code managing the flash memory, it is not clear.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyway, the goal of my note was to mention, that there is chance to meet this case, so someone same unlucky as me may found a testimony of his idea when surfing the Web in search for recipe to work it out. &lt;LI-EMOJI id="lia_slightly-smiling-face" title=":slightly_smiling_face:"&gt;&lt;/LI-EMOJI&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Apr 2024 16:22:59 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Is-there-a-chance-to-meet-the-malfunctioning-flash-memory/m-p/1843291#M55837</guid>
      <dc:creator>GlebPlekhotko</dc:creator>
      <dc:date>2024-04-09T16:22:59Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a chance to meet the malfunctioning flash memory?</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Is-there-a-chance-to-meet-the-malfunctioning-flash-memory/m-p/1843592#M55839</link>
      <description>&lt;P&gt;&lt;FONT color="#0000FF"&gt;&lt;EM&gt;&amp;gt; With the LPC devices I'm not sure that the "erased" state of the flash memory is "0xFF". Actually, the freshly erased page is read as "0x00".&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I just have personal experience with a small range of LPC devices, and those I know use to have 0xFF in erased state. This would be the "default", resulting from the physical implementation of the cell.&lt;BR /&gt;Although I know other devices that return 0x00 in the erased state. One example would be Infineon XC228x MCUs my company uses for some devices. While hardly any vendor reveals details, this would be easily achieved with logical inverters.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT color="#0000FF"&gt;&amp;gt; Especially because it was actually a "fresh" chip, which did not undergo any significant usage, so the flash had no chances to "wear off". Oh, and it is a "lab" sample, so no harsh environments as well.&amp;nbsp;&lt;/FONT&gt;&lt;LI-EMOJI id="lia_slightly-smiling-face" title=":slightly_smiling_face:"&gt;&lt;/LI-EMOJI&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;As mentioned, perhaps it was pre-damaged to an extend that did not become during factory testing (supposing that happens on an individual base ...).&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I would try to write that cell during the "normal" flashing process, i.e. not from IAP code.&lt;BR /&gt;Perhaps by placing constant data at that location in your code, and flash it with a debug pod.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Apr 2024 05:28:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Is-there-a-chance-to-meet-the-malfunctioning-flash-memory/m-p/1843592#M55839</guid>
      <dc:creator>frank_m</dc:creator>
      <dc:date>2024-04-10T05:28:49Z</dc:date>
    </item>
  </channel>
</rss>

