<?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: LPC11U35 Led Blink in LPC Microcontrollers</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC11U35-Led-Blink/m-p/1305380#M45828</link>
    <description>&lt;P&gt;Hello &lt;SPAN class="UserName lia-user-name lia-user-rank-Contributor-II lia-component-message-view-widget-author-username"&gt;&lt;A id="link_12" class="lia-link-navigation lia-page-link lia-user-name-link" style="color: #333f48;" href="https://community.nxp.com/t5/user/viewprofilepage/user-id/180501" target="_self" aria-label="View Profile of ahmad_"&gt;&lt;SPAN class=""&gt;ahmad_&lt;/SPAN&gt;&lt;/A&gt;&lt;/SPAN&gt;,&lt;/P&gt;
&lt;P&gt;Recommend you can refer to the blinky demo under LPCopen for LPC11U14:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Alice_Yang_0-1625825779542.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/149358i954331C817EB7E19/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Alice_Yang_0-1625825779542.png" alt="Alice_Yang_0-1625825779542.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Download from:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.nxp.com/design/microcontrollers-developer-resources/lpcopen-libraries-and-examples/lpcopen-software-development-platform-lpc11xx:LPCOPEN-SOFTWARE-FOR-LPC11XX?tab=Design_Tools_Tab" target="_blank"&gt;https://www.nxp.com/design/microcontrollers-developer-resources/lpcopen-libraries-and-examples/lpcopen-software-development-platform-lpc11xx:LPCOPEN-SOFTWARE-FOR-LPC11XX?tab=Design_Tools_Tab&lt;/A&gt;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 09 Jul 2021 10:16:51 GMT</pubDate>
    <dc:creator>Alice_Yang</dc:creator>
    <dc:date>2021-07-09T10:16:51Z</dc:date>
    <item>
      <title>LPC11U35 Led Blink</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC11U35-Led-Blink/m-p/1305200#M45814</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I try to do simple led blink using LPC11u35 dip module. I use LPC-Link2 and connect to swd pins on LPC11u35 to program the flash.&lt;/P&gt;&lt;P&gt;Below is the change to&amp;nbsp;&lt;SPAN&gt;system_LPCUUxx.c that I've made to use the internal clock of the chip;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;#define CLOCK_SETUP 1&lt;BR /&gt;#define SYSOSCCTRL_Val 0x00000000 // Reset: 0x000&lt;BR /&gt;#define WDTOSCCTRL_Val 0x00000000 // Reset: 0x000&lt;BR /&gt;#define SYSPLLCTRL_Val 0x00000023 // Reset: 0x000&lt;BR /&gt;#define SYSPLLCLKSEL_Val 0x0000000&lt;FONT color="#FF0000"&gt;0&lt;/FONT&gt; // Reset: 0x000&lt;BR /&gt;#define MAINCLKSEL_Val 0x00000003 // Reset: 0x000&lt;BR /&gt;#define SYSAHBCLKDIV_Val 0x00000001 // Reset: 0x001&lt;BR /&gt;#define USBPLLCTRL_Val 0x00000023 // Reset: 0x000&lt;BR /&gt;#define USBPLLCLKSEL_Val 0x00000001 // Reset: 0x000&lt;BR /&gt;#define USBCLKSEL_Val 0x00000000 // Reset: 0x000&lt;BR /&gt;#define USBCLKDIV_Val 0x00000001 // Reset: 0x001&lt;/P&gt;&lt;P&gt;/*&lt;BR /&gt;//-------- &amp;lt;&amp;lt;&amp;lt; end of configuration section &amp;gt;&amp;gt;&amp;gt; ------------------------------&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Here is the full code of system_LPCUUxx.c.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;/******************************************************************************
 * @file     system_LPC11Uxx.c
 * @purpose  CMSIS Cortex-M3 Device Peripheral Access Layer Source File
 *           for the NXP LPC13xx Device Series
 * @version  V1.10
 * @date     24. November 2010
 *
 * @note
 * Copyright (C) 2009-2010 ARM Limited. All rights reserved.
 *
 * @par
 * ARM Limited (ARM) is supplying this software for use with Cortex-M 
 * processor based microcontrollers.  This file can be freely distributed 
 * within development tools that are supporting such ARM based processors. 
 *
 * @par
 * THIS SOFTWARE IS PROVIDED "AS IS".  NO WARRANTIES, WHETHER EXPRESS, IMPLIED
 * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
 * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
 * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
 *
 ******************************************************************************/


#include &amp;lt;stdint.h&amp;gt;
#include "LPC11Uxx.h"

/*
//-------- &amp;lt;&amp;lt;&amp;lt; Use Configuration Wizard in Context Menu &amp;gt;&amp;gt;&amp;gt; ------------------
*/

