Hi,
my problem is the following: I can not handle any interrupt! In my example I just want to handle the interrupt with timer 0.
Here is the code:
void main(void)
{
mcf5xxx_irq_disable();
mcf5xxx_set_handler(68, PIT0_handler);
MCF5208_INTC_ICR(4) = MCF5208_INTC_ICR_IL(2);
MCF5208_INTC_IMRL &= ~(0
|MCF5208_INTC_IMRL_INT_MASK4);
MCF5208_PIT0_PMR = 40000; // 40MHz/40000 = 1kHz
MCF5208_PIT0_PCSR = 0
| MCF5208_PIT_PCSR_EN // Bit 0: PIT enable
| MCF5208_PIT_PCSR_RLD // Bit 1: Counter reloaded from PMRn on count of 0x0000
| MCF5208_PIT_PCSR_PIE // Bit 3: PIT interrupt enable
| MCF5208_PIT_PCSR_PRE(1); // Bit 8-11: Prescaler 2 (80MHz/2=40MHz)
mcf5xxx_irq_enable();
}
__interrupt__ void PIT0_handler(void)
{
printf("Interrupt occured");
fflush(stdout);
MCF5208_PIT0_PCSR = MCF5208_PIT0_PCSR
| MCF5208_PIT_PCSR_PIF;
}
But what happens is an illegal instruction error. If I disable the "mcf5xxx_irq_enable()" the flag is on when the counter reaches 0x0000.
Does someone tell me what is wrong?
Mr. Ushuaia