Atmel website | ARM Community | AVR freaks | Technical Support
Banner
 FAQ •  Search •  Register •  Login 

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: PIO Interrupt on AT91RM9200DK
PostPosted: Wed Feb 02, 2011 2:02 pm 
Offline

Joined: Wed Oct 28, 2009 7:46 pm
Posts: 13
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);
}


Top
 Profile  
 
 Post subject: Re: PIO Interrupt on AT91RM9200DK
PostPosted: Thu Feb 03, 2011 9:53 am 
Offline

Joined: Wed Oct 28, 2009 7:46 pm
Posts: 13
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 ?


Top
 Profile  
 
 Post subject: Re: PIO Interrupt on AT91RM9200DK
PostPosted: Thu Feb 03, 2011 10:40 am 
Offline

Joined: Wed Oct 28, 2009 7:46 pm
Posts: 13
The problem is in pioGetLogintr which doesn't mask the status with the mask register (IMR) ...


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: