<?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 MK22FN512 flash security in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/MK22FN512-flash-security/m-p/855424#M51299</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I use&amp;nbsp;NXP_Kinetis_Bootloader_2_0_0\targets\MK22F51212\kds\freedom_bootloader flash resident bootloader and my app on MK22FN512.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What is the correct Flash Configuration value (address 0x400 - 0x40F)&amp;nbsp; for me if I want:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;mass erase enabled&lt;/P&gt;&lt;P&gt;backdoor disabled&lt;/P&gt;&lt;P&gt;nxp factory access denied&lt;/P&gt;&lt;P&gt;flash memory readback protection enabled (there is no way anybody can read my app's code using jtag, ezport, bootloader api or anything else)&lt;/P&gt;&lt;P&gt;ezport disabled&lt;/P&gt;&lt;P&gt;update application firmware using the bootloader&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried to set it to:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;.section .FlashConfig, "a"&lt;BR /&gt; .long 0xFFFFFFFF&lt;BR /&gt; .long 0xFFFFFFFF&lt;BR /&gt; .long 0xFFFFFFFF&lt;BR /&gt; .long 0xFFFFF908&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This way KinetisFlashTool shows that the security state is "SECURED" and the update of my app is not possible:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Updating image......&lt;BR /&gt;Error: Update image failed(Command disallowed when security is enabled.).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Martin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 26 Mar 2019 22:00:55 GMT</pubDate>
    <dc:creator>dusek_martin</dc:creator>
    <dc:date>2019-03-26T22:00:55Z</dc:date>
    <item>
      <title>MK22FN512 flash security</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/MK22FN512-flash-security/m-p/855424#M51299</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I use&amp;nbsp;NXP_Kinetis_Bootloader_2_0_0\targets\MK22F51212\kds\freedom_bootloader flash resident bootloader and my app on MK22FN512.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What is the correct Flash Configuration value (address 0x400 - 0x40F)&amp;nbsp; for me if I want:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;mass erase enabled&lt;/P&gt;&lt;P&gt;backdoor disabled&lt;/P&gt;&lt;P&gt;nxp factory access denied&lt;/P&gt;&lt;P&gt;flash memory readback protection enabled (there is no way anybody can read my app's code using jtag, ezport, bootloader api or anything else)&lt;/P&gt;&lt;P&gt;ezport disabled&lt;/P&gt;&lt;P&gt;update application firmware using the bootloader&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried to set it to:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;.section .FlashConfig, "a"&lt;BR /&gt; .long 0xFFFFFFFF&lt;BR /&gt; .long 0xFFFFFFFF&lt;BR /&gt; .long 0xFFFFFFFF&lt;BR /&gt; .long 0xFFFFF908&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This way KinetisFlashTool shows that the security state is "SECURED" and the update of my app is not possible:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Updating image......&lt;BR /&gt;Error: Update image failed(Command disallowed when security is enabled.).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Martin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Mar 2019 22:00:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/MK22FN512-flash-security/m-p/855424#M51299</guid>
      <dc:creator>dusek_martin</dc:creator>
      <dc:date>2019-03-26T22:00:55Z</dc:date>
    </item>
    <item>
      <title>Re: MK22FN512 flash security</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/MK22FN512-flash-security/m-p/855425#M51300</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Martin,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; About the flash configuration field in your code:&lt;/P&gt;&lt;P&gt;.section .FlashConfig, "a"&lt;BR /&gt; .long 0xFFFFFFFF&lt;BR /&gt; .long 0xFFFFFFFF&lt;BR /&gt; .long 0xFFFFFFFF&lt;BR /&gt; .long 0xFFFFF908&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp; it is according to this picture:&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_12.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/72686iE2685D256507398F/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_12.png" alt="pastedImage_12.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;So, you configure the 0X40C as 0X08, it is 0b00001000&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_13.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/72721i58350A48330AA8B9/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_13.png" alt="pastedImage_13.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;So, you really configure your code as secured mode.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;But don't worry, you still enable the mass erase, now you can use the JLINK commander, and input: unlock kinetis&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;do the mass erase to unlock it.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;If you want to protect the flash, you need to configure 0X408-0X40b, this is the program flash protection bytes.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;Wish it helps you!&lt;/P&gt;&lt;P&gt;Have a great day,&lt;BR /&gt;Kerry&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&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 style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- We are following threads for 7 weeks 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>Wed, 27 Mar 2019 10:57:59 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/MK22FN512-flash-security/m-p/855425#M51300</guid>
      <dc:creator>kerryzhou</dc:creator>
      <dc:date>2019-03-27T10:57:59Z</dc:date>
    </item>
    <item>
      <title>Re: MK22FN512 flash security</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/MK22FN512-flash-security/m-p/855426#M51301</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kerry,&lt;/P&gt;&lt;P&gt;the problem with configuring flash security in bootloader this way:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;.section .FlashConfig, "a"&lt;/SPAN&gt;&lt;BR style="color: #51626f; background-color: #ffffff;" /&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;.long 0xFFFFFFFF&lt;/SPAN&gt;&lt;BR style="color: #51626f; background-color: #ffffff;" /&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;.long 0xFFFFFFFF&lt;/SPAN&gt;&lt;BR style="color: #51626f; background-color: #ffffff;" /&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;.long 0xFFFFFFFF&lt;/SPAN&gt;&lt;BR style="color: #51626f; background-color: #ffffff;" /&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;.long 0xFFFFF908&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;is that I can't update my app using flash resident bootloader (KinetisFlashTool.exe), because KinetisFlashTool.exe outputs:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Updating image......&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Error: Update image failed(Command disallowed when security is enabled.).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;(if I don't secure my chip then the update works)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;So, how to secure my chip and at the same time be able to update my app using bootloader?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Mar 2019 14:29:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/MK22FN512-flash-security/m-p/855426#M51301</guid>
      <dc:creator>dusek_martin</dc:creator>
      <dc:date>2019-03-27T14:29:37Z</dc:date>
    </item>
    <item>
      <title>Re: MK22FN512 flash security</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/MK22FN512-flash-security/m-p/855427#M51302</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Martin,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Thank you for your udpated information.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Please try to secure the chip, but don't configure flash protection, whether it works OK or not?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Please also give me the KinetisFlashTool screen shot about your question.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;Kerry&lt;/P&gt;&lt;P&gt;&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;&lt;/P&gt;&lt;P&gt;- We are following threads for 7 weeks 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>Thu, 28 Mar 2019 07:10:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/MK22FN512-flash-security/m-p/855427#M51302</guid>
      <dc:creator>kerryzhou</dc:creator>
      <dc:date>2019-03-28T07:10:34Z</dc:date>
    </item>
    <item>
      <title>Re: MK22FN512 flash security</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/MK22FN512-flash-security/m-p/855428#M51303</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As far as i know this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;.section .FlashConfig, "a"&lt;/SPAN&gt;&lt;BR style="color: #51626f; background-color: #ffffff;" /&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;.long 0xFFFFFFFF&lt;/SPAN&gt;&lt;BR style="color: #51626f; background-color: #ffffff;" /&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;.long 0xFFFFFFFF&lt;/SPAN&gt;&lt;BR style="color: #51626f; background-color: #ffffff;" /&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;.long 0xFFFFFFFF&lt;/SPAN&gt;&lt;BR style="color: #51626f; background-color: #ffffff;" /&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;.long 0xFFFFF908&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;will set FPROT to ones which means unprotected flash areas. And it will secure the chip as you confirmed earlier. So I don't understand yours: "&lt;SPAN&gt;Please try to secure the chip, but don't configuration flash protect, whether it works OK or not?&lt;/SPAN&gt;"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;This is printscreen of KinetisFlashTool:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="printscreen.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/74226i5E9B13ECD7AD6881/image-size/large?v=v2&amp;amp;px=999" role="button" title="printscreen.png" alt="printscreen.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;I also tried to set "Erase All to Unlock" without success - obviously, as this is probably trying to mass erase the device and it would mass erase also the bootloader which is at the beginning of the flash memory. I don't want to use backdoor key.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Mar 2019 08:34:20 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/MK22FN512-flash-security/m-p/855428#M51303</guid>
      <dc:creator>dusek_martin</dc:creator>
      <dc:date>2019-03-28T08:34:20Z</dc:date>
    </item>
    <item>
      <title>Re: MK22FN512 flash security</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/MK22FN512-flash-security/m-p/855429#M51304</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Martin,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; It's my fault, you didn't enable the flash protection function.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Please give me your K22 chip full name, I need to check whether the flash bootloader can be used as your chip, as you know, K22 have a lot of chip, different chip have different feature.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; The bootloader code is mainly used for the FRDM-K22f120m board and the twr-k22f120m board.&lt;/P&gt;&lt;P&gt;&amp;nbsp; If you are using the same chip as FRDM-K22 board, please check the bootloader project, do you use the debug mode or the release mode? When the chip is secured, you need to select "Erase All to unlock", if you select this item, do you still have the same log in your above reply?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;Kerry&lt;/P&gt;&lt;P&gt;&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;&lt;/P&gt;&lt;P&gt;- We are following threads for 7 weeks 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>Fri, 29 Mar 2019 07:13:01 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/MK22FN512-flash-security/m-p/855429#M51304</guid>
      <dc:creator>kerryzhou</dc:creator>
      <dc:date>2019-03-29T07:13:01Z</dc:date>
    </item>
    <item>
      <title>Re: MK22FN512 flash security</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/MK22FN512-flash-security/m-p/855430#M51305</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It is MK22FN512VLL12&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The bootloader can be for sure used on MK22FN512VLL12 or you want to tell me that your bootloader can be used only for one specific K22 MCU?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I use release mode. I repeat: bootloader works just fine, the problem is only with flash security settings.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Erase All to unlock causes:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Start update progress......&lt;BR /&gt;Unlock device by ERASEALL......&lt;BR /&gt;Error: Unlock device failed(FlashEraseAllUnsecure isn't supported!).&lt;BR /&gt;Update process is stopped by error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Obviously, the bootloader doesn't want to erase itself...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you don't know answer to my issue, please can you pass it to another competent engineer?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Mar 2019 07:45:04 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/MK22FN512-flash-security/m-p/855430#M51305</guid>
      <dc:creator>dusek_martin</dc:creator>
      <dc:date>2019-03-29T07:45:04Z</dc:date>
    </item>
    <item>
      <title>Re: MK22FN512 flash security</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/MK22FN512-flash-security/m-p/855431#M51306</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Martin,&lt;/P&gt;&lt;P&gt;&amp;nbsp; Please take easy!&lt;/P&gt;&lt;P&gt;&amp;nbsp; I already test it on my side, I can reproduce your problem now.&lt;/P&gt;&lt;P&gt;&amp;nbsp; So, I check it with our MCUBOOT R&amp;amp;D team this afternoon.&lt;/P&gt;&lt;P&gt;&amp;nbsp; I have got that, the flash bootloader don't have the unlock function, the EraseAll to Unlock is used for the kinetis chip which contains the ROM bootloader.&lt;/P&gt;&lt;P&gt;&amp;nbsp;K22 and K64 don't have the ROM bootloader, so it just use the flashbootloader.&lt;/P&gt;&lt;P&gt;So, they recommend me to use the backdoor key to unlock the flashbootloader.&lt;/P&gt;&lt;P&gt;&amp;nbsp;Now, follow me to use the backdoor key, and secure the flash bootloader.&lt;/P&gt;&lt;P&gt;1. In the flash bootloader&lt;/P&gt;&lt;P&gt;&amp;nbsp; 1)Set the backdoor key, take an example:&lt;/P&gt;&lt;P&gt;BackDoorK0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; EQU&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x1&lt;BR /&gt;BackDoorK1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; EQU&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x1&lt;BR /&gt;BackDoorK2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; EQU&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x1&lt;BR /&gt;BackDoorK3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; EQU&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x1&lt;BR /&gt;BackDoorK4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; EQU&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x1&lt;BR /&gt;BackDoorK5&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; EQU&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x1&lt;BR /&gt;BackDoorK6&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; EQU&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x1&lt;BR /&gt;BackDoorK7&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; EQU&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x1&lt;/P&gt;&lt;P&gt;2) FSEC enable the backdoor key and secure the chip&lt;/P&gt;&lt;P&gt;FSEC&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; EQU&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0xbf&lt;/P&gt;&lt;P&gt;2. In the KinetisFlashTool, please do it like this:&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/66570i04D852F44817042D/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;Now, it works perfectly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please try it on your side.&lt;/P&gt;&lt;P&gt;Any updated information from your side, please kindly let me know.&lt;BR /&gt;Have a great day,&lt;BR /&gt;Kerry&lt;/P&gt;&lt;P&gt;&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;&lt;/P&gt;&lt;P&gt;- We are following threads for 7 weeks 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>Fri, 29 Mar 2019 09:28:52 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/MK22FN512-flash-security/m-p/855431#M51306</guid>
      <dc:creator>kerryzhou</dc:creator>
      <dc:date>2019-03-29T09:28:52Z</dc:date>
    </item>
    <item>
      <title>Re: MK22FN512 flash security</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/MK22FN512-flash-security/m-p/855432#M51307</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm sorry, but after 3 posts I had feeling that you still don't understand the issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As I wrote in post 2 or 3, I don't want to use backdoor key.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, it seems that the conclusion is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If we want:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) secure the MCU so nobody is able to read contents of flash - either via JTAG, ezport, or bootloader (if there&amp;nbsp;is read command implemented in flash resident bootloder - I don't know). Backdoor key is not an option in&amp;nbsp;this case&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) update firmware using flash resident bootloader.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then this is not possible.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To be honest, I don't understand why the flash resident bootloader can't erase and reprogram flash of secured device. This is perfectly possible and it seems it is just not implemented in your bootloader.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Mar 2019 12:35:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/MK22FN512-flash-security/m-p/855432#M51307</guid>
      <dc:creator>dusek_martin</dc:creator>
      <dc:date>2019-03-29T12:35:49Z</dc:date>
    </item>
    <item>
      <title>Re: MK22FN512 flash security</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/MK22FN512-flash-security/m-p/855433#M51308</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Martin,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; You are right, the flash bootloader is designed like that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Why the bootloader can't erase and reprogram flash of secured device, it is also the flash bootloader function designed result. I have checked this confusion with our bootloader R&amp;amp;D department in the last week. They told me, just don't let the MCU have the risk in the secured mode.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; So, if you want to let the flash bootloader still work, you totally can modify the flash bootloader source code by yourself.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; From the chip function side, you can do it, because as you know, the secure just relate to the SWD interface. But the bootloader UART interface, if your bootloader code don't have limitation, you still can do it.&lt;/P&gt;&lt;P&gt;&amp;nbsp; Now, if you have interest, you totally can modify the flash bootloader by yourself, if you even don't want to use the back door key. The back door key which I told you, just give you the method to let it work with the exist flash bootloader.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;Kerry&lt;/P&gt;&lt;P&gt;&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;&lt;/P&gt;&lt;P&gt;- We are following threads for 7 weeks 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, 01 Apr 2019 08:48:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/MK22FN512-flash-security/m-p/855433#M51308</guid>
      <dc:creator>kerryzhou</dc:creator>
      <dc:date>2019-04-01T08:48:14Z</dc:date>
    </item>
    <item>
      <title>Re: MK22FN512 flash security</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/MK22FN512-flash-security/m-p/855434#M51309</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kerry,&lt;/P&gt;&lt;P&gt;thank you. Finally we got to the point. I apologize for my impatience.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I modified bl_command.c:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; kCommandsAllowedWhenSecure = (HAS_CMD(kCommandTag_FlashSecurityDisable) | HAS_CMD(kCommandTag_GetProperty) |&lt;BR /&gt; HAS_CMD(kCommandTag_Reset) | HAS_CMD(kCommandTag_SetProperty) | HAS_CMD(kCommandTag_ReceiveSbFile) | HAS_CMD(kCommandTag_FlashEraseRegion) | HAS_CMD(kCommandTag_WriteMemory))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Apr 2019 10:21:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/MK22FN512-flash-security/m-p/855434#M51309</guid>
      <dc:creator>dusek_martin</dc:creator>
      <dc:date>2019-04-01T10:21:46Z</dc:date>
    </item>
    <item>
      <title>Re: MK22FN512 flash security</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/MK22FN512-flash-security/m-p/855435#M51310</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Martin,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Now, after the modification, do you make it work on your side?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;Kerry&lt;/P&gt;&lt;P&gt;&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;&lt;/P&gt;&lt;P&gt;- We are following threads for 7 weeks 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>Tue, 02 Apr 2019 01:58:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/MK22FN512-flash-security/m-p/855435#M51310</guid>
      <dc:creator>kerryzhou</dc:creator>
      <dc:date>2019-04-02T01:58:25Z</dc:date>
    </item>
    <item>
      <title>Re: MK22FN512 flash security</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/MK22FN512-flash-security/m-p/855436#M51311</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, it works for me, I can't see any unexpected behaviour.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you also confirm that this modification will work as intended?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Apr 2019 10:23:41 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/MK22FN512-flash-security/m-p/855436#M51311</guid>
      <dc:creator>dusek_martin</dc:creator>
      <dc:date>2019-04-02T10:23:41Z</dc:date>
    </item>
    <item>
      <title>Re: MK22FN512 flash security</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/MK22FN512-flash-security/m-p/855437#M51312</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Martin,&lt;/P&gt;&lt;P&gt;&amp;nbsp; Do you just modify the enum _secure_commands located at line 111 in file bl_command.c?&lt;/P&gt;&lt;PRE class="language-c line-numbers"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;enum&lt;/SPAN&gt; _secure_commands
