Hi everyone,
I have a keypad controller (MAX7348) hooked up to my 5213EVB through I2C. It seems to be programming right, and I have the IRQ output of the keypad controller connected to the edge port interrupt(level 1) pin. I hooked up a led to the same pin to see if the keypad controller is correctly signalling an interrupt on a keypress. the IRQ line is going low, but the processor is not going to the ISR for this level. Are there any differences between the IRQ1 pin and the other IRQ's, because I have several other external interrupt sources connected, and they all seem to be operating fine (with similar code for init, and the ISR functions themselves)? The processor does not jump to an illegal location or anything like that (it still runs the normal code fine...), it just does not execute the interrupt subroutine code! I have included some code of how i set up the interrut port, and the isr itself:
[code]
void setupInterrupts()
{
MCF_EPORT_EPPAR = 0
| MCF_EPORT_EPPAR_EPPA1_BOTH
| MCF_EPORT_EPPAR_EPPA3_RISING
| MCF_EPORT_EPPAR_EPPA4_RISING
| MCF_EPORT_EPPAR_EPPA5_RISING
| MCF_EPORT_EPPAR_EPPA6_FALLING
| MCF_EPORT_EPPAR_EPPA7_LEVEL; //pin6 changed (see if it'll work)
/* MCF_INTC_ICR21 = 0
| MCF_INTC_ICR_IP(3)
| MCF_INTC_ICR_IL(1); //set priorities
MCF_INTC_IMRL &= ~ MCF_INTC_IMRL_MASK21;
*/
/* mcf5xxx_set_handler(64 + 1, key_handler);
mcf5xxx_set_handler(64 + 3, power_down);
mcf5xxx_set_handler(64 + 4, sw1_handler);
mcf5xxx_set_handler(64 + 5, sw2_handler);
mcf5xxx_set_handler(64 + 6, zero_cross);
mcf5xxx_set_handler(64 + 7, abort_handler);
mcf5xxx_set_handler(64 + 21,delay_handler);
mcf5xxx_set_handler(64 + 55,quad_handler); //PIT0 interrupt
*/
//check out vectors.s for ^^ definitions (don't want to use the 200k runtime library!!!
mcf5xxx_irq_enable(); //enable interrupts
}
[/code]
[code]
__interrupt__ void key_handler(void)
{
uint8 keypress = 0x40;
TURN_OFF_DISPLAY_PWR;
while(keypress & 0x40)
{
keypress = I2CreceiveByte(KEYSCAN_FIFO,KEYSCAN_ADDR); // the key
interpretKey(keypress); //what do we do???
}
MCF_EPORT_EPFR = MCF_EPORT_EPFR_EPF1; //clear the interrupt
}
[/code]
from sysinit.c:
[code]
void mcf5213_allow_interrupts(void)
{
/*
* Allow interrupts from ABORT, SW1, and SW2 (IRQ[4,5,7])
*/
/* Enable IRQ signals on the port */
MCF_GPIO_PNQPAR = 0
| MCF_GPIO_PNQPAR_IRQ1_IRQ1
| MCF_GPIO_PNQPAR_IRQ3_IRQ3
| MCF_GPIO_PNQPAR_IRQ4_IRQ4
| MCF_GPIO_PNQPAR_IRQ5_IRQ5
| MCF_GPIO_PNQPAR_IRQ6_IRQ6
| MCF_GPIO_PNQPAR_IRQ7_IRQ7;
/* Set EPORT to look for rising edges */
MCF_EPORT_EPPAR = 0
| MCF_EPORT_EPPAR_EPPA1_FALLING
| MCF_EPORT_EPPAR_EPPA3_RISING
| MCF_EPORT_EPPAR_EPPA4_RISING
| MCF_EPORT_EPPAR_EPPA5_RISING
| MCF_EPORT_EPPAR_EPPA6_RISING
| MCF_EPORT_EPPAR_EPPA7_RISING;
/* Clear any currently triggered events on the EPORT */
MCF_EPORT_EPIER = 0
| MCF_EPORT_EPIER_EPIE1
| MCF_EPORT_EPIER_EPIE3
| MCF_EPORT_EPIER_EPIE4
| MCF_EPORT_EPIER_EPIE5
| MCF_EPORT_EPIER_EPIE6
| MCF_EPORT_EPIER_EPIE7;
/* Enable interrupts in the interrupt controller */
MCF_INTC_IMRL &= ~(0
| MCF_INTC_IMRL_MASK1
| MCF_INTC_IMRL_MASK3
| MCF_INTC_IMRL_MASK4
| MCF_INTC_IMRL_MASK5
| MCF_INTC_IMRL_MASK6
| MCF_INTC_IMRL_MASK7
| MCF_INTC_IMRL_MASKALL
| MCF_INTC_IMRL_MASK13);
}
[/code]