<?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>topic Re: K82 : erase and write internal flash memory and FreeRTOS in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/K82-erase-and-write-internal-flash-memory-and-FreeRTOS/m-p/826993#M49983</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Eugene:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your update, let me do more tests on my side and I'll get it back to you when I have results.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 24 Oct 2018 15:39:55 GMT</pubDate>
    <dc:creator>danielchen</dc:creator>
    <dc:date>2018-10-24T15:39:55Z</dc:date>
    <item>
      <title>K82 : erase and write internal flash memory and FreeRTOS</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/K82-erase-and-write-internal-flash-memory-and-FreeRTOS/m-p/826989#M49979</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello !&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can successfully run pflash SDK example on FRDM K82 board. After that I adopt this test for FreeRTOS environment&lt;/P&gt;&lt;P&gt;and it is also possible to pass erase/write/verify loop if all interrupts disabled.&lt;/P&gt;&lt;P&gt;E,g.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;asm volatile ("cpsid f");&lt;BR /&gt; result = FLASH_Erase(&amp;amp;s_flashDriver, destAdrss, pflashSectorSize, kFTFx_ApiEraseKey);&lt;BR /&gt; asm volatile ("cpsie f");&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;asm volatile ("cpsid f");&lt;BR /&gt; result = FLASH_Program(&amp;amp;s_flashDriver, i, (uint8_t *) s_buffer, sizeof(s_buffer));&lt;/P&gt;&lt;P&gt;asm volatile ("cpsie f");&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have used last 4KB sector in flash memory.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But if I enable MPU this technique dosn't help and it cause BusFault if erase operation initiated&lt;/P&gt;&lt;P&gt;Even Task running in privileged mode and whole flash area set as rwx in MPU table.&lt;/P&gt;&lt;P&gt;But I think rwx is no need becouse flash memory accessed via controller peripheral registers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I no need to run any special code in RAM, timing can wait.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But how to disable everything what is need when one sector of flash memory need to be erased ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have few different interrupts and FreeRTOS is MPU enabled.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Eugene&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Oct 2018 12:53:52 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/K82-erase-and-write-internal-flash-memory-and-FreeRTOS/m-p/826989#M49979</guid>
      <dc:creator>EugeneHiihtaja</dc:creator>
      <dc:date>2018-10-04T12:53:52Z</dc:date>
    </item>
    <item>
      <title>Re: K82 : erase and write internal flash memory and FreeRTOS</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/K82-erase-and-write-internal-flash-memory-and-FreeRTOS/m-p/826990#M49980</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Eugene:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would suggest you check&lt;/P&gt;&lt;P&gt;1. whether you have configure the MPU correctly.&lt;/P&gt;&lt;P&gt;2. whether you have execute the flash erase/program software subroutines from a different flash block than the one with the sectors being erased/programmed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You also can share your project for further analyzing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Oct 2018 08:39:19 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/K82-erase-and-write-internal-flash-memory-and-FreeRTOS/m-p/826990#M49980</guid>
      <dc:creator>danielchen</dc:creator>
      <dc:date>2018-10-16T08:39:19Z</dc:date>
    </item>
    <item>
      <title>Re: K82 : erase and write internal flash memory and FreeRTOS</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/K82-erase-and-write-internal-flash-memory-and-FreeRTOS/m-p/826991#M49981</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Daniel !&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So if everything is correct,it shouldn't be any problem to execute&amp;nbsp;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;asm volatile ("cpsid f"); disable/enable&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; color: #51626f;"&gt;?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; color: #51626f;"&gt;Or&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;asm volatile ("cpsid i") ie enought ?&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; color: #51626f;"&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; color: #51626f;"&gt;Eugene&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Oct 2018 10:16:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/K82-erase-and-write-internal-flash-memory-and-FreeRTOS/m-p/826991#M49981</guid>
      <dc:creator>EugeneHiihtaja</dc:creator>
      <dc:date>2018-10-16T10:16:48Z</dc:date>
    </item>
    <item>
      <title>Re: K82 : erase and write internal flash memory and FreeRTOS</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/K82-erase-and-write-internal-flash-memory-and-FreeRTOS/m-p/826992#M49982</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Daniel !&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think it can work this way if code running in User mode, MPU and AIPS setting are correct.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Wait loop in fsl_ftfx_controller.c :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;portENTER_CRITICAL();&lt;BR /&gt; callFtfxRunCommand((FTFx_REG8_ACCESS_TYPE)(&amp;amp;FTFx-&amp;gt;FSTAT)); //&lt;BR /&gt; portEXIT_CRITICAL();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Wait loop in fsl_ftfx_cache.c :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SUPERVISOR_MODE_START();&lt;BR /&gt; // FMC_CACHE_REG can be written in Privileged mode only !&lt;BR /&gt; callftfxCommonBitOperation((FTFx_REG32_ACCESS_TYPE)&amp;amp;FMC_CACHE_REG, FMC_CACHE_CLEAR_MASK, FMC_CACHE_CLEAR_SHIFT, 0xFU);&lt;BR /&gt; SUPERVISOR_MODE_END();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is this should work like this ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Eugene&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Oct 2018 10:52:00 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/K82-erase-and-write-internal-flash-memory-and-FreeRTOS/m-p/826992#M49982</guid>
      <dc:creator>EugeneHiihtaja</dc:creator>
      <dc:date>2018-10-23T10:52:00Z</dc:date>
    </item>
    <item>
      <title>Re: K82 : erase and write internal flash memory and FreeRTOS</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/K82-erase-and-write-internal-flash-memory-and-FreeRTOS/m-p/826993#M49983</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Eugene:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your update, let me do more tests on my side and I'll get it back to you when I have results.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Oct 2018 15:39:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/K82-erase-and-write-internal-flash-memory-and-FreeRTOS/m-p/826993#M49983</guid>
      <dc:creator>danielchen</dc:creator>
      <dc:date>2018-10-24T15:39:55Z</dc:date>
    </item>
    <item>
      <title>Re: K82 : erase and write internal flash memory and FreeRTOS</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/K82-erase-and-write-internal-flash-memory-and-FreeRTOS/m-p/826994#M49984</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Daniel !&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I just try to say it is important to know how-to run all FSL components with User privileges.&lt;/P&gt;&lt;P&gt;All serious applications require MPU enabled RTOS, AIPS and User privileges.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Eugene&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Oct 2018 06:31:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/K82-erase-and-write-internal-flash-memory-and-FreeRTOS/m-p/826994#M49984</guid>
      <dc:creator>EugeneHiihtaja</dc:creator>
      <dc:date>2018-10-25T06:31:26Z</dc:date>
    </item>
    <item>
      <title>Re: K82 : erase and write internal flash memory and FreeRTOS</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/K82-erase-and-write-internal-flash-memory-and-FreeRTOS/m-p/826995#M49985</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I think it's not only MPU problem, it's relate to M4 core. Since instruction like " cpsid f" can only execute in&amp;nbsp;privileged mode, you must switch to rtos supervisor mode and then disable interrupt and do flash erase/write. &amp;nbsp;&lt;/P&gt;&lt;P&gt;"cpsid f" disable all exception and interrupt except NMI. I think "CPSID I" is enough.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jing&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Oct 2018 07:13:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/K82-erase-and-write-internal-flash-memory-and-FreeRTOS/m-p/826995#M49985</guid>
      <dc:creator>jingpan</dc:creator>
      <dc:date>2018-10-29T07:13:37Z</dc:date>
    </item>
  </channel>
</rss>

