lpcware

Problem with blue LED in own program with LPCXpresso V2 LPC1549

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by capiman on Sat Nov 08 09:39:38 MST 2014
I just tried some first steps with KEIL uVision 5.12.0 to do some blinking LEDs on LPCXpresso V2 LPC1549.
After downloading CMSIS-DAP into debug controller (via DFUsec), I am able to download self written programs to LPC1549
via KEIL uVision (don't forget to switch from JTAG to SWD).
The red and green LEDs are blinking, the blue one stays off.
The blue one is on port 1 instead of red and green one, which are on port 0.
Is there something special for port 1 or even PIO1_1?
Or some other silly bug, which I have overseen?

int main (void) 
{
  LPC_SYSCON->SYSAHBCLKCTRL0 |= ((1UL << 14) | (1UL << 15));  /* enable clock for GPIO0 and GPIO1 port */

  /* configure GPIO as output */
  LPC_GPIO_PORT->DIR[1]  |= (1UL <<  1);
  LPC_GPIO_PORT->DIR[0]  |= (1UL <<  3);
  LPC_GPIO_PORT->DIR[0]  |= (1UL << 25);

  while(1)
  {
    volatile unsigned long w;
   
    LPC_GPIO_PORT->CLR[1]  = (1UL <<  1);
    LPC_GPIO_PORT->SET[0]  = (1UL <<  3);
    LPC_GPIO_PORT->SET[0]  = (1UL << 25);
   
    for(w = 0; w < 10000000; w++);

    LPC_GPIO_PORT->SET[1]  = (1UL <<  1);
    LPC_GPIO_PORT->CLR[0]  = (1UL <<  3);
    LPC_GPIO_PORT->SET[0]  = (1UL << 25);

    for(w = 0; w < 10000000; w++);

    LPC_GPIO_PORT->SET[1]  = (1UL <<  1);
    LPC_GPIO_PORT->SET[0]  = (1UL <<  3);
    LPC_GPIO_PORT->CLR[0]  = (1UL << 25);

    for(w = 0; w < 10000000; w++);
  }
}

Outcomes