UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Explorer
Explorer
6,852 Views
Registered: ‎02-27-2014

how to access led on microzed board through kernel space

I am using microzed board to boot linux from it and i am using petalinux tool to build my images. I want to glow an LED through kernel space. I am not sure where and in which file should i make a change so that i can glow LED through kernel space.

Please suggest me , what should i do for this problem?

thanks

0 Kudos
6 Replies
Scholar sampatd
Scholar
6,829 Views
Registered: ‎09-05-2011

Re: how to access led on microzed board through kernel space

The Linux GPIO driver can be accessed by user space through sysfs file system. You should be able to see the controllers at /sys/class/gpio

For more information, check:
http://www.wiki.xilinx.com/Linux+GPIO+Driver
http://www.wiki.xilinx.com/GPIO+User+Space+App
0 Kudos
Explorer
Explorer
6,718 Views
Registered: ‎02-27-2014

Re: how to access led on microzed board through kernel space

@sampatd Thanks for your reply.

I want to access LED from kernel space and not from user's space.

can u tell me how and where to include the following function:

http://www.zilogic.com/releases/bsp-1.5.1/doc/zdev-user-manual/API-gpio-direction-output.html

 

you can find function gpio_direction_output() in this link .

Can i access and glow LED using this function?

If possible, please help me where to include this function and modification needed to be done

Thanks

 

0 Kudos
Highlighted
Explorer
Explorer
6,679 Views
Registered: ‎02-27-2014

Re: how to access led on microzed board through kernel space

Can anyone help me regarding this query ?

0 Kudos
Scholar rfs613
Scholar
6,662 Views
Registered: ‎05-28-2013

Re: how to access led on microzed board through kernel space

This is part of the Linux kernel GPIO framework.
See https://www.kernel.org/doc/Documentation/gpio/
in particular the files consumer.txt and gpio-legacy.txt
I do not know if the Zynq GPIOs work with this framework.

You could also consult the source code of the Xilinx GPIO driver module: https://github.com/Xilinx/linux-xlnx/blob/master/drivers/gpio/gpio-xilinx.c

-R
0 Kudos
Explorer
Explorer
6,501 Views
Registered: ‎02-27-2014

Re: how to access led on microzed board through kernel space

I have to access gpio pin 47 to glow LED on microzed board.

can i access this pin using the function: gpio_direction_output(unsigned gpio, int value)

 

                                                  gpio_direction_output(47,1);

 If possible, In which file can i include above function?

What other functions are required other than gpio_direction_output?

I want my LED glow after kernel boots and i want it from kernel space and not from users space

 

Please help me.

0 Kudos
Scholar sampatd
Scholar
6,492 Views
Registered: ‎09-05-2011

Re: how to access led on microzed board through kernel space

I have not tried the above kernel API; however, if you use PetaLinux 2014.4, you can create the application and integrate it into the rootfs.

Once you have the application, you can auto run it on start up.

Please refer to ug1144 for more information:

http://www.xilinx.com/support/documentation/sw_manuals/petalinux2014_4/ug1144-petalinux-tools-reference-guide.pdf
0 Kudos