/*--------------------- Clock Configuration ----------------------------------
//
// &amp;lt;e&amp;gt; Clock Configuration
//   &amp;lt;h&amp;gt; System Oscillator Control Register (SYSOSCCTRL)
//     &amp;lt;o1.0&amp;gt;      BYPASS: System Oscillator Bypass Enable
//                     &amp;lt;i&amp;gt; If enabled then PLL input (sys_osc_clk) is fed
//                     &amp;lt;i&amp;gt; directly from XTALIN and XTALOUT pins.
//     &amp;lt;o1.9&amp;gt;      FREQRANGE: System Oscillator Frequency Range
//                     &amp;lt;i&amp;gt; Determines frequency range for Low-power oscillator.
//                   &amp;lt;0=&amp;gt; 1 - 20 MHz
//                   &amp;lt;1=&amp;gt; 15 - 25 MHz
//   &amp;lt;/h&amp;gt;
//
//   &amp;lt;h&amp;gt; Watchdog Oscillator Control Register (WDTOSCCTRL)
//     &amp;lt;o2.0..4&amp;gt;   DIVSEL: Select Divider for Fclkana
//                     &amp;lt;i&amp;gt; wdt_osc_clk = Fclkana/ (2 � (1 + DIVSEL))
//                   &amp;lt;0-31&amp;gt;
//     &amp;lt;o2.5..8&amp;gt;   FREQSEL: Select Watchdog Oscillator Analog Output Frequency (Fclkana)
//                   &amp;lt;0=&amp;gt; Undefined
//                   &amp;lt;1=&amp;gt; 0.5 MHz
//                   &amp;lt;2=&amp;gt; 0.8 MHz
//                   &amp;lt;3=&amp;gt; 1.1 MHz
//                   &amp;lt;4=&amp;gt; 1.4 MHz
//                   &amp;lt;5=&amp;gt; 1.6 MHz
//                   &amp;lt;6=&amp;gt; 1.8 MHz
//                   &amp;lt;7=&amp;gt; 2.0 MHz
//                   &amp;lt;8=&amp;gt; 2.2 MHz
//                   &amp;lt;9=&amp;gt; 2.4 MHz
//                   &amp;lt;10=&amp;gt; 2.6 MHz
//                   &amp;lt;11=&amp;gt; 2.7 MHz
//                   &amp;lt;12=&amp;gt; 2.9 MHz
//                   &amp;lt;13=&amp;gt; 3.1 MHz
//                   &amp;lt;14=&amp;gt; 3.2 MHz
//                   &amp;lt;15=&amp;gt; 3.4 MHz
//   &amp;lt;/h&amp;gt;
//
//   &amp;lt;h&amp;gt; System PLL Control Register (SYSPLLCTRL)
//                   &amp;lt;i&amp;gt; F_clkout = M * F_clkin = F_CCO / (2 * P)
//                   &amp;lt;i&amp;gt; F_clkin must be in the range of  10 MHz to  25 MHz
//                   &amp;lt;i&amp;gt; F_CCO   must be in the range of 156 MHz to 320 MHz
//     &amp;lt;o3.0..4&amp;gt;   MSEL: Feedback Divider Selection
//                     &amp;lt;i&amp;gt; M = MSEL + 1
//                   &amp;lt;0-31&amp;gt;
//     &amp;lt;o3.5..6&amp;gt;   PSEL: Post Divider Selection
//                   &amp;lt;0=&amp;gt; P = 1
//                   &amp;lt;1=&amp;gt; P = 2
//                   &amp;lt;2=&amp;gt; P = 4
//                   &amp;lt;3=&amp;gt; P = 8
//   &amp;lt;/h&amp;gt;
//
//   &amp;lt;h&amp;gt; System PLL Clock Source Select Register (SYSPLLCLKSEL)
//     &amp;lt;o4.0..1&amp;gt;   SEL: System PLL Clock Source
//                   &amp;lt;0=&amp;gt; IRC Oscillator
//                   &amp;lt;1=&amp;gt; System Oscillator
//                   &amp;lt;2=&amp;gt; Reserved
//                   &amp;lt;3=&amp;gt; Reserved
//   &amp;lt;/h&amp;gt;
//
//   &amp;lt;h&amp;gt; Main Clock Source Select Register (MAINCLKSEL)
//     &amp;lt;o5.0..1&amp;gt;   SEL: Clock Source for Main Clock
//                   &amp;lt;0=&amp;gt; IRC Oscillator
//                   &amp;lt;1=&amp;gt; Input Clock to System PLL
//                   &amp;lt;2=&amp;gt; WDT Oscillator
//                   &amp;lt;3=&amp;gt; System PLL Clock Out
//   &amp;lt;/h&amp;gt;
//
//   &amp;lt;h&amp;gt; System AHB Clock Divider Register (SYSAHBCLKDIV)
//     &amp;lt;o6.0..7&amp;gt;   DIV: System AHB Clock Divider
//                     &amp;lt;i&amp;gt; Divides main clock to provide system clock to core, memories, and peripherals.
//                     &amp;lt;i&amp;gt; 0 = is disabled
//                   &amp;lt;0-255&amp;gt;
//   &amp;lt;/h&amp;gt;
//
//   &amp;lt;h&amp;gt; USB PLL Control Register (USBPLLCTRL)
//                   &amp;lt;i&amp;gt; F_clkout = M * F_clkin = F_CCO / (2 * P)
//                   &amp;lt;i&amp;gt; F_clkin must be in the range of  10 MHz to  25 MHz
//                   &amp;lt;i&amp;gt; F_CCO   must be in the range of 156 MHz to 320 MHz
//     &amp;lt;o7.0..4&amp;gt;   MSEL: Feedback Divider Selection
//                     &amp;lt;i&amp;gt; M = MSEL + 1
//                   &amp;lt;0-31&amp;gt;
//     &amp;lt;o7.5..6&amp;gt;   PSEL: Post Divider Selection
//                   &amp;lt;0=&amp;gt; P = 1
//                   &amp;lt;1=&amp;gt; P = 2
//                   &amp;lt;2=&amp;gt; P = 4
//                   &amp;lt;3=&amp;gt; P = 8
//   &amp;lt;/h&amp;gt;
//
//   &amp;lt;h&amp;gt; USB PLL Clock Source Select Register (USBPLLCLKSEL)
//     &amp;lt;o8.0..1&amp;gt;   SEL: USB PLL Clock Source
//                     &amp;lt;i&amp;gt; USB PLL clock source must be switched to System Oscillator for correct USB operation
//                   &amp;lt;0=&amp;gt; IRC Oscillator
//                   &amp;lt;1=&amp;gt; System Oscillator
//                   &amp;lt;2=&amp;gt; Reserved
//                   &amp;lt;3=&amp;gt; Reserved
//   &amp;lt;/h&amp;gt;
//
//   &amp;lt;h&amp;gt; USB Clock Source Select Register (USBCLKSEL)
//     &amp;lt;o9.0..1&amp;gt;   SEL: System PLL Clock Source
//                   &amp;lt;0=&amp;gt; USB PLL out
//                   &amp;lt;1=&amp;gt; Main clock
//                   &amp;lt;2=&amp;gt; Reserved
//                   &amp;lt;3=&amp;gt; Reserved
//   &amp;lt;/h&amp;gt;
//
//   &amp;lt;h&amp;gt; USB Clock Divider Register (USBCLKDIV)
//     &amp;lt;o10.0..7&amp;gt;  DIV: USB Clock Divider
//                     &amp;lt;i&amp;gt; Divides USB clock to 48 MHz.
//                     &amp;lt;i&amp;gt; 0 = is disabled
//                   &amp;lt;0-255&amp;gt;
//   &amp;lt;/h&amp;gt;
// &amp;lt;/e&amp;gt;
*/
#define CLOCK_SETUP           1
#define SYSOSCCTRL_Val        0x00000000              // Reset: 0x000
#define WDTOSCCTRL_Val        0x00000000              // Reset: 0x000
#define SYSPLLCTRL_Val        0x00000023              // Reset: 0x000
#define SYSPLLCLKSEL_Val      0x00000000              // Reset: 0x000
#define MAINCLKSEL_Val        0x00000003              // Reset: 0x000
#define SYSAHBCLKDIV_Val      0x00000001              // Reset: 0x001
#define USBPLLCTRL_Val        0x00000023              // Reset: 0x000
#define USBPLLCLKSEL_Val      0x00000001              // Reset: 0x000
#define USBCLKSEL_Val         0x00000000              // Reset: 0x000
#define USBCLKDIV_Val         0x00000001              // Reset: 0x001

