# Problem: LPC2136and multiple interrupts

**URL:** <https://forums.freertos.org/t/problem-lpc2136and-multiple-interrupts/3227>\
**Category:** Kernel\
**Created:** [November 19, 2006, 11:24am UTC](https://forums.freertos.org/t/problem-lpc2136and-multiple-interrupts/3227 "2006-11-19T11:24:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [November 19, 2006, 11:24am UTC](https://forums.freertos.org/t/problem-lpc2136and-multiple-interrupts/3227/1 "2006-11-19T11:24:25Z")

</div>

**nobody** wrote on [Sunday, November 19, 2006](https://sourceforge.net/p/freertos/discussion/382005/thread/92bff1e7/#6bd8):

Hello!

I have a problem using multiple IRQ…  
Port: ARM7 (LPC2136)  
Devel.suite: Cross Works 1.6

I’m using two IRQs: Timer1, running with 22kHz and I2C (slave) called  
every 50ms, receiving 3bytes and seding 1byte.  
When testing with only one int, everything works fine. As soon as both  
are used, the I2C-IRQ stops working after a short period of time (approx.  
10-50 ints). The SI-Flag in I2C0STAT is set, but the handler is not called.

Here the relevant code snipplets:

//Timer1  
static void Timer1\_Isr(void) \_\_attribute\_\_((naked));

void InitIRQTimer()  
{  
&nbsp; VICIntSelect &= ~(TIMER1\_VIC\_CHANNEL\_BIT);  
&nbsp; VICIntEnable |= TIMER1\_VIC\_CHANNEL\_BIT;  
&nbsp; VICVectAddr3 = (unsigned int) &Timer1\_Isr;  
&nbsp; VICVectCntl3 = TIMER1\_VIC\_CHANNEL | TIMER1\_VIC\_ENABLE;  
}

static void Timer1\_Isr(void)  
{

&nbsp; portSAVE\_CONTEXT();

&nbsp; T1IR |= T1IR\_MR0; // clear TI  
&nbsp; .  
&nbsp; .  
&nbsp; .  
&nbsp; VICVectAddr = 0;  
&nbsp; portRESTORE\_CONTEXT();  
}

//Now i2c  
void I2C0\_Isr(void) \_\_attribute\_\_ ((naked));  
static void I2C\_Init(void)  
{  
&nbsp;&nbsp;&nbsp; //I2C-Init  
&nbsp;&nbsp;&nbsp; PINSEL0 |= 0x50; // P0.3 = SDA, P0.2 = SCL  
&nbsp;&nbsp;&nbsp; I2C0ADR = I2C\_SLAVE\_ADDR\<\<1; // set I2C slave address  
&nbsp;&nbsp;&nbsp; I2C0CONSET = 0x44; // enable I2C hardwar and set AA (ack)  
&nbsp;&nbsp;&nbsp; VICVectAddr4 = (unsigned int) &I2C0\_Isr;  
&nbsp;&nbsp;&nbsp; VICVectCntl4 = 0x29; // Channel1 on Source#9 … enabled  
&nbsp;&nbsp;&nbsp; VICIntEnable |= 0x200; // 9th bit is the I2C  
}

void I2C0\_Isr(void)  
{  
&nbsp; portSAVE\_CONTEXT();  
&nbsp; I2C0CONCLR = 0x08; // clear SI  
&nbsp; .  
&nbsp; .  
&nbsp; .  
&nbsp; VICVectAddr = 0;  
&nbsp; portRESTORE\_CONTEXT();  
}

I have a feeling, I forgot something… 🙂

I’m thankful for any hint!

Thanks,  
Th.Kusch
