Thanks for your advice. I've been reading about NVIC and trying a few things.
I found an error in my original program and fixed that. (I had PORTA_PCR11 |= PORT_PCR_IRQC(0x10); should've been PORTA_PCR11 |= PORT_PCR_IRQC(0xA);)
Now the program switches the BLUE LED on (which should trigger the interrupt) but does not enter the ISR... NOR does it get to "Test Point 1". The blue LED does not switch off (obviously).
So, something is working and something else isn't.
=========
here is main:
=========
int main (void)
{
#if(defined(CW))
sysinit();
#endif
gpio_init();
app_init();
printf("\r\nRunning the PA11 Interrupt project.\r\n");
LED3_OFF;
// The following 2 lines commented out because subsequent lines should do the same job. Shouldn't they?
// EnableInterrupts;
// enable_irq(30); //30 = 46-16
// Initialise the NVIC to enable the specified IRQ
// Report relevant NVIC Regs
printf("\r\nNVIC_ICPR: %x", NVIC_ICPR);
printf("\r\nNVIC_ISER: %x", NVIC_ISER);
printf("\r\nNVIC_IPR7: %x\r\n", NVIC_IPR7);
// Setup relevant NVIC Regs
NVIC_ICPR = 0x40000000; // Clear pending interrupts
NVIC_ISER = 0x40000000; // Enable interrupts from Port A
NVIC_IPR7 = 0x00c00000; // Set interrupt priority to 3
// Report relevant NVIC Regs
printf("\r\nNVIC_ICPR: %x", NVIC_ICPR);
printf("\r\nNVIC_ISER: %x", NVIC_ISER);
printf("\r\nNVIC_IPR7: %x\r\n", NVIC_IPR7);
// Configure PA11
PDDR(A) &= ~(1<<11); // configure PA11 as input
PORTA_PCR11 &= ~(1<<2); // Clear bit 2 for fast slew rate
PORTA_PCR11 |= PORT_PCR_IRQC(0xA); // configure port A for falling edge interrupts
// Report PORT A Regs
printf("\r\nGPIO_PDDR_REG(PTA_BASE_PTR): %x", GPIO_PDDR_REG(PTA_BASE_PTR));
printf("\r\nPORTA_PCR11: %x", PORTA_PCR11);
printf("\r\nPORTA_ISFR: %x\r\n", PORTA_ISFR);
while(1)
{
printf("\r\nInput: %d", PDIR(A) & (1<<11));
LED3_ON;
printf("\r\n *************** Test point 1 **************");
delay(500000);
printf("\r\nInput: %d", PDIR(A) & (1<<11));
LED3_OFF;
delay(500000);
}
}
===========
Here is the ISR:
===========
void PORTA_ISR(void)
{
PORTA_PCR11 |= PORT_PCR_ISF_MASK;
printf("\r\n *** ISR *** \r\n");
}
================
and here is isr.h:
================
#ifndef __ISR_H
#define __ISR_H 1
#undef VECTOR_046
#define VECTOR_046 PORTA_ISR
extern void PORTA_ISR(void);
#endif //__ISR_H
==============
Here is the output:
==============
Running the project.
NVIC_ICPR: 100000
NVIC_ISER: 0
NVIC_IPR7: 0
NVIC_ICPR: 100000
NVIC_ISER: 40000000
NVIC_IPR7: c00000
GPIO_PDDR_REG(PTA_BASE_PTR): 0
PORTA_PCR11: a0107
PORTA_ISFR: 0
Input: 2048