lpcware

No interrupts (systick) on M0??

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by omegahacker on Thu Jun 12 18:37:06 MST 2014
OK, here we go again trying to get this M0 running.  I have a dirt simple program that starts the systick and loops with an LED output based on a counter the ISR updates:

volatile uint8_t count = 0;

int main(void) {
  LPC_SCU->SFSPE_5 = 4;                 // GPIO
  LPC_GPIO_PORT->DIR[7] |= (1<<5);      // OUT
  LPC_GPIO_PORT->PIN[7] &= ~(1<<5);     // LED ON

  SysTick->LOAD = 100000;
  SysTick->VAL = 0;
  SysTick->CTRL = 0x00000007;

  NOPx(10000000);

  while (1) {
    if (count == 0) {
      LPC_GPIO_PORT->PIN[7] &= ~(1<<5);         // LED on
    } else {
      LPC_GPIO_PORT->PIN[7] |= (1<<5);          // LED off
    }
  }
}

void xPortSysTickHandler( void ) {
  count++;
}


When I run this directly on the M4, I get exactly what I expect: after an initial burst on, an LED that flickers.

When I load this onto the M0 (see previous threads), I get the LED starting on, a short delay (the NOPx before while()), then it goes off and stays off.  The fact that the LED goes on then off proves that the code is indeed functioning.  The fact that the LED stays dead proves that the interrupt is not firing.

Clearly I'm missing something, but I have no idea what.  Help?

Outcomes