/*
//-------- &amp;lt;&amp;lt;&amp;lt; end of configuration section &amp;gt;&amp;gt;&amp;gt; ------------------------------
*/

/*----------------------------------------------------------------------------
  Check the register settings
 *----------------------------------------------------------------------------*/
#define CHECK_RANGE(val, min, max)                ((val &amp;lt; min) || (val &amp;gt; max))
#define CHECK_RSVD(val, mask)                     (val &amp;amp; mask)

/* Clock Configuration -------------------------------------------------------*/
#if (CHECK_RSVD((SYSOSCCTRL_Val),  ~0x00000003))
   #error "SYSOSCCTRL: Invalid values of reserved bits!"
#endif

#if (CHECK_RSVD((WDTOSCCTRL_Val),  ~0x000001FF))
   #error "WDTOSCCTRL: Invalid values of reserved bits!"
#endif

#if (CHECK_RANGE((SYSPLLCLKSEL_Val), 0, 2))
   #error "SYSPLLCLKSEL: Value out of range!"
#endif

#if (CHECK_RSVD((SYSPLLCTRL_Val),  ~0x000001FF))
   #error "SYSPLLCTRL: Invalid values of reserved bits!"
#endif

#if (CHECK_RSVD((MAINCLKSEL_Val),  ~0x00000003))
   #error "MAINCLKSEL: Invalid values of reserved bits!"
