<?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 Watchdog Reset in LPC Microcontrollers</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/Watchdog-Reset/m-p/522453#M5089</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by pcalton on Thu Nov 07 11:18:08 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I have been trying to add the watchdog to my application to reset the processor if the software hangs using the following setup routine&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;
#define MHz(x) (x * 1000000)

#define WDT_MAX_TIME 5000 // 5 seconds (Max 5592)
#define WDT_MIN_TIME 1 // 1 millisecond

void Board_WWDT_Init(void)
{
// Windowed watchdog runs from internal RC osc at 12MHz with fixed div by 4 prescale.
// 24 bit counter decremented from timeout value to zero (reset core at zero)
// feed resets counter to timeout value
// feed with counter above window value results in a core reset
const uint32_t wdt_count_per_ms = (MHz(12) / 4) / 1000;
const uint32_t wdt_timeout = WDT_MAX_TIME * wdt_count_per_ms;
const uint32_t wdt_window = (WDT_MAX_TIME - WDT_MIN_TIME) * wdt_count_per_ms;

Chip_WWDT_Init(LPC_WWDT);
Chip_WWDT_SetTimeOut(LPC_WWDT, wdt_timeout);
Chip_WWDT_SetOption(LPC_WWDT, WWDT_WDMOD_WDRESET);
Chip_WWDT_ClearStatusFlag(LPC_WWDT, WWDT_WDMOD_WDTOF | WWDT_WDMOD_WDINT);
Chip_WWDT_SetWindow(LPC_WWDT, wdt_window);
Chip_WWDT_Start(LPC_WWDT);
}&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;To test my setup I purposefully allowed the watchdog to expire, expecting the software to reset and restart. The software certainly stopped after 5 seconds, but didnt restart.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;To check whether I had missed anything I loaded up the keil lpcopen peripheral example for the watchdog on a clean un-modded MCB4357 board&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;That application allows interaction via usart3 with the option to disable the feed and reset the device. When I selected this option the flashing led that indicated program life stopped and then to my surprise the LCD lit up showing MCB4300 Demo Example. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If I press the external reset button, the watchdog example starts again and runs until I select the option to disable feeding at which point the MCB4300 Demo Example appears. I can only assume that following the watchdog reset the processor is booting out of external memory even though there is a valid application in the internal flash.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Could someone please explain what is happening and how to rectify it so that the internal flash application starts following a watchdog reset?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 16:40:55 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T16:40:55Z</dc:date>
    <item>
      <title>Watchdog Reset</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Watchdog-Reset/m-p/522453#M5089</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by pcalton on Thu Nov 07 11:18:08 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I have been trying to add the watchdog to my application to reset the processor if the software hangs using the following setup routine&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;
#define MHz(x) (x * 1000000)

#define WDT_MAX_TIME 5000 // 5 seconds (Max 5592)
#define WDT_MIN_TIME 1 // 1 millisecond

void Board_WWDT_Init(void)
{
// Windowed watchdog runs from internal RC osc at 12MHz with fixed div by 4 prescale.
// 24 bit counter decremented from timeout value to zero (reset core at zero)
// feed resets counter to timeout value
// feed with counter above window value results in a core reset
const uint32_t wdt_count_per_ms = (MHz(12) / 4) / 1000;
const uint32_t wdt_timeout = WDT_MAX_TIME * wdt_count_per_ms;
const uint32_t wdt_window = (WDT_MAX_TIME - WDT_MIN_TIME) * wdt_count_per_ms;

Chip_WWDT_Init(LPC_WWDT);
Chip_WWDT_SetTimeOut(LPC_WWDT, wdt_timeout);
Chip_WWDT_SetOption(LPC_WWDT, WWDT_WDMOD_WDRESET);
Chip_WWDT_ClearStatusFlag(LPC_WWDT, WWDT_WDMOD_WDTOF | WWDT_WDMOD_WDINT);
Chip_WWDT_SetWindow(LPC_WWDT, wdt_window);
Chip_WWDT_Start(LPC_WWDT);
}&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;To test my setup I purposefully allowed the watchdog to expire, expecting the software to reset and restart. The software certainly stopped after 5 seconds, but didnt restart.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;To check whether I had missed anything I loaded up the keil lpcopen peripheral example for the watchdog on a clean un-modded MCB4357 board&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;That application allows interaction via usart3 with the option to disable the feed and reset the device. When I selected this option the flashing led that indicated program life stopped and then to my surprise the LCD lit up showing MCB4300 Demo Example. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If I press the external reset button, the watchdog example starts again and runs until I select the option to disable feeding at which point the MCB4300 Demo Example appears. I can only assume that following the watchdog reset the processor is booting out of external memory even though there is a valid application in the internal flash.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Could someone please explain what is happening and how to rectify it so that the internal flash application starts following a watchdog reset?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 16:40:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Watchdog-Reset/m-p/522453#M5089</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T16:40:55Z</dc:date>
    </item>
    <item>
      <title>Re: Watchdog Reset</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Watchdog-Reset/m-p/522454#M5090</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by pcalton on Wed Nov 13 11:20:10 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Is anyone able to provide any feedback on this please?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 16:40:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Watchdog-Reset/m-p/522454#M5090</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T16:40:56Z</dc:date>
    </item>
    <item>
      <title>Re: Watchdog Reset</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Watchdog-Reset/m-p/522455#M5091</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by pcalton on Wed Nov 20 11:14:39 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;For anyone facing a similar problem, I managed to get the following response from NXP support&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: &lt;/STRONG&gt;&lt;BR /&gt;That looks like an issue with the MCB4350 board.&lt;BR /&gt;Remove C97 (in parallel to the ISP pushbutton).&lt;BR /&gt;&lt;BR /&gt;When populated, C97 charges to a level which depends on A9 address line activity.&lt;BR /&gt;After a watchdog reset, the device almost immediately checks P2_7 (=A9). If low, the device boots depending on the four boot switches on the board. These may well be in the position to boot the demo code from external memory.&lt;BR /&gt;&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Removing C97 fixed my problem&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 16:40:57 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Watchdog-Reset/m-p/522455#M5091</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T16:40:57Z</dc:date>
    </item>
  </channel>
</rss>

