PIO Interrupt on AT91RM9200DK

This forum is for users of Atmel's SAM Series and who are interested in using WinCE OS.

Moderator: nferre

jwei
Posts: 3
Joined: Wed Oct 28, 2009 7:46 pm

PIO Interrupt on AT91RM9200DK

Wed Feb 02, 2011 2:02 pm

I am trying the PIO Interrupt on AT91RM9200DK in WinCE.

I have connected a switch between PIN 17 (input with pullup) and PIN 11 (output)

Once i press the switch i get the following output:

+pioGetLogintr() = 103 (!=3)
+SOCDisablePioIrq(103) bank 1 pin 7
+SOCEnablePioIrq(103) bank 1 pin 7
+pioGetLogintr() = 107 (!=3)
+SOCDisablePioIrq(107) bank 1 pin 11
+SOCEnablePioIrq(107) bank 1 pin 11
+pioGetLogintr() = 113 (!=3)
+SOCDisablePioIrq(113) bank 1 pin 17
+SOCEnablePioIrq(113) bank 1 pin 17

Why i get 3 Interrupts ???
The next press doesnt generate an output anymore...

Thats the thread for interrupt handling:

T_PIO_DESC PIO_DETECT = { AT91C_VA_BASE_PIOB, 17 };
void DSInterruptThread(void)
{
DWORD RetVal = 0;
HANDLE hEvent;
DWORD SysintrValue;
DWORD IRQ = GetPIOLogintr(&PIO_DETECT);

AT91PS_PIO pPio = (AT91PS_PIO)VirtualAllocCopy(sizeof(AT91S_PIO), TEXT("GPIO AllocateVirtual : pPio failed"), (PVOID) AT91C_VA_BASE_PIOB);

AT91F_PIO_CfgOutput(pPio, 1 << 11);
AT91F_PIO_ClearOutput(pPio, 1 << 11);

hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);

KernelIoControl(IOCTL_HAL_REQUEST_SYSINTR, &IRQ, sizeof(DWORD), &SysintrValue, sizeof(DWORD), NULL) ;
RetVal = InterruptInitialize( SysintrValue, hEvent, NULL, 0 );

CeSetThreadPriority(GetCurrentThread(), 150);

while (1)
{
RetVal = WaitForSingleObject(hEvent, 2000 );

if( RetVal == WAIT_OBJECT_0 )
{
//todo
InterruptDone( SysintrValue );
}
else if( RetVal == WAIT_TIMEOUT )
{
}
}

InterruptDisable( SysintrValue );
CloseHandle( hEvent );
KernelIoControl(IOCTL_HAL_RELEASE_SYSINTR, &SysintrValue, sizeof(DWORD), NULL, 0, NULL);
}
jwei
Posts: 3
Joined: Wed Oct 28, 2009 7:46 pm

Re: PIO Interrupt on AT91RM9200DK

Thu Feb 03, 2011 9:53 am

I thinked about signal bounce - but i also get an interrupt for PIN 11 which is configured as output.

I checked also the interrupt mask register, and the only interrupt enabled is for PIN 17.

I checked the OEMInterruptHandler: when i get an interrupt for PIN 11 (which is an output !), it will be called a SOCEnableIrq for it too - so the PIN 11 gets reconfigured as input - thats why i only get one interrupt. If i comment out the SOCEnableIrq for dwSysIntr == SYSINTR_UNDEFINED, then i get the interrupt for every key press - but also some other interrupt on other pins (which are not configured as pin input interrupt)

So the real question is, why i get interrupts for PIN's, which aren't configured as input with interrupt ?
jwei
Posts: 3
Joined: Wed Oct 28, 2009 7:46 pm

Re: PIO Interrupt on AT91RM9200DK

Thu Feb 03, 2011 10:40 am

The problem is in pioGetLogintr which doesn't mask the status with the mask register (IMR) ...

Return to “WinCE”

Who is online

Users browsing this forum: No registered users and 1 guest