Interrupt handler for LPC2294

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

Interrupt handler for LPC2294

938 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by tvink on Tue Jun 02 06:42:01 MST 2015
Hi,
I need to handle interrupts in an lpc2294 application.

I see from other postings that there is a c language startup file generated by lpcxpresso when a new project is created.  In that startup are weak handlers for each vector that can be overridden in the normal code.

However when I create an lpc2294 project, there is only an assembler language startup and as best as I can figure there are no weak handlers.  The line in the exception vector table where _irq is handled is commented out.  I can handle dispatching the IRQ and FIQ to the appropriate handlers in my code.  But how to I hook my c code to the hardware?

Please help.

thanks
Labels (1)
0 Kudos
7 Replies

781 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by tvink on Fri Jun 05 12:50:50 MST 2015
Thanks...

The code snippets and appnote look to be just what I need.

Tony
0 Kudos

781 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Fri Jun 05 09:42:00 MST 2015
It's not difficult to find inline assembler examples using the GNU ARM tool chain on the web. The macro definitions I've attached (port.h) might be of use. With regard to the ARM7 core behavior and the VIC in particular, this application note should answer your questions:

Nesting of interrupts in the LPC2000

LPCXpresso Support
0 Kudos

781 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by tvink on Fri Jun 05 06:21:06 MST 2015
Hi again,

Thanks for the example. ... but I am going to have more head scratching to do.

Many times you need an atomic _ei() / _di() thing that inlines with your code.  In these cases you dont want the overhead of accessing several peripheral registers to stop/start interrupts.  Worse yet, if another irq comes in while you are messing with the peripheral registers you may end up with a real mess.  For this reason board support packages will include some form of an _ei / _di inline macro.


The 2468 code had this inline in irq.h.  It was used but commented out in timer0 C code.  When I un comment it, it wont compile.  I spent some time trying to figure out how to make it work but was hoping you would have access to a quicker solution.  This may be something that only you guys can provide since it requires intimate knowledge of the LPCXpresso assembler and the CPU core.  Anyway, your help would be appreciated.  Thanks.


#define IENABLE __asm { MRS sysreg, SPSR; MSR CPSR_c, #SYS32Mode }
#define IDISABLE __asm { MSR CPSR_c, #(IRQ32Mode|I_Bit); MSR SPSR_cxsf, sysreg }
0 Kudos

781 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Thu Jun 04 15:36:34 MST 2015

Here's a do nothing IRQ example I came across using Timer 0. The IRQ increments a seconds count, and the main loop counts minutes, hours, and days. The point here is to familiarize yourself with the Timer 0 and VIC setup.

LPCXpresso Support
0 Kudos

781 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by tvink on Thu Jun 04 14:33:14 MST 2015
Hi,

Thanks for the suggestion above...

I have modified the 2368 example and created a BSP for my 2294.  It looks hopeful... complies with the IRQ code error free.  Have not yet begun to test.

I am missing code enabling and disabling interrupts.  The 2368 has IENABLE and IDISABLE which emit inline assembler code.  I have not been able to get these to compile/assemble without errors.
Can you provide a means of enabling and disabling FIQ and IRQ interrupts?

Thanks
0 Kudos

781 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by tvink on Tue Jun 02 09:35:00 MST 2015
Thanks,
I'll have a look...
0 Kudos

781 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Tue Jun 02 08:33:14 MST 2015
Interrupts work completely differently on the ARM7 parts compared to Cortex-M.

The projects attached to:
[list]
  [*]http://www.lpcware.com/content/forum/debug-problem-lpc2468-vic#comment-1136987
[/list]
may help you to see how things basically work.

Regards,
LPCXpresso Support
0 Kudos