#endif

#if (CHECK_RANGE((SYSAHBCLKDIV_Val), 0, 255))
   #error "SYSAHBCLKDIV: Value out of range!"
#endif

#if (CHECK_RANGE((USBPLLCLKSEL_Val), 0, 1))
   #error "USBPLLCLKSEL: Value out of range!"
#endif

#if (CHECK_RSVD((USBPLLCTRL_Val),  ~0x000001FF))
   #error "USBPLLCTRL: Invalid values of reserved bits!"
#endif

#if (CHECK_RANGE((USBCLKSEL_Val), 0, 1))
   #error "USBCLKSEL: Value out of range!"
#endif

#if (CHECK_RANGE((USBCLKDIV_Val), 0, 255))
   #error "USBCLKDIV: Value out of range!"
#endif


/*----------------------------------------------------------------------------
  DEFINES
 *----------------------------------------------------------------------------*/
    
/*----------------------------------------------------------------------------
  Define clocks
 *----------------------------------------------------------------------------*/
#define __XTAL            (12000000UL)    /* Oscillator frequency             */
#define __SYS_OSC_CLK     (    __XTAL)    /* Main oscillator frequency        */
#define __IRC_OSC_CLK     (12000000UL)    /* Internal RC oscillator frequency */


#define __FREQSEL   ((WDTOSCCTRL_Val &amp;gt;&amp;gt; 5) &amp;amp; 0x0F)
#define __DIVSEL   (((WDTOSCCTRL_Val &amp;amp; 0x1F) &amp;lt;&amp;lt; 1) + 2)

#if (CLOCK_SETUP)                         /* Clock Setup              */
  #if  (__FREQSEL ==  0)
    #define __WDT_OSC_CLK        ( 0)                  /* undefined */
  #elif (__FREQSEL ==  1)
    #define __WDT_OSC_CLK        ( 500000 / __DIVSEL)
  #elif (__FREQSEL ==  2)
    #define __WDT_OSC_CLK        ( 800000 / __DIVSEL)
  #elif (__FREQSEL ==  3)
    #define __WDT_OSC_CLK        (1100000 / __DIVSEL)
  #elif (__FREQSEL ==  4)
    #define __WDT_OSC_CLK        (1400000 / __DIVSEL)
  #elif (__FREQSEL ==  5)
    #define __WDT_OSC_CLK        (1600000 / __DIVSEL)
  #elif (__FREQSEL ==  6)
    #define __WDT_OSC_CLK        (1800000 / __DIVSEL)
  #elif (__FREQSEL ==  7)
    #define __WDT_OSC_CLK        (2000000 / __DIVSEL)
  #elif (__FREQSEL ==  8)
    #define __WDT_OSC_CLK        (2200000 / __DIVSEL)
  #elif (__FREQSEL ==  9)
    #define __WDT_OSC_CLK        (2400000 / __DIVSEL)
  #elif (__FREQSEL == 10)
    #define __WDT_OSC_CLK        (2600000 / __DIVSEL)
  #elif (__FREQSEL == 11)
    #define __WDT_OSC_CLK        (2700000 / __DIVSEL)
  #elif (__FREQSEL == 12)
    #define __WDT_OSC_CLK        (2900000 / __DIVSEL)
  #elif (__FREQSEL == 13)
    #define __WDT_OSC_CLK        (3100000 / __DIVSEL)
  #elif (__FREQSEL == 14)
    #define __WDT_OSC_CLK        (3200000 / __DIVSEL)
  #else
    #define __WDT_OSC_CLK        (3400000 / __DIVSEL)
  #endif

  /* sys_pllclkin calculation */
  #if   ((SYSPLLCLKSEL_Val &amp;amp; 0x03) == 0)
    #define __SYS_PLLCLKIN           (__IRC_OSC_CLK)
  #elif ((SYSPLLCLKSEL_Val &amp;amp; 0x03) == 1)
    #define __SYS_PLLCLKIN           (__SYS_OSC_CLK)
  #else
    #define __SYS_PLLCLKIN           (0)
  #endif

  #define  __SYS_PLLCLKOUT         (__SYS_PLLCLKIN * ((SYSPLLCTRL_Val &amp;amp; 0x01F) + 1))

  /* main clock calculation */
  #if   ((MAINCLKSEL_Val &amp;amp; 0x03) == 0)
    #define __MAIN_CLOCK             (__IRC_OSC_CLK)
  #elif ((MAINCLKSEL_Val &amp;amp; 0x03) == 1)
    #define __MAIN_CLOCK             (__SYS_PLLCLKIN)
  #elif ((MAINCLKSEL_Val &amp;amp; 0x03) == 2)
    #if (__FREQSEL ==  0)
      #error "MAINCLKSEL: WDT Oscillator selected but FREQSEL is undefined!"
    #else
      #define __MAIN_CLOCK           (__WDT_OSC_CLK)
    #endif
  #elif ((MAINCLKSEL_Val &amp;amp; 0x03) == 3)
    #define __MAIN_CLOCK             (__SYS_PLLCLKOUT)
  #else
    #define __MAIN_CLOCK             (0)
  #endif

  #define __SYSTEM_CLOCK             (__MAIN_CLOCK / SYSAHBCLKDIV_Val)

