Hi all, I am using STR912FAW44 core. I am trying to get an external interrupt from GPIO6.2 pin. There is a problem with my configuration, but I do not know where I am wrong. Could you tell me where I am wrong. My external initialization function as follows.
void externalInt_init(void) { GPIO_InitTypeDef GPIO_InitStructure; WIU_InitTypeDef WIU_InitStructure; SCU_AHBPeriphClockConfig(__VIC,ENABLE); VIC_DeInit(); SCU_APBPeriphClockConfig(__WIU, ENABLE); WIU_DeInit(); SCU_APBPeriphClockConfig(__GPIO6, ENABLE); GPIO_DeInit(GPIO6); /* GPIO6 pin configuration */ GPIO_DeInit(GPIO6); GPIO_StructInit(&GPIO_InitStructure); GPIO_InitStructure.GPIO_Direction = GPIO_PinInput; GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2;//|GPIO_Pin_1|GPIO_Pin_0; //GPIO_InitStructure.GPIO_Type = GPIO_Type_PushPull;//GPIO_Type_OpenCollector ; GPIO_Init (GPIO6, &GPIO_InitStructure); // Enable the WIU & Clear the WIU line 18 pending bit WIU_Cmd(ENABLE ); WIU_ClearITPendingBit(WIU_Line18); //WIU_DeInit(); WIU_InitStructure.WIU_Line = WIU_Line18 ; WIU_InitStructure.WIU_TriggerEdge = /*WIU_RisingEdge;*/WIU_FallingEdge ; WIU_Init(&WIU_InitStructure); // Select WIU line 18 as VIC1.12 interrupt source SCU_WakeUpLineConfig(18); //Configure and enable the interrupt controller // VIC_DeInit(); //VIC_InitDefaultVectors(); // Configure the External interrupt group 2 priority VIC_Config(EXTIT2_ITLine, VIC_IRQ, 1); // Enable the External interrupt group 2 VIC_ITCmd(EXTIT2_ITLine, ENABLE); }
ISR as follows
void EXTIT2_IRQHandler(void) { WIU_ClearITPendingBit(WIU_Line18); printf("ext18\n"); }
Did you check the value of SCU_PRR1...? Maybe GPIO6 is held in reset...?
Did you check the value of SCU_PCGR1...? Maybe the clock for port 6 is disabled...?
I want to add some information about external input which will force to cpu to an interrupt. The interrupt line is normally low(zero). When the external chip wants to send an interrupt rises up to one(high voltage.)
View all questions in Keil forum