<?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: Flash Swap - Swap Control Command in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Flash-Swap-Swap-Control-Command/m-p/644170#M39052</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am using a MK24 with 1 MB flash on a custom board.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The flash demo has been very helpful. I see conflicting suggestions about where to place the indicator address, but as I see it, you have to dedicate one whole sector (4k) for the indicator.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there something wrong with my swap indicator address?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do I need to erase the Swap Indicator before using PFlashSwapCtl on a UNINITIALIZED system?&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;0x01 (Initialize Swap System to UPDATE-ERASED State) - After verifying that the&lt;BR /&gt;current swap state is UNINITIALIZED, and &lt;STRONG&gt;that both phrases which will contain the&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;swap indicators&lt;/STRONG&gt; (located in each half of the Program flash memory within the relative&lt;BR /&gt;double-phrase flash address provided) &lt;STRONG&gt;are erased&lt;/STRONG&gt;, and that the flash address provided&lt;BR /&gt;is in the lower half of Program flash memory but not in the Flash Configuration&lt;BR /&gt;Field, the flash address provided (shifted with bits[3:0] removed) will be&lt;BR /&gt;programmed into the IFR Swap Field found in the program flash swap IFR. After the&lt;BR /&gt;swap indicator address has been programmed into the IFR Swap Field, the swap&lt;BR /&gt;enable word will be programmed to 0x0000. After the swap enable word has been&lt;BR /&gt;programmed, the swap indicator located in the lower half of the Program flash&lt;BR /&gt;memory will be programmed to 0xFF00.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It seems like I need to check what state the swap is in. If it is&amp;nbsp;&lt;SPAN&gt;UNINITIALIZED, then I should erase both sectors in each swap block. I didn't see a protection error, but I know that in order to program. the sector must first be erased. I thought maybe the command would have handled that. I will check that soon. Unfortunately, I can not use the callback function after finding out it is&amp;nbsp;UNINITIALIZED to erase it before it tries to update it to UPDATE-ERASED.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I'll give this a try.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 18 Oct 2016 22:18:19 GMT</pubDate>
    <dc:creator>jasonphilippi</dc:creator>
    <dc:date>2016-10-18T22:18:19Z</dc:date>
    <item>
      <title>Flash Swap - Swap Control Command</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Flash-Swap-Swap-Control-Command/m-p/644168#M39050</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Everybody,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to use the Swap Control Command as used in AN4533 from an Uninitialized State.&lt;/P&gt;&lt;P&gt;In PFlashSwap.c:&lt;/P&gt;&lt;PRE class="language-c line-numbers"&gt;&lt;CODE&gt;&lt;SPAN class="comment token"&gt;/* Report current swap state */&lt;/SPAN&gt;
 ret &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;PFlashSwapCtl&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;pSSDConfig&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;addr&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;FTFx_SWAP_REPORT_STATUS&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;amp;&lt;/SPAN&gt;currentSwapMode&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; \
 &lt;SPAN class="operator token"&gt;&amp;amp;&lt;/SPAN&gt;currentSwapBlockStatus&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;&amp;amp;&lt;/SPAN&gt;nextSwapBlockStatus &lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;pFlashCommandSequence&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I get&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;ret = FTFx_OK&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;currentSwapMode = 0x00 (&lt;SPAN&gt;Uninitialized)&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN&gt;currentSwapBlockStatus =&amp;nbsp;0x00 (Block 0 at 0x0_0000)&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN&gt;nextSwapBlockStatus =&amp;nbsp;0x00 (Block 0 at 0x0_0000)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Which that is all fine with me.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Next I go into this in PFlashSwap.c:&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE class="language-c line-numbers"&gt;&lt;CODE&gt;&lt;SPAN class="comment token"&gt;/* If current swap mode is Uninitialized */&lt;/SPAN&gt;
 &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;FTFx_SWAP_UNINIT &lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt; currentSwapMode&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
 &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
 &lt;SPAN class="comment token"&gt;/* Initialize Swap to Initialized/READY state */&lt;/SPAN&gt;
 ret &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;PFlashSwapCtl&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;pSSDConfig&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; addr&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; FTFx_SWAP_SET_INDICATOR_ADDR&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;amp;&lt;/SPAN&gt;currentSwapMode&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; \
 &lt;SPAN class="operator token"&gt;&amp;amp;&lt;/SPAN&gt;currentSwapBlockStatus&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;&amp;amp;&lt;/SPAN&gt;nextSwapBlockStatus &lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; pFlashCommandSequence&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
 &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This time I am Initializing the Swap System to UPDATE-ERASED, but this where I run into problems.&lt;/P&gt;&lt;P&gt;I get back&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;ret = FTFx_ERR_ACCERR&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Based on the FTFE Chapter in my manual, there are 4 errors I could be having.&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Command not available in current mode/security&lt;/LI&gt;&lt;LI&gt;Flash Address is not in the lower half of program flash memory&lt;/LI&gt;&lt;LI&gt;Flash address is in the Flash Configuration Field&lt;/LI&gt;&lt;LI&gt;Flash address is not 128-bit aligned&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm not sure what my problem is, but I'll throw in some snippets of information that might help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Memory Segments in my linker file&lt;/P&gt;&lt;PRE class="language-c line-numbers"&gt;&lt;CODE&gt;MEMORY &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
 m_interrupts &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;RX&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; ORIGIN &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;0x00000000&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; LENGTH &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;0x00000400&lt;/SPAN&gt;
 m_flash_config &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;RX&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; ORIGIN &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;0x00000400&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; LENGTH &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;0x00000010&lt;/SPAN&gt;
 m_interrupts_ram &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;RW&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; ORIGIN &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;0x1FFF0000&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; LENGTH &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;0x00000400&lt;/SPAN&gt;
 m_text &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;RX&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; ORIGIN &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;0x00002000&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; LENGTH &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;0x0007E000&lt;/SPAN&gt;
 m_data &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;RW&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; ORIGIN &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;0x1FFF0400&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; LENGTH &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;0x0000FC00&lt;/SPAN&gt;
 m_data_2 &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;RW&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; ORIGIN &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;0x20000000&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; LENGTH &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;0x00030000&lt;/SPAN&gt;
 m_swap &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;RX&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; ORIGIN &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;0x00001000&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; LENGTH &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;0x00001000&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I added a separate section called m_swap to hold my SWAP_INDICATOR.&lt;/P&gt;&lt;P&gt;That block is 128 bit or double phrase aligned.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="language-c line-numbers"&gt;&lt;CODE&gt;&lt;SPAN class="property macro token"&gt;#define FLASH_SWAP_INDICATOR_ADDR 0x1000 &lt;/SPAN&gt;&lt;SPAN class="comment token"&gt;//!&amp;lt;Address for the Flash Swap Indicator&lt;/SPAN&gt;
