<?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: Hard Fault at MKV42F64VLF16 MCU in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-Fault-at-MKV42F64VLF16-MCU/m-p/1095978#M57852</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;You can follow the Myke's advice. And I want to know, which line causes this problem. Not function, but may be a control of register or any other.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have a great day,&lt;BR /&gt;TIC&lt;/P&gt;&lt;P&gt;-------------------------------------------------------------------------------&lt;BR /&gt;Note:&lt;BR /&gt;- If this post answers your question, please click the "Mark Correct" button. Thank you!&lt;/P&gt;&lt;P&gt;- We are following threads for 7 days after the last post, later replies are ignored&lt;BR /&gt;Please open a new thread and refer to the closed one, if you have a related question at a later point in time.&lt;BR /&gt;-------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 17 Aug 2020 01:18:15 GMT</pubDate>
    <dc:creator>nxf56274</dc:creator>
    <dc:date>2020-08-17T01:18:15Z</dc:date>
    <item>
      <title>Hard Fault at MKV42F64VLF16 MCU</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-Fault-at-MKV42F64VLF16-MCU/m-p/1095976#M57850</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Evreyone&lt;/P&gt;&lt;P&gt;I am continuously encountering Hard Fault on&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;MKV42F64VLF16 MCU when connecting&amp;nbsp;easing flash page&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;result = FLASH_Erase(&amp;amp;s_flashDriver, destAdrss, pflashSectorSize, kFTFx_ApiEraseKey);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;result = FLASH_Erase(&amp;amp;s_flashDriver, destAdrss, pflashSectorSize, kFTFx_ApiEraseKey);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;any ideas about the reason? or a solution?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Many Thanks for the cooperation&lt;/SPAN&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/114713iF711941EDA491F7D/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;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 16 Aug 2020 18:35:27 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-Fault-at-MKV42F64VLF16-MCU/m-p/1095976#M57850</guid>
      <dc:creator>amerzater</dc:creator>
      <dc:date>2020-08-16T18:35:27Z</dc:date>
    </item>
    <item>
      <title>Re: Hard Fault at MKV42F64VLF16 MCU</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-Fault-at-MKV42F64VLF16-MCU/m-p/1095977#M57851</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A class="jx-jive-macro-user" href="https://community.nxp.com/people/amerzater"&gt;amerzater&lt;/A&gt;‌,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Before anybody can make a determination could you show your initialization code for "s_flashDriver" and what is the value for "destAdrss"?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The initialization code (for FreeRTOS applications) that I use is:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;&amp;nbsp; /* Clean up Flash driver Structure*/&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;&amp;nbsp; memset(&amp;amp;s_flashDriver, 0, sizeof(flash_config_t));&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;&amp;nbsp; memset(&amp;amp;s_cacheDriver, 0, sizeof(ftfx_cache_config_t));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;&amp;nbsp; /* Setup flash driver structure for device and initialize variables. */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;&amp;nbsp; if (kStatus_FLASH_Success != (result = FLASH_Init(&amp;amp;s_flashDriver))) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;#if (2 != SDK_DEBUGCONSOLE)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;&amp;nbsp; &amp;nbsp; PRINTF("\nFailed to Initialize Flash File System - Error %i"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;, result);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;#endif&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;&amp;nbsp; &amp;nbsp; vTaskSuspend(NULL);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;&amp;nbsp; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;&amp;nbsp; if (kStatus_FTFx_Success != (result = FTFx_CACHE_Init(&amp;amp;s_cacheDriver))) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;#if (2 != SDK_DEBUGCONSOLE)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;&amp;nbsp; &amp;nbsp; PRINTF("\nFailed to Initialize Flash File System Cache - Error %i"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;, result);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;#endif&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;&amp;nbsp; &amp;nbsp; vTaskSuspend(NULL);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;&amp;nbsp; }&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: inherit;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;This is basically taken directly from the example code.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;myke&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 16 Aug 2020 19:26:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-Fault-at-MKV42F64VLF16-MCU/m-p/1095977#M57851</guid>
      <dc:creator>myke_predko</dc:creator>
      <dc:date>2020-08-16T19:26:16Z</dc:date>
    </item>
    <item>
      <title>Re: Hard Fault at MKV42F64VLF16 MCU</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-Fault-at-MKV42F64VLF16-MCU/m-p/1095978#M57852</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;You can follow the Myke's advice. And I want to know, which line causes this problem. Not function, but may be a control of register or any other.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have a great day,&lt;BR /&gt;TIC&lt;/P&gt;&lt;P&gt;-------------------------------------------------------------------------------&lt;BR /&gt;Note:&lt;BR /&gt;- If this post answers your question, please click the "Mark Correct" button. Thank you!&lt;/P&gt;&lt;P&gt;- We are following threads for 7 days after the last post, later replies are ignored&lt;BR /&gt;Please open a new thread and refer to the closed one, if you have a related question at a later point in time.&lt;BR /&gt;-------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Aug 2020 01:18:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-Fault-at-MKV42F64VLF16-MCU/m-p/1095978#M57852</guid>
      <dc:creator>nxf56274</dc:creator>
      <dc:date>2020-08-17T01:18:15Z</dc:date>
    </item>
    <item>
      <title>Re: Hard Fault at MKV42F64VLF16 MCU</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-Fault-at-MKV42F64VLF16-MCU/m-p/1095979#M57853</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Good Day Mr. &lt;A class="jx-jive-macro-user" href="https://community.nxp.com/people/mykepredkomimetics"&gt;mykepredkomimetics&lt;/A&gt;‌&lt;/P&gt;&lt;P&gt;Many Thanks for your help&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;here is my FlashDriver Initializing Code&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro" style="color: #51626f; border-width: 0px 0px 0px 2px; border-style: initial initial initial solid; border-color: initial initial initial #cccccc; font-size: 14px; margin: 10px 0px; padding: 10px 20px;"&gt;&lt;P&gt;memset(&amp;amp;s_flashDriver, 0, sizeof(flash_config_t));&lt;BR /&gt;memset(&amp;amp;s_cacheDriver, 0, sizeof(ftfx_cache_config_t));&lt;/P&gt;&lt;P&gt;/* Setup flash driver structure for device and initialize variables. */&lt;BR /&gt;&lt;STRONG&gt;result = FLASH_Init(&amp;amp;s_flashDriver);&lt;/STRONG&gt;&lt;BR /&gt;if (kStatus_FTFx_Success != result)&lt;BR /&gt;{&lt;BR /&gt;retRes=-1;&lt;BR /&gt;}&lt;BR /&gt;/* Setup flash cache driver structure for device and initialize variables. */&lt;BR /&gt;&lt;STRONG&gt;result = FTFx_CACHE_Init(&amp;amp;s_cacheDriver);&lt;/STRONG&gt;&lt;BR /&gt;if (kStatus_FTFx_Success != result)&lt;BR /&gt;{&lt;BR /&gt;retRes=-2;&lt;BR /&gt;}&lt;BR /&gt;/* Get flash properties*/&lt;BR /&gt;&lt;STRONG&gt;FLASH_GetProperty(&amp;amp;s_flashDriver, kFLASH_PropertyPflash0BlockBaseAddr, &amp;amp;pflashBlockBase);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;FLASH_GetProperty(&amp;amp;s_flashDriver, kFLASH_PropertyPflash0TotalSize, &amp;amp;pflashTotalSize);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;FLASH_GetProperty(&amp;amp;s_flashDriver, kFLASH_PropertyPflash0SectorSize, &amp;amp;pflashSectorSize);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&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;retRes=-3;&lt;BR /&gt;}&lt;BR /&gt;if (kFTFx_SecurityStateNotSecure == securityStatus)&lt;BR /&gt;{&lt;BR /&gt;/* Pre-preparation work about flash Cache/Prefetch/Speculation. */&lt;BR /&gt;FTFx_CACHE_ClearCachePrefetchSpeculation(&amp;amp;s_cacheDriver, true);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* Erase a sector from destAdrss. */&lt;BR /&gt;#if defined(FSL_FEATURE_FLASH_HAS_PFLASH_BLOCK_SWAP) &amp;amp;&amp;amp; FSL_FEATURE_FLASH_HAS_PFLASH_BLOCK_SWAP&lt;BR /&gt;/* Note: we should make sure that the sector shouldn't be swap indicator sector*/&lt;BR /&gt;destAdrss = pflashBlockBase + (pflashTotalSize - (SECTOR_INDEX_FROM_END * pflashSectorSize * 2));&lt;BR /&gt;#else&lt;BR /&gt;&lt;STRONG&gt;destAdrss = pflashBlockBase + (pflashTotalSize - (SECTOR_INDEX_FROM_END * pflashSectorSize));&lt;/STRONG&gt;&lt;BR /&gt;#endif&lt;/P&gt;&lt;P&gt;result = FLASH_Erase(&amp;amp;s_flashDriver, destAdrss, pflashSectorSize, kFTFx_ApiEraseKey);&lt;BR /&gt;if (kStatus_FTFx_Success != result)&lt;BR /&gt;{&lt;BR /&gt;retRes=-4;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;/* Verify sector if it's been erased. */&lt;BR /&gt;result = FLASH_VerifyErase(&amp;amp;s_flashDriver, destAdrss, pflashSectorSize, kFTFx_MarginValueUser);&lt;BR /&gt;if (kStatus_FTFx_Success != result)&lt;BR /&gt;{&lt;BR /&gt;retRes=-5;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;/* Post-preparation work about flash Cache/Prefetch/Speculation. */&lt;BR /&gt;FTFx_CACHE_ClearCachePrefetchSpeculation(&amp;amp;s_cacheDriver, false);&lt;/P&gt;&lt;P style="border: 0px; font-weight: inherit; font-size: 14px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Aug 2020 16:52:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-Fault-at-MKV42F64VLF16-MCU/m-p/1095979#M57853</guid>
      <dc:creator>amerzater</dc:creator>
      <dc:date>2020-08-17T16:52:44Z</dc:date>
    </item>
    <item>
      <title>Re: Hard Fault at MKV42F64VLF16 MCU</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-Fault-at-MKV42F64VLF16-MCU/m-p/1095980#M57854</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A class="jx-jive-macro-user" href="https://community.nxp.com/people/amerzater"&gt;amerzater&lt;/A&gt;‌,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Looking at your code - it looks like it was taken from the "pflash" example - correct?&amp;nbsp; What board example did you get that from?&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm asking because I want to make sure that:&lt;/P&gt;&lt;P&gt;a) You're working with the same SDK between the example and your device.&amp;nbsp; I found that if I'm running with SDK 2.7.0 on a Freedom board, I need to use the FLASH_Erase method call:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;if (kStatus_FLASH_Success != (status = FLASH_Erase(&amp;amp;s_flashDriver&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; , sector&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; , FSL_FEATURE_FLASH_PFLASH_BLOCK_SECTOR_SIZE&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; , kFTFx_ApiEraseKey))) {&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;but if it's on my product (SDK 2.3.1), I need to use the FLASH_Erase method call:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;if (kStatus_FLASH_Success != (status = FLASH_Erase(&amp;amp;s_flashDriver&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; , sector&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; , FSL_FEATURE_FLASH_PFLASH_BLOCK_SECTOR_SIZE&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; , kFLASH_ApiEraseKey))) {&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Not a lot of difference, but one works and one doesn't.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;b) You're not having an issue with the board swap keep out flash block (Sorry, I don't know the&amp;nbsp;MKV42 as intimately as I know the K2x series).&amp;nbsp; How are you verifying "destAdrss"?&amp;nbsp; What if you set "destAdrss" to the start of the block after the end of your code?&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;c) You loaded the "flash" driver when you created the project and aren't copying in the flash.c/.h and associated files from anywhere else.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;d) When you compile, do you get any errors or warnings?&amp;nbsp; If so, what are they?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;myke&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Aug 2020 18:21:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-Fault-at-MKV42F64VLF16-MCU/m-p/1095980#M57854</guid>
      <dc:creator>myke_predko</dc:creator>
      <dc:date>2020-08-17T18:21:50Z</dc:date>
    </item>
    <item>
      <title>Re: Hard Fault at MKV42F64VLF16 MCU</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-Fault-at-MKV42F64VLF16-MCU/m-p/1095981#M57855</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;Mr &lt;A class="jx-jive-macro-user" href="https://community.nxp.com/people/mykepredkomimetics"&gt;mykepredkomimetics&lt;/A&gt;‌&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;yes I've taken these Functions from Pflash Example of another board example but it was using the same SDK&amp;nbsp;&lt;/LI&gt;&lt;LI&gt;I have copied the flash driver files from that example project and placed in my already existing project.&lt;/LI&gt;&lt;LI&gt;No warnings relating to the flash init or writing code&lt;/LI&gt;&lt;LI&gt;when debugging the project:&amp;nbsp;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;destAdrss&amp;nbsp; variable seems to be correct (right at the beginning of the last page)&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;I didnt understand your meaning by :&amp;nbsp;&lt;STRONG&gt;&amp;nbsp;the board swap keep out flash block. could you please explain ?&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Aug 2020 14:53:05 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-Fault-at-MKV42F64VLF16-MCU/m-p/1095981#M57855</guid>
      <dc:creator>amerzater</dc:creator>
      <dc:date>2020-08-18T14:53:05Z</dc:date>
    </item>
    <item>
      <title>Re: Hard Fault at MKV42F64VLF16 MCU</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-Fault-at-MKV42F64VLF16-MCU/m-p/1095982#M57856</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey &lt;A class="jx-jive-macro-user" href="https://community.nxp.com/people/amerzater"&gt;amerzater&lt;/A&gt;‌,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A couple of things - could you try a new project with "flash" selected in the "drivers" selection?&amp;nbsp; A number of people (including me) have seen problems when you copy driver files into a project rather than build the project with them and have MCUXpresso configure them.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I look at your code, "desAdrss" will not be "&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;right at the beginning of the last page&lt;/SPAN&gt;", it looks like it will be at the last&amp;nbsp;sector in Flash.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I asked about the "swap" function as it uses the last block in Flash - the "swap" function allows the two blocks to switch ("swap") start addresses in the memory map so that an application's firmware can be updated in the field (without any programming equipment).&amp;nbsp; The function uses the last sector in each block for saving boot/configuration information - It looks like you are erasing the last sector in Flash, which is the last sector in Block 1.&amp;nbsp; I had some issues with erasing/writing to those two blocks in the past and now I just avoid them all together.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you try a new project (with the "flash" driver specified) and then copy in your application code to see what happens?&amp;nbsp; If&amp;nbsp;there is still a problem, could I suggest that you set "destAdrss" to the start of Block 1 using the code:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;uint32_t blockSize;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;&amp;nbsp; FLASH_GetProperty(&amp;amp;s_flashDriver&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; , kFLASH_PropertyPflash0BlockSize&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; , &amp;amp;blockSize);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;&amp;nbsp; destAdrss = blockSize;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;myke&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Aug 2020 21:12:40 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-Fault-at-MKV42F64VLF16-MCU/m-p/1095982#M57856</guid>
      <dc:creator>myke_predko</dc:creator>
      <dc:date>2020-08-18T21:12:40Z</dc:date>
    </item>
    <item>
      <title>Re: Hard Fault at MKV42F64VLF16 MCU</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-Fault-at-MKV42F64VLF16-MCU/m-p/1095983#M57857</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Mr. &lt;A class="jx-jive-macro-user" href="https://community.nxp.com/people/mykepredkomimetics"&gt;mykepredkomimetics&lt;/A&gt;‌&lt;/P&gt;&lt;P&gt;I found that disabling the interrupts (DisableGlobalIRQ() )&amp;nbsp; before starting the flash write and re-enabling the interrupts after flash write process is finished , solves the problem and no hard fault exception is being&amp;nbsp;thrown..&lt;/P&gt;&lt;P&gt;any idea about the relationship between flash write functions and the interrupt handling procedures.&lt;/P&gt;&lt;P&gt;because finally I need to be able to store my parameters on the flash while the mcu interrupts are fucntioning..&lt;/P&gt;&lt;P&gt;the active interrupts are:&lt;/P&gt;&lt;P&gt;UART0&lt;/P&gt;&lt;P&gt;UART1&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;FTM0&lt;/P&gt;&lt;P&gt;FTM1&lt;/P&gt;&lt;P&gt;FTM2&lt;/P&gt;&lt;P&gt;LPTMR&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Aug 2020 16:54:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-Fault-at-MKV42F64VLF16-MCU/m-p/1095983#M57857</guid>
      <dc:creator>amerzater</dc:creator>
      <dc:date>2020-08-27T16:54:46Z</dc:date>
    </item>
    <item>
      <title>Re: Hard Fault at MKV42F64VLF16 MCU</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-Fault-at-MKV42F64VLF16-MCU/m-p/1095984#M57858</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A class="jx-jive-macro-user" href="https://community.nxp.com/people/amerzater"&gt;amerzater&lt;/A&gt;‌,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That's great news!&amp;nbsp; I'm happy you figured it out and shared it with everybody.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm honestly annoyed with myself that I didn't suggest that you halt interrupts before erase/writes - I know I ws&amp;nbsp;told&amp;nbsp;to &lt;STRONG&gt;ALWAYS DISABLE INTERRUPTS FOR WRITES&lt;/STRONG&gt; years ago to always do it but the example code in the SDKs&amp;nbsp;(ie "pflash") don't disable interrrupts so it didn't ding on me when I was looking at the code.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is my Erase/Write method and you'll notice that I disable interrupts before each write:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;uint32_t flashSectorEraseWrite(uint32_t sector&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;, uint32_t* source) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;uint32_t returnValue = FLASH_RESPONSE_NOERROR;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;status_t status;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;&amp;nbsp; __disable_irq();&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;&amp;nbsp; if (kStatus_FLASH_Success != (status = FLASH_Erase(&amp;amp;s_flashDriver&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;, sector&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;, FSL_FEATURE_FLASH_PFLASH_BLOCK_SECTOR_SIZE&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // , kFLASH_ApiEraseKey))) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;, kFTFx_ApiEraseKey))) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;#if (2 != SDK_DEBUGCONSOLE)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;&amp;nbsp; &amp;nbsp; PRINTF("\nFLASH_Erase returned %i"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;, status);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;#endif&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;&amp;nbsp; &amp;nbsp; returnValue = FLASH_RESPONSE_WRITEFAILURE;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;&amp;nbsp; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;&amp;nbsp; __enable_irq();&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;&amp;nbsp; if (FLASH_RESPONSE_NOERROR == returnValue) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;&amp;nbsp; __disable_irq();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;&amp;nbsp; &amp;nbsp; if (kStatus_FLASH_Success != (status = FLASH_Program(&amp;amp;s_flashDriver&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;, sector&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;, (uint8_t*)source&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;, FSL_FEATURE_FLASH_PFLASH_BLOCK_SECTOR_SIZE))) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;#if (2 != SDK_DEBUGCONSOLE)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; PRINTF("\nFLASH_Program returned %i"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;, status);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;#endif&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; returnValue = FLASH_RESPONSE_WRITEFAILURE;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;&amp;nbsp; &amp;nbsp; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;&amp;nbsp; &amp;nbsp; __enable_irq();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;&amp;nbsp; }&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;&amp;nbsp; return returnValue;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Apologies for not suggesting to disable interrupts - I should have looked at my own code.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Great job figuring out the issue,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;myke&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Aug 2020 18:34:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-Fault-at-MKV42F64VLF16-MCU/m-p/1095984#M57858</guid>
      <dc:creator>myke_predko</dc:creator>
      <dc:date>2020-08-27T18:34:24Z</dc:date>
    </item>
  </channel>
</rss>

