<?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 Problem with Watchdog in a S08PA4 in 8-bit Microcontrollers</title>
    <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Problem-with-Watchdog-in-a-S08PA4/m-p/466036#M21703</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi every one,&lt;/P&gt;&lt;P&gt;I am experiencing problems with the Watchdog of a S08PA4. I configure it like this just right after power on (so the 128 clocks condition is met):&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp; Os_F_DisAllInterrupts_v();&lt;/SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp; Sys_f_InitCLKModule_v();&amp;nbsp; /* Initialize clock module ( Bus clock set to 19,2 MHz)&amp;nbsp; */&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;STRONG&gt;WDOG_TOVAL&lt;/STRONG&gt; = (uint16_t)32000; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp; //WDOG_WIN = ZERO_U8; /* This is not necesary since I am not using window watchdog */&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp; &lt;STRONG&gt;WDOG_CS2&lt;/STRONG&gt; = 0x42; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp; /*( Sys_d_WDOG_CS2_WIN_OFF| Sys_d_WDOG_CS2_IRQ_FLAG| Sys_d_WDOG_CS2_256_PRESCALAR_OFF| Sys_d_WDOG_CS2_CLK_IS_BUS_CLK); */&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;STRONG&gt; WDOG_CS1&lt;/STRONG&gt; = 0x84;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp; /*( Sys_d_WDOG_CS1_WD_ENA| Sys_d_WDOG_CS1_WD_IRQ_DIS| Sys_d_WDOG_CS1_UPDATE_OFF| Sys_d_WDOG_CS1_TST_DIS|&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Sys_d_WDOG_CS1_IN_DBG_ON| Sys_d_WDOG_CS1_IN_WAIT_OFF| Sys_d_WDOG_CS1_IN_STOP_OFF );*/&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp; Os_F_EnAllInterrupts_v();&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;------------------------------------------------------------------------------&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After this I initialize all the application modules and go to the Cyclic mode. There I refresh the watchdog using the following function:&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;void Os_f_FeedIntWD(void)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;{&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp; Os_F_DisAllInterrupts_v();&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp; &lt;STRONG&gt;WDOG_CNT&lt;/STRONG&gt;=(uint16_t)0xA602;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp; &lt;STRONG&gt;WDOG_CNT&lt;/STRONG&gt;=(uint16_t)0xB480;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp; Os_F_EnAllInterrupts_v();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* the sequence 0xA602, 0xB480 will reset the watchdog */&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;------------------------------------------------------------------------------&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After reading in other threads I understood that while debugging, one should not set a brakepoint (BP) or step inside this function. So I placed a BP right after returning from this function (no other BP was active). The System starts but does not reach the BP and the Debugger shows reset and I loose connection to the µC. When I place a BP during the initialization of the application I can see that the time is correct. I mean, the refresh point is not too late. I can even set a BP just before the refresh function is called the first time and it is reached. &lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Am I missing something?&lt;/P&gt;&lt;P&gt;Can anybody find a mistake in the way I am initializing the watchdog?&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="149166_149166.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/121589i4EEA0851F4BCC7AC/image-size/large?v=v2&amp;amp;px=999" role="button" title="149166_149166.png" alt="149166_149166.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_11.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/57140i227BC02E71516911/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_11.png" alt="pastedImage_11.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried using other timing configuration like using bus clock or the 1KHz bus clock and offcourse modifying properly the WDOG_TOVAL. I have even made a stand alone version (no debugger connected) with the Debug-enable bit set to zero and the result was the same (the application does not run).&lt;/P&gt;&lt;P&gt;When I deactivate the watchdog and its refreshing function, the application runs without a Problem.&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Please I have no idea what else I can do.&lt;/P&gt;&lt;P&gt;Omar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 12 May 2016 07:12:55 GMT</pubDate>
    <dc:creator>omarayala</dc:creator>
    <dc:date>2016-05-12T07:12:55Z</dc:date>
    <item>
      <title>Problem with Watchdog in a S08PA4</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Problem-with-Watchdog-in-a-S08PA4/m-p/466036#M21703</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi every one,&lt;/P&gt;&lt;P&gt;I am experiencing problems with the Watchdog of a S08PA4. I configure it like this just right after power on (so the 128 clocks condition is met):&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp; Os_F_DisAllInterrupts_v();&lt;/SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp; Sys_f_InitCLKModule_v();&amp;nbsp; /* Initialize clock module ( Bus clock set to 19,2 MHz)&amp;nbsp; */&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;STRONG&gt;WDOG_TOVAL&lt;/STRONG&gt; = (uint16_t)32000; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp; //WDOG_WIN = ZERO_U8; /* This is not necesary since I am not using window watchdog */&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp; &lt;STRONG&gt;WDOG_CS2&lt;/STRONG&gt; = 0x42; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp; /*( Sys_d_WDOG_CS2_WIN_OFF| Sys_d_WDOG_CS2_IRQ_FLAG| Sys_d_WDOG_CS2_256_PRESCALAR_OFF| Sys_d_WDOG_CS2_CLK_IS_BUS_CLK); */&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;STRONG&gt; WDOG_CS1&lt;/STRONG&gt; = 0x84;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp; /*( Sys_d_WDOG_CS1_WD_ENA| Sys_d_WDOG_CS1_WD_IRQ_DIS| Sys_d_WDOG_CS1_UPDATE_OFF| Sys_d_WDOG_CS1_TST_DIS|&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Sys_d_WDOG_CS1_IN_DBG_ON| Sys_d_WDOG_CS1_IN_WAIT_OFF| Sys_d_WDOG_CS1_IN_STOP_OFF );*/&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp; Os_F_EnAllInterrupts_v();&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;------------------------------------------------------------------------------&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After this I initialize all the application modules and go to the Cyclic mode. There I refresh the watchdog using the following function:&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;void Os_f_FeedIntWD(void)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;{&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp; Os_F_DisAllInterrupts_v();&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp; &lt;STRONG&gt;WDOG_CNT&lt;/STRONG&gt;=(uint16_t)0xA602;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp; &lt;STRONG&gt;WDOG_CNT&lt;/STRONG&gt;=(uint16_t)0xB480;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp; Os_F_EnAllInterrupts_v();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* the sequence 0xA602, 0xB480 will reset the watchdog */&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;------------------------------------------------------------------------------&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After reading in other threads I understood that while debugging, one should not set a brakepoint (BP) or step inside this function. So I placed a BP right after returning from this function (no other BP was active). The System starts but does not reach the BP and the Debugger shows reset and I loose connection to the µC. When I place a BP during the initialization of the application I can see that the time is correct. I mean, the refresh point is not too late. I can even set a BP just before the refresh function is called the first time and it is reached. &lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Am I missing something?&lt;/P&gt;&lt;P&gt;Can anybody find a mistake in the way I am initializing the watchdog?&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="149166_149166.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/121589i4EEA0851F4BCC7AC/image-size/large?v=v2&amp;amp;px=999" role="button" title="149166_149166.png" alt="149166_149166.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_11.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/57140i227BC02E71516911/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_11.png" alt="pastedImage_11.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried using other timing configuration like using bus clock or the 1KHz bus clock and offcourse modifying properly the WDOG_TOVAL. I have even made a stand alone version (no debugger connected) with the Debug-enable bit set to zero and the result was the same (the application does not run).&lt;/P&gt;&lt;P&gt;When I deactivate the watchdog and its refreshing function, the application runs without a Problem.&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Please I have no idea what else I can do.&lt;/P&gt;&lt;P&gt;Omar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 May 2016 07:12:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Problem-with-Watchdog-in-a-S08PA4/m-p/466036#M21703</guid>
      <dc:creator>omarayala</dc:creator>
      <dc:date>2016-05-12T07:12:55Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with Watchdog in a S08PA4</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Problem-with-Watchdog-in-a-S08PA4/m-p/466037#M21704</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Omar&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please try with &lt;/P&gt;&lt;P&gt;WDOG_CNT = 0xC520;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* First part of the WDG unlock sequence */ &lt;/P&gt;&lt;P&gt; WDOG_CNT =0xD928;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Second part of the WDG unlock sequence */ &lt;/P&gt;&lt;P&gt;&amp;nbsp; /*&amp;nbsp; Initialization of Init_WDOG */&lt;/P&gt;&lt;P&gt;&amp;nbsp; /* WDOG_CS1: EN=1,INT=0,UPDATE=1,TST=0,DBG=0,WAIT=1,STOP=1 */&lt;/P&gt;&lt;P&gt; WDOG_CS1 = 0xA3;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; /* WDOG_CS2: WIN=0,FLG=0,??=0,PRES=0,??=0,??=0,CLK=0 */&lt;/P&gt;&lt;P&gt; WDOG_CS2 =0x00;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; /* WDOG_TOVAL: TOVAL=0xF800 */&lt;/P&gt;&lt;P&gt; WDOG_TOVAL =0xF800;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also you can use processor expert to set the WDG&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this will help you&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;Vicente Gomez&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 May 2016 17:54:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Problem-with-Watchdog-in-a-S08PA4/m-p/466037#M21704</guid>
      <dc:creator>vicentegomez</dc:creator>
      <dc:date>2016-05-18T17:54:46Z</dc:date>
    </item>
  </channel>
</rss>

