On Fri, Apr 5, 2013 at 6:21 PM, Rafael Machado <
rfa...@gmail.com> wrote:
> tl;dr:
> How to achieve a high sampling frequency on gpio input data reading
> (beaglebone) ?
>
Theoretically:
Best is to remain inside kernel for capturing the data at high
frequency to avoid context switch to userspace.
Fastest would be to put your code in some existing debugfs "cat
/sys/kernel/debug/pm_debug/... "
Hack some existing infrastructure.
Start a timer and print your gpio and see how well its sampling.
Next you could try with dmtimer sending some interrupt to ARM and do
the same in interrupt handler.
If you have to pump data to userspace, some kind of poll/select will
have to be implemented to wakeup userspace app when the sampling timer
expires.
>
> My goal is to collect lots of digital input samples (via GPIOs), keeping a
> rate ~200Khz.
> I'm using the latest BeagleBone.
>
>
> So far, I've tried:
>
> - usleep
> - a dummy busy waiting loop watching CLOCK_REALTIME via clock_gettime
> - watching dmtimer2 values (mmaped)
>
> Even when I comment out the lines responsible for actually using the input
> gpios
> (i.e. the sampling overhead turns out to be completely empty),
> I cannot go further a sampling period of ~30microsec (~34Khz).
>
>
> I'm currently relying expectations on one of the following:
>
> - pru
> - /dev/rtc
> - change my ubuntu arm to xenomai or some realtime patched linux
> - write a kernel module
> - write assembly
>
> I don't know yet what of the above ideas are completely absurd or worth a
> shot
> and really need some guidance or shared experiences on this subject.
>
>
> Thanks.
>
> --
> 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.
> For more options, visit
https://groups.google.com/groups/opt_out.
>
>