Default interrupt handler for LPC1313

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

Default interrupt handler for LPC1313

Jump to solution
3,000 Views
prachipanse
Contributor III

Hi,

I want to run an interrupt handling routing on receiving an interrupt on a GPIO pin for LPC1313. I am using the LPCOpen library. I have only defined the IntDefaultHandler() in my code. However, I see that on an interrupt event, this routing is not being called.

As per my understanding if any other specific interrupt handler is not defined, then the controller should execute the default interrupt handler. 

Please tell me if my understanding is correct.

Thanks and Regards.

Labels (4)
0 Kudos
1 Solution
2,299 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hello prachi panse,

   Actually, in the cr_start_lpc13xx.c, you can find the result:

1.jpg

 ALIAS(IntDefaultHandler);

If you don't define it, it will go to  IntDefaultHandler;


Have a great day,
Kerry

 

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
10 Replies
2,300 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hello prachi panse,

   Actually, in the cr_start_lpc13xx.c, you can find the result:

1.jpg

 ALIAS(IntDefaultHandler);

If you don't define it, it will go to  IntDefaultHandler;


Have a great day,
Kerry

 

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
2,299 Views
prachipanse
Contributor III

Hi,

Thank you very much for the confirmation.

Regards,

Prachi

0 Kudos
2,299 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi prachi panse,

  You are welcome!

  If your question is solved, please help to mark the correct answer to close this question.

  Thank you and have a nice day!


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
2,299 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi prachi panse,

   Thank you for your more details.

 From the lpcxpresso project, we can get that:

//*****************************************************************************
//
// Processor ends up here if an unexpected interrupt occurs or a specific
// handler is not present in the application code.
//
//*****************************************************************************
__attribute__ ((section(".after_vectors")))
void IntDefaultHandler(void)
{
    while(1)
    {
    }
}

So, if the peripherals handler is not defined, when the accoriding ISR is triggered, the code will enter IntDefaultHandler.

Take periph_grouped_int project as an example.

If I comment GINT0_IRQHandler, and when P1_19 is connect 0, the ISR will be triggered, then the code will enter IntDefaultHandler.

 

82.jpg

So your first post understanding is correct!

Any further question, just let us know.

 

Wish it helps you!

Have a great day,
Kerry

 

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
2,299 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi prachi panse,

    If you want to enter the interrupt handler, you must add the code with the ISR function name the same as the .s file defined.

  Take an example, if you want to use PIO INT0, you need to use:

void PIOINT0_IRQHandler(void)

{

//add  your own code.

}

pastedImage_1.png

If you don't write the according interrupt function, the code will have error, it may enter hardfault.

About the GPIO interrupt code, you also can refer to this code:

Sample Code Bundle for LPC1311_13_42_43 Peripherals using Keil's MDK-ARM | www.LPCware.com 

You can find the gpio driver in folder:code.bundle.lpc13xx.keil__3\LPC13xx_SampleSoftware.107\Common\src

gpio.c

Wish it helps you!


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
2,299 Views
prachipanse
Contributor III

Hi,

The interrupt handler routine must be defined in PIOINT0_IRQHandler() for an interrupt on the GPIO0 port. However, in the case it is not defined, then is it expected that the program goes to the default IntDefaultHandler()?

Thanks and Regards.

 

0 Kudos
2,299 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hello Prachi panse,

   Just as what I have told you, if the according interrupt handler is missing, the code will enter HardFault_Handler:

pastedImage_2.png

pastedImage_1.png

Wish it helps you!


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
2,299 Views
prachipanse
Contributor III

Thanks, that answers my doubt. 

However, in what event is the IntDefaultHandler() called?

Regards.

0 Kudos
2,299 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi prachi panse,

  I don't know what the indeed code you are using, I am using the lpcopen_2_05_keil_iar_nxp_lpcxpresso_1343 code.

 I didn't find the function IntDefaultHandler.

 You can check your project .s file, in the vectors, do you have the IntDefaultHandler vector?

Actually, you don't need to care about the default handler, if you want the code enter GPIO interrupt, please add the according handler, this is the most important thing to you.


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
2,299 Views
prachipanse
Contributor III

I am using LPCXpresso and not keil. 'lpcopen_2_05_lpcxpresso_nxp_lpcxpresso_1343'

0 Kudos