#else
  #define __SYSTEM_CLOCK             (__IRC_OSC_CLK)
#endif  // CLOCK_SETUP 


/*----------------------------------------------------------------------------
  Clock Variable definitions
 *----------------------------------------------------------------------------*/
uint32_t SystemCoreClock = __SYSTEM_CLOCK;/*!&amp;lt; System Clock Frequency (Core Clock)*/


/*----------------------------------------------------------------------------
  Clock functions
 *----------------------------------------------------------------------------*/
void SystemCoreClockUpdate (void)            /* Get Core Clock Frequency      */
{
  uint32_t wdt_osc = 0;

  /* Determine clock frequency according to clock register values             */
  switch ((LPC_SYSCON-&amp;gt;WDTOSCCTRL &amp;gt;&amp;gt; 5) &amp;amp; 0x0F) {
    case 0:  wdt_osc =       0; break;
    case 1:  wdt_osc =  500000; break;
    case 2:  wdt_osc =  800000; break;
    case 3:  wdt_osc = 1100000; break;
    case 4:  wdt_osc = 1400000; break;
    case 5:  wdt_osc = 1600000; break;
    case 6:  wdt_osc = 1800000; break;
    case 7:  wdt_osc = 2000000; break;
    case 8:  wdt_osc = 2200000; break;
    case 9:  wdt_osc = 2400000; break;
    case 10: wdt_osc = 2600000; break;
    case 11: wdt_osc = 2700000; break;
    case 12: wdt_osc = 2900000; break;
    case 13: wdt_osc = 3100000; break;
    case 14: wdt_osc = 3200000; break;
    case 15: wdt_osc = 3400000; break;
  }
  wdt_osc /= ((LPC_SYSCON-&amp;gt;WDTOSCCTRL &amp;amp; 0x1F) &amp;lt;&amp;lt; 1) + 2;
 
  switch (LPC_SYSCON-&amp;gt;MAINCLKSEL &amp;amp; 0x03) {
    case 0:                             /* Internal RC oscillator             */
      SystemCoreClock = __IRC_OSC_CLK;
      break;
    case 1:                             /* Input Clock to System PLL          */
      switch (LPC_SYSCON-&amp;gt;SYSPLLCLKSEL &amp;amp; 0x03) {
          case 0:                       /* Internal RC oscillator             */
            SystemCoreClock = __IRC_OSC_CLK;
            break;
          case 1:                       /* System oscillator                  */
            SystemCoreClock = __SYS_OSC_CLK;
            break;
          case 2:                       /* Reserved                           */
          case 3:                       /* Reserved                           */
            SystemCoreClock = 0;
            break;
      }
      break;
    case 2:                             /* WDT Oscillator                     */
      SystemCoreClock = wdt_osc;
      break;
    case 3:                             /* System PLL Clock Out               */
      switch (LPC_SYSCON-&amp;gt;SYSPLLCLKSEL &amp;amp; 0x03) {
          case 0:                       /* Internal RC oscillator             */
            if (LPC_SYSCON-&amp;gt;SYSPLLCTRL &amp;amp; 0x180) {
              SystemCoreClock = __IRC_OSC_CLK;
            } else {
              SystemCoreClock = __IRC_OSC_CLK * ((LPC_SYSCON-&amp;gt;SYSPLLCTRL &amp;amp; 0x01F) + 1);
            }
            break;
          case 1:                       /* System oscillator                  */
            if (LPC_SYSCON-&amp;gt;SYSPLLCTRL &amp;amp; 0x180) {
              SystemCoreClock = __SYS_OSC_CLK;
            } else {
              SystemCoreClock = __SYS_OSC_CLK * ((LPC_SYSCON-&amp;gt;SYSPLLCTRL &amp;amp; 0x01F) + 1);
            }
            break;
          case 2:                       /* Reserved                           */
          case 3:                       /* Reserved                           */
            SystemCoreClock = 0;
            break;
      }
      break;
  }

  SystemCoreClock /= LPC_SYSCON-&amp;gt;SYSAHBCLKDIV;  

}

