Wow ,congratulations! I have work out the interrupt finally. Just after such a exhausting time.
Thanks to the meanful blogs: http://forums.xilinx.com/t5/Zynq-7000-All-Programmable-SoC/%E7%94%A8SDK%E7%BC%96%E5%86%99GPIO%E4%B8%AD%E6%96%AD%E7%A8%8B%E5%BA%8F%E6%97%B6%E5%87%BA%E7%8E%B0%E7%9A%84%E9%97%AE%E9%A2%98/m-p/314191/highlight/false#M111
I just add a sentence: XGpioPs_IntrDisablePin(pGpioPs,50) and it works!
Now a screen shot for memory!
XGpioPs* pGpioPs=(XGpioPs*)CallBackRef; XGpioPs_IntrDisablePin(pGpioPs,50); xil_printf("Gpio Handler...\n"); XGpioPs_IntrEnablePin(pGpioPs,50);
But I just commented the sentence and re-build the application, it runs either! I don't know why?
and i have noticed that although i just press BTN8 once ,but it prints "Gpio Handler..." 2 times!
The interrupt remains undetected if:
XScuGic_SetPriorityTriggerType(&ScuGic,52,0xFF,0x01);
But it remains interrupt detected if:
XScuGic_SetPriorityTriggerType(&ScuGic,52,0xa0,0x03);
The total application is shown as follows:
static void GpioHandler(void *CallBackRef, int Bank, u32 Status) { xil_printf("Gpio Handler...\n"); } int main() { u32 data; XGpioPs Gpio; XGpioPs_Config *ConfigPtr; ConfigPtr = XGpioPs_LookupConfig(0); XGpioPs_CfgInitialize(&Gpio, ConfigPtr, ConfigPtr->BaseAddr); XGpioPs_SetDirectionPin(&Gpio,50,0x0); XGpioPs_SetOutputEnablePin(&Gpio,50,0x1); XGpioPs_SetIntrTypePin(&Gpio,50,XGPIOPS_IRQ_TYPE_EDGE_FALLING); XGpioPs_SetCallbackHandler(&Gpio, (void *)&Gpio, GpioHandler); XGpioPs_IntrEnablePin(&Gpio,50); XScuGic ScuGic; XScuGic_Config* pScuGicCfg; pScuGicCfg=XScuGic_LookupConfig(XPAR_SCUGIC_SINGLE_DEVICE_ID); XScuGic_CfgInitialize(&ScuGic,pScuGicCfg,pScuGicCfg->CpuBaseAddress); XScuGic_Connect(&ScuGic, 52, (Xil_ExceptionHandler)XGpioPs_IntrHandler, (void *)&Gpio); XScuGic_SetPriorityTriggerType(&ScuGic,52,0xA0,0x01); XScuGic_Enable(&ScuGic,52); Xil_ExceptionInit(); Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_INT,(Xil_ExceptionHandler)XScuGic_InterruptHandler,&ScuGic); Xil_ExceptionEnable(); xil_printf("Intr test: \n"); while(1) { } }
I notify that the XGpioPs_GetPinNumber remains go wrong at the pin 50; it says pin 50 belongs to bank 0.
I don't know why?