<?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: KL17: Updating bootloader from application fails with erased flash in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/KL17-Updating-bootloader-from-application-fails-with-erased/m-p/1353353#M61671</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/178437"&gt;@Alexander_S&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;It sounds really weird. Did you check the FTFA+FSEC[SEC] bit after a power cycle? If this field is 00 or 11, the flash is secured, then you can't read flash.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Jing&lt;/P&gt;</description>
    <pubDate>Mon, 11 Oct 2021 08:18:38 GMT</pubDate>
    <dc:creator>jingpan</dc:creator>
    <dc:date>2021-10-11T08:18:38Z</dc:date>
    <item>
      <title>KL17: Updating bootloader from application fails with erased flash</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/KL17-Updating-bootloader-from-application-fails-with-erased/m-p/1350479#M61633</link>
      <description>&lt;P&gt;Dear community,&lt;/P&gt;&lt;P&gt;When trying to update the bootloader from the application (not vice versa) in the internal flash of a MKL17Z128 (M0+ core, 128 kB flash), the flash content is shown correctly via the debugger interface directly after flashing. But after a reset or power cycle the complete flash is erased, zero page, bootloader and application area.&lt;/P&gt;&lt;P&gt;What I did was relocating and adapting the existing bootloader to be an application, which then in turn is used to update the bootloader. Also, updating the application from the bootloader, with identical flash routines, works fine. I use flash-routines placed in RAM and interrupts are disabled during flashing. The exact same code works fine, when updating the vectors page or when updating the application from the bootloader. But something fails when updating the bootloader area from the application.&lt;/P&gt;&lt;P&gt;Flash memory layout is as follows:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;0x0 - 0x400: vectors page&lt;/LI&gt;&lt;LI&gt;0x400 - 0x6000: uTasker serial bootloader area&lt;/LI&gt;&lt;LI&gt;0x6000 - end: application area&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Working set-up is a MKL17Z128, MCUXpresso 13, Segger J-Link connected via SWD, UART doing Modbus for the software update on the target.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When updating the bootloader, at first, the updater-application is loaded into the target via the bootloader. Then, the updater-app takes over, and, to secure the process against power loss during flashing, re-writes the vector page so it always is started after power-up. Up to this point everything works fine and reproducible.&lt;/P&gt;&lt;P&gt;Then, the updater-app clears the bootloader area and starts writing the new bootloader. From here things get weird. Even if I only clear the area, but do not write anything to the flash, the flash memory shown by Segger's J-mem seems to be as&amp;nbsp; expected, but after reset, a power cycle, or sometimes just by disconnecting and re-connecting the software connection to the debugger (not the SWD cable), the flash is shown as erased. This is correct as the target won't boot anymore and the bootloader needs to be flashed again.&lt;/P&gt;&lt;P&gt;I also tried to re-start the target with the bootloader updating app installed to make sure, the correct interrupt vectors are active. But it did not change the result.&lt;/P&gt;&lt;P&gt;The problem is, why is the flash content erased after the reset, but shows the correct content before? Is it the debugger connection showing incorrect information, or is it the µC and it's flash controller going amok?&lt;/P&gt;&lt;P&gt;Another thing I did not find out is, why is the vector page mostly empty and the VTOR set to 0x0, although there are interrupt routines which obviously work correct? I studied the documentation from NXP and ARM about the Cortex-M, the M0+ and the Armv6-M architecture reference manual, but did not find the missing link here.&lt;/P&gt;&lt;P&gt;Any hints for where to look for the problem are greatly welcome. &lt;LI-EMOJI id="lia_slightly-smiling-face" title=":slightly_smiling_face:"&gt;&lt;/LI-EMOJI&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Alexander&lt;/P&gt;</description>
      <pubDate>Tue, 05 Oct 2021 09:11:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/KL17-Updating-bootloader-from-application-fails-with-erased/m-p/1350479#M61633</guid>
      <dc:creator>Alexander_S</dc:creator>
      <dc:date>2021-10-05T09:11:08Z</dc:date>
    </item>
    <item>
      <title>Re: KL17: Updating bootloader from application fails with erased flash</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/KL17-Updating-bootloader-from-application-fails-with-erased/m-p/1353353#M61671</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/178437"&gt;@Alexander_S&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;It sounds really weird. Did you check the FTFA+FSEC[SEC] bit after a power cycle? If this field is 00 or 11, the flash is secured, then you can't read flash.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Jing&lt;/P&gt;</description>
      <pubDate>Mon, 11 Oct 2021 08:18:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/KL17-Updating-bootloader-from-application-fails-with-erased/m-p/1353353#M61671</guid>
      <dc:creator>jingpan</dc:creator>
      <dc:date>2021-10-11T08:18:38Z</dc:date>
    </item>
    <item>
      <title>Re: KL17: Updating bootloader from application fails with erased flash</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/KL17-Updating-bootloader-from-application-fails-with-erased/m-p/1353449#M61673</link>
      <description>&lt;P&gt;Hi Jing,&lt;/P&gt;&lt;P&gt;Thanks for your answer. I do not apply Flash security at the moment, so if the bits are set, it should have happened as a failure. I'll check it though as soon as possible.&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Alexander&lt;/P&gt;</description>
      <pubDate>Mon, 11 Oct 2021 09:57:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/KL17-Updating-bootloader-from-application-fails-with-erased/m-p/1353449#M61673</guid>
      <dc:creator>Alexander_S</dc:creator>
      <dc:date>2021-10-11T09:57:36Z</dc:date>
    </item>
    <item>
      <title>Re: KL17: Updating bootloader from application fails with erased flash</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/KL17-Updating-bootloader-from-application-fails-with-erased/m-p/1354875#M61689</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/61241"&gt;@jingpan&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;thank you for your reply. The register contains 10 after (and before) power cycle. So that does not seem to be the problem.&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;Alexander&lt;/P&gt;</description>
      <pubDate>Wed, 13 Oct 2021 09:57:59 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/KL17-Updating-bootloader-from-application-fails-with-erased/m-p/1354875#M61689</guid>
      <dc:creator>Alexander_S</dc:creator>
      <dc:date>2021-10-13T09:57:59Z</dc:date>
    </item>
    <item>
      <title>Re: KL17: Updating bootloader from application fails with erased flash</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/KL17-Updating-bootloader-from-application-fails-with-erased/m-p/1355477#M61700</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/178437"&gt;@Alexander_S&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;Can you give a example project? This sounds really interesting.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Jing&lt;/P&gt;</description>
      <pubDate>Thu, 14 Oct 2021 03:09:59 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/KL17-Updating-bootloader-from-application-fails-with-erased/m-p/1355477#M61700</guid>
      <dc:creator>jingpan</dc:creator>
      <dc:date>2021-10-14T03:09:59Z</dc:date>
    </item>
    <item>
      <title>Re: KL17: Updating bootloader from application fails with erased flash</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/KL17-Updating-bootloader-from-application-fails-with-erased/m-p/1355619#M61703</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/132744"&gt;@jing&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The project is an adaptation of SW licensed from&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/1431"&gt;@mjbcswitzerland&lt;/a&gt;, so I'd need to ask for his permission or support, before I can send the complete project.&lt;/P&gt;&lt;P&gt;Also, I have only 5 days left at my current company and I'm not sure, how much time my successor will have to invest in this problem. But the bootloader-updater is needed anyway, so chances are there, that it will be pursued.&lt;/P&gt;&lt;P&gt;Let me update my reply, when I heard Mark (&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/1431"&gt;@mjbcswitzerland&lt;/a&gt;) and/or my colleague.&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;Alexander&lt;/P&gt;</description>
      <pubDate>Thu, 14 Oct 2021 07:05:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/KL17-Updating-bootloader-from-application-fails-with-erased/m-p/1355619#M61703</guid>
      <dc:creator>Alexander_S</dc:creator>
      <dc:date>2021-10-14T07:05:53Z</dc:date>
    </item>
    <item>
      <title>Re: KL17: Updating bootloader from application fails with erased flash</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/KL17-Updating-bootloader-from-application-fails-with-erased/m-p/1355831#M61708</link>
      <description>&lt;P&gt;Hi Alexander&lt;BR /&gt;&lt;BR /&gt;It is Ok for you to supply the project source to NXP.&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Oct 2021 12:07:52 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/KL17-Updating-bootloader-from-application-fails-with-erased/m-p/1355831#M61708</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2021-10-14T12:07:52Z</dc:date>
    </item>
  </channel>
</rss>

