<?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: Hard Fault When Watchdog Unlock is Written (MK20FX512)</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-Fault-When-Watchdog-Unlock-is-Written-MK20FX512/m-p/237137#M5550</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Leonardo&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Check that the startup code that unlocks the Watchdog and disables it sets the ALLOWUPDATE flag otherwise it will not allow you to change the setting again.&lt;/P&gt;&lt;P&gt;2. When you later enable the watchdog you also need to perform the unlock sequence immediately before the change.&lt;/P&gt;&lt;P&gt;3 The unlock sequence will cause a reset if the written values are incorrect, or if the sequence takes more that 20 bus cycles to be executed - if there is a risk of interrupts at this time disable interrupts to ensure that the sequence cannot be interrupted.&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;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 18 Nov 2015 13:45:09 GMT</pubDate>
    <dc:creator>mjbcswitzerland</dc:creator>
    <dc:date>2015-11-18T13:45:09Z</dc:date>
    <item>
      <title>Hard Fault When Watchdog Unlock is Written (MK20FX512)</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-Fault-When-Watchdog-Unlock-is-Written-MK20FX512/m-p/237130#M5543</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a program which is about 200KB, and I am attempting to run on an MK20FX512, using Codewarrior for the download and debug.&amp;nbsp; When the standard CW generated __init_hardware() runs, and attempts to write to the watchdog unlock register, a hard fault interrupt is generated (by the strh instruction) and the processor is reset. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; __init_hardware:&lt;/P&gt;&lt;P&gt; 21&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SCB_VTOR = (uint32_t)__vector_table; /* Set the interrupt vector table position */&lt;/P&gt;&lt;P&gt;00000800:&amp;nbsp;&amp;nbsp; ldr r1,[pc,#0x34]&lt;/P&gt;&lt;P&gt;00000804:&amp;nbsp;&amp;nbsp; movw r0,#0xed08&lt;/P&gt;&lt;P&gt;00000808:&amp;nbsp;&amp;nbsp; movt r0,#0xe000&lt;/P&gt;&lt;P&gt;0000080c:&amp;nbsp;&amp;nbsp; str r1,[r0,#0]&lt;/P&gt;&lt;P&gt; 35&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; *(volatile unsigned short *)KINETIS_WDOG_UNLOCK_ADDR = KINETIS_WDOG_UNLOCK_SEQ_1;&lt;/P&gt;&lt;P&gt;0000080e:&amp;nbsp;&amp;nbsp; movw r1,#0xc520&lt;/P&gt;&lt;P&gt;00000812:&amp;nbsp;&amp;nbsp; movw r0,#0x200e&lt;/P&gt;&lt;P&gt;00000816:&amp;nbsp;&amp;nbsp; movt r0,#0x4005&lt;/P&gt;&lt;P&gt;0000081a:&amp;nbsp;&amp;nbsp; strh r1,[r0,#0] // &lt;STRONG&gt;INTERRUPT GENERATED HERE&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is also worth noting that when this same initialization is run in a different project (with smaller code size), no interrupt is generated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Another interesting fact is that if I refresh the watchdog instead of trying to unlock it, no hard fault is generated, but the processor has another interrupt when it attempts to initialize the stack pointer (after __init_hardware).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; lda r0,__SP_INIT&lt;/P&gt;&lt;P&gt;&amp;nbsp; // skip stack setup if __SP_INIT is 0&lt;/P&gt;&lt;P&gt;&amp;nbsp; // assume sp is already setup.&lt;/P&gt;&lt;P&gt;&amp;nbsp; cmp r0,#0&lt;/P&gt;&lt;P&gt;&amp;nbsp; beq skip_sp&lt;/P&gt;&lt;P&gt;&amp;nbsp; mov sp,r0&lt;/P&gt;&lt;P&gt;&amp;nbsp; sub sp,#4&lt;/P&gt;&lt;P&gt;&amp;nbsp; mov r0,#0&lt;/P&gt;&lt;P&gt;&amp;nbsp; mvn r0,r0&lt;/P&gt;&lt;P&gt;&amp;nbsp; str r0,[sp,#0]&lt;/P&gt;&lt;P&gt;&amp;nbsp; add sp,#4 // &lt;STRONG&gt;INTERRUPT GENERATED HERE&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;skip_sp:&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jan 2014 18:59:11 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-Fault-When-Watchdog-Unlock-is-Written-MK20FX512/m-p/237130#M5543</guid>
      <dc:creator>nicholasf</dc:creator>
      <dc:date>2014-01-15T18:59:11Z</dc:date>
    </item>
    <item>
      <title>Re: Hard Fault When Watchdog Unlock is Written (MK20FX512)</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-Fault-When-Watchdog-Unlock-is-Written-MK20FX512/m-p/237131#M5544</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;could you check which interrupt is really generated?&lt;/P&gt;&lt;P&gt;I know that you already stated that a hardfault is generated but at this early state in the program (before main) it is more likely that it is a "forced" hardfault. It is used if an non-maskable interrupt is generated which cannot be serviced by an ISR because the corresponding interrupt is turned off. The information can be found in the system control block of the ARM cortex core.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Thomas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jan 2014 21:12:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-Fault-When-Watchdog-Unlock-is-Written-MK20FX512/m-p/237131#M5544</guid>
      <dc:creator>thomasgrieger</dc:creator>
      <dc:date>2014-01-15T21:12:58Z</dc:date>
    </item>
    <item>
      <title>Re: Hard Fault When Watchdog Unlock is Written (MK20FX512)</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-Fault-When-Watchdog-Unlock-is-Written-MK20FX512/m-p/237132#M5545</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Thomas,&lt;BR /&gt;Thanks for the great idea, I copied all the system control registers, and here they are:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE height="451" style="height: 425px; width: 318px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;SCB_ACTLR&lt;/TD&gt;&lt;TD&gt;0x0&lt;/TD&gt;&lt;TD&gt;0xe000e008&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;SCB_CPUID&lt;/TD&gt;&lt;TD&gt;0x410fc241&lt;/TD&gt;&lt;TD&gt;0xe000ed00&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;SCB_ICSR&lt;/TD&gt;&lt;TD&gt;0x803&lt;/TD&gt;&lt;TD&gt;0xe000ed04&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;SCB_VTOR&lt;/TD&gt;&lt;TD&gt;0x0&lt;/TD&gt;&lt;TD&gt;0xe000ed08&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;SCB_AIRCR&lt;/TD&gt;&lt;TD&gt;0xfa050000&lt;/TD&gt;&lt;TD&gt;0xe000ed0c&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;SCB_SCR&lt;/TD&gt;&lt;TD&gt;0x0&lt;/TD&gt;&lt;TD&gt;0xe000ed10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;SCB_CCR&lt;/TD&gt;&lt;TD&gt;0x200&lt;/TD&gt;&lt;TD&gt;0xe000ed14&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;SCB_SHPR1&lt;/TD&gt;&lt;TD&gt;0x0&lt;/TD&gt;&lt;TD&gt;0xe000ed18&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;SCB_SHPR2&lt;/TD&gt;&lt;TD&gt;0x0&lt;/TD&gt;&lt;TD&gt;0xe000ed1c&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;SCB_SHPR3&lt;/TD&gt;&lt;TD&gt;0x0&lt;/TD&gt;&lt;TD&gt;0xe000ed20&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;SCB_SHCSR&lt;/TD&gt;&lt;TD&gt;0x0&lt;/TD&gt;&lt;TD&gt;0xe000ed24&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;SCB_CFSR&lt;/TD&gt;&lt;TD&gt;0x1400&lt;/TD&gt;&lt;TD&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;0xe000ed28&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;SCB_HFSR&lt;/TD&gt;&lt;TD&gt;0x40000000&lt;/TD&gt;&lt;TD&gt;0xe000ed2c&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;SCB_DFSR&lt;/TD&gt;&lt;TD&gt;0x9&lt;/TD&gt;&lt;TD&gt;0xe000ed30&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;SCB_MMFAR&lt;/TD&gt;&lt;TD&gt;0xe000edf8&lt;/TD&gt;&lt;TD&gt;0xe000ed34&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;SCB_BFAR&lt;/TD&gt;&lt;TD&gt;0xe000edf8&lt;/TD&gt;&lt;TD&gt;0xe000ed38&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;SCB_AFSR&lt;/TD&gt;&lt;TD&gt;0x0&lt;/TD&gt;&lt;TD&gt;0xe000ed3c&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From what I understand about the system control registers, SCB_ICSR is the relevant one in this case, and it appears to confirm the idea that there is a hard fault (though I may be completely wrong)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0552a/CIHFDJCA.html" title="http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0552a/CIHFDJCA.html"&gt;ARM Information Center&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I still do not understand what is causing these problems with writing to registers.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jan 2014 21:53:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-Fault-When-Watchdog-Unlock-is-Written-MK20FX512/m-p/237132#M5545</guid>
      <dc:creator>nicholasf</dc:creator>
      <dc:date>2014-01-15T21:53:16Z</dc:date>
    </item>
    <item>
      <title>Re: Hard Fault When Watchdog Unlock is Written (MK20FX512)</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-Fault-When-Watchdog-Unlock-is-Written-MK20FX512/m-p/237133#M5546</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;From the SCB_ICSR register, the hard fault exception happens. &lt;/P&gt;&lt;P&gt;And the SCB_CFSR register shows it caused by bus fault.&lt;/P&gt;&lt;P&gt;The SCB_CFSR value 0x1400 means store stack cause error and Imprecise data access error has occurred.&lt;/P&gt;&lt;P&gt;The SCB_HFSR value 0x40000000 also means the hard fault is caused by bus fault.&lt;/P&gt;&lt;P&gt;If in your project the stack start address definition with problem?&lt;/P&gt;&lt;P&gt;Wish it helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;best regards,&lt;/P&gt;&lt;P&gt;Ma Hui&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jan 2014 03:49:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-Fault-When-Watchdog-Unlock-is-Written-MK20FX512/m-p/237133#M5546</guid>
      <dc:creator>Hui_Ma</dc:creator>
      <dc:date>2014-01-16T03:49:53Z</dc:date>
    </item>
    <item>
      <title>Re: Hard Fault When Watchdog Unlock is Written (MK20FX512)</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-Fault-When-Watchdog-Unlock-is-Written-MK20FX512/m-p/237134#M5547</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dears,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am having the same problem with the FRDM-K64F board. My code works perfectly fine without the WatchDog, but when I try to use it, a hardfault is generated exactly when the program tries to unlock the hardware. How do I solve this issue?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Bellow is the registers dump. As pointed by Hui_Ma, the IMPRECISERR bit is activated. That means there is some problem with the Data Bus, but I don't know how to fix it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;r0= [0x1FFFFF88]&lt;/P&gt;&lt;P&gt;r1= [0x40052000]&lt;/P&gt;&lt;P&gt;r2= [0x00000001]&lt;/P&gt;&lt;P&gt;r3= [0x0000C520]&lt;/P&gt;&lt;P&gt;r12= [0x40052000]&lt;/P&gt;&lt;P&gt;lr= [0xCF4B6F7F]&lt;/P&gt;&lt;P&gt;pc= [0x00029ABB]&lt;/P&gt;&lt;P&gt;psr= [0x00029A62]&lt;/P&gt;&lt;P&gt;CFSR= [0x00000400]&lt;/P&gt;&lt;P&gt;CFS.DIVBYZERO = no&lt;/P&gt;&lt;P&gt;CFS.UNALIGNED = no&lt;/P&gt;&lt;P&gt;CFS.NOCP = no&lt;/P&gt;&lt;P&gt;CFS.INVPC = no&lt;/P&gt;&lt;P&gt;CFS.INVSTATE = no&lt;/P&gt;&lt;P&gt;CFS.UNDEFINSTR = no&lt;/P&gt;&lt;P&gt;CFS.BFARVALID = no&lt;/P&gt;&lt;P&gt;CFS.LSPERR = no&lt;/P&gt;&lt;P&gt;CFS.STKERR = no&lt;/P&gt;&lt;P&gt;CFS.UNSTKERR = no&lt;/P&gt;&lt;P&gt;CFS.IMPRECISERR = yes&lt;/P&gt;&lt;P&gt;CFS.PRECISERR = no&lt;/P&gt;&lt;P&gt;CFS.IBUSERR = no&lt;/P&gt;&lt;P&gt;CFS.MMARVALID = no&lt;/P&gt;&lt;P&gt;CFS.MLSPERR = no&lt;/P&gt;&lt;P&gt;CFS.MSTKERR = no&lt;/P&gt;&lt;P&gt;CFS.MUNSTKERR = no&lt;/P&gt;&lt;P&gt;CFS.DACCVIOL = no&lt;/P&gt;&lt;P&gt;CFS.IACCVIOL = no&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for the patience&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Leonardo Bueno&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Nov 2015 14:42:02 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-Fault-When-Watchdog-Unlock-is-Written-MK20FX512/m-p/237134#M5547</guid>
      <dc:creator>leonardobueno</dc:creator>
      <dc:date>2015-11-17T14:42:02Z</dc:date>
    </item>
    <item>
      <title>Re: Hard Fault When Watchdog Unlock is Written (MK20FX512)</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-Fault-When-Watchdog-Unlock-is-Written-MK20FX512/m-p/237135#M5548</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Leonardo&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When you don't use the watchdog you still disable it. Therefore you must already have used the unlock code successfully.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What is the difference between your original&lt;/P&gt;&lt;P&gt;UNLOCK WATCHDOG&lt;/P&gt;&lt;P&gt;DISABLE WATCHDOG&lt;/P&gt;&lt;P&gt;sequence&lt;/P&gt;&lt;P&gt;and you new&lt;/P&gt;&lt;P&gt;UNLOCK WATCHDOG&lt;/P&gt;&lt;P&gt;ENABLE WATCHDOG&lt;/P&gt;&lt;P&gt;sequence?&lt;/P&gt;&lt;P&gt;The only thing to be careful of is that the unlock sequence is performed within 256 bus clock cycles otherwise it will cause a reset.&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;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Nov 2015 16:16:42 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-Fault-When-Watchdog-Unlock-is-Written-MK20FX512/m-p/237135#M5548</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2015-11-17T16:16:42Z</dc:date>
    </item>
    <item>
      <title>Re: Hard Fault When Watchdog Unlock is Written (MK20FX512)</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-Fault-When-Watchdog-Unlock-is-Written-MK20FX512/m-p/237136#M5549</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Mark,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The watchdog is not set anywhere in the code but the given Freescale Startup code (that Disables the Watchdog by default). So I did not necessarily implemented the unlock sequence anywhere in the code. Anyway, the start up code doesn't result on a hardfault, but if I try to enable the watchdog anywhere on the main loop it results on a Bus Fault. How do I solve it?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your patience&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Leonardo Bueno&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Nov 2015 12:03:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-Fault-When-Watchdog-Unlock-is-Written-MK20FX512/m-p/237136#M5549</guid>
      <dc:creator>leonardobueno</dc:creator>
      <dc:date>2015-11-18T12:03:55Z</dc:date>
    </item>
    <item>
      <title>Re: Hard Fault When Watchdog Unlock is Written (MK20FX512)</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-Fault-When-Watchdog-Unlock-is-Written-MK20FX512/m-p/237137#M5550</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Leonardo&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Check that the startup code that unlocks the Watchdog and disables it sets the ALLOWUPDATE flag otherwise it will not allow you to change the setting again.&lt;/P&gt;&lt;P&gt;2. When you later enable the watchdog you also need to perform the unlock sequence immediately before the change.&lt;/P&gt;&lt;P&gt;3 The unlock sequence will cause a reset if the written values are incorrect, or if the sequence takes more that 20 bus cycles to be executed - if there is a risk of interrupts at this time disable interrupts to ensure that the sequence cannot be interrupted.&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;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Nov 2015 13:45:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-Fault-When-Watchdog-Unlock-is-Written-MK20FX512/m-p/237137#M5550</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2015-11-18T13:45:09Z</dc:date>
    </item>
    <item>
      <title>Re: Hard Fault When Watchdog Unlock is Written (MK20FX512)</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-Fault-When-Watchdog-Unlock-is-Written-MK20FX512/m-p/237138#M5551</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Mark,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I changed my watchdog unlock code to behave exactly like the startup on. Now it doesn't give me a hardfault, but it resets before the end of the unlock sequence. I certified that the ALLOWUPDATE flag is set on the startup code, and I disabled interruptions before starting the unlock sequence to avoid missing the 20 bus cycle time, but the processor still resets when I try the first step of the unlock sequence. Any ideias of what might be causing this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your time&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Leonardo Bueno&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Nov 2015 15:02:39 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-Fault-When-Watchdog-Unlock-is-Written-MK20FX512/m-p/237138#M5551</guid>
      <dc:creator>leonardobueno</dc:creator>
      <dc:date>2015-11-18T15:02:39Z</dc:date>
    </item>
    <item>
      <title>Re: Hard Fault When Watchdog Unlock is Written (MK20FX512)</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-Fault-When-Watchdog-Unlock-is-Written-MK20FX512/m-p/237139#M5552</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Leonardo&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check the user's manaual for a list of watchdog restrictions. I don't see what the problem is at the moment. I use the following code and have never experienced any difficuties:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// This sequence must be performed within 20 bus cycles and the writes are possible for the WCT period (16 bus clocks for KE and 128 bus clocks for configuration)&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;WDOG_UNLOCK = WDOG_UNLOCK_SEQUENCE_1;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;WDOG_UNLOCK = WDOG_UNLOCK_SEQUENCE_2;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;// Watchdog enabled to generate reset on 2s timeout (no further updates allowed)&lt;/P&gt;&lt;P&gt;//&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;WDOG_TOVALL = (2000/5);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;WDOG_TOVALH = 0;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;WDOG_STCTRLH = (WDOG_STCTRLH_STNDBYEN | WDOG_STCTRLH_WAITEN | WDOG_STCTRLH_STOPEN | WDOG_STCTRLH_WDOGEN);&lt;/STRONG&gt;&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;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Nov 2015 15:42:30 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-Fault-When-Watchdog-Unlock-is-Written-MK20FX512/m-p/237139#M5552</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2015-11-18T15:42:30Z</dc:date>
    </item>
  </channel>
</rss>

