On 03/18/2014 08:15 PM, Roque Lora wrote:
I am expecting from 60 pulses to 100 pulses per second.

Do you think I can handle that with GPIO?

I would say that chances are pretty good.

I am not sure how accurately you will be able to measure their relative timing, however. If that is important to you, it would be good to do some measurements.

Markus




2014-03-18 17:25 GMT-06:00 Markus Svilans <msvilans@aeonyx.ca>:
Hi Roque,



On 03/18/2014 06:55 PM, Roque Lora wrote:
Hi Markus,

I could set the gpio to detect rising and falling edges. Now when I do 

cat /sys/class/gpio/gpio146/edge 

it answers both, as it should. But I set it up from the command line and I cannot find the "board_overo.c". I tried doing a find / -name *overo.c but did not get any file with that ending. So could you tell me where I should look for it so I can define it permanently?


That file is part of the Linux kernel board support for Gumstix Overo, and would not be found on your Gumstix itself because it gets compiled right into the Linux kernel.

To work with customizing the Linux kernel and board_overo.c, would have to install the Gumstix Yocto development environment.

The Gumstix Yocto "getting started" page is here:
https://github.com/gumstix/Gumstix-YoctoProject-Repo



And also, I could not deduce the usage of poll() or select() from that documentation, I just know that they detect the rising and falling edges if /sys/class/gpio/gpio146/edge is configured to do so. So could you give me a small example of poll()?


poll() and select() are C language functions, part of the Linux system.

Examples and tutorials can be found all over the internet. Here is one page with useful introductory info:
http://www.makelinux.net/ldd3/chp-6-sect-3




I can not use the less efficient way since I am trying to get the time of a pulse from a RC Receiver similar to PWM.

Regards and thank you for all the help so far.


Ok, it would be important to know how many pulses per second you want to handle. If the pulse rate is too fast, then the GPIO edge interrupt method I am suggesting will not work. In that case, the direction suggested by Scott Ellis, which uses hardware timers, would make more sense.


Regards,
Markus





2014-03-18 14:21 GMT-06:00 Markus Svilans <msvilans@aeonyx.ca>:
Hi Roque,

Next try this:
ls /sys/class/gpio/gpio145/

to see what is available for that GPIO.

I don't have the time right now to make a complete example, but it won't be hard for you to follow some steps on your own. Here is what I suggest:

Have a look here, it basically explains step by step how to set up a gpio for input:
http://gumstix.org/software-development/how-to/250-gpio.html


Next, to use the edge interrupts, you need to read this carefully:
https://www.kernel.org/doc/Documentation/gpio/sysfs.txt

In your system start-up script (e.g. /etc/init.d/rcS) you could do something like this:

# Set direction of gpio 145
echo in > /sys/class/gpio/gpio145/direction

# Request edge interrupts, rising and falling
echo both > /sys/class/gpio/gpio145/edge

You could also do this from a C program, by opening the files and writing the strings to them. A more permanent way is to set up the gpio is to patch your kernel (board_overo.c file) to set up the gpio(s).

Then, in your C program you can do this:

int gpio = open("/sys/class/gpio/gpio145/value", O_RDONLY);

Then, you can set up a loop that uses poll() or select() to wait for events occurring on the gpio file descriptor. This would probably have to be run from a separate thread.

An alternate and less CPU efficient way, that does not involve poll() or select(), would be to set up a loop that periodically (e.g. 10 or 50 times per second) checks the gpio value, and takes action when the value changes.

Hope this helps you start.

Regards,
Markus





On 03/18/2014 04:04 PM, Roque Lora wrote:

Hi Markus,

Could you give me a small example of using edge (for rising and falling)?
I have these gpio available:

gpio15   gpio168      gpiochip160  gpiochip64

gpio144  gpio16   gpiochip0    gpiochip192  gpiochip96

gpio145  gpio164  gpiochip128  gpiochip32 


I want to use the gpio145 (I am not using and LCD).

That would be of great help.

Regards


Hi Roque,

You can configure GPIO pins for input or output:
http://gumstix.org/software-development/how-to/250-gpio.html

Additional useful info can be found here:
https://www.kernel.org/doc/Documentation/gpio/sysfs.txt

If you log into your Overo command line, you can see what GPIOs you have 
available by running the command:
ls /sys/class/gpio


By using the "edge" property of sysfs GPIOs, you can use poll(), 
select() or epoll() to efficiently wait for GPIO input events.

The Overo has lots of pins that you can use as GPIOs. The thing is, lots 
of them are assigned to other functions by default. But, you can change 
that by adjusting the pin multiplexing ("pin mux") in the kernel and/or 
U-boot to use them.

Also, if you share more details about your application it would people 
here to provide useful info.

Best wishes
Markus


On 03/18/2014 02:53 PM, Roque Lora wrote:
>
> Good afternoon,
>
> I want to set up a pin of an overo fire as a timer in capture mode but 
> I do not know where to look for this information. I have read a lot of 
> articles and datasheets but it does not work for the distribution that 
> I am using, Linaro (Yocto Project).
>
> Could you help me with this?
>
> Best regards
> -- 
> Roque Lora
> Graduate Research Assistant of Electrical Engineering
> AggieAir Flying Circus (http://aggieair.usu.edu/)
> Utah State University
> Logan, UT, USA
>
>
> ------------------------------------------------------------------------------
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and their
> applications. Written by three acclaimed leaders in the field,
> this first edition is now available. Download your free book today!
> http://p.sf.net/sfu/13534_NeoTech
>
>
> _______________________________________________
> gumstix-users mailing list
> gumstix-users@...
> https://lists.sourceforge.net/lists/listinfo/gumstix-users


2014-03-18 12:44 GMT-06:00 Roque Lora <roquelora@gmail.com>:
Good afternoon,

I want to set up a pin of an overo fire as a timer in capture mode but I do not know where to look for this information. I have read a lot of articles and datasheets but it does not work for the distribution that I am using, Linaro (Yocto Project).

Could you help me with this?

Best regards

--
Roque Lora
Graduate Research Assistant of Electrical Engineering
AggieAir Flying Circus (http://aggieair.usu.edu/)
Utah State University
Logan, UT, USA



--
Roque Lora
Graduate Research Assistant of Electrical Engineering
AggieAir Flying Circus (http://aggieair.usu.edu/)
Utah State University
Logan, UT, USA


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech


_______________________________________________
gumstix-users mailing list
gumstix-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gumstix-users


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
gumstix-users mailing list
gumstix-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gumstix-users




--
Roque Lora
Graduate Research Assistant of Electrical Engineering
AggieAir Flying Circus (http://aggieair.usu.edu/)
Utah State University
Logan, UT, USA


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech


_______________________________________________
gumstix-users mailing list
gumstix-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gumstix-users


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
gumstix-users mailing list
gumstix-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gumstix-users




--
Roque Lora
Graduate Research Assistant of Electrical Engineering
AggieAir Flying Circus (http://aggieair.usu.edu/)
Utah State University
Logan, UT, USA


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech


_______________________________________________
gumstix-users mailing list
gumstix-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gumstix-users