AnsweredAssumed Answered

GPIO IRQ fails

Question asked by Ardoster on Jul 19, 2012
Latest reply on Aug 8, 2012 by Ardoster



I'm trying to link an IRQ to an extern IRQ pin. I've been reading the manuals and consulting different threads in this forum, but I can't see where the error is. Have I to modify or enable something in the BSP or PSP?


This is my code, maybe you know what's happening.


// define inputsconst uint_32 g_GPIOS_Inputs[] = { GPIO_PORT_NQ | GPIO_PIN1 | GPIO_PIN_IRQ_FALLING, GPIO_LIST_END };static MQX_FILE_PTR g_GPIOS_OutputPort = NULL;static MQX_FILE_PTR g_GPIOS_InputPort = NULL;void irq_callback();// current value of output gpiosboolean g_GPIOS_OutputsValue[PROJECT_MAX_OUTPUTS] = {0};void irq_callback(){ static u8 counter=0;  counter++; }/** GPIOS_Init *  Initializes all gpios in the hardware  *  @return Error code */error_t GPIOS_Init(){ // configure gpios outputs g_GPIOS_OutputPort = fopen("gpio:write", (char_ptr)&g_GPIOS_Outputs); if (g_GPIOS_OutputPort == NULL){  PrintError("GPIO Init failed. Exiting...", ERROR_MQX_GPIO);  _time_delay(PROJECT_MQX_DELAY_TO_EXIT);  _mqx_exit((_mqx_uint)ERROR_MQX_GPIO); } // configure gpios inputs g_GPIOS_InputPort = fopen("gpio:read", (char_ptr)&g_GPIOS_Inputs); if (g_GPIOS_InputPort == NULL){  PrintError("GPIO Init failed. Exiting...", ERROR_MQX_GPIO);  _time_delay(PROJECT_MQX_DELAY_TO_EXIT);  _mqx_exit((_mqx_uint)ERROR_MQX_GPIO); }  ioctl(g_GPIOS_InputPort, GPIO_IOCTL_SET_IRQ_FUNCTION, (pointer) &irq_callback); ioctl(g_GPIOS_InputPort, GPIO_IOCTL_ENABLE_IRQ, NULL);  //GPIOS_InstallCallbackIRQ(&MAIN_Callback); //GPIOS_IRQEnable(TRUE);  }

 Thanks in advance.