Addressing issue for FIQ in LPC2138?

Hey All!

I’m having trouble doing a simple FIQ interrupt example from “The Insider’s Guide to the Philips ARM7-Based Microcontrollers” on my Olimex 2138.

In main I have the green and yellow LEDs turn on, upon a pushbutton it triggers the interrup, they turn off briefly in the routine, and then go back to main. When I debug, the pushbutton never triggers the interrupt. A few people think it may be an addressing issue.


Here’s the relevant start up code:

/* Stack Sizes */

.set UND_STACK_SIZE, 0x00000004

/* stack for “undefined instruction” interrupts is 4 bytes */

.set ABT_STACK_SIZE, 0x00000004

/* stack for “abort” interrupts is 4 bytes*/

.set FIQ_STACK_SIZE, 0x00000004

/* stack for “FIQ” interrupts is 4 bytes*/

.set IRQ_STACK_SIZE, 0X00000004

/* stack for “IRQ” normal interrupts is 4 bytes*/

.set SVC_STACK_SIZE, 0x00000004

/* stack for “SVC” supervisor mode is 4 bytes*/

vectors: ldr PC, Reset_Addr

ldr PC, Undef_Addr

ldr PC, SWI_Addr

ldr PC, PAbt_Addr

ldr PC, DAbt_Addr

nop /* Reserved Vector (holds Philips ISP checksum) */

ldr PC, [PC,#-0xFF0]

/* see page 71 of “Insiders Guide to the Philips ARM7-Based Microcontrollers” by Trevor Martin */

ldr PC, FIQ_Addr

Reset_Addr: .word Reset_Handler

/* defined in this module below */

Undef_Addr: .word UNDEF_Routine

/* defined in LPC2138Functions.h */

SWI_Addr: .word SWI_Routine

/* defined in LPC2138Functions.h */

PAbt_Addr: .word UNDEF_Routine

/* defined in LPC2138Functions.h */

DAbt_Addr: .word UNDEF_Routine

/* defined in LPC2138Functions.h */

IRQ_Addr: .word IRQ_Routine

/* defined in LPC2138Functions.h */

FIQ_Addr: .word FIQ_Routine

/* defined in LPC2138Functions.h */

.word 0

/* rounds the vectors and ISR addresses to 64 bytes total */

.=.+0x1C0

/* skips pas Phillips ISP ram usage all the way to 0x40000200) according to Jim Lynch */


Here’s the relevant Linker Script:

ENTRY(_startup)

/* Specify the LPC2138 memory areas */

MEMORY

{

flash : ORIGIN = 0, LENGTH = 500K /* FLASH ROM */

ram : ORIGIN = 0x40000000, LENGTH = 32K /* Free RAM area */

}

/* Define a global symbol _stack_end End of Stack */

_stack_end = 0x40007EDB;

/Top of ram is 0x4000 7FFF. Flash Utility use top 288 bytes./

/0x40007FFF-0x120(288 bytes) = 0x40007EDF - 4 bytes for beginning of UDF Stack = 0x40007EDB/


I can post what’s in my main and interrupt routine but, like I said, it’s the example from the guide (with the LED and pushbutton pin information and initialization for my specific board).

Can anyone shed some light? :lol: