Hi Andreas,
You commented out a printf() in the void enable_irq(int irq) routine that caused the div calculation to be in error (it pulled the div = irq/32; into the if statement).
if (irq > 91)
//printf("\nERR! Invalid IRQ value passed to enable irq function!\n");
/* Determine which of the NVICISERs corresponds to the irq */
div = irq/32;
Changing the code to:
if (irq > 91)
asm(" nop"); //DES Must have an instruction after the "if() statement or using {} to indicate no instruction. With printf commented out div was not calculated correctly.
OR (better solution)
if (irq > 91)
{
//printf("\nERR! Invalid IRQ value passed to enable irq function!\n");
}
fixes the issue.
I also changed how the LED_PORT toggle was operating by following:
#define LED_PORT_T GPIOA_PTOR //DES toggle port pin control
LED_PORT_T |= (1<<LED_GREEN);
Regards,
David