<?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: Software reset causes system freeze but BKPT causes correct reset in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Software-reset-causes-system-freeze-but-BKPT-causes-correct/m-p/355056#M17679</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Chris&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The same code is shown in a few other threads reporting difficulties, although I don't see an actual explanation as to why.&lt;/P&gt;&lt;P&gt;The simplified version is also seen sometimes (as solution) and I have used it myself for about 7 years on many Cortex Ms (including Kinetis KE,KV, KL and Ks) without any issues.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;At a guess I would suggest that&lt;/P&gt;&lt;P&gt;i &amp;amp;= 0x0000ffff;&lt;/P&gt;&lt;P&gt;is dangerous since the bits 0x0000003 are write-only and if they "were" to read back '1' and not zero the command would be bad.&lt;/P&gt;&lt;P&gt;ARM writes that these bits should be written only with '0' since they are reserved for debug usage and a write with '1' could cause unpredicatable behaviour: &lt;A href="http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0552a/Cihehdge.html" title="http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0552a/Cihehdge.html"&gt;ARM Information Center&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i &amp;amp;= 0x00000300 would be theoretically correct (to preserve the interrupt priority grouping field) but since you are resetting it is also not really of any relevance.&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 class="jive-link-external-small" data-content-finding="Community" href="http://www.utasker.com/kinetis.html" target="_blank"&gt;µTasker Kinetis 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>Fri, 27 Mar 2015 00:47:47 GMT</pubDate>
    <dc:creator>mjbcswitzerland</dc:creator>
    <dc:date>2015-03-27T00:47:47Z</dc:date>
    <item>
      <title>Software reset causes system freeze but BKPT causes correct reset</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Software-reset-causes-system-freeze-but-BKPT-causes-correct/m-p/355053#M17676</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have some diagnostic code that writes flash when a problem is detected then tries to reset the system on a K10 device.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I do a SW reset with the following, the system hangs:&lt;/P&gt;&lt;P&gt;unsigned int i;&lt;/P&gt;&lt;P&gt;asm(" CPSID i"); //DisableInterrupts;&lt;/P&gt;&lt;P&gt;asm(" DSB ");&lt;/P&gt;&lt;P&gt;i = SCB_AIRCR;&lt;/P&gt;&lt;P&gt;i &amp;amp;= 0x0000ffff;&lt;/P&gt;&lt;P&gt;SCB_AIRCR = (i | 0x05FA0004);&lt;/P&gt;&lt;P&gt;asm(" DSB ");&lt;/P&gt;&lt;P&gt;asm (" NOP ");&lt;/P&gt;&lt;P&gt;while(1){};&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If, instead, I use a BKPT 0xFF, the system resets fine (when not connected to a debugger of course).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can use the BKPT approach for production code but would like to understand why the SW reset could cause the hang?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Mar 2015 17:51:59 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Software-reset-causes-system-freeze-but-BKPT-causes-correct/m-p/355053#M17676</guid>
      <dc:creator>chris_f</dc:creator>
      <dc:date>2015-03-26T17:51:59Z</dc:date>
    </item>
    <item>
      <title>Re: Software reset causes system freeze but BKPT causes correct reset</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Software-reset-causes-system-freeze-but-BKPT-causes-correct/m-p/355054#M17677</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Chris&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just do&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SCB_AIRCR = 0x05FA0004;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;while (1) {}&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and you should have no problems.&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;&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>Thu, 26 Mar 2015 20:20:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Software-reset-causes-system-freeze-but-BKPT-causes-correct/m-p/355054#M17677</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2015-03-26T20:20:13Z</dc:date>
    </item>
    <item>
      <title>Re: Software reset causes system freeze but BKPT causes correct reset</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Software-reset-causes-system-freeze-but-BKPT-causes-correct/m-p/355055#M17678</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Mark, I'll try that tomorrow.&lt;/P&gt;&lt;P&gt;I don't recall where the reset code I was using originated.&lt;/P&gt;&lt;P&gt;I can't see the disable interrupts causing the problem.&lt;/P&gt;&lt;P&gt;The DSB (Data Synchronisation Barrier) instruction could conceivably hang.&lt;/P&gt;&lt;P&gt;Do you think that's the problem?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Mar 2015 21:12:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Software-reset-causes-system-freeze-but-BKPT-causes-correct/m-p/355055#M17678</guid>
      <dc:creator>chris_f</dc:creator>
      <dc:date>2015-03-26T21:12:24Z</dc:date>
    </item>
    <item>
      <title>Re: Software reset causes system freeze but BKPT causes correct reset</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Software-reset-causes-system-freeze-but-BKPT-causes-correct/m-p/355056#M17679</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Chris&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The same code is shown in a few other threads reporting difficulties, although I don't see an actual explanation as to why.&lt;/P&gt;&lt;P&gt;The simplified version is also seen sometimes (as solution) and I have used it myself for about 7 years on many Cortex Ms (including Kinetis KE,KV, KL and Ks) without any issues.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;At a guess I would suggest that&lt;/P&gt;&lt;P&gt;i &amp;amp;= 0x0000ffff;&lt;/P&gt;&lt;P&gt;is dangerous since the bits 0x0000003 are write-only and if they "were" to read back '1' and not zero the command would be bad.&lt;/P&gt;&lt;P&gt;ARM writes that these bits should be written only with '0' since they are reserved for debug usage and a write with '1' could cause unpredicatable behaviour: &lt;A href="http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0552a/Cihehdge.html" title="http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0552a/Cihehdge.html"&gt;ARM Information Center&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i &amp;amp;= 0x00000300 would be theoretically correct (to preserve the interrupt priority grouping field) but since you are resetting it is also not really of any relevance.&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 class="jive-link-external-small" data-content-finding="Community" href="http://www.utasker.com/kinetis.html" target="_blank"&gt;µTasker Kinetis 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>Fri, 27 Mar 2015 00:47:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Software-reset-causes-system-freeze-but-BKPT-causes-correct/m-p/355056#M17679</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2015-03-27T00:47:47Z</dc:date>
    </item>
    <item>
      <title>Re: Software reset causes system freeze but BKPT causes correct reset</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Software-reset-causes-system-freeze-but-BKPT-causes-correct/m-p/355057#M17680</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks again, Mark.&lt;/P&gt;&lt;P&gt;That fixed it.&lt;/P&gt;&lt;P&gt;Chris&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Mar 2015 11:55:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Software-reset-causes-system-freeze-but-BKPT-causes-correct/m-p/355057#M17680</guid>
      <dc:creator>chris_f</dc:creator>
      <dc:date>2015-03-27T11:55:31Z</dc:date>
    </item>
  </channel>
</rss>

