interrupts dont seem to work at all

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

interrupts dont seem to work at all

450 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Elimathew on Sun Mar 16 09:12:21 MST 2014
hi guys writing a simple program to blink a led for every 500ms using a systic timer i have observed the interrupt never occurs led stays on forever not only this but i have used many working sample programs involving interrupts but it doesnt work . Im using lpc1768(100mhz) with bootloader(factory installed) residing at 0x00000000 to 0x00002000 like is there a need to offset the vector table manually or the booloader does that by itself my application starts at 0x00002000 i have done that accordingly in keil heres the code for the systic timer
#include "LPC17xx.h"

volatile uint32_t msTicks = 0;

void SysTick_Handler(void)

{

msTicks++;//count no of ms

}

void Delay (uint32_t dlyTicks)

{
volatile uint32_t curTicks;
curTicks = msTicks;

while ((msTicks - curTicks) < dlyTicks);//stay here until delay is acheived

}

int main (void)
{ SystemInit();//core speed 100mhz

SysTick_Config(SystemCoreClock/1000);//configuring systic timer to interrupt every 1ms

LPC_SC->PCONP |= ( 1 << 15 ); // power up GPIO
LPC_GPIO1->FIODIR |= 1 << 29; // puts P1.29 into output mode.
while(1)
{

LPC_GPIO1->FIOPIN |= 1 << 29; // make P1.29 high
Delay(500);
LPC_GPIO1->FIOPIN &= ~( 1 << 29 ); // make P1.29 low
Delay(500);
}}
Labels (1)
0 Kudos
4 Replies

423 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by MarcVonWindscooting on Wed Mar 19 04:06:23 MST 2014
OK. Let's try.

I assume linking is fine.

Let's verify, your program really doesn't call interrupts (which is YOUR assumption). There's a chance, you program crashes (abort) or constantly re-enters the ISR - meaning: it does call interrupts, but not the way you think.
To be sure about that, don't toggle the LED based on the ms variable, but use the loop delay. Keep the systickTimer initialization.

Now if the LED toggles, then the systick (or the initialization of it) does not crash.
Check that.

Please understand: it's not about solving your current problem, it's all about you learning to solve such problems yourself, soon.
0 Kudos

422 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Elimathew on Mon Mar 17 21:39:27 MST 2014
guys please help im going no where
0 Kudos

423 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Elimathew on Mon Mar 17 04:45:40 MST 2014
i have done the simple led blinking using delay(for loop)  it works fine the bootloader is of 8kb as mentioned by board supplier so i set the IROM=0x00002000 in keil
0 Kudos

423 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by MarcVonWindscooting on Sun Mar 16 16:13:54 MST 2014
You're trying to do 3 steps at once, that's why you have no idea, what's wrong.
Reduce to managable steps:

1. Verify, you program is executing at all, i.e. LED is not on just because of the reset default (pullup). Write a program that switches the LED off (and nothing more). If that doesn't work, then don't worry about the vector table, you have much bigger problems, like wrong placement of the executable. I don't know what Keil does. None of my programs ever started at 0x2000 (8ki, why that?). VTOR must be adjusted accordingly. No, bootloader doesn't do that for you. It uses the entries at 0x00 and 0x04 to prepare your application's stack and find the entry point.

2. switch the LED on. If that works, you know, you really have control over the LED port :-)

3. Then think about using systick as a timer.
0 Kudos