<?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>Kinetis MicrocontrollersのトピックRe: problem erasing MK02FN128VLF10 flash with program calls to flash driver</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/problem-erasing-MK02FN128VLF10-flash-with-program-calls-to-flash/m-p/702070#M43145</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;A little more information about the command sequence of code, being run from ram.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1: I am using assembly code breakpoints. &amp;nbsp;If I place (1)&amp;nbsp;BP&amp;nbsp;anywhere in the while loop assembly code, ONLY required before the sector erase command, &amp;nbsp;and then let it run freely to write and read. &amp;nbsp;It works. &amp;nbsp;That is the only way it works at this point&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;DIV style="color: #000000; border: 0px; font-size: 12px;"&gt;&lt;DIV style="color: #000000; border: 0px; font-size: 12px; padding: 0px;"&gt;void flash_run_command(FTFx_REG_ACCESS_TYPE ftfx_fstat)&lt;/DIV&gt;&lt;DIV style="color: #000000; border: 0px; font-size: 12px; padding: 0px;"&gt;{&lt;/DIV&gt;&lt;DIV style="color: #000000; border: 0px; font-size: 12px; padding: 0px;"&gt; &lt;/DIV&gt;&lt;DIV style="color: #000000; border: 0px; font-size: 12px; padding: 0px;"&gt;&amp;nbsp; &amp;nbsp; /* clear CCIF bit */&lt;/DIV&gt;&lt;DIV style="color: #000000; border: 0px; font-size: 12px; padding: 0px;"&gt;&amp;nbsp; &amp;nbsp; *ftfx_fstat = FTFx_FSTAT_CCIF_MASK;&lt;/DIV&gt;&lt;DIV style="color: #000000; border: 0px; font-size: 12px; padding: 0px;"&gt; &lt;/DIV&gt;&lt;DIV style="color: #000000; border: 0px; font-size: 12px; padding: 0px;"&gt;&amp;nbsp; &amp;nbsp; /* Check CCIF bit of the flash status register, wait till it is set. &amp;nbsp; I PLACE BP anywhere is this section of Assy code*/&lt;/DIV&gt;&lt;DIV style="color: #000000; border: 0px; font-size: 12px; padding: 0px;"&gt;&amp;nbsp; &amp;nbsp;while (!((*ftfx_fstat) &amp;amp; FTFx_FSTAT_CCIF_MASK)){ }&lt;/DIV&gt;&lt;DIV style="color: #000000; border: 0px; font-size: 12px; padding: 0px;"&gt; &lt;/DIV&gt;&lt;DIV style="color: #000000; border: 0px; font-size: 12px; padding: 0px;"&gt;}&lt;/DIV&gt;&lt;DIV style="color: #000000; border: 0px; font-size: 12px; padding: 0px;"&gt; &lt;/DIV&gt;&lt;DIV style="color: #000000; border: 0px; font-size: 12px; padding: 0px;"&gt; &lt;/DIV&gt;&lt;DIV style="color: #000000; border: 0px; font-size: 12px; padding: 0px;"&gt;Note: &amp;nbsp;&lt;/DIV&gt;&lt;DIV style="color: #000000; border: 0px; font-size: 12px; padding: 0px;"&gt;1: WDOGEN is 0, watchdog is disabled.&lt;/DIV&gt;&lt;DIV style="color: #000000; border: 0px; font-size: 12px; padding: 0px;"&gt;2: I have tried various sectors throughout free flash where program does not reside.&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 11 Oct 2017 15:38:53 GMT</pubDate>
    <dc:creator>Ed_McM</dc:creator>
    <dc:date>2017-10-11T15:38:53Z</dc:date>
    <item>
      <title>problem erasing MK02FN128VLF10 flash with program calls to flash driver</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/problem-erasing-MK02FN128VLF10-flash-with-program-calls-to-flash/m-p/702069#M43144</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV style="color: #000000; font-size: 12px;"&gt;Hello,&lt;/DIV&gt;&lt;DIV style="color: #000000; font-size: 12px;"&gt; &lt;/DIV&gt;&lt;DIV style="color: #000000; font-size: 12px;"&gt;I’m having a problem erasing MK02FN128VLF10 flash, using Flash driver calls from within our program . &amp;nbsp;Our board design is loosely based on the FRDM K22 board. &amp;nbsp;The part on our board is clocked with internal IRC48M clock. &amp;nbsp;The SDK used for the starting point of our software was built with NXP SDK builder configured for MK02FN128xxx10.&amp;nbsp;&lt;/DIV&gt;&lt;DIV style="color: #000000; font-size: 12px;"&gt; &lt;/DIV&gt;&lt;DIV style="color: #000000; font-size: 12px;"&gt;The design works fine overall, &amp;nbsp;wejust ran into a problem when trying to use Flash to save “user setting”, between power downs. &amp;nbsp;I started the Flash access effort, &amp;nbsp;using the example in the SDK “flash_erase_program_verify”. (see attached C file)&lt;/DIV&gt;&lt;DIV style="color: #000000; font-size: 12px;"&gt; &lt;/DIV&gt;&lt;DIV style="color: #000000; font-size: 12px;"&gt;The MK02 has 128M of Flash, in 1 block with 2K sectors. &amp;nbsp;Given the fact that Flash is one block, the section of code that sends flash command and waits for completion, has to be run from ram. &amp;nbsp;&lt;/DIV&gt;&lt;DIV style="color: #000000; font-size: 12px;"&gt; &lt;/DIV&gt;&lt;DIV style="color: #000000; font-size: 12px;"&gt;I have verified that the correct section of Flash code is copied into the correct section of Ram. &amp;nbsp;Using the debugger, I am able to verify that the code runs as expected from Ram. &amp;nbsp;I can verify that the last sector in Flash is erased, and then that it is written with the correct 4 bytes.&amp;nbsp;&lt;/DIV&gt;&lt;DIV style="color: #000000; font-size: 12px;"&gt; &lt;/DIV&gt;&lt;DIV style="color: #000000; font-size: 12px;"&gt;The problem is that I can only get the code to run successfully if I put a single breakpoint in the ram code, between the code to send the command and the code to wait for it to complete. &amp;nbsp;I place the breakpoint there and run the the erase command. &amp;nbsp;Then I remove it for all the other Read / Write commands. &amp;nbsp;It works fine and I can verify such in memory view.&lt;/DIV&gt;&lt;DIV style="color: #000000; font-size: 12px;"&gt;When Running it without the break point there, and just letting it run, it doesn’t work. &amp;nbsp;I get a reset once the code is sent. &amp;nbsp;I’m not sure of the actual error that causes reset.&lt;/DIV&gt;&lt;DIV style="color: #000000; font-size: 12px;"&gt; &lt;/DIV&gt;&lt;DIV style="color: #000000; font-size: 12px;"&gt;Any thoughts on what the problem may be or where I should look for hints?&lt;/DIV&gt;&lt;DIV style="color: #000000; font-size: 12px;"&gt; &lt;/DIV&gt;&lt;DIV style="color: #000000; font-size: 12px;"&gt;Thanks,&lt;/DIV&gt;&lt;DIV style="color: #000000; font-size: 12px;"&gt;Ed&lt;/DIV&gt;&lt;DIV style="color: #000000; font-size: 12px;"&gt; &lt;/DIV&gt;&lt;DIV style="color: #000000; font-size: 12px;"&gt;&lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt;Miscellaneous info:&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="color: #000000; font-size: 12px;"&gt;a: flash_driver.c &amp;nbsp;see function call to erase flash sector&lt;/DIV&gt;&lt;DIV style="color: #000000; font-size: 12px;"&gt;&lt;SPAN class=""&gt; &lt;/SPAN&gt;result = FLASH_Erase(&amp;amp;flashDriver, destAdrss, pflashSectorSize, kFLASH_apiEraseKey);&lt;/DIV&gt;&lt;DIV style="color: #000000; font-size: 12px;"&gt; &lt;/DIV&gt;&lt;DIV style="color: #000000; font-size: 12px;"&gt;b: fsl_flash.c &amp;nbsp;see function call to run command in ram&lt;/DIV&gt;&lt;DIV style="color: #000000; font-size: 12px;"&gt;&lt;SPAN class=""&gt; &lt;/SPAN&gt;callFlashRunCommand((FTFx_REG_ACCESS_TYPE)(&amp;amp;FTFx-&amp;gt;FSTAT));&lt;/DIV&gt;&lt;DIV style="color: #000000; font-size: 12px;"&gt; &lt;/DIV&gt;&lt;DIV style="color: #000000; font-size: 12px;"&gt;c: I have checked commnd registers, it looks like the flash commands are good.&lt;/DIV&gt;&lt;DIV style="color: #000000; font-size: 12px;"&gt; &lt;/DIV&gt;&lt;DIV style="color: #000000; font-size: 12px;"&gt;&lt;DIV&gt;d: Flash Code placed in Ram&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&amp;nbsp;/* This function should be copied to RAM for execution to make sure that code works properly even flash cache is disabled.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; It is for flash-resident bootloader only, not technically required for ROM or flashloader (RAM-resident bootloader). &amp;nbsp;*/&lt;/DIV&gt;&lt;DIV&gt;void flash_run_command(FTFx_REG_ACCESS_TYPE ftfx_fstat)&lt;/DIV&gt;&lt;DIV&gt;{&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; volatile int i_ram; // mcmurray&lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; /* clear CCIF bit */&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; *ftfx_fstat = FTFx_FSTAT_CCIF_MASK;&lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp;// Breakpoint placed here&lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; /* Check CCIF bit of the flash status register, wait till it is set. &amp;nbsp;IP team indicates that this loop will always complete. */&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp;while (!((*ftfx_fstat) &amp;amp; FTFx_FSTAT_CCIF_MASK)){ }&lt;/DIV&gt;&lt;DIV&gt;}&lt;/DIV&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;STRONG&gt;Original Attachment has been moved to: &lt;A _jive_internal="true" href="https://community.nxp.com/docs/DOC-335776"&gt;flashTest.zip&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Oct 2017 23:49:01 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/problem-erasing-MK02FN128VLF10-flash-with-program-calls-to-flash/m-p/702069#M43144</guid>
      <dc:creator>Ed_McM</dc:creator>
      <dc:date>2017-10-10T23:49:01Z</dc:date>
    </item>
    <item>
      <title>Re: problem erasing MK02FN128VLF10 flash with program calls to flash driver</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/problem-erasing-MK02FN128VLF10-flash-with-program-calls-to-flash/m-p/702070#M43145</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;A little more information about the command sequence of code, being run from ram.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1: I am using assembly code breakpoints. &amp;nbsp;If I place (1)&amp;nbsp;BP&amp;nbsp;anywhere in the while loop assembly code, ONLY required before the sector erase command, &amp;nbsp;and then let it run freely to write and read. &amp;nbsp;It works. &amp;nbsp;That is the only way it works at this point&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;DIV style="color: #000000; border: 0px; font-size: 12px;"&gt;&lt;DIV style="color: #000000; border: 0px; font-size: 12px; padding: 0px;"&gt;void flash_run_command(FTFx_REG_ACCESS_TYPE ftfx_fstat)&lt;/DIV&gt;&lt;DIV style="color: #000000; border: 0px; font-size: 12px; padding: 0px;"&gt;{&lt;/DIV&gt;&lt;DIV style="color: #000000; border: 0px; font-size: 12px; padding: 0px;"&gt; &lt;/DIV&gt;&lt;DIV style="color: #000000; border: 0px; font-size: 12px; padding: 0px;"&gt;&amp;nbsp; &amp;nbsp; /* clear CCIF bit */&lt;/DIV&gt;&lt;DIV style="color: #000000; border: 0px; font-size: 12px; padding: 0px;"&gt;&amp;nbsp; &amp;nbsp; *ftfx_fstat = FTFx_FSTAT_CCIF_MASK;&lt;/DIV&gt;&lt;DIV style="color: #000000; border: 0px; font-size: 12px; padding: 0px;"&gt; &lt;/DIV&gt;&lt;DIV style="color: #000000; border: 0px; font-size: 12px; padding: 0px;"&gt;&amp;nbsp; &amp;nbsp; /* Check CCIF bit of the flash status register, wait till it is set. &amp;nbsp; I PLACE BP anywhere is this section of Assy code*/&lt;/DIV&gt;&lt;DIV style="color: #000000; border: 0px; font-size: 12px; padding: 0px;"&gt;&amp;nbsp; &amp;nbsp;while (!((*ftfx_fstat) &amp;amp; FTFx_FSTAT_CCIF_MASK)){ }&lt;/DIV&gt;&lt;DIV style="color: #000000; border: 0px; font-size: 12px; padding: 0px;"&gt; &lt;/DIV&gt;&lt;DIV style="color: #000000; border: 0px; font-size: 12px; padding: 0px;"&gt;}&lt;/DIV&gt;&lt;DIV style="color: #000000; border: 0px; font-size: 12px; padding: 0px;"&gt; &lt;/DIV&gt;&lt;DIV style="color: #000000; border: 0px; font-size: 12px; padding: 0px;"&gt; &lt;/DIV&gt;&lt;DIV style="color: #000000; border: 0px; font-size: 12px; padding: 0px;"&gt;Note: &amp;nbsp;&lt;/DIV&gt;&lt;DIV style="color: #000000; border: 0px; font-size: 12px; padding: 0px;"&gt;1: WDOGEN is 0, watchdog is disabled.&lt;/DIV&gt;&lt;DIV style="color: #000000; border: 0px; font-size: 12px; padding: 0px;"&gt;2: I have tried various sectors throughout free flash where program does not reside.&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Oct 2017 15:38:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/problem-erasing-MK02FN128VLF10-flash-with-program-calls-to-flash/m-p/702070#M43145</guid>
      <dc:creator>Ed_McM</dc:creator>
      <dc:date>2017-10-11T15:38:53Z</dc:date>
    </item>
    <item>
      <title>Re: problem erasing MK02FN128VLF10 flash with program calls to flash driver</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/problem-erasing-MK02FN128VLF10-flash-with-program-calls-to-flash/m-p/702071#M43146</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you provide the K02 RCM_SRS0 &amp;amp; RCM_SRS1 register value?&lt;/P&gt;&lt;P&gt;We want to know what kind of reset during the Flash operation. Thanks.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;Ma Hui&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Oct 2017 07:00:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/problem-erasing-MK02FN128VLF10-flash-with-program-calls-to-flash/m-p/702071#M43146</guid>
      <dc:creator>Hui_Ma</dc:creator>
      <dc:date>2017-10-25T07:00:46Z</dc:date>
    </item>
  </channel>
</rss>

