Problem in Hard fault handler

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

Problem in Hard fault handler

3,388 Views
prasanthapplied
Contributor III

Dear all,

          I'm using lpc1768 controller external interrupts. While using interrupt pins my program getting hang to hard fault handler in program startup code. Until reset nothing will happen. I don't know how to handle this problem. Please give me a solution to solve that problem. I hope your reply .Thanks in advance.

Thanks & Regards,

Prasanth.

Labels (1)
0 Kudos
9 Replies

2,060 Views
converse
Senior Contributor V

The default exception handler just enters a while(1) loop. To solve your problem, you need to find out what is causing the hard fault. See https://community.nxp.com/message/630605 

0 Kudos

2,060 Views
prasanthapplied
Contributor III

Thanks for your reply Con Verse. I debug my code and got the cause of hard fault. But i don't have an idea to solve that. I attached a screenshot to it.

hard fault.PNG

Hard fault gets occur due to instruction bus error. Please help me to solve this.

This hard fault gets occur while using an external interrupt pins else code works fine. Is have any relation between them?

Thanks & Regards,

Prasanth

0 Kudos

2,060 Views
carstengroen
Senior Contributor II

Use the link I gave you to gain the knowledge to find whats going on. Hint, check LR register, find out what instruction (address) that caused the hardfault in the first place. Possibly something in your EINT3 IRQ handler ??

0 Kudos

2,060 Views
prasanthapplied
Contributor III

Dear Groen,

               LR register indicating address is 0xFFFFFFF9. How to i find the instruction using this address? If i put this address to memory window it gives a message of "cannot access memory". What i want to do?

            If a problem occur due to EINT3 IRQ Handler what modification i want to do to solve that?

0 Kudos

2,060 Views
Carlos_Mendoza
NXP Employee
NXP Employee

Hi Prasanth,

I would recommend you to take a look to the periph_pinint example that comes with the LPCOpen package for the LPC1769 board, this example demonstrates use of the GPIO pin interrupts:

LPCOpen Software for LPC17XX|NXP 

You can see how the GPIO interrupt is configured and enabled.


Hope it helps!

Best Regards,
Carlos Mendoza
Technical Support Engineer

0 Kudos

2,060 Views
prasanthapplied
Contributor III

Dear Mendoza,

                   Thank you very much for your response. I got that example programs any verified my code with that. Now i find the cause of that hard fault handler. Actually the problem is my program logic. What i did is while occurring an external interrupt update some variables to call the function. But i didn't properly get out from the currently running function. So when i give an external interrupt continuously program gets hang with a hard fault handler.

           Now i alter my code to whenever getting an interrupt get out from a currently running function and then proceed corresponding interrupt process. It works fine.

Thanks & Regards,

Prasanth.

0 Kudos

2,060 Views
Carlos_Mendoza
NXP Employee
NXP Employee

Hi Prasanth,

 

Thanks for your response, It is good to hear that it is now working fine!

 

Best Regards,
Carlos Mendoza
Technical Support Engineer

0 Kudos

2,060 Views
carstengroen
Senior Contributor II
0 Kudos

2,060 Views
prasanthapplied
Contributor III

Thanks groen. My program don't wanna go to hard fault handler. What i want to do for that?

I'm using uart interrupt,timer0 interrupt and 3 external interrupt pins in an EINT3. But i was set a priority to each block.

Am i wanna do anything more except priority set?

Thanks & Regards,

prasanth

0 Kudos