Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Please help FIQ interrupte on LPC2138-MT

2006-04-09 by vpat1714vpat

I try to write  the FIQ interrupt program for LPC2138-MT. 
Input EINT1 is used for generate  the
interrupt  with button and pull-up resistor at P0.3.
Output P0.31 is connected to Led.  The simplest  FIQ Handler  is 
written for switching off  Led, when 
the interrupt comes  from EINT1 ( P0.3) , Hex-file and led.elf 
created by CrossWorks v 1.5, all necessary startup and system files 
are connected. The Compiler and Linker does not give any errors  in 
report.
That can be wrong here?      Thanks.

/* Target board  OLIMEX   LPC2138-MT	 */
#include <targets/LPC21xx.h>
void EXTintFIQ (void) __attribute__ ((interrupt("FIQ")));    // 
Declare FIQ ISR
void EXTintFIQ (void)
{
IO0SET 	= 0x80000000;	// Set 1 to LED pin P0.31
EXTINT  = 0x00000002;	// Clear the peripheral interrupt flag
}
int main (void)
{
IO0DIR	= 0x80000000;	// Set the LED pin P0.31 as output
PINSEL0        |= 0x000000C0;	   // Set  P0.3 as  EINT1
VICIntSelect 	= 0x00008000;	   	
VICIntEnable	= 0x00008000;      //Enable a Vic Channel as FIQ
IO0CLR = 0x80000000;	                 //  Led  On
__ARMLIB_enableFIQ();
while(1);           //Loop here forever   
}


     Section _vectors   in output file  led.elf   contain :
         ldr pc, [pc, #fiq_handler_address - . - 8] /* fiq handler */
E59FF014   ldr pc, [pc, #20]
    <fiq_handler_address>:
234        andeq r0, r0, r4, lsr r2
 
      Section _start     contain :
                   orr r1, r0, #0x11 /* FIQ mode */
   	E3801011   orr r1, r0, #0x00000011
                   msr cpsr_cxsf, r1
   	E12FF001   msr cpsr_cxsf, r1
                  ldr sp, =__stack_fiq_end__
   	E59FD150  ldr sp, [pc, #336]
   
    At the beginning of   EXTintFIQ  in output file  led.elf
    located  next operators : 
        E52DC004   str r12, [sp, #-4] !
   	E1A0C00D   mov r12, sp
   	E92DD80C   stmfd sp!, {r2-r3, r11-r12, lr-pc}
   	E24CB004   sub r11, r12, #0x00000004

             User  code  ……..

            And at the end of   EXTintFIQ  :
        E89D680C   ldmfd sp, {r2-r3, r11, sp-lr}
   	E8BD1000   ldmfd sp!, {r12}
   	E25EF004   subs pc, lr, #0x00000004

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.