<?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: hard fault with watchdog, bootloader K64 in Kinetis Software Development Kit</title>
    <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/hard-fault-with-watchdog-bootloader-K64/m-p/756430#M7748</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 find solution thaks to &lt;A href="https://community.nxp.com/thread/338114"&gt;https://community.nxp.com/thread/338114&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 27 Jan 2018 16:11:06 GMT</pubDate>
    <dc:creator>PO220</dc:creator>
    <dc:date>2018-01-27T16:11:06Z</dc:date>
    <item>
      <title>hard fault with watchdog, bootloader K64</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/hard-fault-with-watchdog-bootloader-K64/m-p/756427#M7745</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;&lt;SPAN class="" lang="en"&gt;&lt;SPAN class=""&gt;I create a bootloader with a special protocol for a K64&lt;/SPAN&gt;&lt;/SPAN&gt;.&lt;/P&gt;&lt;P&gt;&lt;SPAN class="" lang="en"&gt;&lt;SPAN class=""&gt;I encountered several problems of hard fault before the jump but I solved them by deactivating the modules and their interruptions.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="" lang="en"&gt;&lt;SPAN class=""&gt;I'm using KDS V3.2 with SDK2.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="" lang="en"&gt;&lt;SPAN class=""&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="" lang="en"&gt;&lt;SPAN class=""&gt;&lt;STRONG&gt;Without watchdog&lt;/STRONG&gt; this jump works &lt;STRONG&gt;well &lt;/STRONG&gt;(SD card and USB cdc) :&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;#define USER_APP_ADDRESS&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x00010000&lt;BR /&gt;#define USER_APP_MAX_SIZE&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x000F0000&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;if (*((unsigned long*)USER_APP_ADDRESS) != 0xFFFFFFFF)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp; // Stop usb module and interruptions&lt;BR /&gt;&amp;nbsp;&amp;nbsp; USB_deInit() ;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; //stop all interruptions&lt;BR /&gt;&amp;nbsp;&amp;nbsp; __asm volatile ("cpsid i");&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; // Stop SDcard interruptions and module&lt;BR /&gt;&amp;nbsp;&amp;nbsp; SDHC_DisableInterruptStatus(SDHC, (uint32_t)kSDHC_AllInterruptFlags);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; SDHC_DisableInterruptSignal(SDHC, (uint32_t)kSDHC_AllInterruptFlags);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; DisableIRQ(BOARD_SDHC_IRQ);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; sd_disk_deinit(); &lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; // Stop systick&lt;BR /&gt;&amp;nbsp;&amp;nbsp; SysTick-&amp;gt;CTRL = 0 ; &lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; __DSB(); //Data Synchronization Barrier. &lt;BR /&gt;&amp;nbsp;&amp;nbsp; __ISB(); // Instruction Synchronization Barrier. &lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; //jump&lt;BR /&gt;&amp;nbsp;&amp;nbsp; JumpToUserApplication(*((unsigned long*)USER_APP_ADDRESS), *((unsigned long*)(USER_APP_ADDRESS+4)));&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;void JumpToUserApplication(uint32_t userSP, uint32_t userStartup)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp; __asm("msr msp, r0");&lt;BR /&gt;&amp;nbsp; __asm("msr psp, r0");&lt;BR /&gt;&amp;nbsp; __asm("mov pc,&amp;nbsp; r1");&lt;BR /&gt;}&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN class="" lang="en"&gt;&lt;SPAN class=""&gt;if I activate the watchdog it works very well until the jump (hard fault)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="" lang="en"&gt;&lt;SPAN class=""&gt;&lt;STRONG&gt;if I disable it before the jump it does not change anything&lt;/STRONG&gt; and this does not surprise me since it does not handle interruptions.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="" lang="en"&gt;&lt;SPAN class=""&gt;here is how i activate the watchdog&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;void Activate_wd(void)&lt;BR /&gt;{&lt;BR /&gt;wdog_config_t config ;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;WDOG_GetDefaultConfig(&amp;amp;config) ;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;config.timeoutValue = WATCHDOG_28_SECONDES ;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;WDOG_Init(wdog_base, &amp;amp;config) ;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;WaitWctClose(wdog_base) ;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;void WaitWctClose(WDOG_Type *base)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Accessing register by bus clock */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (uint32_t i = 0; i &amp;lt; 256; i++)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (void)base-&amp;gt;RSTCNT;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;}&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN class="" lang="en"&gt;&lt;SPAN&gt;How can I avoid this hard fault?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class=""&gt;How to know the exact origin at the time of the jump (the debug does not work at this time)&lt;/SPAN&gt;&lt;/SPAN&gt; ?&lt;/P&gt;&lt;P&gt;Thank you very much in advance&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Jan 2018 10:34:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/hard-fault-with-watchdog-bootloader-K64/m-p/756427#M7745</guid>
      <dc:creator>PO220</dc:creator>
      <dc:date>2018-01-25T10:34:37Z</dc:date>
    </item>
    <item>
      <title>Re: hard fault with watchdog, bootloader K64</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/hard-fault-with-watchdog-bootloader-K64/m-p/756428#M7746</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;My colleague had written a document about tracking down hard faults.&lt;/P&gt;&lt;P&gt;Please check &lt;A _jive_internal="true" href="https://community.nxp.com/thread/306244"&gt;here&lt;/A&gt; to find the detailed info.&lt;/P&gt;&lt;P&gt;Wish it helps.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;Mike&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Jan 2018 04:44:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/hard-fault-with-watchdog-bootloader-K64/m-p/756428#M7746</guid>
      <dc:creator>Hui_Ma</dc:creator>
      <dc:date>2018-01-26T04:44:09Z</dc:date>
    </item>
    <item>
      <title>Re: hard fault with watchdog, bootloader K64</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/hard-fault-with-watchdog-bootloader-K64/m-p/756429#M7747</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;Thanks for hard fault debugging. &lt;SPAN class="" lang="en"&gt;&lt;SPAN class=""&gt;I'm a fan of MCUoneclipse blog but I have missed this one &lt;A class="link-titled" href="https://mcuoneclipse.com/2015/07/05/debugging-arm-cortex-m-hard-faults-with-gdb-custom-command/" title="https://mcuoneclipse.com/2015/07/05/debugging-arm-cortex-m-hard-faults-with-gdb-custom-command/"&gt;Debugging ARM Cortex-M Hard Faults with GDB Custom Command | MCU on Eclipse&lt;/A&gt;, great !&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="" lang="en"&gt;&lt;SPAN class=""&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="" lang="en"&gt;&lt;SPAN class=""&gt;In fact my problem has nothing to do with the watchdog!&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="" lang="en"&gt;&lt;SPAN class=""&gt;To use the watchdog I had to optimize the size of my code with -Os option...&amp;nbsp; does it create alignment problems?&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="" lang="en"&gt;&lt;SPAN class=""&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="" lang="en"&gt;&lt;SPAN class=""&gt;Would there be an option to not disrupt the jump with a -Os optimization?&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="" lang="en"&gt;&lt;SPAN class=""&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="" lang="en"&gt;&lt;SPAN class=""&gt;Thanks&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="" lang="en"&gt;&lt;SPAN class=""&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="" lang="en"&gt;&lt;SPAN class=""&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="" lang="en"&gt;&lt;SPAN class=""&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="" lang="en"&gt;&lt;SPAN class=""&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Jan 2018 12:58:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/hard-fault-with-watchdog-bootloader-K64/m-p/756429#M7747</guid>
      <dc:creator>PO220</dc:creator>
      <dc:date>2018-01-26T12:58:22Z</dc:date>
    </item>
    <item>
      <title>Re: hard fault with watchdog, bootloader K64</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/hard-fault-with-watchdog-bootloader-K64/m-p/756430#M7748</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 find solution thaks to &lt;A href="https://community.nxp.com/thread/338114"&gt;https://community.nxp.com/thread/338114&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 27 Jan 2018 16:11:06 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/hard-fault-with-watchdog-bootloader-K64/m-p/756430#M7748</guid>
      <dc:creator>PO220</dc:creator>
      <dc:date>2018-01-27T16:11:06Z</dc:date>
    </item>
  </channel>
</rss>

