<?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: Initial flash access in KL02Z</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Initial-flash-access-in-KL02Z/m-p/441208#M25859</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Haim&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. I think that they are unsecured but I wouldn't assume anything.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. After a mass erase the chip is unsecured but after a reset it becomes secured again when the Flash configuration is all 0xff. Therefore, the Flash configuration has to be written "after"&amp;nbsp; the mass erase "but" before the reset because that is the only time that it is possible.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. Debuggers do a mass erase and write the Flash configuration to unsecure a device - exactly as the SW needs to do.&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;Kinetis: &lt;A _jive_internal="true" data-content-finding="Community" href="https://community.nxp.com/www.utasker.com/kinetis.html" rel="nofollow" target="_blank"&gt;µTasker Kinetis support&lt;/A&gt; &lt;/P&gt;&lt;P&gt;KL02: &lt;A _jive_internal="true" data-content-finding="Community" href="https://community.nxp.com/www.utasker.com/kinetis/FRDM-KL02Z.html" rel="nofollow" target="_blank"&gt;µTasker FRDM-KL02Z support&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;EM&gt;For the complete "out-of-the-box" Kinetis experience and faster time to market&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 01 Jul 2015 10:38:29 GMT</pubDate>
    <dc:creator>mjbcswitzerland</dc:creator>
    <dc:date>2015-07-01T10:38:29Z</dc:date>
    <item>
      <title>Initial flash access in KL02Z</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Initial-flash-access-in-KL02Z/m-p/441205#M25856</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;I am trying to implement flash configuration functionality on the FRDM-KL02Z board using SWD interface.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;According to the documentation, in order to perform any FTFA flash operation, the CCIF bit in the FTFA_STAT register must be set.&lt;/P&gt;&lt;P&gt;From the bit description:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;The CCIF bit is reset to 0 but is set to 1 by the memory controller at the end of the reset initialization&lt;/EM&gt;&lt;/P&gt;&lt;OL style="list-style-type: lower-alpha;"&gt;&lt;LI&gt;&lt;EM&gt;sequence. Depending on how quickly the read occurs after reset release, the user may or may not see the&lt;/EM&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;EM&gt;0 hardware reset value.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I tried to implement these operations on a board after flash mass erase operation, I saw that the CCIF bit is never being set.&lt;/P&gt;&lt;P&gt;Only after burning a demo firmware using the USB interface, I saw the respond, and the bit was set.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My question is, what is setting this bit? According to the document, the memory controller is supposed to initialize it, so is it firmware related?&lt;/P&gt;&lt;P&gt;I would appreciate if you can provide some explanation about the boot sequence and how it initiates the flash interface.&lt;/P&gt;&lt;P&gt;If I have a new board, how can I access it with no FW uploaded to it?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Jun 2015 16:02:17 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Initial-flash-access-in-KL02Z/m-p/441205#M25856</guid>
      <dc:creator>haimf</dc:creator>
      <dc:date>2015-06-29T16:02:17Z</dc:date>
    </item>
    <item>
      <title>Re: Initial flash access in KL02Z</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Initial-flash-access-in-KL02Z/m-p/441206#M25857</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A mass erase (+ reset) sets the chip's security so no flash operations are possible until the chip is unsecured again.&lt;/P&gt;&lt;P&gt;Loading new code with the debugger will remove the security.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To avoid this, you need to perform a mass erase, followed by writing the Flash configuration to an unsecure state, before resetting and then subsequent Flash operations will not be blocked.&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;Kinetis: &lt;A href="http://www.utasker.com/kinetis.html" title="http://www.utasker.com/kinetis.html"&gt;µTasker Kinetis support&lt;/A&gt; &lt;/P&gt;&lt;P&gt;KL02: &lt;A href="http://www.utasker.com/kinetis/FRDM-KL02Z.html" title="http://www.utasker.com/kinetis/FRDM-KL02Z.html"&gt;µTasker FRDM-KL02Z support&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;EM&gt;For the complete "out-of-the-box" Kinetis experience and faster time to market&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Jun 2015 10:54:40 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Initial-flash-access-in-KL02Z/m-p/441206#M25857</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2015-06-30T10:54:40Z</dc:date>
    </item>
    <item>
      <title>Re: Initial flash access in KL02Z</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Initial-flash-access-in-KL02Z/m-p/441207#M25858</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Mark,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot for the quick reply.&lt;/P&gt;&lt;P&gt;I have 3 follow-up questions:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1.       What is the case of a new (out of the box) uP. Can I assume that it comes unsecured, so I will be able to access the flash?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2.       Why writing the Flash configuration to an unsecure state after mass erase removes the security?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3.       Can you please explain how the debugger removes the security?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Haim&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Jun 2015 13:15:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Initial-flash-access-in-KL02Z/m-p/441207#M25858</guid>
      <dc:creator>haimf</dc:creator>
      <dc:date>2015-06-30T13:15:58Z</dc:date>
    </item>
    <item>
      <title>Re: Initial flash access in KL02Z</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Initial-flash-access-in-KL02Z/m-p/441208#M25859</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Haim&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. I think that they are unsecured but I wouldn't assume anything.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. After a mass erase the chip is unsecured but after a reset it becomes secured again when the Flash configuration is all 0xff. Therefore, the Flash configuration has to be written "after"&amp;nbsp; the mass erase "but" before the reset because that is the only time that it is possible.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. Debuggers do a mass erase and write the Flash configuration to unsecure a device - exactly as the SW needs to do.&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;Kinetis: &lt;A _jive_internal="true" data-content-finding="Community" href="https://community.nxp.com/www.utasker.com/kinetis.html" rel="nofollow" target="_blank"&gt;µTasker Kinetis support&lt;/A&gt; &lt;/P&gt;&lt;P&gt;KL02: &lt;A _jive_internal="true" data-content-finding="Community" href="https://community.nxp.com/www.utasker.com/kinetis/FRDM-KL02Z.html" rel="nofollow" target="_blank"&gt;µTasker FRDM-KL02Z support&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;EM&gt;For the complete "out-of-the-box" Kinetis experience and faster time to market&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Jul 2015 10:38:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Initial-flash-access-in-KL02Z/m-p/441208#M25859</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2015-07-01T10:38:29Z</dc:date>
    </item>
    <item>
      <title>Re: Initial flash access in KL02Z</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Initial-flash-access-in-KL02Z/m-p/441209#M25860</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Haim F:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In addition to Mark's comments, I recommend you to give a check to the next application note about flash programming:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://cache.freescale.com/files/microcontrollers/doc/app_note/AN4835.pdf" title="http://cache.freescale.com/files/microcontrollers/doc/app_note/AN4835.pdf"&gt;http://cache.freescale.com/files/microcontrollers/doc/app_note/AN4835.pdf&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It will resolve many of your doubts.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let us know if you face further questions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards!&lt;/P&gt;&lt;P&gt;Jorge Gonzalez&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Jul 2015 02:50:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Initial-flash-access-in-KL02Z/m-p/441209#M25860</guid>
      <dc:creator>Jorge_Gonzalez</dc:creator>
      <dc:date>2015-07-02T02:50:44Z</dc:date>
    </item>
    <item>
      <title>Re: Initial flash access in KL02Z</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Initial-flash-access-in-KL02Z/m-p/441210#M25861</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: #1f497d;"&gt;Mark and Jorge,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: #1f497d;"&gt;Thanks a lot for your help, it really helped me a lot and I was able to progress.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: #1f497d;"&gt;I followed the document that Jorge attached and used this sequence for the initialization:&lt;/SPAN&gt;&lt;/P&gt;&lt;OL style="list-style-type: decimal;"&gt;&lt;LI&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: #1f497d;"&gt;Keep reset low and establish communication with the ARM DAP. The MDM-AP ID register can be read to verify that &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: #1f497d;"&gt;the connection is working correctly.&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: #1f497d;"&gt;Read the MDM-AP status register until the Flash Ready bit sets.&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: #1f497d;"&gt;Read the System Security bit to determine if security is enabled. If System Security = 0, then proceed. If System &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: #1f497d;"&gt;Security = 1, then communication with the internals of the processor, including the flash, will not be possible without &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: #1f497d;"&gt;issuing a mass erase command or unsecuring the part through other means (backdoor key unlock).&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: #1f497d;"&gt;Write the MDM-AP register to set the Core Hold Reset bit. This will prevent the core from attempting to boot when the &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: #1f497d;"&gt;reset pin is released. NOTE: the Core Hold Reset bit cannot be written if the processor is secured.&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: #1f497d;"&gt;Negate the RESET signal or clear the System Reset Request bit in the MDM-AP control register.&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: #1f497d;"&gt;After doing so, I get the access to the flash registers but when I am trying to burn the image, I still see 2 issues:&lt;/SPAN&gt;&lt;/P&gt;&lt;OL style="list-style-type: decimal;"&gt;&lt;LI&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: #1f497d;"&gt;When I do sector erase, after I erase sector 2 (starting at address 0x400) that contains the flash configuration, the next SWD operation that I do will return with fault ACK (0x4), and I am not able to recover from it.&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: #1f497d;"&gt;When I try to program the flash using multiple Program Long Word commands, after several of these commands I see the Access Error Flag bit in the FSTAT register is set, so that indicated the operation failed. I suspect it is because of some security mode issue, but I am not sure.&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: #1f497d;"&gt;Is there anything else in the initialization sequence that I am missing?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: #1f497d;"&gt;BR,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: #1f497d;"&gt;Haim&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Jul 2015 18:35:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Initial-flash-access-in-KL02Z/m-p/441210#M25861</guid>
      <dc:creator>haimf</dc:creator>
      <dc:date>2015-07-02T18:35:09Z</dc:date>
    </item>
  </channel>
</rss>

