LPC1114: Sometimes can't clear interrupt flags

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPC1114: Sometimes can't clear interrupt flags

658 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by kamenik on Mon Oct 25 15:36:46 MST 2010
Hello, all.
I'm using LPCXpresso LPC1114 development board.
In my application I'm using all  timers implemented in, Partically, TMR32B1 is in use for software PWM implementation, PIO2_0 should be a PWM output, for example. This is part of my code:
void TIMER32_1_IRQHandler (void)
{
        if ((LPC_TMR32B1->IR&0x1)==1)    //if MR0 interrupt occurs
        {
        LPC_GPIO2->DATA|=1;                //Set PIO2_0 to high 
        }
        if ((LPC_TMR32B1->IR&0x2)==2)    //if MR1 interrupt occurs
        {
        LPC_GPIO2->DATA&=~1;            //Set PIO2_0 to low 
        }
         LPC_TMR32B1->IR|=0b11;            //This should clear interrupt flags, but
                                                                   //sometimes it isn't works
}

When I debug this in instruction step mode, I can see that instruction
[B]str    r3, [r1, #0][/B]
clears  TMR32B1IR register(previously r1=0x40018000; r3=0x3; TMR32B1IR=0x3), but upon next instruction ([B]mov    sp, r7[/B])  TMR32B1IR returns to its previous value(0x3):confused:
What I forgot? Apologize my terrible English. Thanks.
0 Kudos
Reply
1 Reply

612 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by CodeRedSupport on Tue Oct 26 07:19:00 MST 2010
I've not tried this on the hardware, but I suspect that your interrupts are being cleared, but as you single step you are then immediately encountering another interrupt. The key point is is the following from the LPC11xx user manual:


Quote:
During a debugging session, the System Tick Timer is automatically stopped whenever the CPU is stopped. Other peripherals are not affected.

from section 20.6, Debug Notes, UM10398, Rev. 1 — 21 July 2010.

Regards,
CodeRedSupport
0 Kudos
Reply