GPIO on Beaglebone Black using Xenomai

578 views
Skip to first unread message

daivy....@gmail.com

unread,
Apr 2, 2014, 3:00:51 AM4/2/14
to beagl...@googlegroups.com
Hello,

I patched the linux kernel 3.8.13 with Xenomai 2.6.3 using Robert Nelson instructions : https://github.com/cdsteinkuehler/linux-dev/tree/3.8.13-xenomai/patches, and I want to capture interrupt GPIOs using the Xenomai API on the Pin 12 on the P9 header (gpio_1[28] ==> GPIO 60), using this code : 

 /*
 * main.cpp
 *
 *  Created on: 26 mars 2014
 *      Author: daivymerlijs
 */


#include <stdio.h>
#include <sys/mman.h>
#include <xenomai/native/task.h>
#include <xenomai/native/intr.h>


static RT_INTR intr;

int main() {
mlockall(MCL_CURRENT | MCL_FUTURE);
rt_task_shadow(NULL,NULL,90,0);
rt_intr_create(&intr,NULL,60,0); //not the correct value
rt_intr_enable(&intr);

while(1){
printf("Waiting interruption... \n");
rt_intr_wait(&intr,TM_INFINITE);
printf("Interruption OK");

}
return 0;
}


I want to capture the interruption by using a button connected to that GPIO, because BBB can capture 1-0 or 0-1 interruption. So, if everything is alright and I press the button, "rt_intr_wait" will deblock (it's a blocking fonction) and will print "Interruption OK".

The main problem is "rt_intr_create", where I don't know the correct value to use, because the GPIO number is not the correct the value to use, the value I need to know is the value used by the kernel ID that is linked with the GPIO. However, I can't find this information anywhere. At the opposite of some cards, like FOXG20, which tell me what is the ID number depending of the kernel version :http://www.acmesystems.it/pinout_foxg20 

So I think I should find a similar information in the BBB documentation (and the Texas Instruement documentation too) , but I can't find it anywhere. I need a lot of help on this, I hope you guys can help me.

Thanks,
Daivy

dlewin555

unread,
Apr 6, 2014, 7:03:21 AM4/6/14
to beagl...@googlegroups.com
Could you describe the process how you managed to get that image?

Charles Steinkuehler

unread,
Apr 11, 2014, 8:03:42 AM4/11/14
to beagl...@googlegroups.com
On 4/2/2014 2:00 AM, daivy....@gmail.com wrote:

<snip>

> I want to capture the interruption by using a button connected to that
> GPIO, because BBB can capture 1-0 or 0-1 interruption. So, if everything is
> alright and I press the button, "rt_intr_wait" will deblock (it's a
> blocking fonction) and will print "Interruption OK".
>
> The main problem is "rt_intr_create", where I don't know the correct value
> to use, because the GPIO number is not the correct the value to use, the
> value I need to know is the value used by the kernel ID that is linked with
> the GPIO. However, I can't find this information anywhere. At the opposite
> of some cards, like FOXG20, which tell me what is the ID number depending
> of the kernel version :http://www.acmesystems.it/pinout_foxg20
>
> So I think I should find a similar information in the BBB documentation
> (and the Texas Instruement documentation too) , but I can't find it
> anywhere. I need a lot of help on this, I hope you guys can help me.

I'd ask on the Xenomai list.

--
Charles Steinkuehler
cha...@steinkuehler.net

felipe.si...@gmail.com

unread,
Sep 24, 2014, 6:58:03 AM9/24/14
to beagl...@googlegroups.com, daivy....@gmail.com
Hi Daivy, I am currently having the same problem, and I would like to know if you have solved it already. Even I am not using BBB I am pretty sure it must be almost the same procedure.

Thanks

Felipe

Matteo Loda

unread,
Nov 13, 2015, 5:01:32 AM11/13/15
to BeagleBoard, daivy....@gmail.com
I got the same problem, I am using this image :  http://elinux.org/Beagleboard:BeagleBoneBlack_Debian

 Anybody did it ? 

felipe andres silva gomez

unread,
Nov 13, 2015, 5:17:57 PM11/13/15
to beagl...@googlegroups.com
Hi Matteo, actually I did solved it for the raspberry Pi. It should be a similar solution for your case:

To create interruptions in Xenomai is necessary the use of the function rt_intr_create that requires as a parameter the hardware interrupt channel associated with the interrupt object, this value is architecture dependent. To find the specified hardware interrupt channel it is necessary to download the linux header for the Raspberry Pi using the command: sudo apt-get install linux-headers-3.10-3-rpi. Once this headers are installed, the specified channel can be obtained, calling gpio_to_irq(PIN_NUMBER).


--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to a topic in the Google Groups "BeagleBoard" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/beagleboard/UGaVWPBx254/unsubscribe.
To unsubscribe from this group and all its topics, send an email to beagleboard...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages