<?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: KW21 256KB with FlexNVM module in Wireless MCU</title>
    <link>https://community.nxp.com/t5/Wireless-MCU/KW21-256KB-with-FlexNVM-module/m-p/413108#M501</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Sean,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It seems that your board is not configured to use Flex-Memory feature. Please note that each mass erase of the chip will set D-FLASH block as normal flash.&lt;/P&gt;&lt;P&gt;Try to use the following code to partition correctly your device:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- define somewhere in NV_Flash.c file the below 2 lines:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;#define gFlashConfigUpdateAddress_c&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x40CuL&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;uint8_t FlashConfig[] = {0xFE, 0xFF, 0xFF, 0xFF};&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Add the following code just after &lt;STRONG&gt;NV_FlashInit(&amp;amp;mNvConfig)&lt;/STRONG&gt; statement:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;if(gNV_OK_c == NV_FlashEraseAllBlock(&amp;amp;mNvConfig))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;{&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; (void)NV_FlashProgramLongword(&amp;amp;mNvConfig, gFlashConfigUpdateAddress_c, 4, (uint32_t)&amp;amp;FlashConfig[0]);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;}&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- After the device mass erase will occur, you will loose the connection with the debugger, which is normal to happen. Close the current debug session and replace the previous lines of code with this one:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;(void)NV_DEFlashPartition(&amp;amp;mNvConfig, gNV_EEPROM_DATASET_SIZE_CODE_c, gNV_EEPROM_BACKUP_SIZE_CODE_c);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Start a new debug session and set a breakpoint at the line above. When the breakpoint is hit, execute this line of code (step over) and then exit the debug session.&lt;/P&gt;&lt;P&gt;- Remove the line above and the definitions from the start. Basically, you should get the same code as was before all these modifications.&lt;/P&gt;&lt;P&gt;- Run your application, it should work now.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please let me know if this solved your issue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mihai&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 18 Nov 2015 09:07:51 GMT</pubDate>
    <dc:creator>mihaidragnea</dc:creator>
    <dc:date>2015-11-18T09:07:51Z</dc:date>
    <item>
      <title>KW21 256KB with FlexNVM module</title>
      <link>https://community.nxp.com/t5/Wireless-MCU/KW21-256KB-with-FlexNVM-module/m-p/413107#M500</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Sir,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I get an issue about KW21 256KB with NVM module.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I created a new example project about ZigBee using BeeKit.&lt;/P&gt;&lt;P&gt;Example is: Ha IASCIE.&lt;/P&gt;&lt;P&gt;Codebase is BeeStack Codebase 4.0.1.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_0.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/30784i85C8E782BCAA4BD4/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_0.png" alt="pastedImage_0.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Target board is TWR-KW21D256.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_1.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/30795i2D3829171975CE92/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_1.png" alt="pastedImage_1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Enable NVM storage module.&lt;/P&gt;&lt;P&gt;And KW21 256 uses FlexNVM as storage.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;#if (gTargetTWR_KW21D256_d == 1)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; #define gNvUseFlexNVM_d TRUE&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;#endif&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_2.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/30796i91D7F445947E650A/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_2.png" alt="pastedImage_2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Enable ZTC.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_3.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/30815i4BA6450CE01CA1E4/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_3.png" alt="pastedImage_3.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The device type is Coordinator.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_4.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/30873i3C985300BDCF97C1/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_4.png" alt="pastedImage_4.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Other settings are default, and export the project to IAR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When run the example, all LEDs are always on.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_5.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/30905i3AF5D3B7E8FAAB0B/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_5.png" alt="pastedImage_5.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I traced the code, it stops at while loop. This means &lt;SPAN style="color: #e23d39;"&gt;&lt;STRONG&gt;NvModuleInit() is failed&lt;/STRONG&gt;&lt;/SPAN&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#if gNvStorageIncluded_d&lt;/P&gt;&lt;P&gt;&amp;nbsp; if (&lt;SPAN style="color: #e23d39;"&gt;&lt;STRONG&gt;NvModuleInit() != gNVM_OK_c&lt;/STRONG&gt;&lt;/SPAN&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;/* NV Module has failed initialization. Lock up node */&lt;/P&gt;&lt;P&gt;TurnOnLeds();&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #e23d39;"&gt;while(1);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;#endif&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I also traced the code more, and found the error point is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; /* Initialize flash HAL driver */&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;NV_FlashInit(&amp;amp;mNvConfig);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#if (gNvUseFlexNVM_d == TRUE) &amp;amp;&amp;amp; (gNV_DEBLOCK_SIZE_c != 0)&amp;nbsp; /* FlexNVM */&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; /* check data flash IFR map */&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="color: red;"&gt;if(mNvConfig.EEEBlockSize == 0)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="color: red;"&gt;&amp;nbsp; {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="color: red;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return gNVM_NvWrongFlashDataIFRMap_c;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="color: red;"&gt;&amp;nbsp; }&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;…&lt;/P&gt;&lt;P style="margin-left: 12.0pt; text-indent: -12.0pt;"&gt;EEEDataSetSize and DEPartitionCode are 0.&lt;/P&gt;&lt;P style="margin-left: 12.0pt; text-indent: -12.0pt;"&gt;FTFL_FCCOB6 and FTFL_FCCOB7 are 0xFF.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_6.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/30906i929C8C6E3C050FF2/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_6.png" alt="pastedImage_6.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I see SIM_FCFG1 register. EESIZE is 0x2 means 4k.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_7.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/30913iFB65D75F9EBC9923/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_7.png" alt="pastedImage_7.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I am confused about the two differences, and why the FlexNVM module initialize failed?&lt;/P&gt;&lt;P&gt;The example code is generated from Beekit, I think it should work normally.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please help to check and resolve this issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;BR,&lt;/P&gt;&lt;P&gt;Sean Wu&lt;/P&gt;&lt;P&gt;Weikeng Inc.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Nov 2015 10:08:45 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Wireless-MCU/KW21-256KB-with-FlexNVM-module/m-p/413107#M500</guid>
      <dc:creator>seanwu</dc:creator>
      <dc:date>2015-11-16T10:08:45Z</dc:date>
    </item>
    <item>
      <title>Re: KW21 256KB with FlexNVM module</title>
      <link>https://community.nxp.com/t5/Wireless-MCU/KW21-256KB-with-FlexNVM-module/m-p/413108#M501</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Sean,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It seems that your board is not configured to use Flex-Memory feature. Please note that each mass erase of the chip will set D-FLASH block as normal flash.&lt;/P&gt;&lt;P&gt;Try to use the following code to partition correctly your device:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- define somewhere in NV_Flash.c file the below 2 lines:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;#define gFlashConfigUpdateAddress_c&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x40CuL&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;uint8_t FlashConfig[] = {0xFE, 0xFF, 0xFF, 0xFF};&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Add the following code just after &lt;STRONG&gt;NV_FlashInit(&amp;amp;mNvConfig)&lt;/STRONG&gt; statement:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;if(gNV_OK_c == NV_FlashEraseAllBlock(&amp;amp;mNvConfig))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;{&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; (void)NV_FlashProgramLongword(&amp;amp;mNvConfig, gFlashConfigUpdateAddress_c, 4, (uint32_t)&amp;amp;FlashConfig[0]);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;}&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- After the device mass erase will occur, you will loose the connection with the debugger, which is normal to happen. Close the current debug session and replace the previous lines of code with this one:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;(void)NV_DEFlashPartition(&amp;amp;mNvConfig, gNV_EEPROM_DATASET_SIZE_CODE_c, gNV_EEPROM_BACKUP_SIZE_CODE_c);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Start a new debug session and set a breakpoint at the line above. When the breakpoint is hit, execute this line of code (step over) and then exit the debug session.&lt;/P&gt;&lt;P&gt;- Remove the line above and the definitions from the start. Basically, you should get the same code as was before all these modifications.&lt;/P&gt;&lt;P&gt;- Run your application, it should work now.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please let me know if this solved your issue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mihai&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Nov 2015 09:07:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Wireless-MCU/KW21-256KB-with-FlexNVM-module/m-p/413108#M501</guid>
      <dc:creator>mihaidragnea</dc:creator>
      <dc:date>2015-11-18T09:07:51Z</dc:date>
    </item>
    <item>
      <title>Re: KW21 256KB with FlexNVM module</title>
      <link>https://community.nxp.com/t5/Wireless-MCU/KW21-256KB-with-FlexNVM-module/m-p/413109#M502</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Sir,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your support, Your method is OK.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And I have resolved the issue before.&lt;/P&gt;&lt;P&gt;My method is add parameter in IAR like below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="font-size: 10.5pt; font-family: 'Arial',sans-serif; background: white;"&gt;In the project options, go to the Download Tab in the Debugger category.&amp;nbsp; Check the box "Override default .board file"&amp;nbsp; Then click the Edit button&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="font-size: 10.5pt; font-family: 'Arial',sans-serif; background: white;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="a.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/23607i6E61367C7B246380/image-size/large?v=v2&amp;amp;px=999" role="button" title="a.png" alt="a.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="font-size: 10.5pt; font-family: 'Arial',sans-serif; background: white;"&gt;Select the memory range for the program flash, starting at address 0x0.&amp;nbsp; Click the Edit button.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="b.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/2000iCC11F5751FC5D1AA/image-size/large?v=v2&amp;amp;px=999" role="button" title="b.png" alt="b.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="font-size: 10.5pt; font-family: 'Arial',sans-serif; background: white;"&gt;In the Extra Parameters field, add &lt;SPAN style="color: red;"&gt;&lt;STRONG&gt;--partition 0x0432&lt;/STRONG&gt;&lt;/SPAN&gt; after –erase_flexNVM.&amp;nbsp; Click OK.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="font-size: 10.5pt; font-family: 'Arial',sans-serif; background: white;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="c.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/2030iD852CDBA5C01923D/image-size/large?v=v2&amp;amp;px=999" role="button" title="c.png" alt="c.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;04: FlexNVM Partition Code(DEPART).&lt;/P&gt;&lt;P&gt;32: EEPROM Data Set Size(3: EEESPLIT, 2: EEESIZE).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;More description about “--partition”:&lt;/P&gt;&lt;P&gt;The "--partition" argument is used to program EEPROM Size and FlexNVM Partition Code in the Data Flash IFR.&lt;/P&gt;&lt;P&gt;The value after"--partition" should be 2 bytes. The LS byte is the EEPROM Size and the MS byte is the FlexNVM Partition Code.&lt;/P&gt;&lt;P&gt;Refer to device data sheet for EEPROM Size and Partition Code settings.&lt;/P&gt;&lt;P&gt;Note1: Using "--partition" arg will erase all program flash memory, data flash memory, data flash IFR space, EEPROM backup memory, and FlexRAM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;BR,&lt;/P&gt;&lt;P&gt;Sean&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Nov 2015 00:52:28 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Wireless-MCU/KW21-256KB-with-FlexNVM-module/m-p/413109#M502</guid>
      <dc:creator>seanwu</dc:creator>
      <dc:date>2015-11-19T00:52:28Z</dc:date>
    </item>
  </channel>
</rss>