/**
 * Initialize the system
 *
 * @param  none
 * @return none
 *
 * @brief  Setup the microcontroller system.
 *         Initialize the System.
 */
void SystemInit (void) {
  volatile uint32_t i;

#if (CLOCK_SETUP)                                 /* Clock Setup              */

#if ((SYSPLLCLKSEL_Val &amp;amp; 0x03) == 1)
  LPC_SYSCON-&amp;gt;PDRUNCFG     &amp;amp;= ~(1 &amp;lt;&amp;lt; 5);          /* Power-up System Osc      */
  LPC_SYSCON-&amp;gt;SYSOSCCTRL    = SYSOSCCTRL_Val;
  for (i = 0; i &amp;lt; 200; i++) __NOP();
#endif

  LPC_SYSCON-&amp;gt;SYSPLLCLKSEL  = SYSPLLCLKSEL_Val;   /* Select PLL Input         */
  LPC_SYSCON-&amp;gt;SYSPLLCLKUEN  = 0x01;               /* Update Clock Source      */
  LPC_SYSCON-&amp;gt;SYSPLLCLKUEN  = 0x00;               /* Toggle Update Register   */
  LPC_SYSCON-&amp;gt;SYSPLLCLKUEN  = 0x01;
  while (!(LPC_SYSCON-&amp;gt;SYSPLLCLKUEN &amp;amp; 0x01));     /* Wait Until Updated       */
#if ((MAINCLKSEL_Val &amp;amp; 0x03) == 3)                /* Main Clock is PLL Out    */
  LPC_SYSCON-&amp;gt;SYSPLLCTRL    = SYSPLLCTRL_Val;
  LPC_SYSCON-&amp;gt;PDRUNCFG     &amp;amp;= ~(1 &amp;lt;&amp;lt; 7);          /* Power-up SYSPLL          */
  while (!(LPC_SYSCON-&amp;gt;SYSPLLSTAT &amp;amp; 0x01));	      /* Wait Until PLL Locked    */
#endif

#if (((MAINCLKSEL_Val &amp;amp; 0x03) == 2) )
  LPC_SYSCON-&amp;gt;WDTOSCCTRL    = WDTOSCCTRL_Val;
  LPC_SYSCON-&amp;gt;PDRUNCFG     &amp;amp;= ~(1 &amp;lt;&amp;lt; 6);          /* Power-up WDT Clock       */
  for (i = 0; i &amp;lt; 200; i++) __NOP();
#endif

  LPC_SYSCON-&amp;gt;MAINCLKSEL    = MAINCLKSEL_Val;     /* Select PLL Clock Output  */
  LPC_SYSCON-&amp;gt;MAINCLKUEN    = 0x01;               /* Update MCLK Clock Source */
  LPC_SYSCON-&amp;gt;MAINCLKUEN    = 0x00;               /* Toggle Update Register   */
  LPC_SYSCON-&amp;gt;MAINCLKUEN    = 0x01;
  while (!(LPC_SYSCON-&amp;gt;MAINCLKUEN &amp;amp; 0x01));       /* Wait Until Updated       */

  LPC_SYSCON-&amp;gt;SYSAHBCLKDIV  = SYSAHBCLKDIV_Val;

#if ((USBCLKDIV_Val &amp;amp; 0x1FF) != 0)                /* USB clock is used        */
  LPC_SYSCON-&amp;gt;PDRUNCFG     &amp;amp;= ~(1 &amp;lt;&amp;lt; 10);         /* Power-up USB PHY         */

#if ((USBCLKSEL_Val &amp;amp; 0x003) == 0)                /* USB clock is USB PLL out */
  LPC_SYSCON-&amp;gt;PDRUNCFG     &amp;amp;= ~(1 &amp;lt;&amp;lt;  8);         /* Power-up USB PLL         */
  LPC_SYSCON-&amp;gt;USBPLLCLKSEL  = USBPLLCLKSEL_Val;   /* Select PLL Input         */
  LPC_SYSCON-&amp;gt;USBPLLCLKUEN  = 0x01;               /* Update Clock Source      */
  LPC_SYSCON-&amp;gt;USBPLLCLKUEN  = 0x00;               /* Toggle Update Register   */
  LPC_SYSCON-&amp;gt;USBPLLCLKUEN  = 0x01;
  while (!(LPC_SYSCON-&amp;gt;USBPLLCLKUEN &amp;amp; 0x01));     /* Wait Until Updated       */
  LPC_SYSCON-&amp;gt;USBPLLCTRL    = USBPLLCTRL_Val;
  while (!(LPC_SYSCON-&amp;gt;USBPLLSTAT   &amp;amp; 0x01));     /* Wait Until PLL Locked    */
  LPC_SYSCON-&amp;gt;USBCLKSEL     = 0x00;               /* Select USB PLL           */
#endif

  LPC_SYSCON-&amp;gt;USBCLKSEL     = USBCLKSEL_Val;      /* Select USB Clock         */
  LPC_SYSCON-&amp;gt;USBCLKDIV     = USBCLKDIV_Val;      /* Set USB clock divider    */

#else                                             /* USB clock is not used    */                        
  LPC_SYSCON-&amp;gt;PDRUNCFG     |=  (1 &amp;lt;&amp;lt; 10);         /* Power-down USB PHY       */
  LPC_SYSCON-&amp;gt;PDRUNCFG     |=  (1 &amp;lt;&amp;lt;  8);         /* Power-down USB PLL       */
#endif

#endif

  /* System clock to the IOCON needs to be enabled or
  most of the I/O related peripherals won't work. */
  LPC_SYSCON-&amp;gt;SYSAHBCLKCTRL |= (1&amp;lt;&amp;lt;16);

}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my main code;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;/*****************************************************************************
 *
 *   Copyright(C) 2012, Embedded Artists AB
 *   All rights reserved.
 *
 *   This project is based on Code Red Technologies systick example
 *
 ******************************************************************************
 * Software that is described herein is for illustrative purposes only
 * which provides customers with programming information regarding the
 * products. This software is supplied "AS IS" without any warranties.
 * Embedded Artists AB assumes no responsibility or liability for the
 * use of the software, conveys no license or title under any patent,
 * copyright, or mask work right to the product. Embedded Artists AB
 * reserves the right to make changes in the software without
 * notification. Embedded Artists AB also make no representation or
 * warranty that such application will be suitable for the specified
 * use without further testing or modification.
 *****************************************************************************/

