| Welcome to AT91SAM Community Forum http://www.at91.com/samphpbb/ |
|
| PIO Interrupt on AT91RM9200DK http://www.at91.com/samphpbb/viewtopic.php?f=13&t=19870 |
Page 1 of 1 |
| Author: | jwei [ Wed Feb 02, 2011 2:02 pm ] |
| Post subject: | PIO Interrupt on AT91RM9200DK |
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); } |
|
| Author: | jwei [ Thu Feb 03, 2011 9:53 am ] |
| Post subject: | Re: PIO Interrupt on AT91RM9200DK |
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 ? |
|
| Author: | jwei [ Thu Feb 03, 2011 10:40 am ] |
| Post subject: | Re: PIO Interrupt on AT91RM9200DK |
The problem is in pioGetLogintr which doesn't mask the status with the mask register (IMR) ... |
|
| Page 1 of 1 | All times are UTC + 1 hour [ DST ] |
| Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |
|



Forum