am335x (beaglebone) problem with interrupt

95 views
Skip to first unread message

scm...@gmail.com

unread,
May 8, 2017, 6:01:02 AM5/8/17
to BeagleBoard
hey everyone,

i hope i post in the right place but if not, please inform me to post it in a more suitable place...
Let me describe my problem..
For my project, i use starterware (version 2.00.01.01) and build my files via code composer studio (version 6.1.0.00104) with compiler version:GNU v4.8.4 (Linaro).
My goal is to learn using interrupts. Thus i started with a simple project in mind: by pressing a switch i expect to create an interrupt in an input pin of my beaglebone and via the isr i created, i want to turn off a led that was already on and turn on an other, previously off, led.

The problem seems to be that i can not get an interrupt...
I give you the piece of code responsible for achieving my goal:
IntMasterIRQEnable();
IntAINTCInit();
GPIO1ModuleClkConfig();
GpioModuleEnable(SOC_GPIO_1_REGS);
GPIODirModeSet(SOC_GPIO_1_REGS, GPIO_INTER_INP, GPIO_DIR_INPUT);
IntRegister(SYS_INT_GPIOINT1A, isr_buttonLed);
IntPrioritySet(SYS_INT_GPIOINT1A, 0, AINTC_HOSTINT_ROUTE_IRQ);
IntSystemEnable(SYS_INT_GPIOINT1A);
GPIOIntTypeSet(SOC_GPIO_1_REGS,GPIO_INTER_INP,GPIO_INT_TYPE_LEVEL_HIGH);
HWREG(SOC_GPIO_1_REGS + 0x34) = 0x10;
HWREG(SOC_GPIO_1_REGS + 0x38) = 0x10;
HWREG(SOC_GPIO_1_REGS + 0x44) = 0x10;

//
//------isr function
//

static void isr_buttonLed(void)
{
  /*    Clear interrupt      */
  HWREG(SOC_GPIO_1_REGS + 0x2C) = 0x10;
  HWREG(SOC_GPIO_1_REGS + 0x30) = 0x10;
  //turn off led that is already on
  GPIOPinWrite(SOC_GPIO_1_REGS, GPIO_LED_ON, GPIO_PIN_LOW);
  //turn on an other led
  GPIOPinWrite(SOC_GPIO_1_REGS, GPIO_LED_2, GPIO_PIN_HIGH);
  //again enable IRQ
  HWREG(SOC_GPIO_1_REGS + 0x34) = 0x10;//GPIO_IRQSTATUS_SET_0
  HWREG(SOC_GPIO_1_REGS + 0x38) = 0x10;//GPIO_IRQSTATUS_SET_1
  HWREG(SOC_GPIO_1_REGS + 0x44) = 0x10;//GPIO_IRQWAKEN_0
}

Unfortunately, nothing happens when i push the switch..can somebody point out to me a possible solution or what is wrong with the above?
Moreover, how can i test if an interrupt is actually triggered or not when i push the switch?

Thanks in advance for any help

Mark Lazarewicz

unread,
May 8, 2017, 6:51:59 AM5/8/17
to beagl...@googlegroups.com
Increment a counter in interupt and print it in background 


--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups "BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beagleboard...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beagleboard/faa84f8d-fc8c-4e27-adea-8f6a2157de3d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

scm...@gmail.com

unread,
May 9, 2017, 10:25:53 AM5/9/17
to BeagleBoard, laza...@yahoo.com
firstly thanks for your response, although i was actually more interested in a suggestion of a register, maybe, that could show me the status of the interrupts..meaning if there is a register showing if there is an interrupt produced or not...
To return to the problem, i have tried with a counter in interrupt too, but it doesn't work. I mean it seems like the isr is never taking over and thus none of the "commands" inside the isr are called.
Additionally i would like to add that the pin doesn't seem to have any problem, cause i used the GPIOPinRead function of starterware (which i supposed to return the logic level(value) of the specified gpio pin) and it seems that it works properly.

Update: i also tried to use the starterware's function, GPIOPinIntEnable, cause i thought that it may helps but i have the same results...

The way i think of it, either the interrupt controller is not properly working (but why,what else should i do and how can i find out for sure?) or there are more to be done regarding gpio module when it comes to interrupts (like using GPIOPinIntEnable function, but again is there anyone who knows?).
Last but not least, is there any chance that the problem is created by the linker file used from code composer studio (which is automatically created when the project is created and depends on the compiler to be used)? and if so, can somebody point out to me, what should i check out in the relative linker file?

Thanks again and sorry for the trouble...

Reply all
Reply to author
Forward
0 new messages