/******************************************************************************
 * Includes
 *****************************************************************************/

#ifdef __USE_CMSIS
#include "LPC11Uxx.h"
#endif

#include &amp;lt;cr_section_macros.h&amp;gt;
#include &amp;lt;NXP/crp.h&amp;gt;

#include "gpio.h"

/******************************************************************************
 * Typedef and defines
 *****************************************************************************/

// p0.7 is connected to LED3 on LPC11U35 QSB Board
#define LED_PORT 0  // Port for led
#define LED_BIT  7  // Bit on port for led
#define LED_ON   1  // Level to set port to turn on led
#define LED_OFF  0  // Level to set port to turn off led

// delay when toggling the LED
#define DELAY_LEN_MS 500

// Variable to store CRP value in. Will be placed automatically
// by the linker when "Enable Code Read Protect" selected.
// See crp.h header for more information
__CRP const unsigned int CRP_WORD = CRP_NO_CRP ;


/******************************************************************************
 * Local variables
 *****************************************************************************/

static volatile uint32_t msTicks;

/******************************************************************************
 * Local functions
 *****************************************************************************/

/******************************************************************************
 *
 * Description:
 *    Delay function
 *
 * Params:
 *    ms - number of milliseconds to wait
 *
 *****************************************************************************/
__INLINE static void delay_ms (uint32_t ms) {
  uint32_t curTicks;

  curTicks = msTicks;
  while ((msTicks - curTicks) &amp;lt; ms);
}

/******************************************************************************
 * Public functions
 *****************************************************************************/

void SysTick_Handler(void) {
  msTicks++;
}

/******************************************************************************
 *
 * Description:
 *    Main function
 *
 *****************************************************************************/
