This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

IRQ Not Firing

Hello,

I am writing an I2C master transmitter object. The problem I am having is that the IRQ Handler for I2C1 is not firing. According to the manual, it should fire after the start condition is sent and the status register is 0x08. When I step through the code with the debugger, the status code is 0x08. I am using an MCB1700 development board. Why is it not firing? Did I not configure something properly? For tests, All I am doing is toggling an LED on when the interrupt fires. Once I solve this problem, I will write the rest of the code.

#include <stdio.h>
#include <LPC17XX.h>
#include "GPIO1Output.h"

GPIO1Output out(P1_28);

__irq void I2C1_IRQHandler(void)
{
        if (LPC_I2C1->I2STAT == 0x08)
        {
             out.Set();
        }
}

int main(void)
{
        // Initialize I2C.
        LPC_PINCON->PINSEL0 = 0x0F;
        LPC_PINCON->PINMODE_OD0 = 0x03;

        NVIC_EnableIRQ(I2C1_IRQn);
        LPC_I2C1->I2CONSET = 0x40;

        LPC_I2C1->I2CONSET = 0x20;
        int status = LPC_I2C1->I2STAT;
}

Parents
  • It always helps if you explicitly state what processor you're using. Don't just leave us to infer it from other details.

    The MCB1700 comes in two versions - with different processors!
    Which one, exactly, do you have?

    http://www.keil.com/mcb1700/

    "I am writing an I2C master transmitter object"

    Before you do that, have you looked at supplied examples - from Keil and NXP ?

    __irq void I2C1_IRQHandler(void)
    

    One of the "key features" claimed by ARM for the new Cortex-M3 was that it didn't require special interrupt handlers - so why are you adding the __irq here...?

Reply
  • It always helps if you explicitly state what processor you're using. Don't just leave us to infer it from other details.

    The MCB1700 comes in two versions - with different processors!
    Which one, exactly, do you have?

    http://www.keil.com/mcb1700/

    "I am writing an I2C master transmitter object"

    Before you do that, have you looked at supplied examples - from Keil and NXP ?

    __irq void I2C1_IRQHandler(void)
    

    One of the "key features" claimed by ARM for the new Cortex-M3 was that it didn't require special interrupt handlers - so why are you adding the __irq here...?

Children