Saturday, November 25th 2017, 10:36am UTC+1

You are not logged in.

  • Login
  • Register

Dear visitor, welcome to SEGGER Forum. If this is your first visit here, please read the Help. It explains how this page works. You must be registered before you can use all the page's features. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

techharsh

Beginner

Date of registration: Feb 1st 2012

Posts: 11

1

Wednesday, April 4th 2012, 3:07pm

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

SEGGER - Armin

Super Moderator

Date of registration: Dec 20th 2007

Posts: 26

2

Wednesday, April 11th 2012, 2:06pm

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

techharsh

Beginner

Date of registration: Feb 1st 2012

Posts: 11

3

Thursday, April 12th 2012, 1:07pm

Thanks a lot for your reply. Now things are working fine :)