<?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>Kinetis MicrocontrollersのトピックRe: why would a hard-fault be generated during a flash sector erase on the KL28?</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/why-would-a-hard-fault-be-generated-during-a-flash-sector-erase/m-p/793654#M48288</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Trevor,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I replicated the issue on my side by copying your function in the pflash example that it's in the KL28 SDK (using MCUXpresso) and I was able to run the project with or without the nop so I have the following comments:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Are you able to know the address of the highlighted instruction in the following snippet? I believe is not an issue caused by the nop I think your function is not returning correctly.&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/73213i80054480284C64F2/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;&lt;/P&gt;&lt;P&gt;-As you can see in the following snippet when I run the project I get the next instructions in disassembly and there are some differences, the highlighted instructions is the one that exits the function.&lt;/P&gt;&lt;P&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/73214iD7BD337115DC420D/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;&lt;/P&gt;&lt;P&gt;I hope this is useful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Felipe&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 31 Jul 2018 20:40:17 GMT</pubDate>
    <dc:creator>FelipeGarcia</dc:creator>
    <dc:date>2018-07-31T20:40:17Z</dc:date>
    <item>
      <title>why would a hard-fault be generated during a flash sector erase on the KL28?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/why-would-a-hard-fault-be-generated-during-a-flash-sector-erase/m-p/793653#M48287</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I wonder if you might be able to help me with a problem I am having here using the KL28..&lt;/P&gt;&lt;P&gt;Basically, I am&amp;nbsp; using a function to erase a sector of flash on the KL28, the function is running from RAM (and code is generated using GCC compiler)..&lt;/P&gt;&lt;P&gt;If I run the function as shown below without a “nop” instruction at the end of the function I get a ‘hard-fault’ generated.. I can’t figure out why the ‘nop’ &amp;nbsp;instruction would have any effect..&lt;/P&gt;&lt;P&gt;I have compared the disassembly with and without the ‘nop’ and its pretty much the same…&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's the function..&amp;nbsp;&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/66691iEB59EE2EB8C239F4/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;&lt;/P&gt;&lt;P&gt;here's is the disassembly comparison of the code generated when i insert the 'NOP' versus the when the 'NOP' is removed, they are practically the same except for whats shown in the snippet below..&amp;nbsp;&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/66693i0F0E16974A098B17/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;I wonder is there a delay required after issuing the flash cache instruction before returning from the function..&lt;/P&gt;&lt;P&gt;Any help would be much appreciated..&amp;nbsp; I am pulling our hair out here.. :-)&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;Trevor&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Jul 2018 09:48:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/why-would-a-hard-fault-be-generated-during-a-flash-sector-erase/m-p/793653#M48287</guid>
      <dc:creator>trevorhunt</dc:creator>
      <dc:date>2018-07-27T09:48:47Z</dc:date>
    </item>
    <item>
      <title>Re: why would a hard-fault be generated during a flash sector erase on the KL28?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/why-would-a-hard-fault-be-generated-during-a-flash-sector-erase/m-p/793654#M48288</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Trevor,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I replicated the issue on my side by copying your function in the pflash example that it's in the KL28 SDK (using MCUXpresso) and I was able to run the project with or without the nop so I have the following comments:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Are you able to know the address of the highlighted instruction in the following snippet? I believe is not an issue caused by the nop I think your function is not returning correctly.&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/73213i80054480284C64F2/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;&lt;/P&gt;&lt;P&gt;-As you can see in the following snippet when I run the project I get the next instructions in disassembly and there are some differences, the highlighted instructions is the one that exits the function.&lt;/P&gt;&lt;P&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/73214iD7BD337115DC420D/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;&lt;/P&gt;&lt;P&gt;I hope this is useful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Felipe&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Jul 2018 20:40:17 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/why-would-a-hard-fault-be-generated-during-a-flash-sector-erase/m-p/793654#M48288</guid>
      <dc:creator>FelipeGarcia</dc:creator>
      <dc:date>2018-07-31T20:40:17Z</dc:date>
    </item>
  </channel>
</rss>

