<?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>LPC MicrocontrollersのトピックRe: LPCXpresso802 board stuck in flash error</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPCXpresso802-board-stuck-in-flash-error/m-p/859737#M34218</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello James,&lt;/P&gt;&lt;P&gt;I&amp;nbsp; refer to your requirement " modifying the CTimer example from the NXP code examples for the LPC802 (&lt;SPAN style="background-color: #f6f6f6;"&gt;LPC802-EX-CODE-MCUXPRESSO&lt;/SPAN&gt;) in order to just get the WKT working.",&amp;nbsp;&amp;nbsp; delete the needless codes, change LED from port0_17 to port0_8 as your attached code , it can work well on my side , and also there is no problem about debug .&lt;/P&gt;&lt;P&gt;I attached project, you can have a look.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&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:&lt;BR /&gt;- If this post answers your question, please click the "Mark Correct" button. Thank you!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- We are following threads for 7 weeks after the last post, later replies are ignored&lt;BR /&gt; Please open a new thread and refer to the closed one, if you have a related question at a later point in time.&lt;BR /&gt;-------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 15 Mar 2019 10:14:32 GMT</pubDate>
    <dc:creator>Alice_Yang</dc:creator>
    <dc:date>2019-03-15T10:14:32Z</dc:date>
    <item>
      <title>LPCXpresso802 board stuck in flash error</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPCXpresso802-board-stuck-in-flash-error/m-p/859735#M34216</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm working on the Wakeup Timer for the LPC802 but have crashed my board.&amp;nbsp; The built-in debugger will no longer connect, giving the following error:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;ProgramPage (0x0, 0x100003D8, 0x80) status 0x1 - driver reported driver error - ONCHIP driver rc 10 - Source and destination data not equal&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;Closing flash driver LPC80x_16.cfx&lt;BR /&gt;Target error from Commit Flash write: Ef(49): Flash driver operation gave error.&lt;BR /&gt;GDB stub (crt_emu_cm_redlink) terminating - GDB protocol problem: Pipe has been closed by GDB.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was modifying the CTimer example from the NXP code examples for the LPC802 (&lt;SPAN style="background-color: #f6f6f6;"&gt;LPC802-EX-CODE-MCUXPRESSO&lt;/SPAN&gt;) in order to just get the WKT working.&amp;nbsp; The goal is to use the WKT to drive a LED via the WKT interrupt.&amp;nbsp; I removed all of the CTimer code in the example, only leaving the WKT code.&amp;nbsp; I'm also converting the register calls to the values set in LPC802.h, the header file that comes with the SDK for the board (e.g. SYSCON-&amp;gt;… instead of LPC_SYSCON-&amp;gt;…)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm looking for suggestions for&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. How to reset the board so it stops hanging.&amp;nbsp; (I'm assuming that I should use an external debugger via the SWD port)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. What to change about the WKT initialization or the ISR so that it prevents this issue again in the future.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;James&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;DIV&gt;void WKT_Config() {&lt;BR /&gt;&amp;nbsp;// Step 1: In the SYSAHBCLCKCTRL register, set bit 9 to enable the clock to the reg. interface&lt;BR /&gt;&amp;nbsp;// also enable GPIO for the LED.&lt;BR /&gt;&amp;nbsp;SYSCON-&amp;gt;SYSAHBCLKCTRL0 |= (SYSCON_SYSAHBCLKCTRL0_WKT_MASK|SYSCON_SYSAHBCLKCTRL0_GPIO0_MASK); //(WKT|GPIO0);// Enable some clocks&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;// Power-up the LPOSC&lt;BR /&gt;&amp;nbsp;// PD: Power config register.&amp;nbsp; Active Low: Bit 6 set to 0 (zero) makes the Low Power Osc. turn ON.&lt;BR /&gt;&amp;nbsp;SYSCON-&amp;gt;PDRUNCFG &amp;amp;= ~(SYSCON_PDRUNCFG_LPOSC_PD_MASK);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Power-up the LPOSC&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;// Enable the LPOSC clock to the WKT&lt;BR /&gt;&amp;nbsp;// Enable clock for the Wakeup Timer.&lt;BR /&gt;&amp;nbsp;// Bit 1 of LPOSCCLKEN set to 1 to enable. (Section 6.6.8 of the User Manual)&lt;BR /&gt;&amp;nbsp;SYSCON-&amp;gt;LPOSCCLKEN |= (1&amp;lt;&amp;lt;SYSCON_LPOSCCLKEN_WKT_SHIFT);&amp;nbsp; // Enable the LPOSC clock to the WKT&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;// Step 2. Clear the WKT reset using the PRESETCTRL register&lt;BR /&gt;&amp;nbsp;// (Peripheral Reset Control 0 Register)&lt;BR /&gt;&amp;nbsp;// WKT: bit 9.&amp;nbsp; 0 is "assert" the reset. 1 is "clear" the reset.&lt;BR /&gt;&amp;nbsp;SYSCON-&amp;gt;PRESETCTRL0 &amp;amp;= (SYSCON_PRESETCTRL0_WKT_RST_N_MASK);&amp;nbsp;&amp;nbsp; // "0": Assert the reset&lt;BR /&gt;&amp;nbsp;SYSCON-&amp;gt;PRESETCTRL0 |= ~(SYSCON_PRESETCTRL0_WKT_RST_N_MASK);&amp;nbsp; // "1": Clear the reset&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;// Step 3. Connect WKT interrupt to #15 in NVIC&lt;BR /&gt;&amp;nbsp;NVIC_EnableIRQ(WKT_IRQn);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Enable the WKT interrupt in the NVIC&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;// Step 4. Enable the Clock source&lt;BR /&gt;&amp;nbsp;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a) Enable the low power oscillator in PDRUNCFG register if you're using that clock source&lt;BR /&gt;&amp;nbsp;//&amp;nbsp;&amp;nbsp;&amp;nbsp;b) Enable the FRO and FRO output in PDRUNCFG register if used as the clock source&lt;BR /&gt;&amp;nbsp;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; c) (otherwise ext. clock source via PIO0_11 and switch matrix PINENABLE0 and CTRL registers)&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;//LPC_WKT-&amp;gt;CTRL = DIVIDED_IRC&amp;lt;&amp;lt;WKT_CLKSEL;// Select fro_clk/16 as WKT clock source&lt;BR /&gt;&amp;nbsp;WKT-&amp;gt;CTRL |= (1&amp;lt;&amp;lt;WKT_CTRL_CLKSEL_MASK);&amp;nbsp;// Set bit 0 to 1 for Low power clock. //LOW_POWER_OSC&amp;lt;&amp;lt;WKT_CLKSEL;// Select LPOSC as WKT clock source (approx. 1 MHz)&lt;BR /&gt;&amp;nbsp;WKT-&amp;gt;COUNT = WKT_RELOAD;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Start the WKT, counts down WKT_RELOAD clocks then interrupts&lt;/DIV&gt;&lt;DIV&gt;&lt;BR /&gt;&amp;nbsp; // Set data direction on&lt;BR /&gt;&amp;nbsp; // GPIO to Output.&lt;BR /&gt;&amp;nbsp; GPIO-&amp;gt;DIRSET[0] = (1UL&amp;lt;&amp;lt;8);&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; // Turn on the LED.&lt;BR /&gt;&amp;nbsp; GPIO-&amp;gt;CLR[0] = (1UL&amp;lt;&amp;lt;8);&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;}&lt;/DIV&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;DIV&gt;// Function name: WKT_IRQHandler (interrupt service routine)&lt;BR /&gt;// Description:&amp;nbsp;&amp;nbsp; WKT interrupt service routine.&lt;BR /&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Toggles a pin, restarts the WKT.&lt;BR /&gt;// Parameters:&amp;nbsp;&amp;nbsp;&amp;nbsp; None&lt;BR /&gt;// Returns:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Void&lt;BR /&gt;void WKT_IRQHandler(void) {&lt;BR /&gt;&amp;nbsp; WKT-&amp;gt;CTRL |= 1&amp;lt;&amp;lt;WKT_CTRL_ALARMFLAG_SHIFT;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Clear the interrupt flag&lt;BR /&gt;&amp;nbsp; WKT-&amp;gt;COUNT = WKT_RELOAD;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Restart the WKT&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; // Toggle the LED&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; GPIO-&amp;gt;NOT[0] = (1UL&amp;lt;&amp;lt;8);&lt;/DIV&gt;&lt;DIV&gt;&lt;BR /&gt;&amp;nbsp; return;&lt;BR /&gt;}&lt;/DIV&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;DIV&gt;//&lt;BR /&gt;// main routine&lt;BR /&gt;//&lt;BR /&gt;int main(void) {&lt;/DIV&gt;&lt;DIV&gt;&lt;BR /&gt;&amp;nbsp; // WKT: Wake Timer&lt;BR /&gt;&amp;nbsp; // Configure and start the WKT, also configures an output pin, which toggles every WKT interrupt&lt;BR /&gt;&amp;nbsp; WKT_Config();&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; while(1) { // Have a tequila&lt;BR /&gt;&amp;nbsp;&amp;nbsp; asm("NOP");&lt;BR /&gt;&amp;nbsp; } // end of while 1&lt;/DIV&gt;&lt;DIV&gt;} // end of main&lt;/DIV&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Mar 2019 05:20:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPCXpresso802-board-stuck-in-flash-error/m-p/859735#M34216</guid>
      <dc:creator>drsmith_yorku</dc:creator>
      <dc:date>2019-03-15T05:20:53Z</dc:date>
    </item>
    <item>
      <title>Re: LPCXpresso802 board stuck in flash error</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPCXpresso802-board-stuck-in-flash-error/m-p/859736#M34217</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I figured out how to re-enable the CMSIS-DAP debugger on the LPCXpresso board.&amp;nbsp; I bridged the EXT_DBG connector and then connected a Segger JLink.&amp;nbsp; I downloaded the following via the JLink.&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;DIV&gt;#include "LPC802.h"&lt;/DIV&gt;&lt;DIV&gt;// prototypes&lt;BR /&gt;void WKT_Config();&lt;/DIV&gt;&lt;DIV&gt;// main routine&lt;BR /&gt;//&lt;BR /&gt;int main(void) {&lt;BR /&gt;&amp;nbsp; // WKT: Wake Timer configuration&lt;BR /&gt;&amp;nbsp; WKT_Config();&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; while(1) { // Have a tequila&lt;BR /&gt;&amp;nbsp;&amp;nbsp; asm("NOP");&lt;BR /&gt;&amp;nbsp; } // end of while 1&lt;/DIV&gt;&lt;DIV&gt;} // end of main&lt;/DIV&gt;&lt;DIV&gt;&lt;BR /&gt;// Function name: WKT_Config&lt;BR /&gt;// Description:&amp;nbsp;&amp;nbsp; Initialize a GPIO output pin and the WKT, then start it.&lt;BR /&gt;// Parameters:&amp;nbsp;&amp;nbsp;&amp;nbsp; None&lt;BR /&gt;// Returns:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Void&lt;BR /&gt;// Source: Ch. 18 of the User Manual (UM11045)&lt;BR /&gt;void WKT_Config() {&lt;BR /&gt;&amp;nbsp;// Enable GPIO for the LED.&lt;BR /&gt;&amp;nbsp;SYSCON-&amp;gt;SYSAHBCLKCTRL0 |= (SYSCON_SYSAHBCLKCTRL0_GPIO0_MASK); //(WKT|GPIO0);// Enable some clocks&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; // Set data direction on&lt;BR /&gt;&amp;nbsp;&amp;nbsp; // GPIO to Output.&lt;BR /&gt;&amp;nbsp;&amp;nbsp; GPIO-&amp;gt;DIRSET[0] = (1UL&amp;lt;&amp;lt;LED_USER1);&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; // Turn on the LED.&lt;BR /&gt;&amp;nbsp;&amp;nbsp; GPIO-&amp;gt;CLR[0] = (1UL&amp;lt;&amp;lt;LED_USER1);&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; // Turn off the LED.&lt;BR /&gt;&amp;nbsp;&amp;nbsp; GPIO-&amp;gt;SET[0] = (1UL&amp;lt;&amp;lt;LED_USER1);&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;// Step 1:&lt;BR /&gt;&amp;nbsp;// turn off the WKT enabling clock.&lt;BR /&gt;&amp;nbsp;SYSCON-&amp;gt;SYSAHBCLKCTRL0 &amp;amp;= ~(SYSCON_SYSAHBCLKCTRL0_WKT_MASK);&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;// Step 2: disable the vector lookup for WKT.&lt;BR /&gt;&amp;nbsp;NVIC_DisableIRQ(WKT_IRQn);&amp;nbsp;&amp;nbsp;&amp;nbsp;// turn off the WKT interrupt.&lt;/DIV&gt;&lt;DIV&gt;}&lt;/DIV&gt;&lt;/BLOCKQUOTE&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;So, I've turned off the WKT, after unbridging EXT_DBG and disconnecting the JLink, the CMSIS-DAP connection works again.&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Now, to figure out why the WKT code locked things up in the first place...&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;James&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Mar 2019 08:28:04 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPCXpresso802-board-stuck-in-flash-error/m-p/859736#M34217</guid>
      <dc:creator>drsmith_yorku</dc:creator>
      <dc:date>2019-03-15T08:28:04Z</dc:date>
    </item>
    <item>
      <title>Re: LPCXpresso802 board stuck in flash error</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPCXpresso802-board-stuck-in-flash-error/m-p/859737#M34218</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello James,&lt;/P&gt;&lt;P&gt;I&amp;nbsp; refer to your requirement " modifying the CTimer example from the NXP code examples for the LPC802 (&lt;SPAN style="background-color: #f6f6f6;"&gt;LPC802-EX-CODE-MCUXPRESSO&lt;/SPAN&gt;) in order to just get the WKT working.",&amp;nbsp;&amp;nbsp; delete the needless codes, change LED from port0_17 to port0_8 as your attached code , it can work well on my side , and also there is no problem about debug .&lt;/P&gt;&lt;P&gt;I attached project, you can have a look.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&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:&lt;BR /&gt;- If this post answers your question, please click the "Mark Correct" button. Thank you!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- We are following threads for 7 weeks after the last post, later replies are ignored&lt;BR /&gt; Please open a new thread and refer to the closed one, if you have a related question at a later point in time.&lt;BR /&gt;-------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Mar 2019 10:14:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPCXpresso802-board-stuck-in-flash-error/m-p/859737#M34218</guid>
      <dc:creator>Alice_Yang</dc:creator>
      <dc:date>2019-03-15T10:14:32Z</dc:date>
    </item>
    <item>
      <title>Re: LPCXpresso802 board stuck in flash error</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPCXpresso802-board-stuck-in-flash-error/m-p/859738#M34219</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Alice,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the prompt and helpful reply.&amp;nbsp; I realized that I misinterpreted what was going on in the original version of the code in the lines associated with the Reset Control.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="wrong_code.PNG"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/78038iD15D8F81CCA5A959/image-size/large?v=v2&amp;amp;px=999" role="button" title="wrong_code.PNG" alt="wrong_code.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Normally, with an "&amp;amp;=" I would expect to see a tilde to invert the bitmask.&amp;nbsp; If forgot to do that and it resulted in a number of other registers getting reset, instead of just WKT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I finished the modification of the original code to only use the defintions/macros in lpc802.h.&amp;nbsp; Here it is, and it works, with an ISR period of about 100 ms.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;DIV&gt;// based on LPC802_Project_NXPCode_Ctimer_Ex.c&lt;BR /&gt;//&lt;BR /&gt;// ------------------------------------------------------------------------------------&lt;/DIV&gt;&lt;DIV&gt;#define WKT_FREQ 1000000&amp;nbsp;&amp;nbsp; // Use if the WKT is clocked by the LPOSC&lt;BR /&gt;//#define WKT_FREQ 937500&amp;nbsp; // Use if the WKT is clocked by the 15 MHz FRO, via the div-by-16 WKT divider&lt;BR /&gt;#define WKT_RELOAD 100000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Reload value for the WKT down counter&lt;BR /&gt;#define WKT_INT_FREQ (WKT_FREQ/WKT_RELOAD)&amp;nbsp; // INterrupt frequency of the WKT.&lt;BR /&gt;#define LED_USER1&amp;nbsp;(8)&amp;nbsp;&amp;nbsp;// PIO0_8_RXD&lt;/DIV&gt;&lt;DIV&gt;#include "LPC802.h"&lt;/DIV&gt;&lt;DIV&gt;// prototypes&lt;BR /&gt;void WKT_Config();&lt;/DIV&gt;&lt;DIV&gt;// main routine&lt;BR /&gt;//&lt;BR /&gt;int main(void) {&lt;BR /&gt;&amp;nbsp; // WKT: Wake Timer configuration&lt;BR /&gt;&amp;nbsp; WKT_Config();&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; while(1) { // Have a tequila&lt;BR /&gt;&amp;nbsp;&amp;nbsp; asm("NOP");&lt;BR /&gt;&amp;nbsp; } // end of while 1&lt;/DIV&gt;&lt;DIV&gt;} // end of main&lt;/DIV&gt;&lt;DIV&gt;&lt;BR /&gt;// Function name: WKT_Config&lt;BR /&gt;// Description:&amp;nbsp;&amp;nbsp; Initialize a GPIO output pin and the WKT, then start it.&lt;BR /&gt;// Parameters:&amp;nbsp;&amp;nbsp;&amp;nbsp; None&lt;BR /&gt;// Returns:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Void&lt;BR /&gt;// Source: Ch. 18 of the User Manual (UM11045)&lt;BR /&gt;void WKT_Config() {&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;// --------------------------------------------------------&lt;BR /&gt;&amp;nbsp;// Step 1.&amp;nbsp; Make an LED turn on.&amp;nbsp; Checks that board is up and running.&lt;BR /&gt;&amp;nbsp;// Enable GPIO for the LED.&lt;BR /&gt;&amp;nbsp;SYSCON-&amp;gt;SYSAHBCLKCTRL0 |= (SYSCON_SYSAHBCLKCTRL0_GPIO0_MASK);&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;// GPIO to Output.&lt;BR /&gt;&amp;nbsp;GPIO-&amp;gt;DIRSET[0] = (1UL&amp;lt;&amp;lt;LED_USER1);&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;// Turn on the LED.&lt;BR /&gt;&amp;nbsp;GPIO-&amp;gt;CLR[0] = (1UL&amp;lt;&amp;lt;LED_USER1);&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;// --------------------------------------------------------&lt;BR /&gt;&amp;nbsp;// Step 2: turn on the Wake-up Timer (WKT) enabling clock.&lt;BR /&gt;&amp;nbsp;SYSCON-&amp;gt;SYSAHBCLKCTRL0 |= (SYSCON_SYSAHBCLKCTRL0_WKT_MASK);&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;// --------------------------------------------------------&lt;BR /&gt;&amp;nbsp;// Step 3: disable the vector lookup for WKT.&lt;BR /&gt;&amp;nbsp;NVIC_DisableIRQ(WKT_IRQn);&amp;nbsp; // turn off the WKT interrupt.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;// --------------------------------------------------------&lt;BR /&gt;&amp;nbsp;// Step 4: Turn on the Low Power Oscillator's power supply.&lt;BR /&gt;&amp;nbsp;// &amp;nbsp;&amp;nbsp;&amp;nbsp;bit 6 to 0 in order to turn it ON. (Active low)&lt;BR /&gt;&amp;nbsp;// old version:&amp;nbsp; LPC_SYSCON-&amp;gt;PDRUNCFG &amp;amp;= ~(LPOSC_PD);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Power-up the LPOSC&lt;BR /&gt;&amp;nbsp;SYSCON-&amp;gt;PDRUNCFG &amp;amp;= ~(SYSCON_PDRUNCFG_LPOSC_PD_MASK);&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;// --------------------------------------------------------&lt;BR /&gt;&amp;nbsp;// Step 5: Enable the LPOSC clock to the WKT.&amp;nbsp; (Bit 1 to 1)&lt;BR /&gt;&amp;nbsp;// old version:&amp;nbsp; LPC_SYSCON-&amp;gt;LPOSCCLKEN |= 1&amp;lt;&amp;lt;WKT_CLK_EN;&amp;nbsp; // Enable the LPOSC clock to the WKT&lt;BR /&gt;&amp;nbsp;SYSCON-&amp;gt;LPOSCCLKEN |= (SYSCON_LPOSCCLKEN_WKT_MASK);&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;// --------------------------------------------------------&lt;BR /&gt;&amp;nbsp;// Step 6: Reset the WKT.&lt;BR /&gt;&amp;nbsp;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set bit 9 to 0: assert (i.e. "make") the WKT reset&lt;BR /&gt;&amp;nbsp;// &amp;nbsp;&amp;nbsp; Set bit 9 to 1: clear the WKT reset (i.e. "remove" reset)&lt;BR /&gt;&amp;nbsp;// the original version was broken here.&amp;nbsp; Missing ~ on first line.&amp;nbsp; Too much ~ on 2nd line.&lt;BR /&gt;&amp;nbsp;// without this fix, other modules were getting reset and resulting in hard fault.&lt;BR /&gt;&amp;nbsp;SYSCON-&amp;gt;PRESETCTRL0 &amp;amp;= ~(SYSCON_PRESETCTRL0_WKT_RST_N_MASK);&amp;nbsp;&amp;nbsp; // Reset the WKT&lt;BR /&gt;&amp;nbsp;SYSCON-&amp;gt;PRESETCTRL0 |= (SYSCON_PRESETCTRL0_WKT_RST_N_MASK);&amp;nbsp;&amp;nbsp;// clear the reset.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;// --------------------------------------------------------&lt;BR /&gt;&amp;nbsp;// Step 7: Load the timer&lt;BR /&gt;&amp;nbsp;// --------------------------------------------------------&lt;BR /&gt;&amp;nbsp;// Select the LPOSC as the WKT clock source (0b0001)&lt;BR /&gt;&amp;nbsp;// Bit 0 (CLKSEL) to 1 for Low Power Clock&lt;BR /&gt;&amp;nbsp;// BIt 1 (ALARMFLAG) read flag.&amp;nbsp; If 1, an interrupt has happend. if 0, then no timeout.&lt;BR /&gt;&amp;nbsp;// Bit 2 (CLEARCTR).&amp;nbsp; Set to 1 to clear the counter.&lt;BR /&gt;&amp;nbsp;// Bit 3 (SEL_EXTCLK).&amp;nbsp; Set to 0 for internal clock source.&lt;BR /&gt;&amp;nbsp;//&lt;BR /&gt;&amp;nbsp;//LPC_WKT-&amp;gt;CTRL = LOW_POWER_OSC&amp;lt;&amp;lt;WKT_CLKSEL;// Select LPOSC as WKT clock source (approx. 1 MHz)&lt;BR /&gt;&amp;nbsp;WKT-&amp;gt;CTRL = 0x00000001;&lt;BR /&gt;&amp;nbsp;// need to un-hardcode the line above (line 90.)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;// load the timer count-down value. (The "Timeout value")&lt;BR /&gt;&amp;nbsp;WKT-&amp;gt;COUNT = WKT_RELOAD;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Start the WKT, counts down WKT_RELOAD clocks then interrupts&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;// Enable the IRQ&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;NVIC_EnableIRQ(WKT_IRQn);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Enable the WKT interrupt in the NVIC&lt;BR /&gt;}&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;BR /&gt;// Function name: WKT_IRQHandler (interrupt service routine)&lt;BR /&gt;// Description:&amp;nbsp;&amp;nbsp; WKT interrupt service routine.&lt;BR /&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Toggles a pin, restarts the WKT.&lt;BR /&gt;// Parameters:&amp;nbsp;&amp;nbsp;&amp;nbsp; None&lt;BR /&gt;// Returns:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Void&lt;BR /&gt;void WKT_IRQHandler(void) {&lt;BR /&gt;&amp;nbsp; WKT-&amp;gt;CTRL |= (1&amp;lt;&amp;lt;WKT_CTRL_ALARMFLAG_SHIFT);&amp;nbsp;// Clear the interrupt flag&lt;BR /&gt;&amp;nbsp; WKT-&amp;gt;COUNT = WKT_RELOAD;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;// Restart the WKT&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; // Toggle the LED&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; GPIO-&amp;gt;NOT[0] = (1UL&amp;lt;&amp;lt;LED_USER1);&lt;/DIV&gt;&lt;DIV style="padding-left: 30px;"&gt;&lt;BR /&gt;&amp;nbsp; return;&lt;BR /&gt;}&lt;/DIV&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Mar 2019 12:25:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPCXpresso802-board-stuck-in-flash-error/m-p/859738#M34219</guid>
      <dc:creator>drsmith_yorku</dc:creator>
      <dc:date>2019-03-15T12:25:48Z</dc:date>
    </item>
  </channel>
</rss>