int main(void) {

  // Initialize GPIO
  GPIOInit();

  // Set LED pin as output
  GPIOSetDir(0, 17, 1 );
  GPIOSetDir(1, 15, 1 );
  GPIOSetDir(0, 16, 1 );

  // enable 1 ms timer tick
  if (SysTick_Config(SystemCoreClock / 1000)) {
    while (1);
  }

  while (1) {

    // off
    GPIOSetBitValue(0, 17, 1 );
    GPIOSetBitValue(1, 15, 1 );
    GPIOSetBitValue(0, 16, 1 );
    delay_ms(DELAY_LEN_MS);

    // on
    GPIOSetBitValue(0, 17, 0 );
    GPIOSetBitValue(1, 15, 0 );
    GPIOSetBitValue(0, 16, 0 );
    delay_ms(DELAY_LEN_MS);

  }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I successfully program the flash, but the LEDs wont blink.&lt;/P&gt;&lt;P&gt;Is there any other setup that I need to do?&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Nov 2021 07:05:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC11U35-Led-Blink/m-p/1305200#M45814</guid>
      <dc:creator>mohd_</dc:creator>
      <dc:date>2021-11-16T07:05:33Z</dc:date>
    </item>
    <item>
      <title>Re: LPC11U35 Led Blink</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC11U35-Led-Blink/m-p/1305229#M45816</link>
      <description>&lt;P&gt;Use a debugger, and see where the code gets stuck.&lt;/P&gt;&lt;P&gt;I suspect a while loop in the clock setup (&lt;FONT face="courier new,courier"&gt;SystemInit()&lt;/FONT&gt;).&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jul 2021 06:45:01 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC11U35-Led-Blink/m-p/1305229#M45816</guid>
      <dc:creator>frank_m</dc:creator>
      <dc:date>2021-07-09T06:45:01Z</dc:date>
    </item>
    <item>
      <title>Re: LPC11U35 Led Blink</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC11U35-Led-Blink/m-p/1305380#M45828</link>
      <description>&lt;P&gt;Hello &lt;SPAN class="UserName lia-user-name lia-user-rank-Contributor-II lia-component-message-view-widget-author-username"&gt;&lt;A id="link_12" class="lia-link-navigation lia-page-link lia-user-name-link" style="color: #333f48;" href="https://community.nxp.com/t5/user/viewprofilepage/user-id/180501" target="_self" aria-label="View Profile of ahmad_"&gt;&lt;SPAN class=""&gt;ahmad_&lt;/SPAN&gt;&lt;/A&gt;&lt;/SPAN&gt;,&lt;/P&gt;
&lt;P&gt;Recommend you can refer to the blinky demo under LPCopen for LPC11U14:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Alice_Yang_0-1625825779542.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/149358i954331C817EB7E19/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Alice_Yang_0-1625825779542.png" alt="Alice_Yang_0-1625825779542.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Download from:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.nxp.com/design/microcontrollers-developer-resources/lpcopen-libraries-and-examples/lpcopen-software-development-platform-lpc11xx:LPCOPEN-SOFTWARE-FOR-LPC11XX?tab=Design_Tools_Tab" target="_blank"&gt;https://www.nxp.com/design/microcontrollers-developer-resources/lpcopen-libraries-and-examples/lpcopen-software-development-platform-lpc11xx:LPCOPEN-SOFTWARE-FOR-LPC11XX?tab=Design_Tools_Tab&lt;/A&gt;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jul 2021 10:16:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC11U35-Led-Blink/m-p/1305380#M45828</guid>
      <dc:creator>Alice_Yang</dc:creator>
      <dc:date>2021-07-09T10:16:51Z</dc:date>
    </item>
    <item>
      <title>Re: LPC11U35 Led Blink</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC11U35-Led-Blink/m-p/1305906#M45837</link>
      <description>&lt;P&gt;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/137574"&gt;@frank_m&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/27788"&gt;@Alice_Yang&lt;/a&gt;&lt;/P&gt;&lt;P&gt;Thank you for the suggestion.&lt;/P&gt;&lt;P&gt;I found the problem.&amp;nbsp;&lt;/P&gt;&lt;P&gt;#define CLOCK_SETUP 1&lt;BR /&gt;#define SYSOSCCTRL_Val 0x00000000 // Reset: 0x000&lt;BR /&gt;#define WDTOSCCTRL_Val 0x00000000 // Reset: 0x000&lt;BR /&gt;#define SYSPLLCTRL_Val 0x00000023 // Reset: 0x000&lt;BR /&gt;#define SYSPLLCLKSEL_Val 0x00000000 // Reset: 0x000&lt;BR /&gt;#define MAINCLKSEL_Val 0x00000003 // Reset: 0x000&lt;BR /&gt;#define SYSAHBCLKDIV_Val 0x00000001 // Reset: 0x001&lt;BR /&gt;#define USBPLLCTRL_Val 0x00000023 // Reset: 0x000&lt;BR /&gt;&lt;FONT color="#000000"&gt;#define USBPLLCLKSEL_Val 0x00000000 // Reset: 0x000&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#000000"&gt;#define USBCLKSEL_Val 0x00000000 // Reset: 0x000&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#000000"&gt;#define USBCLKDIV_Val 0x00000000 // Reset: 0x001&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;/*&lt;BR /&gt;//-------- &amp;lt;&amp;lt;&amp;lt; end of configuration section &amp;gt;&amp;gt;&amp;gt; ------------------------------&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Nov 2021 07:03:18 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC11U35-Led-Blink/m-p/1305906#M45837</guid>
      <dc:creator>mohd_</dc:creator>
      <dc:date>2021-11-16T07:03:18Z</dc:date>
    </item>
  </channel>
</rss>