&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
    &lt;SPAN class="comment token"&gt;//! @brief Bitmask of commands allowed when flash security is enabled.&lt;/SPAN&gt;
    &lt;SPAN class="comment token"&gt;//!&lt;/SPAN&gt;
    &lt;SPAN class="comment token"&gt;//! This bitmask uses the same format as the AvailableCommands property. This is,&lt;/SPAN&gt;
    &lt;SPAN class="comment token"&gt;//! the bit number for a given command is the command's tag value minus one.&lt;/SPAN&gt;
  &lt;SPAN class="comment token"&gt;/*  kCommandsAllowedWhenSecure = (HAS_CMD(kCommandTag_FlashSecurityDisable) | HAS_CMD(kCommandTag_GetProperty) |
                                  HAS_CMD(kCommandTag_Reset) | HAS_CMD(kCommandTag_SetProperty) |
                                  HAS_CMD(kCommandTag_FlashEraseAllUnsecure) | HAS_CMD(kCommandTag_ReceiveSbFile))
*/&lt;/SPAN&gt;
    kCommandsAllowedWhenSecure &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;HAS_CMD&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;kCommandTag_FlashSecurityDisable&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;|&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;HAS_CMD&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;kCommandTag_GetProperty&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;|&lt;/SPAN&gt;
                                  &lt;SPAN class="token function"&gt;HAS_CMD&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;kCommandTag_Reset&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;|&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;HAS_CMD&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;kCommandTag_SetProperty&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;|&lt;/SPAN&gt; 
                                 &lt;SPAN class="token function"&gt;HAS_CMD&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;kCommandTag_ReceiveSbFile&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;|&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;HAS_CMD&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;kCommandTag_FlashEraseRegion&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;|&lt;/SPAN&gt; 
                                 &lt;SPAN class="token function"&gt;HAS_CMD&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;kCommandTag_WriteMemory&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; 
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp; Then your Erase All to unlock in the KinetisFlashTool can work?&lt;/P&gt;&lt;P&gt;&amp;nbsp; I tried this point, it can't work on my side.&lt;/P&gt;&lt;P&gt;Have a great day,&lt;BR /&gt;Kerry&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&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 style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- We are following threads for 7 weeks 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>Wed, 03 Apr 2019 03:07:45 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/MK22FN512-flash-security/m-p/855437#M51312</guid>
      <dc:creator>kerryzhou</dc:creator>
      <dc:date>2019-04-03T03:07:45Z</dc:date>
    </item>
    <item>
      <title>Re: MK22FN512 flash security</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/MK22FN512-flash-security/m-p/855438#M51313</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, I modified that (for me it is on line 117, I use NXP_Kinetis_Bootloader_2_0_0).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;No, you can't do erase all to unlock, this operation is not allowed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I just select update file and perform update. Sector erase operation and flash write is allowed.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Apr 2019 07:22:57 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/MK22FN512-flash-security/m-p/855438#M51313</guid>
      <dc:creator>dusek_martin</dc:creator>
      <dc:date>2019-04-03T07:22:57Z</dc:date>
    </item>
    <item>
      <title>Re: MK22FN512 flash security</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/MK22FN512-flash-security/m-p/855439#M51314</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Martin,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; You are right, if not select the erase all to unlock, it works ok, this is my test result:&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/79132i5700AB12F1D26647/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;You can use it now.&lt;/P&gt;&lt;P&gt;Thanks a lot for your effort.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;Kerry&lt;/P&gt;&lt;P&gt;&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;&lt;/P&gt;&lt;P&gt;- We are following threads for 7 weeks 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>Wed, 03 Apr 2019 07:39:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/MK22FN512-flash-security/m-p/855439#M51314</guid>
      <dc:creator>kerryzhou</dc:creator>
      <dc:date>2019-04-03T07:39:25Z</dc:date>
    </item>
  </channel>
</rss>