&lt;SPAN class="property macro token"&gt;#define LAUNCH_CMD_SIZE 0x600&lt;/SPAN&gt;
&lt;SPAN class="property macro token"&gt;#define CALLBACK_SIZE 0x100‍‍‍‍‍‍&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Also, I have defined the address for the swap indicator address.&lt;/P&gt;&lt;P&gt;I went a little overboard on the Ram size for the Launch Command Size, but I checked my map file and found out I needed more room.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="language-c line-numbers"&gt;&lt;CODE&gt;flash1_InitConfig0&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;CallBack &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;PCALLBACK&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;RelocateFunction&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;uint32_t&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;ramForCallback &lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; CALLBACK_SIZE &lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;uint32_t&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;flash_callback&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
 flashLaunchCommand &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;pFLASHCOMMANDSEQUENCE&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;RelocateFunction&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;uint32_t&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;ramFunctions&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; LAUNCH_CMD_SIZE&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;uint32_t&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;FlashCommandSequence&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Putting the functions into RAM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I manually removed program flash protection in debug and I still error out.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think I am having trouble with either 1 or 3.&lt;/P&gt;&lt;P&gt;I am using KSDK 1.3.0 and&amp;nbsp;FreeRTOS on a K24.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas would be appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Jason Philippi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Oct 2016 16:38:52 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Flash-Swap-Swap-Control-Command/m-p/644168#M39050</guid>
      <dc:creator>jasonphilippi</dc:creator>
      <dc:date>2016-10-17T16:38:52Z</dc:date>
    </item>
    <item>
      <title>Re: Flash Swap - Swap Control Command</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Flash-Swap-Swap-Control-Command/m-p/644169#M39051</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;If customer run the Flash swap operation with TWR-K24F120M board?&lt;/P&gt;&lt;P&gt;For the TWR-K24F120M board is using MK24FN256VDC12 chip, which only has one program Flash block and doesn't support SWAP operation.&lt;/P&gt;&lt;P&gt;If customer is using MK24FN1M0VDC12R product or other K24 with internal 1MB flash product board, which could support SWAP operation.&lt;/P&gt;&lt;P&gt;Customer could refer KSDK V1.3 flash_demo, which provides Flash SWAP operation demo and related code.&lt;/P&gt;&lt;P&gt;The flash_demo located at default path:&lt;/P&gt;&lt;P&gt;C:\Freescale\KSDK_1.3.0\examples\twrk24f120m\demo_apps\flash_demo&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Wish it helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have a great day,&lt;BR /&gt;Ma Hui&lt;BR /&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>Tue, 18 Oct 2016 08:19:18 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Flash-Swap-Swap-Control-Command/m-p/644169#M39051</guid>
      <dc:creator>Hui_Ma</dc:creator>
      <dc:date>2016-10-18T08:19:18Z</dc:date>
    </item>
    <item>
      <title>Re: Flash Swap - Swap Control Command</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Flash-Swap-Swap-Control-Command/m-p/644170#M39052</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am using a MK24 with 1 MB flash on a custom board.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The flash demo has been very helpful. I see conflicting suggestions about where to place the indicator address, but as I see it, you have to dedicate one whole sector (4k) for the indicator.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there something wrong with my swap indicator address?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do I need to erase the Swap Indicator before using PFlashSwapCtl on a UNINITIALIZED system?&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;0x01 (Initialize Swap System to UPDATE-ERASED State) - After verifying that the&lt;BR /&gt;current swap state is UNINITIALIZED, and &lt;STRONG&gt;that both phrases which will contain the&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;swap indicators&lt;/STRONG&gt; (located in each half of the Program flash memory within the relative&lt;BR /&gt;double-phrase flash address provided) &lt;STRONG&gt;are erased&lt;/STRONG&gt;, and that the flash address provided&lt;BR /&gt;is in the lower half of Program flash memory but not in the Flash Configuration&lt;BR /&gt;Field, the flash address provided (shifted with bits[3:0] removed) will be&lt;BR /&gt;programmed into the IFR Swap Field found in the program flash swap IFR. After the&lt;BR /&gt;swap indicator address has been programmed into the IFR Swap Field, the swap&lt;BR /&gt;enable word will be programmed to 0x0000. After the swap enable word has been&lt;BR /&gt;programmed, the swap indicator located in the lower half of the Program flash&lt;BR /&gt;memory will be programmed to 0xFF00.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It seems like I need to check what state the swap is in. If it is&amp;nbsp;&lt;SPAN&gt;UNINITIALIZED, then I should erase both sectors in each swap block. I didn't see a protection error, but I know that in order to program. the sector must first be erased. I thought maybe the command would have handled that. I will check that soon. Unfortunately, I can not use the callback function after finding out it is&amp;nbsp;UNINITIALIZED to erase it before it tries to update it to UPDATE-ERASED.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I'll give this a try.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Oct 2016 22:18:19 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Flash-Swap-Swap-Control-Command/m-p/644170#M39052</guid>
      <dc:creator>jasonphilippi</dc:creator>
      <dc:date>2016-10-18T22:18:19Z</dc:date>
    </item>
    <item>
      <title>Re: Flash Swap - Swap Control Command</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Flash-Swap-Swap-Control-Command/m-p/644171#M39053</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;The AN4533 provides below info about where to locate the flash swap indicators:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Where to locate the flash swap indicators?&lt;BR /&gt;The system programmer specifies where the flash swap indicators are to be located when initializing the flash swap system. Any flash sector can be used except the first two sectors which contain the vectors and flash configuration fields. Depending on the device, the swap indicator must be 32-bit, 64-bit, or 128-bit aligned.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;It is recommended to place the flash swap indicators in the last sector of the p-flash block. This will allow the largest contiguous flash area for the application code.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Customer need to erase the Swap Indicator located Flash sector before using PFlashSwapCtl on a UNINITIALIZED system.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Wish it helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have a great day,&lt;BR /&gt;Ma Hui&lt;BR /&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, 19 Oct 2016 05:06:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Flash-Swap-Swap-Control-Command/m-p/644171#M39053</guid>
      <dc:creator>Hui_Ma</dc:creator>
      <dc:date>2016-10-19T05:06:55Z</dc:date>
    </item>
  </channel>
</rss>

