[En-Nut-Discussion] Interrupt help needed!

Lars Tore Skau larstore at gmail.com
Sun Mar 23 17:25:53 CET 2008


Hello.

I've tried to post to this forum before, but never gotten any replies. Well,
i'll try again..

I have been trying to get the PIO interrupts working on the AT91SAM9260..
and i have progress.. but now i have another problem.

Here is the way is set ut the interrupts..


 outr(PIOA_PER, _BV(DATPIN) | _BV(CLKPIN)); //PIO ON CLK and DAT
 outr(PIOA_ODR, _BV(DATPIN) | _BV(CLKPIN)); //Output disable
 outr(PIOA_IER, _BV(CLKPIN)); //enable interrupt on clkpin
 outr(PMC_PCER, _BV(PIOA_ID)); //enable pio clock

 NutRegisterIrqHandler(&sig_PIO, ps2_isr, 0);
 NutIrqEnable(&sig_PIO);


After reading the SAM9260 datasheet over and over again, i found out that i
had to read the PIO_ISR registert to clear the interrupts.
When i run: "inb(PIO_ISR);" to read the register from my debug interface,
then all interrupts are cleared, and when i get a level change at the
CLKPIN, the
ps2_isr() routine is successfully started. So the code above works.. BUT

HERE IS THE PROBLEM:

When i have handled the interrupt in my ISR, i read the PIO_ISR register to
clear the interrupt and be ready for a new interrupt.. This causes the
entire application to freeze..

If i however, put a NutSleep(10); in the ISR before i call the inb(PIO_ISR);
function.. i seems to work.. but this is of course not a acceptable
solution. There seem to be a sync issue somewhere.. can anyone help??


LT



More information about the En-Nut-Discussion mailing list