GPIO toggle Kernel Module for Beaglebone

Showing 1-8 of 8 messages
GPIO toggle Kernel Module for Beaglebone Wesley 8/30/12 2:04 PM
Hey,

So I tested to see how fast the GPIO toggle rate of the Beaglebone could get when using a kernel module. When using user space it was only about 4-5 MHz and once I did the kernel module it got up to 25 MHz. Since I had a difficult time getting the kernel source tree on the beaglebone and compiling everything here is some documentation and code for those who want to build kernel modules/device drivers on the beaglebone and also user program interaction with the kernel module.

gpio.c is the kernel code
gpio.h is the header file for both gpio.c and ioctl.c
ioctl.c is the user code

Here is my Makefile in case you want it also

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
obj-m := gpio.o

KERNELDIR := /usr/src/linux-3.2.23

default:
        $(MAKE) -C $(KERNELDIR) M=$(PWD) modules
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Also, the websites that I used that helped me get here were mainly these:
https://groups.google.com/forum/#!msg/beagleboard/BKnNkP3qzQs/PNloua3737MJ
http://www.cemetech.net/forum/viewtopic.php?t=7814
and the Linux Device Drivers book

~Wesley

Re: [beagleboard] GPIO toggle Kernel Module for Beaglebone Jack Mitchell 8/31/12 1:12 AM
> <https://groups.google.com/forum/#%21msg/beagleboard/BKnNkP3qzQs/PNloua3737MJ>
> http://www.cemetech.net/forum/viewtopic.php?t=7814
> <http://www.cemetech.net/forum/viewtopic.php?t=7814>
> and the Linux Device Drivers book
>
> ~Wesley
>
> -- To join: http://beagleboard.org/discuss
> To unsubscribe from this group, send email to:
> beagleboard...@googlegroups.com
> Frequently asked questions: http://beagleboard.org/faq

Hi Wesley,

Seems like a good start, is there any reason you didn't use the GPIO
lib? Possibly for speed?It would be interesting to see if there was much
difference.

Well done for having a go and getting it working!

Regards,
Jack

--

   Jack Mitchell (ja...@embed.me.uk)
   Embedded Systems Engineer
   http://www.embed.me.uk

--

Re: GPIO toggle Kernel Module for Beaglebone Mark A. Yoder 11/12/12 7:16 AM
I've moved my class away from using bitbake for kernel work.  Here[1] are the instructions we use to prepare for kernel work.

--Mark

[1] http://elinux.org/EBC_Exercise_08_Installing_Development_Tools

On Monday, November 12, 2012 7:45:24 AM UTC-5, ksrenjith wrote:
Great guide,,Thank you so much,,

I followed your notes to start my play with beaglebone,,but when trying to bitbake,getting an error:ERROR:  OE-core's config sanity checker detected a potential misconfiguration.
    Either fix the cause of this error or at your own risk disable the checker (see sanity.conf).
    Following is the list of potential problems / advisories:

    Do not use Bitbake as root.
ERROR: Execution of event handler 'check_sanity_eventhandler' failed
 
in my ubuntu 12.04,,,I have tried it without sudo then again getting error like,,, OperationalError: attempt to write a readonly database

After so much googling I did this,as a starter in Linux I don't have much idea to solve this without proper direction.It looks like some of the files are owned by root,I do not have access to these files.Please help me to solve this.I am waiting to start my studies with beaglebone.Thanks in advance for your time and consideration.



On Friday, 31 August 2012 02:34:39 UTC+5:30, Wesley wrote:
Hey,

So I tested to see how fast the GPIO toggle rate of the Beaglebone could get when using a kernel module. When using user space it was only about 4-5 MHz and once I did the kernel module it got up to 25 MHz. Since I had a difficult time getting the kernel source tree on the beaglebone and compiling everything here is some documentation and code for those who want to build kernel modules/device drivers on the beaglebone and also user program interaction with the kernel module.

gpio.c is the kernel code
gpio.h is the header file for both gpio.c and ioctl.c
ioctl.c is the user code

Here is my Makefile in case you want it also

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
obj-m := gpio.o

KERNELDIR := /usr/src/linux-3.2.23

default:
        $(MAKE) -C $(KERNELDIR) M=$(PWD) modules
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Also, the websites that I used that helped me get here were mainly these:
https://groups.google.com/forum/#!msg/beagleboard/BKnNkP3qzQs/PNloua3737MJ
http://www.cemetech.net/forum/viewtopic.php?t=7814
and the Linux Device Drivers book

~Wesley

Re: GPIO toggle Kernel Module for Beaglebone Erik Dahlinghaus 11/12/12 7:22 AM
On the folder that you have setup-scripts downloaded, use chown to take ownership of the folder. Something like 'chown -r [username]:[username] setup-scripts' if you're above the folder. Replace [username] with your username.
Re: GPIO toggle Kernel Module for Beaglebone Juanjo 11/12/12 5:24 PM
Nice ! I've been using the PRUSS on the BB. Each instruction which don't go out of local memory takes 5ns, so basically using one of the GPIO lines hooked to the PRUSS you could achieve more than 25[Mhz]

LOOP:
      SET r30.t15
      CLR r30.t15
      QBA LOOP

Should takes 15ns (33% duty cycle) that would be 66 [Mhz]

LOOP:
     SET r30.t15
     XOR r0, r0, 0
     CLR r30.t15
     QBA LOOP

Should take 20ns (%50 duty cycle) at 50 [Mhz]

PRUSS seems pretty useful for bit-banging, right now I'm trying to use it to make a "soft" i2s decoder to spare McASP0 for audio cape.
Re: GPIO toggle Kernel Module for Beaglebone ksrenjith 11/18/12 10:25 PM
Thank you so much for your reply,,I could solve my problem,,
Re: GPIO toggle Kernel Module for Beaglebone ksrenjith 11/18/12 10:26 PM
Thank you so much for your reply,,I could solve my problem,,

Re: GPIO toggle Kernel Module for Beaglebone csu...@idapl.in 9/5/14 1:38 AM
does this kernel module will help me for my linux kernel 3.8.13-bone47 which is installed in my beagelbone black

thanking you

sumik chakka