# logomatic interrupt troubles

**URL:** <https://community.sparkfun.com/t/logomatic-interrupt-troubles/18016>\
**Category:** MicroMod\
**Tags:** arm-lpc\
**Created:** [November 2, 2010, 4:29pm UTC](https://community.sparkfun.com/t/logomatic-interrupt-troubles/18016 "2010-11-02T16:29:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jokeb](https://avatars.discourse-cdn.com/v4/letter/j/e79b87/32.png) [@Jokeb](https://community.sparkfun.com/u/Jokeb)\
**Post date:** [November 2, 2010, 4:29pm UTC](https://community.sparkfun.com/t/logomatic-interrupt-troubles/18016/1 "2010-11-02T16:29:25Z")

</div>

hello, I have a logomatic V2 and am trying to conserve power by putting it to sleep and waking up on interrupt from pin1 via EINT3, though am struggling to get my vectored interrupts to do anything,

this is my boot up function which should enable the interrupt:

void boot\_up(void)

{

set\_pin\_mode(STAT0, “DO”); //Set status LEDs as outputs

set\_pin\_mode(STAT1, “DO”);

rprintf\_devopen(putc\_serial0); //Open up serial port 0 for debugging

card\_init(); //Init SD card interface

//Creat the main log file

char name[32];

int count = 0;

string\_printf(name,“LOG%02d.txt”,count);

while(root\_file\_exists(name))

{

count++;

if(count == 250)

{

rprintf(“Too Many Logs!\n\r”);

error\_mode(4);

}

string\_printf(name,“LOG%02d.txt”,count);

}

handle = root\_open\_new(name);

sd\_raw\_sync();

//Setup TIMER1 to run

T1TCR = 0; //Reset Timer1

T1PR = 6000; //Set prescalar to 6,000 - every tick is 0.1ms (changed this from 60,000)

T1TCR = 1; //Start Timer1

//Set up the EINT3 External Interrupt Functionality

PINSEL1 &= ~(3\<\<28); //Clear P0.30 special function

PINSEL1 |= (2\<\<28); //Set P0.30 to EINT3

VICIntEnClr = EINT3\_INT;//Make sure EINT3 interrupts are disabled

EXTMODE &= ~(1\<\<3); //Set EINT3 to be level sensitive

EXTINT |= (1\<\<3); //Clear the EINT3 Interrupt bit

EXTPOLAR &= ~(1\<\<3); //Set EINT3 to detect falling edges

INTWAKE |= (1\<\<3); //ARM will wake up from power down on an EINT3 interrupt

VICIntSelect = ~(EINT3\_INT);

VICVectCntl0 = 0x20 | 16; //EINT3 External Interrupt

VICVectAddr0 = (unsigned long)ISR\_EINT3;

flash\_it(50); //Flash Status Lights

and this is my interrupt code

static void **attribute** ((interrupt(“IRQ”))) ISR\_EINT3(void){

VICIntEnClr = EINT3\_INT; //Temporarily disable EINT3 Interrupts

EXTINT |= (1\<\<3); //Clear the interrupt bit in EINT3

write\_digital\_pin(STAT1, ON); //Turn OFF LED

write\_digital\_pin(STAT0, ON);

delay\_ms(50)

write\_digital\_pin(STAT1, OFF); //Turn OFF LED

write\_digital\_pin(STAT0, OFF);

VICIntEnable = EINT3\_INT;

VICVectAddr =0; //Update the VIC priorities

}

and here’s the start of my code if it helps

/\* Header Files \*/

//======================================

#include \<stdio.h\>

#include \<string.h\>

//#include “LPC21xx.h”

#include “LPC214x.h”

//UART0 Debugging

#include “serial.h”

#include “rprintf.h”

//Needed for main function calls

#include “string\_printf.h”

#include “fat16.h”

#include “rootdir.h”

#include “sd\_raw.h”

/\* Global Variables \*/

//======================================

#define ON 0

#define OFF 1

#define STAT1 9

#define STAT0 10

#define HIGH 1

#define LOW 0

#define EINT3\_INT (1\<\<17)

struct fat16\_file\_struct\* handle;

/\* Function Declarations \*/

//======================================

void UNDEF\_Routine(void) **attribute** ((interrupt(“UNDEF”)));

//void IRQ\_Routine(void) **attribute** ((interrupt(“IRQ”)));

void boot\_up(void);

void log\_string(char \*buf);

void card\_init(void);

//static void ISR\_EINT3(void) **attribute** ((interrupt(“IRQ”)));

void wakeUp(void);

char look\_up\_pin(char labeled\_pin);

void set\_pin\_mode(char pin\_number, char \*buf);

char read\_digital\_pin(char pin\_number);

void write\_digital\_pin(char pin\_number, char pin\_state);

void flash\_it(int);

void error\_mode(char error\_number);

void delay\_ms(int count);

unsigned int power\_register\_values;

//======================================

int main (void)

{

boot\_up(); //Init LPC, IO pins, and FAT

log\_string(“Log started\n\r”);

set\_pin\_mode(4, “DI”);

VICIntEnable = EINT3\_INT;

//Enable Interrupt

//PCON = (1\<\<0); //Go into IDLE mode

while(1)

{

}

return 0;

}

any help is greatly appreciate and I’m very new to all of this so apologies for any elementary mistakes

thanks

---

<div class="post-metadata">

**Author:** ![ssond](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@ssond](https://community.sparkfun.com/u/ssond)\
**Post date:** [February 1, 2011, 11:56pm UTC](https://community.sparkfun.com/t/logomatic-interrupt-troubles/18016/2 "2011-02-01T23:56:58Z")

</div>

Did you ever resolve this issue? I am having similar troubles. According to the lpc2148 user manual you should be able to simply use INTWAKE without VIC - I have not been able to make this work. If I enable the interrupt using VIC\_enable The system wakes (a light goes on) but locks up - both RTC and EINT3 do the same thing when enabled. My sense is that the interrupt is being vectored to some default routine that is not defined in the logomatic software (original or my variant)

As always any thoughts would be appreciated - other than read the user manual which I have done adnauseum.

Cheers

Stefan
