<?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: Waking up issues with watchdog timer and wake-up timer in LPC Microcontrollers</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/Waking-up-issues-with-watchdog-timer-and-wake-up-timer/m-p/797238#M32063</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I also tried a clean project and it is again the same. It interrupts only while the MCU is awake. This is the enire clean project I tried:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#include "chip.h"&lt;/P&gt;&lt;P&gt;void WDT_IRQHandler(void)&lt;BR /&gt;{&lt;BR /&gt; uint32_t wdtStatus = Chip_WWDT_GetStatus(LPC_WWDT);&lt;/P&gt;&lt;P&gt;/* The chip will reset before this happens, but if the WDT doesn't&lt;BR /&gt; have WWDT_WDMOD_WDRESET enabled, this will hit once */&lt;BR /&gt; if (wdtStatus &amp;amp; WWDT_WDMOD_WDTOF) {&lt;BR /&gt; /* A watchdog feed didn't occur prior to window timeout */&lt;BR /&gt; Chip_WWDT_UnsetOption(LPC_WWDT, WWDT_WDMOD_WDEN); /* Stop WDT */&lt;BR /&gt; Chip_WWDT_ClearStatusFlag(LPC_WWDT, WWDT_WDMOD_WDTOF);&lt;BR /&gt; Chip_WWDT_Start(LPC_WWDT); /* Needs restart */&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;/* Handle warning interrupt */&lt;BR /&gt; if (wdtStatus &amp;amp; WWDT_WDMOD_WDINT) {&lt;BR /&gt; /* A watchdog feed didn't occur prior to warning timeout */&lt;BR /&gt; Chip_WWDT_ClearStatusFlag(LPC_WWDT, WWDT_WDMOD_WDINT);&lt;BR /&gt; Chip_WWDT_Feed(LPC_WWDT);&lt;BR /&gt; }&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;int main(void)&lt;BR /&gt;{&lt;/P&gt;&lt;P&gt;//Blink an LED for a short time (to indicate a restart)&lt;BR /&gt; Chip_GPIO_Init(LPC_GPIO_PORT);&lt;BR /&gt; Chip_GPIO_SetPinDIROutput(LPC_GPIO_PORT, 0, 14);&lt;BR /&gt; Chip_GPIO_SetPinState(LPC_GPIO_PORT, 0, 14, 1);&lt;BR /&gt; for(uint32_t i=0;i&amp;lt;0xFFFFF;i++); //busy wait loop&lt;BR /&gt; Chip_GPIO_SetPinState(LPC_GPIO_PORT, 0, 14, 0);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; uint32_t wdtFreq;&lt;/P&gt;&lt;P&gt;SystemCoreClockUpdate();&lt;/P&gt;&lt;P&gt;/* Freq = 0.6Mhz, divided by 64. WDT_OSC should be 9.375khz */&lt;BR /&gt; Chip_Clock_SetWDTOSC(WDTLFO_OSC_0_60, 64);&lt;/P&gt;&lt;P&gt;/* Enable the power to the WDT */&lt;BR /&gt; Chip_SYSCTL_PowerUp(SYSCTL_SLPWAKE_WDTOSC_PD);&lt;/P&gt;&lt;P&gt;/* The WDT divides the input frequency into it by 4 */&lt;BR /&gt; wdtFreq = Chip_Clock_GetWDTOSCRate() / 4;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; /* Initialize WWDT (also enables WWDT clock) */&lt;BR /&gt; Chip_WWDT_Init(LPC_WWDT);&lt;/P&gt;&lt;P&gt;/* Set watchdog feed time constant to approximately 2s&lt;BR /&gt; Set watchdog warning time to 512 ticks after feed time constant&lt;BR /&gt; Set watchdog window time to 3s */&lt;BR /&gt; Chip_WWDT_SetTimeOut(LPC_WWDT, wdtFreq * 2);&lt;BR /&gt; Chip_WWDT_Feed(LPC_WWDT);&lt;BR /&gt; Chip_WWDT_SetWarning(LPC_WWDT, 512);&lt;BR /&gt; Chip_WWDT_SetWindow(LPC_WWDT, wdtFreq * 3);&lt;/P&gt;&lt;P&gt;/* Configure WWDT to reset on timeout */&lt;BR /&gt; Chip_WWDT_SetOption(LPC_WWDT, WWDT_WDMOD_WDRESET);&lt;/P&gt;&lt;P&gt;/* Clear watchdog warning and timeout interrupts */&lt;BR /&gt; Chip_WWDT_ClearStatusFlag(LPC_WWDT, WWDT_WDMOD_WDTOF | WWDT_WDMOD_WDINT);&lt;/P&gt;&lt;P&gt;/* Clear and enable watchdog interrupt */&lt;BR /&gt; NVIC_ClearPendingIRQ(WDT_IRQn);&lt;BR /&gt; NVIC_EnableIRQ(WDT_IRQn);&lt;/P&gt;&lt;P&gt;/* Start watchdog */&lt;BR /&gt; Chip_WWDT_Start(LPC_WWDT);&lt;/P&gt;&lt;P&gt;Chip_PMU_DeepSleepState(LPC_PMU);&lt;BR /&gt;}&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 24 Nov 2018 08:30:51 GMT</pubDate>
    <dc:creator>kamranfarhangi</dc:creator>
    <dc:date>2018-11-24T08:30:51Z</dc:date>
    <item>
      <title>Waking up issues with watchdog timer and wake-up timer</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Waking-up-issues-with-watchdog-timer-and-wake-up-timer/m-p/797237#M32062</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I am using an LPC 824, and I'm trying to wake it up 250 ms after going to DeepSleep (or Power-Down mode). I tried using the Wake-up timer and the watchdog timer to wake it up, but for some reason it does not work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the init part of the code for using the WDT:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;//Setting watchdog timer up&lt;/P&gt;&lt;P&gt;/* Freq = 0.6Mhz, divided by 64. WDT_OSC should be 9.375khz */&lt;BR /&gt; Chip_Clock_SetWDTOSC(WDTLFO_OSC_0_60, 64);&lt;/P&gt;&lt;P&gt;/* Enable the power to the WDT */&lt;BR /&gt; Chip_SYSCTL_PowerUp(SYSCTL_SLPWAKE_WDTOSC_PD);&lt;/P&gt;&lt;P&gt;/* Initialize WWDT (also enables WWDT clock) */&lt;BR /&gt; Chip_WWDT_Init(LPC_WWDT);&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and this is the interrupt handler:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;BR /&gt;void WDT_IRQHandler(void)&lt;BR /&gt;{&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;uint32_t wdtStatus = Chip_WWDT_GetStatus(LPC_WWDT);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (wdtStatus &amp;amp; WWDT_WDMOD_WDTOF) {&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//printf("Inside watchdog timer handler\n");&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;/* A watchdog feed didn't occur prior to window timeout */&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Chip_WWDT_UnsetOption(LPC_WWDT, WWDT_WDMOD_WDEN); /* Stop WDT */&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Chip_WWDT_ClearStatusFlag(LPC_WWDT, WWDT_WDMOD_WDTOF);&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;BR /&gt;}&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and this is the main code putting the MCU in DeepSleep mode:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;if(goToSleep) {&amp;nbsp;&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;#define WAKE_UP_EVERY_MS 250&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;/* The WDT divides the input frequency into it by 4 */&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;uint32_t wdtFreq = Chip_Clock_GetWDTOSCRate() / 4;&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;Chip_WWDT_SetTimeOut(LPC_WWDT, wdtFreq * WAKE_UP_EVERY_MS / 1000);&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;Chip_WWDT_Feed(LPC_WWDT);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;/* Clear watchdog warning and timeout interrupts */&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;Chip_WWDT_ClearStatusFlag(LPC_WWDT, WWDT_WDMOD_WDTOF | WWDT_WDMOD_WDINT);&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;/* Clear and enable watchdog interrupt */&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;NVIC_ClearPendingIRQ(WDT_IRQn);&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;NVIC_EnableIRQ(WDT_IRQn);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;/* Start watchdog */&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;Chip_WWDT_Start(LPC_WWDT);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;Chip_PMU_DeepSleepState(LPC_PMU);&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;//LPC is now in&amp;nbsp;DeepSleep state&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;timems += WAKE_UP_EVERY_MS;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I uncomment the printf, and don't put the MCU in sleep, I can see that the interrupt is called as it should. But&amp;nbsp;for some reason it is either does not interrupt or does not wake the MCU up while it is in sleep mode.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I also tried using wake-up timer and the result was exactly the same. Works good then MCU is awake, but does not work in sleep mode!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you in advance for your help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 24 Nov 2018 08:10:52 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Waking-up-issues-with-watchdog-timer-and-wake-up-timer/m-p/797237#M32062</guid>
      <dc:creator>kamranfarhangi</dc:creator>
      <dc:date>2018-11-24T08:10:52Z</dc:date>
    </item>
    <item>
      <title>Re: Waking up issues with watchdog timer and wake-up timer</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Waking-up-issues-with-watchdog-timer-and-wake-up-timer/m-p/797238#M32063</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I also tried a clean project and it is again the same. It interrupts only while the MCU is awake. This is the enire clean project I tried:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#include "chip.h"&lt;/P&gt;&lt;P&gt;void WDT_IRQHandler(void)&lt;BR /&gt;{&lt;BR /&gt; uint32_t wdtStatus = Chip_WWDT_GetStatus(LPC_WWDT);&lt;/P&gt;&lt;P&gt;/* The chip will reset before this happens, but if the WDT doesn't&lt;BR /&gt; have WWDT_WDMOD_WDRESET enabled, this will hit once */&lt;BR /&gt; if (wdtStatus &amp;amp; WWDT_WDMOD_WDTOF) {&lt;BR /&gt; /* A watchdog feed didn't occur prior to window timeout */&lt;BR /&gt; Chip_WWDT_UnsetOption(LPC_WWDT, WWDT_WDMOD_WDEN); /* Stop WDT */&lt;BR /&gt; Chip_WWDT_ClearStatusFlag(LPC_WWDT, WWDT_WDMOD_WDTOF);&lt;BR /&gt; Chip_WWDT_Start(LPC_WWDT); /* Needs restart */&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;/* Handle warning interrupt */&lt;BR /&gt; if (wdtStatus &amp;amp; WWDT_WDMOD_WDINT) {&lt;BR /&gt; /* A watchdog feed didn't occur prior to warning timeout */&lt;BR /&gt; Chip_WWDT_ClearStatusFlag(LPC_WWDT, WWDT_WDMOD_WDINT);&lt;BR /&gt; Chip_WWDT_Feed(LPC_WWDT);&lt;BR /&gt; }&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;int main(void)&lt;BR /&gt;{&lt;/P&gt;&lt;P&gt;//Blink an LED for a short time (to indicate a restart)&lt;BR /&gt; Chip_GPIO_Init(LPC_GPIO_PORT);&lt;BR /&gt; Chip_GPIO_SetPinDIROutput(LPC_GPIO_PORT, 0, 14);&lt;BR /&gt; Chip_GPIO_SetPinState(LPC_GPIO_PORT, 0, 14, 1);&lt;BR /&gt; for(uint32_t i=0;i&amp;lt;0xFFFFF;i++); //busy wait loop&lt;BR /&gt; Chip_GPIO_SetPinState(LPC_GPIO_PORT, 0, 14, 0);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; uint32_t wdtFreq;&lt;/P&gt;&lt;P&gt;SystemCoreClockUpdate();&lt;/P&gt;&lt;P&gt;/* Freq = 0.6Mhz, divided by 64. WDT_OSC should be 9.375khz */&lt;BR /&gt; Chip_Clock_SetWDTOSC(WDTLFO_OSC_0_60, 64);&lt;/P&gt;&lt;P&gt;/* Enable the power to the WDT */&lt;BR /&gt; Chip_SYSCTL_PowerUp(SYSCTL_SLPWAKE_WDTOSC_PD);&lt;/P&gt;&lt;P&gt;/* The WDT divides the input frequency into it by 4 */&lt;BR /&gt; wdtFreq = Chip_Clock_GetWDTOSCRate() / 4;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; /* Initialize WWDT (also enables WWDT clock) */&lt;BR /&gt; Chip_WWDT_Init(LPC_WWDT);&lt;/P&gt;&lt;P&gt;/* Set watchdog feed time constant to approximately 2s&lt;BR /&gt; Set watchdog warning time to 512 ticks after feed time constant&lt;BR /&gt; Set watchdog window time to 3s */&lt;BR /&gt; Chip_WWDT_SetTimeOut(LPC_WWDT, wdtFreq * 2);&lt;BR /&gt; Chip_WWDT_Feed(LPC_WWDT);&lt;BR /&gt; Chip_WWDT_SetWarning(LPC_WWDT, 512);&lt;BR /&gt; Chip_WWDT_SetWindow(LPC_WWDT, wdtFreq * 3);&lt;/P&gt;&lt;P&gt;/* Configure WWDT to reset on timeout */&lt;BR /&gt; Chip_WWDT_SetOption(LPC_WWDT, WWDT_WDMOD_WDRESET);&lt;/P&gt;&lt;P&gt;/* Clear watchdog warning and timeout interrupts */&lt;BR /&gt; Chip_WWDT_ClearStatusFlag(LPC_WWDT, WWDT_WDMOD_WDTOF | WWDT_WDMOD_WDINT);&lt;/P&gt;&lt;P&gt;/* Clear and enable watchdog interrupt */&lt;BR /&gt; NVIC_ClearPendingIRQ(WDT_IRQn);&lt;BR /&gt; NVIC_EnableIRQ(WDT_IRQn);&lt;/P&gt;&lt;P&gt;/* Start watchdog */&lt;BR /&gt; Chip_WWDT_Start(LPC_WWDT);&lt;/P&gt;&lt;P&gt;Chip_PMU_DeepSleepState(LPC_PMU);&lt;BR /&gt;}&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 24 Nov 2018 08:30:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Waking-up-issues-with-watchdog-timer-and-wake-up-timer/m-p/797238#M32063</guid>
      <dc:creator>kamranfarhangi</dc:creator>
      <dc:date>2018-11-24T08:30:51Z</dc:date>
    </item>
    <item>
      <title>Re: Waking up issues with watchdog timer and wake-up timer</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Waking-up-issues-with-watchdog-timer-and-wake-up-timer/m-p/797239#M32064</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A _jive_internal="true" data-content-finding="Community" data-userid="331038" data-username="kamranfarhangi" href="https://community.nxp.com/people/kamranfarhangi"&gt;Kamran Farhangi&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;Thank you for your interest in NXP Semiconductor products and for the opportunity to serve you.&lt;BR /&gt;To provide the fastest possible support, I'd highly recommend you to refer to the attachment.&lt;BR /&gt;Have a great day,&lt;BR /&gt;TIC&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>Tue, 27 Nov 2018 03:02:18 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Waking-up-issues-with-watchdog-timer-and-wake-up-timer/m-p/797239#M32064</guid>
      <dc:creator>jeremyzhou</dc:creator>
      <dc:date>2018-11-27T03:02:18Z</dc:date>
    </item>
    <item>
      <title>Re: Waking up issues with watchdog timer and wake-up timer</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Waking-up-issues-with-watchdog-timer-and-wake-up-timer/m-p/797240#M32065</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi jeremyzhou,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you. I used the example in the attachment and it is working fine.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Nov 2018 17:31:04 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Waking-up-issues-with-watchdog-timer-and-wake-up-timer/m-p/797240#M32065</guid>
      <dc:creator>kamranfarhangi</dc:creator>
      <dc:date>2018-11-27T17:31:04Z</dc:date>
    </item>
  </channel>
</rss>

