Interrupt not being implemented

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

Interrupt not being implemented

462 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by brobson on Mon Aug 03 05:09:28 MST 2015
Hi all, I'm new to programming with the lpc systems so my problem might be something quite basic that I am not aware of.
I'm trying to get an interrupt to occur whenever a change happens on pio1_8 and have the following bits of code to do this:
(pin set up)
LPC_IOCON->PIO1_8 |=  0x11;//selects ct16b1_CAP0 and sets pull up resistor
(timer set up, in main.c)
LPC_SYSCON->SYSAHBCLKCTRL |=  0x00000180;// Enable CT16B0 & CT16B1 Clocks
LPC_TMR16B1->PC = 0x00000000;
LPC_TMR16B1->PR = 0x00000010;


LPC_TMR16B1->TCR |= 0x01;//ENABLES TIMER AND PRESCALER COUNTER
LPC_TMR16B1->CCR |= 0x04;//SETS INTERRUPT ON STATE CHANGE AT CT16B1_CAP0
LPC_TMR16B1->CTCR |= 0x0;//SELECTS COUNT INPUT AND FLAGS TO BE RAISED ON EITHER EDGE

NVIC_EnableIRQ(TIMER_16_1_IRQn);

(interrupt handler)
void TIMER16_1_IRQHandler (void)
{
int i;

i++;
LPC_GPIO2->DATA |= (0xFC0);
LPC_GPIO2->DATA &= (0xF3F);

LPC_GPIO3->DATA |= (0x03F);
LPC_GPIO3->DATA &= (~0xFC0);

LPC_TMR16B1->IR |= 0x10;//RESET FLAG
}

I have the pin set with a pull up resistor and I am connecting a ground wire to change it, however the software doesn't seem to be picking it up. Can anyone see something wrong with my code?
Labels (1)
0 Kudos
5 Replies

452 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Mon Aug 03 06:39:57 MST 2015

Quote: brobson
I'm using kiel uvision 5 debugger...



'kiel' has a forum with the confusing name www.keil.com/forum/  :~
0 Kudos

452 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by brobson on Mon Aug 03 06:34:19 MST 2015
I'm using kiel uvision 5 debugger, I followed the steps in a forum post about erasing the flash memory, I'm now getting a different error message related to the u-link.
My new error is a memory mismatch:
Address:0x00000000
value: 0x80
expected 0x00

I've tried writing directly to flash as a post suggested but I can't seem to get rid of this error
0 Kudos

452 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Mon Aug 03 06:16:51 MST 2015

Quote: brobson
I've not seen this one before, got any advice on this one?



Could be useful if you give us a hint which toolchain / debugger you are using...

A Forum search with 'Cannot Write to RAM for Flash Algorithms' could help also...
0 Kudos

452 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by brobson on Mon Aug 03 05:53:18 MST 2015
Thanks I'll give that a try.
I've just received this error when I tried to debug:
Load "C:\\Users\\Brandon \\Documents\\LPC1114\\Firmware\\Build\\BTLE.axf"
Cannot Write to RAM for Flash Algorithms !
Erase Failed!
Error: Flash Download failed  -  "Cortex-M0"
Flash Load finished at 13:44:10

I've not seen this one before, got any advice on this one?
0 Kudos

452 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Mon Aug 03 05:30:23 MST 2015

Quote: brobson
Can anyone see something wrong with my code?



No, your code snippet is not showing which toolchain you are using and if IOCON is enabled at all, so I would suggest to use the debugger to check IOCON bit in SYSAHBCLKCTRL and IOCON pin settings...

BTW: Usually the timer is started after setup is finished and interrupt is enabled  ;-)
0 Kudos