<?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のトピックHard Fault on Memory Write K64F</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-Fault-on-Memory-Write-K64F/m-p/585257#M34544</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am currently doing development on a custom boot-loader for my K64F, and I noted a hard fault when writing in certain memory locations.&amp;nbsp; In this case, there are two portions of an S19 that when flashed cause a hard fault.&amp;nbsp; these two lines are&lt;/P&gt;&lt;P&gt;53 33 0D 00 04 57 EC 00 00 00 00 01 14 00 00 96&lt;/P&gt;&lt;P&gt;followed by the second line&lt;/P&gt;&lt;P&gt;53 33 29 00 04 57 F4 EC 57 04 00 00 A0 00 20 08 00 00 00 F4 57 04 00 00 05 FF 1F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 06&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;both records seem to align properly, the first address, going to 0x457EC, aligns as two 32 bit values, while the second, at 0x457F4, aligns 9 32 bit values.&amp;nbsp; neither value should overwrite the other, as they are in different 32 bit spaces, which led me to changing my write to take each 32 bit chunk and write it individually to the flash, allowing me to debug which chunk crashes the program.&lt;/P&gt;&lt;P&gt;Write execution followed this order, First packet is sent, both pieces are wrote to their memory locations, 0x457EC, 0x457F0.&amp;nbsp; followed by the second packet being sent.&amp;nbsp; As its sent, the address at 0x457F0 turns red.&amp;nbsp; As "third write occurs", it is erased, and as the next write of the second packet occurs, we hit "hard fault" where the program has crashed.&amp;nbsp; From the variable view, the addresses are being stored correctly, and the U32 i am writing is the correct data to be wrote.&amp;nbsp; Any idea what could be happening?&amp;nbsp; attached are the PNG's referenced, as well as the S19 file i am attempting to flash.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-Thanks&lt;/P&gt;&lt;P&gt;Nate Hinshaw&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Original Attachment has been moved to: &lt;A _jive_internal="true" href="https://community.nxp.com/docs/DOC-337624"&gt;K64FRedLight.afx.S19.zip&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 28 Jun 2016 13:09:32 GMT</pubDate>
    <dc:creator>nhinshaw</dc:creator>
    <dc:date>2016-06-28T13:09:32Z</dc:date>
    <item>
      <title>Hard Fault on Memory Write K64F</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-Fault-on-Memory-Write-K64F/m-p/585257#M34544</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am currently doing development on a custom boot-loader for my K64F, and I noted a hard fault when writing in certain memory locations.&amp;nbsp; In this case, there are two portions of an S19 that when flashed cause a hard fault.&amp;nbsp; these two lines are&lt;/P&gt;&lt;P&gt;53 33 0D 00 04 57 EC 00 00 00 00 01 14 00 00 96&lt;/P&gt;&lt;P&gt;followed by the second line&lt;/P&gt;&lt;P&gt;53 33 29 00 04 57 F4 EC 57 04 00 00 A0 00 20 08 00 00 00 F4 57 04 00 00 05 FF 1F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 06&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;both records seem to align properly, the first address, going to 0x457EC, aligns as two 32 bit values, while the second, at 0x457F4, aligns 9 32 bit values.&amp;nbsp; neither value should overwrite the other, as they are in different 32 bit spaces, which led me to changing my write to take each 32 bit chunk and write it individually to the flash, allowing me to debug which chunk crashes the program.&lt;/P&gt;&lt;P&gt;Write execution followed this order, First packet is sent, both pieces are wrote to their memory locations, 0x457EC, 0x457F0.&amp;nbsp; followed by the second packet being sent.&amp;nbsp; As its sent, the address at 0x457F0 turns red.&amp;nbsp; As "third write occurs", it is erased, and as the next write of the second packet occurs, we hit "hard fault" where the program has crashed.&amp;nbsp; From the variable view, the addresses are being stored correctly, and the U32 i am writing is the correct data to be wrote.&amp;nbsp; Any idea what could be happening?&amp;nbsp; attached are the PNG's referenced, as well as the S19 file i am attempting to flash.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-Thanks&lt;/P&gt;&lt;P&gt;Nate Hinshaw&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Original Attachment has been moved to: &lt;A _jive_internal="true" href="https://community.nxp.com/docs/DOC-337624"&gt;K64FRedLight.afx.S19.zip&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Jun 2016 13:09:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-Fault-on-Memory-Write-K64F/m-p/585257#M34544</guid>
      <dc:creator>nhinshaw</dc:creator>
      <dc:date>2016-06-28T13:09:32Z</dc:date>
    </item>
    <item>
      <title>Re: Hard Fault on Memory Write K64F</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-Fault-on-Memory-Write-K64F/m-p/585258#M34545</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;It sounds as though you are not respecting the K64's phrase programming requirement (16 bytes aligned) and so if you write two long word straddling a phrase it will cause Flash corruption and hard faults on subsequent reads from the phrase. This requires an erase to recover the Flash sector.&lt;/P&gt;&lt;P&gt;It is best to add a small RAM buffer to collect the phrases and then program each as it becomes full so that there is no dependency on the SREC content and the actual Flash programming operation is transparent to the application layer.&lt;/P&gt;&lt;P&gt;I have attached the Flash driver from the uTasker project as reference which does this (compatible with all K, KE, KL, KV etc. parts) so no porting is required when moving between devices.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Alernatively you can get a complete solution [industrially proven in many custom K64 projects]&amp;nbsp; with UART SREC, iHex, KBOOT, AN2295 developer's loader loading for the K64 from the serial loader project (which also allows SD card, Ethernet, USB-MSD, USB-Kboot, USB-memory stick - also in parallel with UART operation) from &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fwww.utasker.com%2Fkinetis%2FFRDM-K64F.html" rel="nofollow" target="_blank"&gt;http://www.utasker.com/kinetis/FRDM-K64F.html&lt;/A&gt;&lt;SPAN&gt; / &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fwww.utasker.com%2Fkinetis%2FTWR-K64F120M.html" rel="nofollow" target="_blank"&gt;http://www.utasker.com/kinetis/TWR-K64F120M.html&lt;/A&gt;&lt;SPAN&gt; [documentation at &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fwww.utasker.com%2Fdocs%2FuTasker%2FuTaskerSerialLoader.PDF" rel="nofollow" target="_blank"&gt;http://www.utasker.com/docs/uTasker/uTaskerSerialLoader.PDF&lt;/A&gt;&lt;SPAN&gt;].&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Jun 2016 16:08:40 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-Fault-on-Memory-Write-K64F/m-p/585258#M34545</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2016-06-28T16:08:40Z</dc:date>
    </item>
    <item>
      <title>Re: Hard Fault on Memory Write K64F</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-Fault-on-Memory-Write-K64F/m-p/585259#M34546</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sure enough, if I manually align Lines 92 and 93 of the S19 file from&lt;/P&gt;&lt;P&gt;S30D000457EC000000000114000096 and&lt;/P&gt;&lt;P&gt;S329000457F4EC57040000A0002008000000F45704000005FF1F0000000000000000000000000000000006&lt;/P&gt;&lt;P&gt;to&lt;/P&gt;&lt;P&gt;S331000457EC0000000001140000EC57040000A1002008000000F45704000005FF1F00000000000000000000000000000000F0&lt;/P&gt;&lt;P&gt;followed by flashing that line as a block&lt;/P&gt;&lt;P&gt;my program flashes and executes just as I would expect.&amp;nbsp; How would i check the srec lines against misalignment?&amp;nbsp; I don't know how to look at the two lines and be aware that they need to be combined&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Best&lt;/P&gt;&lt;P&gt;Nate&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Jun 2016 18:00:07 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-Fault-on-Memory-Write-K64F/m-p/585259#M34546</guid>
      <dc:creator>nhinshaw</dc:creator>
      <dc:date>2016-06-28T18:00:07Z</dc:date>
    </item>
    <item>
      <title>Re: Hard Fault on Memory Write K64F</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-Fault-on-Memory-Write-K64F/m-p/585260#M34547</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Nate&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is not an SREC issue (you need to be able to accept any alignment) but a programming implementation issue - just save the data to be programmed into a RAM buffer and wait until the buffer fills to a natural size before programming the content to flash and you shouldn't have any problems.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could write a program that takes an SREC input and converts it to an aligned version (filling in any gaps and such) but this is a workaround and is more difficult than correcting the issue at the source.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;P.S. See fnWriteInternalFlash() and its buffer ulFlashRow (declared as below, with FLASH_ROW_SIZE of 8 for the K64)&amp;nbsp; [in the file that I attached] to see how it can be easily done.&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;static unsigned long ulFlashRow[FLASH_ROW_SIZE/sizeof(unsigned long)] = {0}; // FLASH row backup buffer (on long word boundary)&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Jun 2016 18:09:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-Fault-on-Memory-Write-K64F/m-p/585260#M34547</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2016-06-28T18:09:15Z</dc:date>
    </item>
    <item>
      <title>Re: Hard Fault on Memory Write K64F</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-Fault-on-Memory-Write-K64F/m-p/585261#M34548</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for all the help Mark!&lt;/P&gt;&lt;P&gt;-Nate&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Jun 2016 19:56:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-Fault-on-Memory-Write-K64F/m-p/585261#M34548</guid>
      <dc:creator>nhinshaw</dc:creator>
      <dc:date>2016-06-28T19:56:21Z</dc:date>
    </item>
  </channel>
</rss>

