<?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>MCUXpresso SDK中的主题 Re: SWAP does not work from UPPER on SDK 2.4.1 flash driver?</title>
    <link>https://community.nxp.com/t5/MCUXpresso-SDK/SWAP-does-not-work-from-UPPER-on-SDK-2-4-1-flash-driver/m-p/847078#M1144</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Roberto, were you able to find a solution to this issue?&amp;nbsp; I'm having the same troubles with SDK 2.4.2.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 12 Nov 2018 14:52:42 GMT</pubDate>
    <dc:creator>knovinger</dc:creator>
    <dc:date>2018-11-12T14:52:42Z</dc:date>
    <item>
      <title>SWAP does not work from UPPER on SDK 2.4.1 flash driver?</title>
      <link>https://community.nxp.com/t5/MCUXpresso-SDK/SWAP-does-not-work-from-UPPER-on-SDK-2-4-1-flash-driver/m-p/847068#M1134</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;We are using a MK26 with flash swap feature for firmware updates.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;The swap does not work on &lt;/STRONG&gt;&lt;SPAN&gt;&lt;STRONG&gt;SDK 2.4.1&lt;/STRONG&gt; .&lt;/SPAN&gt;Since we have migrated to the SDK 2.4.1 the swap feature does not work any more.&lt;/P&gt;&lt;P&gt;We can swap from block 0 (LOWER) but when we swap from the block 1 (UPPER block) the firmware keeps blocked on the swap state "kFTFx_SwapStateUpdate".&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Furthermore, the &lt;STRONG&gt;swap demo provided for the TowerK65f180m code seems wrong.&lt;/STRONG&gt; The demo code does the swap as follows:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;result = FLASH_Swap(&amp;amp;s_flashDriver, swapIndicatorAddress, false);&lt;/LI&gt;&lt;/UL&gt;&lt;P class=""&gt;This disables the SWAP, the last parameter should be set to TRUE&lt;/P&gt;&lt;P class=""&gt;&lt;/P&gt;&lt;P class=""&gt;With driver fsl_flash v.2.3.1 we did not have this issue.&lt;/P&gt;&lt;P class=""&gt;You have done a lot of modifications/refactoring&amp;nbsp; on the flash driver since sdk&amp;nbsp; 2.3.0, where can we find the changelog with this modifications (specially concerning the flash driver)&lt;/P&gt;&lt;P class=""&gt;If we look at the documentation provided with the SDK 2.4.1,&amp;nbsp;/MCUXpressoSDKReleaseNotes_MK66F18.pdf, on page 5&amp;nbsp; we can read:&amp;nbsp;&lt;/P&gt;&lt;DIV class="" title="Page 18"&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;P&gt;&lt;SPAN style="font-weight: bold; font-size: 13.000000pt;"&gt;FLASH &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12.000000pt;"&gt;The current FLASH driver version is 2.3.1. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12.000000pt;"&gt;• 2.3.1&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN style="font-weight: 500; font-size: 12.000000pt;"&gt;– &lt;/SPAN&gt;&lt;SPAN style="font-size: 12.000000pt;"&gt;Bug fixes: &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12.000000pt;"&gt;* &lt;/SPAN&gt;&lt;SPAN style="font-size: 12.000000pt;"&gt;Unified Flash IFR design from K3. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12.000000pt;"&gt;* &lt;/SPAN&gt;&lt;SPAN style="font-size: 12.000000pt;"&gt;New encoding rule for K3 flash size. &lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;The documentation does not correspond with the code provided in the SDK!?&lt;/STRONG&gt;?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please note that this is critical&amp;nbsp;feature&amp;nbsp; because it is the base&amp;nbsp; the over the air firmware update.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Oct 2018 08:19:30 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-SDK/SWAP-does-not-work-from-UPPER-on-SDK-2-4-1-flash-driver/m-p/847068#M1134</guid>
      <dc:creator>robertoquilez</dc:creator>
      <dc:date>2018-10-10T08:19:30Z</dc:date>
    </item>
    <item>
      <title>Re: SWAP does not work from UPPER on SDK 2.4.1 flash driver?</title>
      <link>https://community.nxp.com/t5/MCUXpresso-SDK/SWAP-does-not-work-from-UPPER-on-SDK-2-4-1-flash-driver/m-p/847069#M1135</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can I expect any support from NXP?&lt;/P&gt;&lt;P&gt;Al least confirm that flash SWAP from UPPER works on SDK 2.4.1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.nxp.com/t5/tag/swap/tg-p"&gt;#swap&lt;/A&gt;‌&lt;A href="https://community.nxp.com/t5/tag/flash swap/tg-p"&gt;#flash swap&lt;/A&gt;‌&lt;A href="https://community.nxp.com/t5/tag/sdk 2.4/tg-p"&gt;#sdk 2.4&lt;/A&gt;‌&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Oct 2018 08:45:17 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-SDK/SWAP-does-not-work-from-UPPER-on-SDK-2-4-1-flash-driver/m-p/847069#M1135</guid>
      <dc:creator>robertoquilez</dc:creator>
      <dc:date>2018-10-23T08:45:17Z</dc:date>
    </item>
    <item>
      <title>Re: SWAP does not work from UPPER on SDK 2.4.1 flash driver?</title>
      <link>https://community.nxp.com/t5/MCUXpresso-SDK/SWAP-does-not-work-from-UPPER-on-SDK-2-4-1-flash-driver/m-p/847070#M1136</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;1.The third parameter should be &lt;STRONG&gt;true&lt;/STRONG&gt; “result = FLASH_Swap(&amp;amp;s_flashDriver, swapIndicatorAddress, true);”&lt;/P&gt;&lt;P&gt;2.I think twrk65 does not support swapping &lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;from the block 1 (UPPER block) to block 0 (&lt;SPAN&gt;LOWER&lt;/SPAN&gt;),&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; color: #51626f;"&gt;the correct step is stap is &amp;nbsp;When you swap from block0 to block1, block1 becomes block0. then you can swap again. &amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; color: #51626f;"&gt;If you want to go back to the starting state, you have to&amp;nbsp;Erase all blocks to clear the swap system back to uninitialized .&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;&amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Oct 2018 03:41:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-SDK/SWAP-does-not-work-from-UPPER-on-SDK-2-4-1-flash-driver/m-p/847070#M1136</guid>
      <dc:creator>nxf42424</dc:creator>
      <dc:date>2018-10-25T03:41:55Z</dc:date>
    </item>
    <item>
      <title>Re: SWAP does not work from UPPER on SDK 2.4.1 flash driver?</title>
      <link>https://community.nxp.com/t5/MCUXpresso-SDK/SWAP-does-not-work-from-UPPER-on-SDK-2-4-1-flash-driver/m-p/847071#M1137</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;1.- So the demo is effectively&amp;nbsp;wrong.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2.-&amp;nbsp; The problem is that once that we have SWAPPED we can NOT SWAP again without doing a mass erase.&lt;/P&gt;&lt;P&gt;With previous SDK we did not have this issue. The status machine keeps blocked on "&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;kFTFx_SwapStateUpdate"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The idea is to implement a&amp;nbsp;"Robust Over-the-Air Firmware Updates Using Program Flash Memory Swap on Kinetis Microcontrollers" as described on&amp;nbsp;&amp;nbsp;&lt;A class="link-titled" href="http://cache.freescale.com/files/microcontrollers/doc/app_note/AN4533.pdf" title="http://cache.freescale.com/files/microcontrollers/doc/app_note/AN4533.pdf"&gt;http://cache.freescale.com/files/microcontrollers/doc/app_note/AN4533.pdf&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The swap works the first time but not the second one (once already swapped) i.e. if we repeat&amp;nbsp; the procedure once swapped it wont work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you confirm that is possible to swap back once swapped (we are using the MK26) with SDK 2.4.1?&lt;/P&gt;&lt;P&gt;(with sdk 2.3.0 we did not have this problem)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Oct 2018 14:03:10 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-SDK/SWAP-does-not-work-from-UPPER-on-SDK-2-4-1-flash-driver/m-p/847071#M1137</guid>
      <dc:creator>robertoquilez</dc:creator>
      <dc:date>2018-10-25T14:03:10Z</dc:date>
    </item>
    <item>
      <title>Re: SWAP does not work from UPPER on SDK 2.4.1 flash driver?</title>
      <link>https://community.nxp.com/t5/MCUXpresso-SDK/SWAP-does-not-work-from-UPPER-on-SDK-2-4-1-flash-driver/m-p/847072#M1138</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Send your code to my mailbox, I want to reproduce your question, &lt;A href="mailto:ding.sang@nxp.com"&gt;ding.sang@nxp.com&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Oct 2018 16:05:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-SDK/SWAP-does-not-work-from-UPPER-on-SDK-2-4-1-flash-driver/m-p/847072#M1138</guid>
      <dc:creator>nxf42424</dc:creator>
      <dc:date>2018-10-26T16:05:44Z</dc:date>
    </item>
    <item>
      <title>Re: SWAP does not work from UPPER on SDK 2.4.1 flash driver?</title>
      <link>https://community.nxp.com/t5/MCUXpresso-SDK/SWAP-does-not-work-from-UPPER-on-SDK-2-4-1-flash-driver/m-p/847073#M1139</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;try this code,&amp;nbsp;During the debugging, please make a breakpoint at BOARD_InitHardware(); and observe the change of the flash value.&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;/*&lt;BR /&gt; * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.&lt;BR /&gt; */&lt;/P&gt;&lt;P&gt;/*******************************************************************************&lt;BR /&gt; * Includes&lt;BR /&gt; ******************************************************************************/&lt;BR /&gt;#include "fsl_device_registers.h"&lt;BR /&gt;#include "fsl_debug_console.h"&lt;BR /&gt;#include "board.h"&lt;BR /&gt;#include "clock_config.h"&lt;BR /&gt;#include "pin_mux.h"&lt;BR /&gt;#include "app.h"&lt;BR /&gt;#include "fsl_flash.h"&lt;BR /&gt;/*******************************************************************************&lt;BR /&gt; * Definitions&lt;BR /&gt; ******************************************************************************/&lt;/P&gt;&lt;P&gt;#define EXAMPLE_IMAGE_SIZE 0x8000 /* 32KB */&lt;BR /&gt;#define LOWER_PFLASH_BASE FSL_FEATURE_FLASH_PFLASH_START_ADDRESS&lt;BR /&gt;#define UPPER_PFLASH_BASE (FSL_FEATURE_FLASH_PFLASH_BLOCK_SIZE * (FSL_FEATURE_FLASH_PFLASH_BLOCK_COUNT &amp;gt;&amp;gt; 1))&lt;BR /&gt;#define FLASH_CONFIG_START 0x400&lt;/P&gt;&lt;P&gt;/*******************************************************************************&lt;BR /&gt; * Prototypes&lt;BR /&gt; ******************************************************************************/&lt;/P&gt;&lt;P&gt;void error_trap(void);&lt;BR /&gt;void app_finalize(void);&lt;/P&gt;&lt;P&gt;/*******************************************************************************&lt;BR /&gt; * Variables&lt;BR /&gt; ******************************************************************************/&lt;/P&gt;&lt;P&gt;/*! @brief Flash driver Structure */&lt;BR /&gt;static flash_config_t s_flashDriver;&lt;BR /&gt;/*! @brief 16 bytes Flash config data */&lt;BR /&gt;/* uint32_t flashConfigData[] = {0xffffffffU, 0xffffffffU, 0xffffffffU, 0xfffffffeU}; */&lt;BR /&gt;/*! @brief Test data used to validate swap result*/&lt;BR /&gt;uint8_t swapUpertData[] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x5, 0x06, 0x07,&lt;BR /&gt; 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f};&lt;/P&gt;&lt;P&gt;uint8_t swaplowerData[] = {0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,&lt;BR /&gt; 0x90, 0x91, 0x91, 0x93, 0x94, 0x95, 0x96, 0x97};&lt;/P&gt;&lt;P&gt;uint32_t pflashBaseAddr;&lt;/P&gt;&lt;P&gt;/*******************************************************************************&lt;BR /&gt; * Code&lt;BR /&gt; ******************************************************************************/&lt;/P&gt;&lt;P&gt;/*&lt;BR /&gt;* @brief Gets called when an error occurs.&lt;BR /&gt;*&lt;BR /&gt;* @details Print error message and trap forever.&lt;BR /&gt;*/&lt;BR /&gt;void error_trap(void)&lt;BR /&gt;{&lt;BR /&gt; PRINTF("\r\n\r\n\r\n\t---- HALTED DUE TO FLASH ERROR! ----");&lt;BR /&gt; while (1)&lt;BR /&gt; {&lt;BR /&gt; }&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;/*&lt;BR /&gt;* @brief Gets called when the app is complete.&lt;BR /&gt;*&lt;BR /&gt;* @details Print finshed message and trap forever.&lt;BR /&gt;*/&lt;BR /&gt;void app_finalize(void)&lt;BR /&gt;{&lt;BR /&gt; /* Print finished message. */&lt;BR /&gt; PRINTF("\r\n End of PFlash Swap Example \r\n");&lt;BR /&gt; while (1)&lt;BR /&gt; {&lt;BR /&gt; }&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;/*!&lt;BR /&gt; * @brief Use Standard Software Drivers (SSD) to enable flash swap feature.&lt;BR /&gt; *&lt;BR /&gt; * @details This function uses SSD to demonstrate flash mode:&lt;BR /&gt; * + Check flash information.&lt;BR /&gt; * + Program swap test data on upper pflash.&lt;BR /&gt; * + Swap the flash system&lt;BR /&gt; * + Check lower pflash to see whether swap test data is over there.&lt;BR /&gt; */&lt;BR /&gt;int main(void)&lt;BR /&gt;{&lt;BR /&gt; ftfx_security_state_t securityStatus = kFTFx_SecurityStateNotSecure; /* Return protection status */&lt;BR /&gt; status_t result; /* Return code from each flash driver function */&lt;/P&gt;&lt;P&gt;uint32_t pflashTotalSize = 0;&lt;BR /&gt; uint32_t pflashBlockCount = 0;&lt;BR /&gt; uint32_t pflashSectorSize = 0;&lt;/P&gt;&lt;P&gt;/* Init hardware */&lt;BR /&gt; BOARD_InitHardware();&lt;/P&gt;&lt;P&gt;/* Clean up structures*/&lt;BR /&gt; memset(&amp;amp;s_flashDriver, 0, sizeof(flash_config_t));&lt;/P&gt;&lt;P&gt;/* Setup flash driver structure for device and initialize variables. */&lt;BR /&gt; result = FLASH_Init(&amp;amp;s_flashDriver);&lt;BR /&gt; if (kStatus_FTFx_Success != result)&lt;BR /&gt; {&lt;BR /&gt; error_trap();&lt;BR /&gt; }&lt;BR /&gt; /* Get flash properties*/&lt;BR /&gt; FLASH_GetProperty(&amp;amp;s_flashDriver, kFLASH_PropertyPflash0TotalSize, &amp;amp;pflashTotalSize);&lt;BR /&gt; FLASH_GetProperty(&amp;amp;s_flashDriver, kFLASH_PropertyPflash0BlockCount, &amp;amp;pflashBlockCount);&lt;BR /&gt; FLASH_GetProperty(&amp;amp;s_flashDriver, kFLASH_PropertyPflash0SectorSize, &amp;amp;pflashSectorSize);&lt;/P&gt;&lt;P&gt;/* print welcome message */&lt;BR /&gt; PRINTF("\r\n PFlash Swap Example Start \r\n");&lt;BR /&gt; /* Print flash information - PFlash. */&lt;BR /&gt; PRINTF("\r\n PFlash Information: ");&lt;BR /&gt; PRINTF("\r\n Total Program Flash Size:\t%d KB, Hex: (0x%x)", (pflashTotalSize / 1024), pflashTotalSize);&lt;BR /&gt; PRINTF("\r\n Total Program Flash Block Count:\t%d", pflashBlockCount);&lt;BR /&gt; PRINTF("\r\n Program Flash Sector Size:\t%d KB, Hex: (0x%x) ", (pflashSectorSize / 1024), pflashSectorSize);&lt;/P&gt;&lt;P&gt;/* Check security status. */&lt;BR /&gt; result = FLASH_GetSecurityState(&amp;amp;s_flashDriver, &amp;amp;securityStatus);&lt;BR /&gt; if (kStatus_FTFx_Success != result)&lt;BR /&gt; {&lt;BR /&gt; error_trap();&lt;BR /&gt; }&lt;BR /&gt; /* Print security status. */&lt;BR /&gt; switch (securityStatus)&lt;BR /&gt; {&lt;BR /&gt; case kFTFx_SecurityStateNotSecure:&lt;BR /&gt; PRINTF("\r\n Flash is UNSECURE!");&lt;BR /&gt; break;&lt;BR /&gt; case kFTFx_SecurityStateBackdoorEnabled:&lt;BR /&gt; PRINTF("\r\n Flash is SECURE, BACKDOOR is ENABLED!");&lt;BR /&gt; break;&lt;BR /&gt; case kFTFx_SecurityStateBackdoorDisabled:&lt;BR /&gt; PRINTF("\r\n Flash is SECURE, BACKDOOR is DISABLED!");&lt;BR /&gt; break;&lt;BR /&gt; default:&lt;BR /&gt; break;&lt;BR /&gt; }&lt;BR /&gt; PRINTF("\r\n");&lt;/P&gt;&lt;P&gt;#if defined(FSL_FEATURE_FLASH_HAS_PFLASH_BLOCK_SWAP) &amp;amp;&amp;amp; FSL_FEATURE_FLASH_HAS_PFLASH_BLOCK_SWAP&lt;/P&gt;&lt;P&gt;/* Debug message for user. */&lt;BR /&gt; /* Test pflash swap feature only if flash is unsecure. */&lt;BR /&gt; if (kFTFx_SecurityStateNotSecure != securityStatus)&lt;BR /&gt; {&lt;BR /&gt; PRINTF("\r\n Flash swap opeation will not be executed, as Flash is SECURE!");&lt;BR /&gt; app_finalize();&lt;BR /&gt; }&lt;BR /&gt; else&lt;BR /&gt; {&lt;BR /&gt; struct _flash_swap_ifr_field_config&lt;BR /&gt; {&lt;BR /&gt; uint16_t swapIndicatorAddress; /*!&amp;lt; A Swap indicator address field.*/&lt;BR /&gt; uint16_t swapEnableWord; /*!&amp;lt; A Swap enable word field.*/&lt;BR /&gt; uint8_t reserved0[4]; /*!&amp;lt; A reserved field.*/&lt;BR /&gt; uint8_t reserved1[2]; /*!&amp;lt; A reserved field.*/&lt;BR /&gt; uint16_t swapDisableWord; /*!&amp;lt; A Swap disable word field.*/&lt;BR /&gt; uint8_t reserved2[4]; /*!&amp;lt; A reserved field.*/&lt;BR /&gt; } flashSwapIfrFieldData;&lt;BR /&gt; uint32_t swapIndicatorAddress;&lt;BR /&gt; ftfx_swap_state_config_t returnSwapInfo;&lt;BR /&gt; uint32_t failedAddress;&lt;BR /&gt; uint32_t failedData;&lt;BR /&gt; uint32_t tempData[2];&lt;/P&gt;&lt;P&gt;/* Clean up structures*/&lt;BR /&gt; memset(&amp;amp;flashSwapIfrFieldData, 0, sizeof(flashSwapIfrFieldData));&lt;BR /&gt; memset(&amp;amp;returnSwapInfo, 0, sizeof(ftfx_swap_state_config_t));&lt;/P&gt;&lt;P&gt;/* Get original swap indicator address */&lt;BR /&gt; result = FLASH_ReadResource(&amp;amp;s_flashDriver, s_flashDriver.ftfxConfig[0].ifrDesc.resRange.pflashSwapIfrStart,&lt;BR /&gt; (uint8_t *)&amp;amp;flashSwapIfrFieldData, sizeof(flashSwapIfrFieldData),&lt;BR /&gt; kFTFx_ResourceOptionFlashIfr);&lt;/P&gt;&lt;P&gt;/* The high bits value of Swap Indicator Address is stored in Program Flash Swap IFR Field,&lt;BR /&gt; * the low severval bit value of Swap Indicator Address is always 1'b0 */&lt;BR /&gt; swapIndicatorAddress = (uint32_t)flashSwapIfrFieldData.swapIndicatorAddress *&lt;BR /&gt; s_flashDriver.ftfxConfig[0].opsConfig.addrAligment.swapCtrlCmd;&lt;BR /&gt; if (kStatus_FTFx_Success != result)&lt;BR /&gt; {&lt;BR /&gt; error_trap();&lt;BR /&gt; }&lt;BR /&gt; else&lt;BR /&gt; {&lt;BR /&gt; PRINTF("\r\n Original swap indicator address:\t0x%x", swapIndicatorAddress);&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;/* It doesn't matter what the provided address is, when option is kFlashSwap_ReportStatus*/&lt;BR /&gt; result = FTFx_CMD_SwapControl(&amp;amp;s_flashDriver.ftfxConfig[0],&lt;BR /&gt; FSL_FEATURE_FLASH_PFLASH_SWAP_CONTROL_CMD_ADDRESS_ALIGMENT,&lt;BR /&gt; kFTFx_SwapControlOptionReportStatus, &amp;amp;returnSwapInfo);&lt;BR /&gt; if (kStatus_FTFx_Success != result)&lt;BR /&gt; {&lt;BR /&gt; error_trap();&lt;BR /&gt; }&lt;BR /&gt; /* Check current flash swap status*/&lt;BR /&gt; switch (returnSwapInfo.flashSwapState)&lt;BR /&gt; {&lt;BR /&gt; case kFTFx_SwapStateUninitialized:&lt;BR /&gt; PRINTF("\r\n Current swap system status: Uninitialized \r\n");&lt;BR /&gt; swapIndicatorAddress = UPPER_PFLASH_BASE - pflashSectorSize;&lt;BR /&gt; PRINTF("\r\n Set swap indicator address as 0x%x \r\n", swapIndicatorAddress);&lt;BR /&gt; break;&lt;BR /&gt; case kFTFx_SwapStateReady:&lt;BR /&gt; PRINTF("\r\n Current swap system status: Ready \r\n");&lt;BR /&gt; break;&lt;BR /&gt; case kFTFx_SwapStateUpdate:&lt;BR /&gt; PRINTF("\r\n Current swap system status: Update \r\n");&lt;BR /&gt; break;&lt;BR /&gt; case kFTFx_SwapStateUpdateErased:&lt;BR /&gt; PRINTF("\r\n Current swap system status: UpdateErased \r\n");&lt;BR /&gt; break;&lt;BR /&gt; case kFTFx_SwapStateComplete:&lt;BR /&gt; PRINTF("\r\n Current swap system status: Complete \r\n");&lt;BR /&gt; break;&lt;BR /&gt; case kFTFx_SwapStateDisabled:&lt;BR /&gt; PRINTF("\r\n Current swap system status: Disabled \r\n");&lt;BR /&gt; //app_finalize();&lt;BR /&gt; break;&lt;BR /&gt; default:&lt;BR /&gt; error_trap();&lt;BR /&gt; break;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;/* Check if the original indicator address is valid */&lt;BR /&gt; if (returnSwapInfo.flashSwapState != kFTFx_SwapStateUninitialized)&lt;BR /&gt; /* if (flashSwapIfrField.swapIndicatorAddress != (uint16_t)(~0)) */&lt;BR /&gt; {&lt;BR /&gt; if ((swapIndicatorAddress &amp;lt; EXAMPLE_IMAGE_SIZE) || (swapIndicatorAddress &amp;gt;= UPPER_PFLASH_BASE))&lt;BR /&gt; {&lt;BR /&gt; PRINTF("\r\n Original swap indicator address couldn't be used for this example \r\n");&lt;BR /&gt; PRINTF(&lt;BR /&gt; "\r\n Swap system needs to be cleared back to uninitialized, This example cannot clear swap system "&lt;BR /&gt; "\r\n");&lt;BR /&gt; app_finalize();&lt;BR /&gt; }&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;result = FLASH_Erase(&amp;amp;s_flashDriver, pflashBaseAddr + EXAMPLE_IMAGE_SIZE, sizeof(swaplowerData),&lt;BR /&gt; kFTFx_ApiEraseKey);&lt;BR /&gt; result = FLASH_Program(&amp;amp;s_flashDriver, pflashBaseAddr + EXAMPLE_IMAGE_SIZE, &amp;amp;swaplowerData[0], sizeof(swaplowerData));&lt;BR /&gt; &lt;BR /&gt; result = FLASH_VerifyProgram( &amp;amp;s_flashDriver, pflashBaseAddr + EXAMPLE_IMAGE_SIZE, sizeof(swaplowerData), &amp;amp;swaplowerData[0], &lt;BR /&gt; kFTFx_MarginValueUser, &amp;amp;failedAddress, &amp;amp;failedData);&lt;BR /&gt; if (kStatus_FTFx_Success != result)&lt;BR /&gt; {&lt;BR /&gt; error_trap();&lt;BR /&gt; }&lt;BR /&gt; &lt;BR /&gt; PRINTF("\r\n Backup example image is invalid \r\n");&lt;BR /&gt; PRINTF("\r\n Start to program backup example image \r\n");&lt;BR /&gt; pflashBaseAddr = LOWER_PFLASH_BASE;&lt;BR /&gt; memcpy((uint8_t *)(&amp;amp;tempData[0]), (uint8_t *)pflashBaseAddr, sizeof(tempData));&lt;BR /&gt; /* Need to program the backup image */&lt;BR /&gt; result = FLASH_Erase(&amp;amp;s_flashDriver, UPPER_PFLASH_BASE, EXAMPLE_IMAGE_SIZE, kFTFx_ApiEraseKey);&lt;BR /&gt; if (kStatus_FTFx_Success != result)&lt;BR /&gt; {&lt;BR /&gt; error_trap();&lt;BR /&gt; }&lt;BR /&gt; result = FLASH_Program(&amp;amp;s_flashDriver, UPPER_PFLASH_BASE, &amp;amp;tempData[0], sizeof(tempData));&lt;BR /&gt; result = FLASH_Program(&amp;amp;s_flashDriver, UPPER_PFLASH_BASE + sizeof(tempData), &lt;BR /&gt; (uint8_t *)(LOWER_PFLASH_BASE + sizeof(tempData)), EXAMPLE_IMAGE_SIZE - sizeof(tempData));&lt;BR /&gt; if (kStatus_FTFx_Success != result)&lt;BR /&gt; {&lt;BR /&gt; error_trap();&lt;BR /&gt; }&lt;BR /&gt; result = FLASH_VerifyProgram(&amp;amp;s_flashDriver, UPPER_PFLASH_BASE + sizeof(tempData), EXAMPLE_IMAGE_SIZE - sizeof(tempData),&lt;BR /&gt; (uint8_t *)(LOWER_PFLASH_BASE + sizeof(tempData)) , kFTFx_MarginValueUser, &amp;amp;failedAddress, &amp;amp;failedData);&lt;BR /&gt; if (kStatus_FTFx_Success != result)&lt;BR /&gt; {&lt;BR /&gt; error_trap();&lt;BR /&gt; }&lt;BR /&gt; &lt;BR /&gt; result = FLASH_Erase(&amp;amp;s_flashDriver, UPPER_PFLASH_BASE + EXAMPLE_IMAGE_SIZE, sizeof(swapUpertData),&lt;BR /&gt; kFTFx_ApiEraseKey);&lt;BR /&gt; if (kStatus_FTFx_Success != result)&lt;BR /&gt; {&lt;BR /&gt; error_trap();&lt;BR /&gt; }&lt;BR /&gt; result = FLASH_Program(&amp;amp;s_flashDriver, UPPER_PFLASH_BASE + EXAMPLE_IMAGE_SIZE, &amp;amp;swapUpertData[0],&lt;BR /&gt; sizeof(swapUpertData));&lt;BR /&gt; &lt;BR /&gt; PRINTF("\r\n Finish programming backup example image \r\n");&lt;BR /&gt; // Enable swap system&lt;BR /&gt; PRINTF("\r\n Start to swap the system \r\n");&lt;BR /&gt; result = FLASH_Swap(&amp;amp;s_flashDriver, swapIndicatorAddress, true);&lt;/P&gt;&lt;P&gt;NVIC_SystemReset();&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;#else&lt;BR /&gt; PRINTF("\r\n Current device doesn't support flash swap feature \r\n");&lt;/P&gt;&lt;P&gt;app_finalize();&lt;BR /&gt;#endif&lt;/P&gt;&lt;P&gt;return 0;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Oct 2018 08:52:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-SDK/SWAP-does-not-work-from-UPPER-on-SDK-2-4-1-flash-driver/m-p/847073#M1139</guid>
      <dc:creator>nxf42424</dc:creator>
      <dc:date>2018-10-29T08:52:51Z</dc:date>
    </item>
    <item>
      <title>Re: SWAP does not work from UPPER on SDK 2.4.1 flash driver?</title>
      <link>https://community.nxp.com/t5/MCUXpresso-SDK/SWAP-does-not-work-from-UPPER-on-SDK-2-4-1-flash-driver/m-p/847074#M1140</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I just tried your code. I just made two modifications:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;I had to comment&amp;nbsp;BOARD_InitHardware();&lt;/LI&gt;&lt;LI&gt;I included following code to know wether I am on the upper or lower:&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt; &lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN class=""&gt;switch&lt;/SPAN&gt;&lt;SPAN class=""&gt; (returnSwapInfo.&lt;/SPAN&gt;currentSwapBlockStatus&lt;SPAN class=""&gt;)&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;STRONG&gt;&lt;SPAN class=""&gt; &lt;/SPAN&gt;&lt;SPAN class=""&gt; &lt;/SPAN&gt;{&lt;/STRONG&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;STRONG&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt; &lt;/SPAN&gt;&lt;SPAN class=""&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class=""&gt;case&lt;/SPAN&gt;&lt;SPAN class=""&gt; &lt;/SPAN&gt;kFTFx_SwapBlockStatusLowerHalfProgramBlocksAtZero&lt;SPAN class=""&gt;:&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;STRONG&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt; &lt;/SPAN&gt;&lt;SPAN class=""&gt; &lt;/SPAN&gt;&lt;SPAN class=""&gt; &lt;/SPAN&gt;printf(&lt;/SPAN&gt;"Current Swap block status is LOWER half program block at zero\r\n"&lt;SPAN class=""&gt;);&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;STRONG&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt; &lt;/SPAN&gt;&lt;SPAN class=""&gt; &lt;/SPAN&gt;&lt;SPAN class=""&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;break&lt;SPAN class=""&gt;;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;STRONG&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt; &lt;/SPAN&gt;&lt;SPAN class=""&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class=""&gt;case&lt;/SPAN&gt;&lt;SPAN class=""&gt; &lt;/SPAN&gt;kFTFx_SwapBlockStatusUpperHalfProgramBlocksAtZero&lt;SPAN class=""&gt;:&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;STRONG&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt; &lt;/SPAN&gt;&lt;SPAN class=""&gt; &lt;/SPAN&gt;&lt;SPAN class=""&gt; &lt;/SPAN&gt;printf(&lt;/SPAN&gt;"Current Swap block status is UPPER half program block at zero\r\n"&lt;SPAN class=""&gt;);&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;STRONG&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt; &lt;/SPAN&gt;&lt;SPAN class=""&gt; &lt;/SPAN&gt;&lt;SPAN class=""&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;break&lt;SPAN class=""&gt;;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;STRONG&gt;&lt;SPAN class=""&gt; &lt;/SPAN&gt;&lt;SPAN class=""&gt; &lt;/SPAN&gt;}&lt;/STRONG&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;/P&gt;&lt;P class=""&gt;The result is that first time (after flash mass erase) that your code is executed, we are in "&lt;SPAN&gt;Current Swap block status is LOWER half program block at zero" and the swap works properly.&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN&gt;Nevertheless, If I start a new debug session (without doing a mass erase),I will be in "&lt;/SPAN&gt;Current Swap block status is UPPER half program block at zero" and SWAP does NOT work.&lt;/P&gt;&lt;P class=""&gt;&lt;/P&gt;&lt;P class=""&gt;The output printfs are the following:&lt;/P&gt;&lt;P class=""&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;STRONG&gt;EGGER J-Link GDB Server V6.32h - Terminal output channel&lt;/STRONG&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;STRONG&gt;PFlash Swap Example Start&lt;/STRONG&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;STRONG&gt;PFlash Information:&lt;/STRONG&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;STRONG&gt;Total Program Flash Size:&lt;SPAN class=""&gt; &lt;/SPAN&gt;2048 KB, Hex: (0x200000)&lt;/STRONG&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;STRONG&gt;Total Program Flash Block Count:&lt;SPAN class=""&gt; &lt;/SPAN&gt;4&lt;/STRONG&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;STRONG&gt;Program Flash Sector Size:&lt;SPAN class=""&gt; &lt;/SPAN&gt;4 KB, Hex: (0x1000)&lt;/STRONG&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;STRONG&gt;Flash is UNSECURE!&lt;/STRONG&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;STRONG&gt;Original swap indicator address:&lt;SPAN class=""&gt; &lt;/SPAN&gt;0xff000&lt;/STRONG&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;STRONG&gt;Current Swap block status is UPPER half program block at zero&lt;/STRONG&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;STRONG&gt;Current swap system status: Update&lt;/STRONG&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;STRONG&gt;Start while erase: 8000-8fff (1000)&lt;/STRONG&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;STRONG&gt;Erasing: 9000&lt;/STRONG&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;STRONG&gt;End erase&lt;/STRONG&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;STRONG&gt;Backup example image is invalid&lt;/STRONG&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;STRONG&gt;Start to program backup example image&lt;/STRONG&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;STRONG&gt;Start while erase: 100000-107fff (1000)&lt;/STRONG&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;STRONG&gt;Erasing: 101000&lt;/STRONG&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;STRONG&gt;Erasing: 102000&lt;/STRONG&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;STRONG&gt;Erasing: 103000&lt;/STRONG&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;STRONG&gt;Erasing: 104000&lt;/STRONG&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;STRONG&gt;Erasing: 105000&lt;/STRONG&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;STRONG&gt;Erasing: 106000&lt;/STRONG&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;STRONG&gt;Erasing: 107000&lt;/STRONG&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;STRONG&gt;Erasing: 108000&lt;/STRONG&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;STRONG&gt;End erase&lt;/STRONG&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;STRONG&gt;Start while erase: 108000-108fff (1000)&lt;/STRONG&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;STRONG&gt;Erasing: 109000&lt;/STRONG&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;STRONG&gt;End erase&lt;/STRONG&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;STRONG&gt;Finish programming backup example image&lt;/STRONG&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;STRONG&gt;Start to swap the system&lt;/STRONG&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;STRONG&gt;Start while erase: 108000-108fff (1000)&lt;/STRONG&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;STRONG&gt;Erasing: 109000&lt;/STRONG&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;STRONG&gt;End erase&lt;/STRONG&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;STRONG&gt;Start while erase: 108000-108fff (1000)&lt;/STRONG&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;STRONG&gt;Erasing: 109000&lt;/STRONG&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;STRONG&gt;End erase&lt;/STRONG&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;STRONG&gt;Start while erase: 108000-108fff (1000)&lt;/STRONG&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;STRONG&gt;Erasing: 109000&lt;/STRONG&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;STRONG&gt;End erase&lt;/STRONG&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;STRONG&gt;Start while erase: 108000-108fff (1000)&lt;/STRONG&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;STRONG&gt;Erasing: 109000&lt;/STRONG&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;STRONG&gt;End erase&lt;/STRONG&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;STRONG&gt;Start while erase: 108000-108fff (1000)&lt;/STRONG&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;STRONG&gt;Erasing: 109000&lt;/STRONG&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;STRONG&gt;End erase...&lt;/STRONG&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;/P&gt;&lt;P class=""&gt;And the code keeps blocked there, because the status machine keeps blocked on "kFTFx_SwapStateUpdate", and no swap is done.&lt;/P&gt;&lt;P class=""&gt;&lt;/P&gt;&lt;P class=""&gt;Again, in order to implement a firmware update ( as in AN4533) I need to be able to swap once I have already swapped and block 0 is&amp;nbsp; on UPPER. Actually I have already done that with the old SDK but does not work anymore since migrated to the new sdk.&lt;/P&gt;&lt;P class=""&gt;&lt;/P&gt;&lt;P class=""&gt;Thank you in advance for your support,&lt;/P&gt;&lt;P class=""&gt;Roberto&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Oct 2018 10:48:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-SDK/SWAP-does-not-work-from-UPPER-on-SDK-2-4-1-flash-driver/m-p/847074#M1140</guid>
      <dc:creator>robertoquilez</dc:creator>
      <dc:date>2018-10-30T10:48:25Z</dc:date>
    </item>
    <item>
      <title>Re: SWAP does not work from UPPER on SDK 2.4.1 flash driver?</title>
      <link>https://community.nxp.com/t5/MCUXpresso-SDK/SWAP-does-not-work-from-UPPER-on-SDK-2-4-1-flash-driver/m-p/847075#M1141</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Are you sure you erase the high address block before the second swap?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have tested it many times and it can be swap normally.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You'd better send me the code you tested, I can't reproduce your mistake now.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Ding&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Oct 2018 11:54:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-SDK/SWAP-does-not-work-from-UPPER-on-SDK-2-4-1-flash-driver/m-p/847075#M1141</guid>
      <dc:creator>nxf42424</dc:creator>
      <dc:date>2018-10-30T11:54:47Z</dc:date>
    </item>
    <item>
      <title>Re: SWAP does not work from UPPER on SDK 2.4.1 flash driver?</title>
      <link>https://community.nxp.com/t5/MCUXpresso-SDK/SWAP-does-not-work-from-UPPER-on-SDK-2-4-1-flash-driver/m-p/847076#M1142</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ding, thank you very much for your detailed doc.&lt;/P&gt;&lt;P&gt;Please find enclosed&amp;nbsp; my source code and a similar document to yours with the results I get.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Oct 2018 15:12:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-SDK/SWAP-does-not-work-from-UPPER-on-SDK-2-4-1-flash-driver/m-p/847076#M1142</guid>
      <dc:creator>robertoquilez</dc:creator>
      <dc:date>2018-10-30T15:12:23Z</dc:date>
    </item>
    <item>
      <title>Re: SWAP does not work from UPPER on SDK 2.4.1 flash driver?</title>
      <link>https://community.nxp.com/t5/MCUXpresso-SDK/SWAP-does-not-work-from-UPPER-on-SDK-2-4-1-flash-driver/m-p/847077#M1143</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think you can try IAR platform download and debug the flash_swap, &amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Nov 2018 06:43:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-SDK/SWAP-does-not-work-from-UPPER-on-SDK-2-4-1-flash-driver/m-p/847077#M1143</guid>
      <dc:creator>nxf42424</dc:creator>
      <dc:date>2018-11-08T06:43:15Z</dc:date>
    </item>
    <item>
      <title>Re: SWAP does not work from UPPER on SDK 2.4.1 flash driver?</title>
      <link>https://community.nxp.com/t5/MCUXpresso-SDK/SWAP-does-not-work-from-UPPER-on-SDK-2-4-1-flash-driver/m-p/847078#M1144</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Roberto, were you able to find a solution to this issue?&amp;nbsp; I'm having the same troubles with SDK 2.4.2.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Nov 2018 14:52:42 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-SDK/SWAP-does-not-work-from-UPPER-on-SDK-2-4-1-flash-driver/m-p/847078#M1144</guid>
      <dc:creator>knovinger</dc:creator>
      <dc:date>2018-11-12T14:52:42Z</dc:date>
    </item>
    <item>
      <title>Re: SWAP does not work from UPPER on SDK 2.4.1 flash driver?</title>
      <link>https://community.nxp.com/t5/MCUXpresso-SDK/SWAP-does-not-work-from-UPPER-on-SDK-2-4-1-flash-driver/m-p/847079#M1145</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry, but I do not understand how trying with IAR might help. MCUXpresso seems to do the job.&lt;/P&gt;&lt;P&gt;Debug the flash_swap is what I am doing from more than a month now without any result.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Nov 2018 09:22:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-SDK/SWAP-does-not-work-from-UPPER-on-SDK-2-4-1-flash-driver/m-p/847079#M1145</guid>
      <dc:creator>robertoquilez</dc:creator>
      <dc:date>2018-11-13T09:22:58Z</dc:date>
    </item>
    <item>
      <title>Re: SWAP does not work from UPPER on SDK 2.4.1 flash driver?</title>
      <link>https://community.nxp.com/t5/MCUXpresso-SDK/SWAP-does-not-work-from-UPPER-on-SDK-2-4-1-flash-driver/m-p/847080#M1146</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Kevin, sadly I am still blocked with this issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am still looking for somebody to &lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt;confirm that it is possible to swap back once swapped using the MK26 with SDK 2.4.1&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is really a pity because it blocks all my developments as it breaks the firmware update feature.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is good to know that I am not alone in the desert. Please come back to this thread if you do any progress.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Nov 2018 09:31:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-SDK/SWAP-does-not-work-from-UPPER-on-SDK-2-4-1-flash-driver/m-p/847080#M1146</guid>
      <dc:creator>robertoquilez</dc:creator>
      <dc:date>2018-11-13T09:31:53Z</dc:date>
    </item>
    <item>
      <title>Re: SWAP does not work from UPPER on SDK 2.4.1 flash driver?</title>
      <link>https://community.nxp.com/t5/MCUXpresso-SDK/SWAP-does-not-work-from-UPPER-on-SDK-2-4-1-flash-driver/m-p/847081#M1147</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Some more information from my struggles.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IDE = MCUXpresso v10.2.1&lt;/P&gt;&lt;P&gt;MCU = Kinetis MK64FN1M0xxxx12&lt;/P&gt;&lt;P&gt;SDK = v2.4.2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was able to capture an error while performing the swap.&amp;nbsp;&amp;nbsp;My process is to first flash the device thru BDM, then allow the device to run the app as intended.&amp;nbsp; I first checked the FlashSwap state machine and would find it to be in the Uninitialized state, as expected.&amp;nbsp; I would then enter our In-System-Programming process thru an external UART.&amp;nbsp; Upon loading a new flash image to Flash Block 1 (upper block), the app would request the flash swap, then reboot the device. After boot, the newly loaded app version took affect.&amp;nbsp; So, swap attempt one worked.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, prior to attempting swap 2, I checked the FlashSwap state machine. Instead of being in the Ready state, it was in the Update state.&amp;nbsp; I connected the debugger to the running target and set a break point just prior to the call to&amp;nbsp;FLASH_Swap.&amp;nbsp; I then commenced with our ISP process and awaited the break.&amp;nbsp; Once at the break point, i proceeded to step thru the FLASH_Swap routine at which time I received error 103 (kStatus_FTFx_AccessError) after the call to FTFx_CMD_Erase under the kFTFxSwapStateUpdate case.&amp;nbsp; From the K64 reference manual, "&lt;EM&gt;The non-active swap indicator will be checked at the erase verify level and if the check fails, the current swap state will be changed to UPDATE and ACCERR set&lt;/EM&gt;".&amp;nbsp; So, this appears to be the area where something is going wrong.&amp;nbsp; My question is, when is the erase verified?&amp;nbsp; Is verification buried in the supplied driver or is it required as part of user app code?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In order to get something working, I have removed the flash driver files provided with SDK2.4.2 from my project and replaced them with the flash driver files used in a previous project from SDK2.2.0 (a KDS project).&amp;nbsp; With these driver files, the process works flawlessly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone clarify the difference between v2.2.0 and v2.4.2 with respect to the flash drivers?&amp;nbsp; Is there additional support required by the user app code for full compatibility with v2.4.2?&amp;nbsp; Are there compiler switches that need to be configured to further define how the v2.4.2 drivers function?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From what I can tell the FLASH_Swap function should be handling everything.&amp;nbsp; But then again, there is no documentation anywhere that I can find which helps to explain it's function.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Nov 2018 20:11:59 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-SDK/SWAP-does-not-work-from-UPPER-on-SDK-2-4-1-flash-driver/m-p/847081#M1147</guid>
      <dc:creator>knovinger</dc:creator>
      <dc:date>2018-11-13T20:11:59Z</dc:date>
    </item>
    <item>
      <title>Re: SWAP does not work from UPPER on SDK 2.4.1 flash driver?</title>
      <link>https://community.nxp.com/t5/MCUXpresso-SDK/SWAP-does-not-work-from-UPPER-on-SDK-2-4-1-flash-driver/m-p/847082#M1148</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 have test SDK2.4.1 TWR-K65 flash swap with&amp;nbsp;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;MCUXpresso v10.2.1, and it is successful ,&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;last time I test SDK2.4.1 flash swap haveProduced some strange mistakes，&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;May be due to the low version of the IDE.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Nov 2018 06:21:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-SDK/SWAP-does-not-work-from-UPPER-on-SDK-2-4-1-flash-driver/m-p/847082#M1148</guid>
      <dc:creator>nxf42424</dc:creator>
      <dc:date>2018-11-14T06:21:44Z</dc:date>
    </item>
    <item>
      <title>Re: SWAP does not work from UPPER on SDK 2.4.1 flash driver?</title>
      <link>https://community.nxp.com/t5/MCUXpresso-SDK/SWAP-does-not-work-from-UPPER-on-SDK-2-4-1-flash-driver/m-p/847083#M1149</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 you need to reinstall a newer IDE,&lt;/P&gt;&lt;P&gt;I have test the SDK2.4.1 flash swap on the TWR-K65F180 platform with MCUXpresso v10.2.1&lt;/P&gt;&lt;P&gt;Aan it is successful,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Nov 2018 06:29:20 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-SDK/SWAP-does-not-work-from-UPPER-on-SDK-2-4-1-flash-driver/m-p/847083#M1149</guid>
      <dc:creator>nxf42424</dc:creator>
      <dc:date>2018-11-14T06:29:20Z</dc:date>
    </item>
    <item>
      <title>Re: SWAP does not work from UPPER on SDK 2.4.1 flash driver?</title>
      <link>https://community.nxp.com/t5/MCUXpresso-SDK/SWAP-does-not-work-from-UPPER-on-SDK-2-4-1-flash-driver/m-p/847084#M1150</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ding, thank you for your response.&amp;nbsp; However, I don't understand. I'm already running v10.2.1.&amp;nbsp; Which I understand to be the latest version.&amp;nbsp; Are you stating that you now have experienced issues with v10.2.1 and SDK 2.4.1?&amp;nbsp; Please clarify.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, most of my testing has been done on a custom board.&amp;nbsp; However, I started further testing on a FRDMK64 until I inadvertently locked the flash by disabling mass erase.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Nov 2018 14:14:54 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-SDK/SWAP-does-not-work-from-UPPER-on-SDK-2-4-1-flash-driver/m-p/847084#M1150</guid>
      <dc:creator>knovinger</dc:creator>
      <dc:date>2018-11-14T14:14:54Z</dc:date>
    </item>
    <item>
      <title>Re: SWAP does not work from UPPER on SDK 2.4.1 flash driver?</title>
      <link>https://community.nxp.com/t5/MCUXpresso-SDK/SWAP-does-not-work-from-UPPER-on-SDK-2-4-1-flash-driver/m-p/847085#M1151</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;nbsp;can I look your code, I don't know how you operate. I have not&amp;nbsp;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;experienced that,&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;I don't understand &amp;nbsp;how you "&lt;SPAN&gt;locked the flash by disabling mass erase&lt;/SPAN&gt;", have you operate correctly?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Nov 2018 08:13:19 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-SDK/SWAP-does-not-work-from-UPPER-on-SDK-2-4-1-flash-driver/m-p/847085#M1151</guid>
      <dc:creator>nxf42424</dc:creator>
      <dc:date>2018-11-15T08:13:19Z</dc:date>
    </item>
    <item>
      <title>Re: SWAP does not work from UPPER on SDK 2.4.1 flash driver?</title>
      <link>https://community.nxp.com/t5/MCUXpresso-SDK/SWAP-does-not-work-from-UPPER-on-SDK-2-4-1-flash-driver/m-p/847086#M1152</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for your response, Ding, but from the beginning I have been using&amp;nbsp;MCUXpresso v10.2.1 (the latest version to my knowledge).&lt;/P&gt;&lt;P&gt;I see that you can swap twice with the&amp;nbsp;TWR-K65F180, nevertheless either of us is using this&amp;nbsp; MCU exactly.&lt;/P&gt;&lt;P&gt;Could be possible that this issue only concerns&amp;nbsp;the&amp;nbsp; MK26 (my case) or MK64 (as Kevin's)?&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Nov 2018 10:00:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-SDK/SWAP-does-not-work-from-UPPER-on-SDK-2-4-1-flash-driver/m-p/847086#M1152</guid>
      <dc:creator>robertoquilez</dc:creator>
      <dc:date>2018-11-19T10:00:35Z</dc:date>
    </item>
    <item>
      <title>Re: SWAP does not work from UPPER on SDK 2.4.1 flash driver?</title>
      <link>https://community.nxp.com/t5/MCUXpresso-SDK/SWAP-does-not-work-from-UPPER-on-SDK-2-4-1-flash-driver/m-p/847087#M1153</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi have you tested successful with &amp;nbsp;&amp;nbsp;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;IDE = MCUXpresso v10.2.1&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Nov 2018 11:44:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-SDK/SWAP-does-not-work-from-UPPER-on-SDK-2-4-1-flash-driver/m-p/847087#M1153</guid>
      <dc:creator>nxf42424</dc:creator>
      <dc:date>2018-11-19T11:44:12Z</dc:date>
    </item>
  </channel>
</rss>

