LPC1114, RedProbe+: stepping through an interrupt fails

Discussion created by lpcware Employee on Jun 15, 2016
Content originally posted in LPCWare by nevis123 on Mon Aug 29 01:42:03 MST 2011
I'm trying to get a first step in with the LPC1114 (running on 48MHz) on a LPCXpresso board. My problem is that I always get an error if I'm stepping through my TIMER_16_0 interrupt service routine. I set a breakboint on the line < if(LPC_TMR16B0->IR & (1<<0)) { > but if the debugger stops and I start single stepping through the code an error "10: Could not start execution from stop" appears,  if I only hit resume everything is fine.
Since I'm debugging with the RedProbe+ and a virtual Windows XP machine, I first thought that it might be a virtualisation problem,  with my Laptop and Windows 7 but I got the same error message there.
Then I realized that I had to adjust the FLASHTIM register according to the mcu speed (btw. is this define missing in the header files?) but this also doesn't solve the problem.
To exclude some cabeling issues,  I did a (fast) setup with the Yagarto and JLink as debug tool. With the result that stepping through the ISR works fine.
If I disable the PLL so that the mcu only runs at 12MHz everything seems to be fine. Any ideas what is going wrong on my 48MHz setup?

typedef struct
    uint32_t flashtim;
} tflashtim;
#define LPC_FLASHTIM ((tflashtim *) 0x4003C010)

void TIMER16_0_IRQHandler(void) {
    if(LPC_TMR16B0->IR & (1<<0)) {  //breakpoint is here
        static int i;
        LPC_TMR16B0->IR |= (1<<0);

int main(void) {
    volatile int i;
    LPC_SYSCON->SYSAHBCLKCTRL |= (1<<7); //enable clock for 16bit timer 0
    LPC_IOCON->PIO0_8 = 0x02;    //select pin function for match 0 timer 0
    LPC_TMR16B0->MR0 = 1000;
    LPC_TMR16B0->MCR |= (1<<1); //reset on MR0 match
    LPC_TMR16B0->MCR |= (1<<0); //enable interrupt on match 0
    LPC_TMR16B0->EMR |= (3<<4); //toggle pin on match
    LPC_TMR16B0->IR |= (1<<0);    //reset pending interrupt flag
    NVIC_EnableIRQ(TIMER_16_0_IRQn);    //general enable of TIMER_16_IRQ
    LPC_TMR16B0->TCR |= (1<<0); //Counter enable

    LPC_FLASHTIM->flashtim |= (2<<0);

    //target speed = 48MHz, irc=12MHz
    LPC_SYSCON->SYSPLLCLKSEL = 0;    //pll source clock = internal rc oscillator
    LPC_SYSCON->SYSPLLCTRL |= 3<<0;        //m divider value = 4
    LPC_SYSCON->SYSPLLCTRL |= 1<<5;        //p divider value = 2;
    LPC_SYSCON->SYSPLLCLKUEN &= ~(1<<0);    //toggle pll clock update

    while(!(LPC_SYSCON->SYSPLLSTAT & 1)){    //wait for pll to lock

    LPC_SYSCON->MAINCLKSEL = 3;    //set pll as main clock
    LPC_SYSCON->MAINCLKUEN = 0;    //toggle main clock update

    LPC_SYSCON->CLKOUTCLKSEL = 3;    //CLKOUT clock source = System oscillator
    LPC_SYSCON->CLKOUTDIV |= 10;    //CLKOUT divider = 1
    LPC_IOCON->PIO0_1 |= 0x01;    //pin has clock out function
    LPC_SYSCON->CLKOUTUEN &= ~(1<<0);    //toggle clockout update

    while(1) {
    return 0;