<?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 WDOG unlock causes reset in MCUXpresso SDK</title>
    <link>https://community.nxp.com/t5/MCUXpresso-SDK/WDOG-unlock-causes-reset/m-p/757375#M610</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm having&amp;nbsp;trouble on configuring WDOG.&lt;/P&gt;&lt;P&gt;I'm using a custom board based on MK66, MCUXpresso 10.1.1 and SDK 2.3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to use the WDOG timer: since it is disabled in the startup function&amp;nbsp;SystemInit(), I need to enabled it at the beginning of my program (after hardware init):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WDOG_GetDefaultConfig( &amp;amp;WdogConfig );&lt;BR /&gt; WdogConfig.clockSource = kWDOG_AlternateClockSource;&lt;BR /&gt; WdogConfig.prescaler = kWDOG_ClockPrescalerDivide5;&lt;BR /&gt; WdogConfig.workMode.enableStop = true;&lt;BR /&gt; WdogConfig.timeoutValue = WDOG_TIMEOUT_VAL;&lt;BR /&gt; WDOG_Init( WDOG, &amp;amp;WdogConfig );&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I step the program through&amp;nbsp;&lt;SPAN&gt;WDOG_Init() -&amp;gt;&amp;nbsp;WDOG_Unlock(): reset&amp;nbsp;occurs at the first instruction of the unlocking sequence:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt; base-&amp;gt;UNLOCK = WDOG_FIRST_WORD_OF_UNLOCK;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The ALLOWUPDATE bit in the STCTRLH register is set (by the&amp;nbsp;SystemInit() function), the WDOG bit in SRS0 register is set (indicating the reset cause is the WDOG timer) and the RSTCNT register increments every reset.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I've no idea, what can I check?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Many thanks&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Biafra&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 14 Mar 2018 12:17:01 GMT</pubDate>
    <dc:creator>biafra</dc:creator>
    <dc:date>2018-03-14T12:17:01Z</dc:date>
    <item>
      <title>WDOG unlock causes reset</title>
      <link>https://community.nxp.com/t5/MCUXpresso-SDK/WDOG-unlock-causes-reset/m-p/757375#M610</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm having&amp;nbsp;trouble on configuring WDOG.&lt;/P&gt;&lt;P&gt;I'm using a custom board based on MK66, MCUXpresso 10.1.1 and SDK 2.3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to use the WDOG timer: since it is disabled in the startup function&amp;nbsp;SystemInit(), I need to enabled it at the beginning of my program (after hardware init):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WDOG_GetDefaultConfig( &amp;amp;WdogConfig );&lt;BR /&gt; WdogConfig.clockSource = kWDOG_AlternateClockSource;&lt;BR /&gt; WdogConfig.prescaler = kWDOG_ClockPrescalerDivide5;&lt;BR /&gt; WdogConfig.workMode.enableStop = true;&lt;BR /&gt; WdogConfig.timeoutValue = WDOG_TIMEOUT_VAL;&lt;BR /&gt; WDOG_Init( WDOG, &amp;amp;WdogConfig );&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I step the program through&amp;nbsp;&lt;SPAN&gt;WDOG_Init() -&amp;gt;&amp;nbsp;WDOG_Unlock(): reset&amp;nbsp;occurs at the first instruction of the unlocking sequence:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt; base-&amp;gt;UNLOCK = WDOG_FIRST_WORD_OF_UNLOCK;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The ALLOWUPDATE bit in the STCTRLH register is set (by the&amp;nbsp;SystemInit() function), the WDOG bit in SRS0 register is set (indicating the reset cause is the WDOG timer) and the RSTCNT register increments every reset.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I've no idea, what can I check?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Many thanks&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Biafra&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Mar 2018 12:17:01 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-SDK/WDOG-unlock-causes-reset/m-p/757375#M610</guid>
      <dc:creator>biafra</dc:creator>
      <dc:date>2018-03-14T12:17:01Z</dc:date>
    </item>
    <item>
      <title>Re: WDOG unlock causes reset</title>
      <link>https://community.nxp.com/t5/MCUXpresso-SDK/WDOG-unlock-causes-reset/m-p/757376#M611</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Biafra,&lt;/P&gt;&lt;P&gt;The watchdog issues a reset, that is, interrupt-then-reset if enabled, to the system for any of these invalid unlock sequences:&lt;/P&gt;&lt;P&gt;• Write any value other than 0xC520 or 0xD928 to the unlock register.&lt;BR /&gt;• ALLOW_UPDATE is set and a gap of more than 20 bus clock cycles is inserted between the writing of the unlock sequence values.&lt;/P&gt;&lt;P&gt;So don't follow the code step by step. This will cause a reset.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jing&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Mar 2018 08:22:28 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-SDK/WDOG-unlock-causes-reset/m-p/757376#M611</guid>
      <dc:creator>jingpan</dc:creator>
      <dc:date>2018-03-16T08:22:28Z</dc:date>
    </item>
    <item>
      <title>Re: WDOG unlock causes reset</title>
      <link>https://community.nxp.com/t5/MCUXpresso-SDK/WDOG-unlock-causes-reset/m-p/757377#M612</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jing,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I stepped into the code because the processor resets.&lt;/P&gt;&lt;P&gt;If I step over (F6 button) the WDOG_Init() function or run, the processor resets. The WDOG_Init() function is the SDK one with no changes: it disables the interrupts before the unlocking sequence and it enables them back at the end of configuration.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there something else to verify?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many thanks&lt;/P&gt;&lt;P&gt;Biafra&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Mar 2018 09:12:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-SDK/WDOG-unlock-causes-reset/m-p/757377#M612</guid>
      <dc:creator>biafra</dc:creator>
      <dc:date>2018-03-16T09:12:56Z</dc:date>
    </item>
    <item>
      <title>Re: WDOG unlock causes reset</title>
      <link>https://community.nxp.com/t5/MCUXpresso-SDK/WDOG-unlock-causes-reset/m-p/757378#M613</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 made a example. It works fine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;jing&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Mar 2018 10:03:10 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-SDK/WDOG-unlock-causes-reset/m-p/757378#M613</guid>
      <dc:creator>jingpan</dc:creator>
      <dc:date>2018-03-16T10:03:10Z</dc:date>
    </item>
    <item>
      <title>Re: WDOG unlock causes reset</title>
      <link>https://community.nxp.com/t5/MCUXpresso-SDK/WDOG-unlock-causes-reset/m-p/757379#M614</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A class="jx-jive-macro-user" href="https://community.nxp.com/people/jingpan"&gt;jingpan&lt;/A&gt;‌,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This thread is old, this year the project changed and didn't need the watchdog anymore, but I started a new project and the problem came again.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the new project&amp;nbsp;I'm using a custom board based on MK66, MCUXpresso 11.0.0 and SDK 2.6 and Freertos 10.2.0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've made some further tests and I have some news: if I use the main function of your project, &lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;WDOG_Init() is executed with no problem. So I inserted the wdog init in different position of my code: it works&amp;nbsp;until&amp;nbsp;&lt;SPAN&gt;WDOG_Init()&amp;nbsp;is called before the os start, but it doesn't work it's called&amp;nbsp;at the beginning of the first task.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;&lt;SPAN&gt;------------------------ This&amp;nbsp;example works -------------------------------&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;&lt;SPAN&gt;void main( void )&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;...&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;xTaskCreate( ... ); //create first task&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;InitWDOG(); //init wdog&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;&lt;SPAN&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;vTaskStartScheduler();&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;&lt;SPAN&gt;------------------------------------------------------------------------------------&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="color: #3d3d3d;"&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;&lt;SPAN&gt;------------------------ This&amp;nbsp;example doesn't work -------------------------------&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #3d3d3d;"&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;&lt;SPAN&gt;void main( void )&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #3d3d3d;"&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #3d3d3d;"&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;...&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #3d3d3d;"&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;xTaskCreate( ... ); //create first task&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #3d3d3d;"&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;vTaskStartScheduler();&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #3d3d3d;"&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #3d3d3d;"&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #3d3d3d;"&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;&lt;SPAN&gt;void FirstTask( void * )&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #3d3d3d;"&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #3d3d3d;"&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;InitWDOG(); //init wdog&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #3d3d3d;"&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;...&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #3d3d3d;"&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #3d3d3d;"&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;&lt;SPAN&gt;------------------------------------------------------------------------------------&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P&gt;Do you have any advice to test?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many thanks&lt;/P&gt;&lt;P&gt;Biafra&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Aug 2019 15:49:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-SDK/WDOG-unlock-causes-reset/m-p/757379#M614</guid>
      <dc:creator>biafra</dc:creator>
      <dc:date>2019-08-02T15:49:32Z</dc:date>
    </item>
  </channel>
</rss>

