Problem in GPIO Port Pin Interrupt

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • Problem in GPIO Port Pin Interrupt

    Hi All,



    In my application, I have switches connected to Port H pins. Requirement is whenever any switch is pressed, interrupt should occur.The problem is when I use GPIOPin interrupt related API like GPIOPinIntEnable(), code doesn't work. It seems control has reached to any undefined location. When I reset and the compile, I got error code 166(OS_ERR_CPU_STATE_ISR_ILLEGAL).



    I had also used OS_EnterInterrupt()/OS_LeaveInterrupt() in ISR. but no success.

    I am using embos ver 3.82K and controller is LM3S5K31 (Texas).



    Please suggest me how I can use port pin interrupt. I am listing API below which I used for port configuration.



    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOH);

    GPIODirModeSet(GPIO_PORTH_BASE, GPIO_PIN_3|GPIO_PIN_4,GPIO_DIR_MODE_IN);

    GPIOPinTypeGPIOInput(GPIO_PORTH_BASE, GPIO_PIN_3|GPIO_PIN_4);

    GPIOPadConfigSet(GPIO_PORTH_BASE, GPIO_PIN_3|GPIO_PIN_4, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU);

    GPIOPortIntRegister(GPIO_PORTH_BASE,PortHIntHandler);

    GPIOIntTypeSet(GPIO_PORTH_BASE,GPIO_PIN_3 | GPIO_PIN_4,GPIO_BOTH_EDGES);

    GPIOPinIntEnable(GPIO_PORTH_BASE,GPIO_PIN_3 | GPIO_PIN_4);



    when I comment Interrupt related APIs, code compiles and works. But it doesn't work with interrupt API.



    Please help.



    Regards,

    Harsh
  • Hi,
    the error OS_ERR_CPU_STATE_ISR_ILLEGAL is shown when an embOS function is called from an ISR running at high priority.
    ISRs may call embOS functions as long as the ISR is running on priority levels from 0xFF down to 0x80.
    Please read the CPU specific embOS manual about interrupt priorites.
    You may use the CPU libraries to set up the GPIO interrupt,
    but you have to set the priority also.
    Try IntPrioritySet() with a priority from 0xFF down to 0x80 before enabling the GPIO interrupt.
    Regards,
    Armin