How to on and off the leds which are connected on lpc3250 board
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
How to on and off the leds which are connected on lpc3250 board
Hi,
I am working on kernel version 2.6.34 in ubuntu 11.10 with LPC3250 board.I loaded the boot loaders kickstart,stage1 and u-boot loaders in my board. In my board leds are connected to P2^0 and P2^1 pins and I have enabled the "LED Support for GPIO connected LEDs" in "LED SUPPORT" option of kernel menuconfiguration. Now i want to
make ON and OFF operations for these LEDS and is any application have to write to perform this operation?Please help me how to make that operation?
Distribution: Currently doing embedded linux so.... Buildroot? ;-)
Posts: 8
Rep:
If you have correctly enabled the LEDs, you can cd to /sys/class/leds/ where you should be able to see several directories. For instance, on a ThinkPad laptop, I can see several led directories that look like this:
/sys/class/leds/tpacpi\:thinklight, when I cd to that directory I see several files, one of which is called "brightness". To check the current setting I type: cat brightness which returns "0" indicating the led is off. To turn on the led I type: echo 100 > brightness and the led turns on.
Distribution: Currently doing embedded linux so.... Buildroot? ;-)
Posts: 8
Rep:
I admit, you have confused me. The /sys filesystem is actually a pseudo file system that is part of the linux kernel from 2.6 on (as far as regular releases go). Wat version of the kernel are you running ? If you could execute the command : uname -a and include the output in your next reply it may help.
Distribution: Currently doing embedded linux so.... Buildroot? ;-)
Posts: 8
Rep:
Since I am not familiar with your LPC3250 evaluation board, I can't know for sure, but are there jumpers or control registers that need to be properly set to enable LED control via the GPIO pins? I am completely puzzled about the lack of a /sys filesystem since I have never worked on a system with a 2.6.x kernel where that was unavailable. Is it possible that you are mounting an NFS filesystem and the listing you have shown me is from that? I am sorry, but I am running out of ideas.
Distribution: Currently doing embedded linux so.... Buildroot? ;-)
Posts: 8
Rep:
Another thought I just had. I noticed that the prompt you were showing: ~ # ls is NOT the filesystem root (the '~' means you are in the logged in user's home directory), so try this:
cd /
ls -l
You can always use 'pwd' on command line to show the working directory;
Quote:
excerpt from 'man pwd';
NAME
pwd - print name of current/working directory
SYNOPSIS
pwd [OPTION]...
DESCRIPTION
Print the full filename of the current working directory.
-L, --logical
use PWD from environment, even if it contains symlinks
-P, --physical
avoid all symlinks
--help display this help and exit
--version
output version information and exit
NOTE: your shell may have its own version of pwd, which usually supersedes the version described here. Please refer to your shell's documentation for
details about the options it supports.
Quote:
Just a few links to aid you to gaining some understanding;
Previously posted directories are before mounting NFS and that is,
~ # ls
bin etc home linuxrc sbin usr
dev ftp lib proc tmp var
I tried this also
~ # cd /
~ # ls -l
drwxr-xr-x 2 1543 1543 3072 Nov 24 2008 bin
drwxr-xr-x 2 root root 3072 Nov 24 2008 dev
drwxr-xr-x 5 1543 1543 1024 Jan 1 00:00 etc
drwxr-xr-x 2 1543 1543 1024 Nov 24 2008 ftp
drwxr-xr-x 2 1543 1543 1024 Nov 24 2008 home
drwxr-xr-x 3 1543 1543 1024 Nov 24 2008 lib
lrwxrwxrwx 1 1543 1543 14 Nov 24 2008 linuxrc -> ../bin/busybx
dr-xr-xr-x 35 root root 0 Jan 1 00:00 proc
drwxr-xr-x 2 1543 1543 1024 Nov 24 2008 sbin
drwxr-xr-x 2 1543 1543 1024 Jan 1 00:00 tmp
drwxr-xr-x 4 1543 1543 1024 Nov 24 2008 usr
drwxr-xr-x 4 1543 1543 1024 Nov 24 2008 var
And after mounting the NFS
~ # mkdir nfs
~ # ls
bin etc home linuxrc proc tmp var
dev ftp lib nfs sbin usr
~ # mount -t nfs -o nolock 192.168.1.10:/home/mohan/nfs /nfs
~ # ls
bin etc home linuxrc proc tmp var
dev ftp lib nfs sbin usr
In the above procedure i didnot found any SYS dir. is there any other kernel version that may contains this Directory?
Above section does show that a /proc & /sys are loaded via busybox. I did not look at the Fedora or Ubuntu loads but I think you use a VM Appliance for Ubuntu. Not having a physical board to verify/debug that indeed uboot is used to init & load Linux Kernel with the command: 'uboot> run mtdboot'. 'mtdboot' would be the image on your stick/sd that must be setup via tools;
Quote:
The Linux Target Image Builder (LTIB) system will be used to build the u-boot, Linux kernel and root file system. LTIB ease the build and deployment process of several components needed in a Linux system. Besides the bootloader and kernel a lot of needed utilities, modules and libraries are included and will be configured and built automatically by LTIB. For more information about LTIB, go to
http://ltib.org
Most ARM systems do use these techniques to utilize Linux on their boards.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.