<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://www.elinux.org/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://www.elinux.org/api.php?action=feedcontributions&amp;user=Yoder&amp;feedformat=atom</id>
		<title>eLinux.org - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="http://www.elinux.org/api.php?action=feedcontributions&amp;user=Yoder&amp;feedformat=atom"/>
		<link rel="alternate" type="text/html" href="http://www.elinux.org/Special:Contributions/Yoder"/>
		<updated>2013-06-19T07:34:02Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.22alpha</generator>

	<entry>
		<id>http://www.elinux.org/ECE497_Tips_and_Tricks</id>
		<title>ECE497 Tips and Tricks</title>
		<link rel="alternate" type="text/html" href="http://www.elinux.org/ECE497_Tips_and_Tricks"/>
				<updated>2013-06-18T16:24:35Z</updated>
		
		<summary type="html">&lt;p&gt;Yoder: Added pico DLP instructions&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:ECE497 |Tips]]&lt;br /&gt;
{{YoderHead}}&lt;br /&gt;
&lt;br /&gt;
Some useful tips and tricks for Linux and the Beagleboard.&lt;br /&gt;
&lt;br /&gt;
== Interesting Links ==&lt;br /&gt;
&lt;br /&gt;
Since we are working with the open source community, you need to know where the action is.  Here are some useful links to what's happening in the Beagle community.&lt;br /&gt;
&lt;br /&gt;
* [http://groups.google.com/group/beagleboard/browse_thread/thread/c5a631c6582119b8 State of the Beagle 2011], learn about the Beagle's past, present and future.&lt;br /&gt;
* [http://BeagleBoard.org BeagleBoard.org], the starting point for all thing Beagle.&lt;br /&gt;
* [http://groups.google.com/group/beagleboard Beagle Discussion Group], lot's of good information here, but you'll have to dig a bit.  Subscribe and follow the discussion.&lt;br /&gt;
* [http://beagleboard.blogspot.com/ blogspot], see what is being said about the Beagle.&lt;br /&gt;
* [http://elinux.org/BeagleBoard eLinux], this is where this page is being hosted.  It's about embedded Linux in general, not just the BeagleBoard.&lt;br /&gt;
* [http://free-electrons.com/blog/beagle-labs/ Free Electrons Beagle Board Training], some good labs about what makes embedded Linux run.&lt;br /&gt;
* [https://gforge.ti.com/gf/project/tiesr/ TI Embedded Speech Recognizer] (TIesr) is a fixed-point recognizer written in C++ and C. &lt;br /&gt;
* [http://code.google.com/soc/ Google Summer of Code].  BeagleBoard is an accepted organization.&lt;br /&gt;
* [http://www.makelinux.net/kernel_map Linux Kernel Map]&lt;br /&gt;
* [http://processors.wiki.ti.com/index.php/Category:OMAP35x Texas Instruments Embedded Processors Wiki]&lt;br /&gt;
&lt;br /&gt;
== Linux ==&lt;br /&gt;
&lt;br /&gt;
[http://freeengineer.org/learnUNIXin10minutes.html Learn UNIX in 10 Minutes] is a quick overview of the most commonly used Linux commands.&lt;br /&gt;
&lt;br /&gt;
[http://lifehacker.com/5935869/top-10-tools-that-are-better-in-the-command-line?utm_campaign=socialflow_lifehacker_twitter&amp;amp;utm_source=lifehacker_twitter&amp;amp;utm_medium=socialflow Top 10 Tools] is a nice summary of 10 of the most useful Linux commands.&lt;br /&gt;
&lt;br /&gt;
=== Quick Tips ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Tip&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
 beagle$ '''gnome-open'''&lt;br /&gt;
| Open a file or directory using the default program&lt;br /&gt;
|-&lt;br /&gt;
| Give the IP address a name&lt;br /&gt;
| Inside /etc/hosts add a line of the form &amp;lt;IP address&amp;gt; &amp;lt;alias&amp;gt; this will allow you to refer to the host by name.&lt;br /&gt;
|-&lt;br /&gt;
| Built-in GUI for gdb&lt;br /&gt;
| If you invoke gdb with the command line argument -tui, it will show a built-in GUI&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
 beagle$ '''ntpdate ntp.org'''&lt;br /&gt;
 beagle$ '''rm /etc/localtime'''&lt;br /&gt;
 beagle$ '''ln -s /usr/share/zoneinfo/America/New_York /etc/localtime'''&lt;br /&gt;
&lt;br /&gt;
| This will go to a '''n'''etwork '''t'''ime '''p'''rotocol server and get the current time and set the Beagle to it and set the local time zone. [http://derekmolloy.ie/automatically-setting-the-beaglebone-black-time-using-ntp/]&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
 beagle$ '''mount -t debugfs debugfs /sys/kernel/debug/'''&lt;br /&gt;
 beagle$ '''cd /sys/kernel/debug'''&lt;br /&gt;
 beagle$ '''ls'''&lt;br /&gt;
| Kernel Debug Info&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Connecting to RHIT wifi ===&lt;br /&gt;
&lt;br /&gt;
There is a discussion in the [https://groups.google.com/forum/?fromgroups=#!topic/beaglebone/9PEUmcsLXLU Beagle Google Group] about getting wireless working with the bone.&lt;br /&gt;
&lt;br /&gt;
Use these settings for connecting to the Rose-Hulman wireless network:&lt;br /&gt;
&lt;br /&gt;
* '''SSID:''' RHIT-1X&lt;br /&gt;
* '''Security:''' WPA &amp;amp; WPA2 Enterprise&lt;br /&gt;
* Leave &amp;quot;anonymous identity&amp;quot; blank &lt;br /&gt;
* '''CA Certificate''': (None)&lt;br /&gt;
* '''PEAP version''': Version 0&lt;br /&gt;
* '''Inner authentication''': MSCHAPv2&lt;br /&gt;
* Use your Rose username and password&lt;br /&gt;
&lt;br /&gt;
=== bash ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Tip&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| Ctrl-r&lt;br /&gt;
| Reverse incremental search&lt;br /&gt;
|-&lt;br /&gt;
| Ctrl-g&lt;br /&gt;
| Abort command&lt;br /&gt;
|-&lt;br /&gt;
| Esc-.&lt;br /&gt;
| Insert last argument from last command&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== ssh ===&lt;br /&gt;
&lt;br /&gt;
==== Suspending ssh ====&lt;br /&gt;
&lt;br /&gt;
Most programs can be suspended by typing &amp;lt;code&amp;gt;^z&amp;lt;/code&amp;gt; (Ctrl-z).  If you have an '''ssh''' connection to another machine you can suspend it by entering &amp;lt;code&amp;gt;~^z&amp;lt;/code&amp;gt;.  You can resume the connection by entering ''fg''.&lt;br /&gt;
&lt;br /&gt;
==== ssh and X-windows ====&lt;br /&gt;
&lt;br /&gt;
When using ssh between to X-windows systems try&lt;br /&gt;
&lt;br /&gt;
 host$ '''ssh -CX root@beagle'''&lt;br /&gt;
&lt;br /&gt;
The -X set the DISPLAY variable on the remote machine so you can open windows from the beagle on your host machine.  &lt;br /&gt;
&lt;br /&gt;
The -C compressed the data over the link.  Good for slow connections.&lt;br /&gt;
&lt;br /&gt;
==== vnc ====&lt;br /&gt;
&lt;br /&gt;
You can run a vnc server on the Beagle.  Install it with:&lt;br /&gt;
 beagle$ '''opkg update'''&lt;br /&gt;
 beagle$ '''opkg install x11vnc'''&lt;br /&gt;
Install a password with&lt;br /&gt;
 beagle$ '''x11vnc -storepasswd'''&lt;br /&gt;
Run it on the Beagle with&lt;br /&gt;
 beagle$ '''x11vnc -display :0 -ssl -usepw -forever -q &amp;amp;'''&lt;br /&gt;
On your host, connect to it with:&lt;br /&gt;
 host$ '''vinagre'''&lt;br /&gt;
or '''Applications:Internet:Remote Desktop Viewer'''&lt;br /&gt;
&lt;br /&gt;
==== Authorizing ssh ====&lt;br /&gt;
&lt;br /&gt;
'''ssh''' and '''scp''' can be set up for automatic authorization so you don't have to enter your password when using these commands. Here's how to do it.&lt;br /&gt;
First let's see what's already there:&lt;br /&gt;
&lt;br /&gt;
* On your Beagle run&lt;br /&gt;
&lt;br /&gt;
 beagle$ '''ls ~/.ssh'''&lt;br /&gt;
&lt;br /&gt;
'''~/.ssh''' may not exist, if not, it will be created.  If it's there, check the files in it.&lt;br /&gt;
&lt;br /&gt;
* On your host computer run&lt;br /&gt;
&lt;br /&gt;
 host$ '''ssh-copy-id root@beagle'''&lt;br /&gt;
&lt;br /&gt;
It was ask for you beagle password and then copy the needed files to it.&lt;br /&gt;
&lt;br /&gt;
* Back on the beagle to see what has changed:&lt;br /&gt;
&lt;br /&gt;
 host$ '''ssh -CX root@beagle'''&lt;br /&gt;
 beagle$ '''ls ~/.ssh'''&lt;br /&gt;
&lt;br /&gt;
The ssh command shouldn't ask for a password.  What new files appeared?&lt;br /&gt;
&lt;br /&gt;
==== ssh configuration ====&lt;br /&gt;
&lt;br /&gt;
Here's a nice tip so you don't have to remember who to login as on the beagle. On your host, put the following in '''~/.ssh/config'''.&lt;br /&gt;
&lt;br /&gt;
 Host beagle&lt;br /&gt;
    User root&lt;br /&gt;
    UserKnownHostsFile /dev/null&lt;br /&gt;
    StrictHostKeyChecking no&lt;br /&gt;
&lt;br /&gt;
Before you had to&lt;br /&gt;
 host$ ssh -CX root@beagle&lt;br /&gt;
&lt;br /&gt;
Now you can just&lt;br /&gt;
 host$ ssh -CX beagle&lt;br /&gt;
&lt;br /&gt;
=== Mounting dfs/afs ===&lt;br /&gt;
&lt;br /&gt;
You can set up your Linux box to directly mount your afs and dfs files.  The [http://lug.rose-hulman.edu/wiki/Main_Page Rose-Hulman Linux Users' Group] has a nice [http://lug.rose-hulman.edu/wiki/HOWTO_Use_sshfs_to_mount_AFS/DFS_home page] with the details .&lt;br /&gt;
&lt;br /&gt;
After installing &amp;lt;code&amp;gt;sshfs&amp;lt;/code&amp;gt; I added the following to my &amp;lt;code&amp;gt;/etc/fstab&amp;lt;/code&amp;gt; file:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sshfs#username@dfs.Rose-hulman.edu:/DFS/MyDocs/username /home/username/MyDocs fuse user,noauto,uid=1000,gid=1000 0 0&lt;br /&gt;
sshfs#username@dfs.rose-hulman.edu:/DFS/Users/Y/username /home/username/dfs-home fuse user,noauto,uid=1000,gid=1000 0 0&lt;br /&gt;
sshfs#username@afs.rose-hulman.edu: /home/username/afs-home fuse user,noauto,uid=1000,gid=1000 0 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You'll have to replace &amp;lt;code&amp;gt;username&amp;lt;/code&amp;gt; with your login name.  Then create the mount points:&lt;br /&gt;
&lt;br /&gt;
 host$ '''cd ~'''&lt;br /&gt;
 host$ '''mkdir MyDocs'''&lt;br /&gt;
 host$ '''mkdir dfs-home'''&lt;br /&gt;
 host$ '''mkdir afs-home'''&lt;br /&gt;
&lt;br /&gt;
Now you can mount your files by using:&lt;br /&gt;
&lt;br /&gt;
 host$ '''cd ~'''&lt;br /&gt;
 host$ '''mount dfs-home'''&lt;br /&gt;
 host$ '''cd dfs-home'''&lt;br /&gt;
 host$ '''ls'''&lt;br /&gt;
&lt;br /&gt;
You should now see your dfs files.  You can unmount using:&lt;br /&gt;
&lt;br /&gt;
 host$ '''cd ~'''&lt;br /&gt;
 host$ '''sudo umount dfs-home'''&lt;br /&gt;
&lt;br /&gt;
=== debugfs ===&lt;br /&gt;
&lt;br /&gt;
'''debugfs''' looks like a handy way to look into the kernel.  These notes are based on the example [https://groups.google.com/forum/#!msg/beagleboard/bGZcCHwHwrI/CXHJ0WOBpV0J here].&lt;br /&gt;
&lt;br /&gt;
 beagle$ '''cd /'''&lt;br /&gt;
 beagle$ '''mkdir debugfs'''&lt;br /&gt;
 beagle$ '''mount -t debugfs none debugfs'''&lt;br /&gt;
&lt;br /&gt;
Then explore...&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd debugfs; ls -F'''&lt;br /&gt;
 asoc/   gpio       mmc0/      pm_debug/   sched_features  vram&lt;br /&gt;
 bdi/    hid/       musb/      regdump     testmode        wakeup_sources&lt;br /&gt;
 clock/  memblock/  omap_mux/  regulator/  usb/&lt;br /&gt;
&lt;br /&gt;
 beagle$ ''' cd debugfs; ls -F'''&lt;br /&gt;
 asoc/  clock/  hid/   omapdss/   sched_features  usb/&lt;br /&gt;
 bdi/   gpio    mmc0/  pm_debug/  tracing/        vram&lt;br /&gt;
&lt;br /&gt;
=== Tool chain work flows ===&lt;br /&gt;
&lt;br /&gt;
[http://www.angstrom-distribution.org/some-usefull-workflow-blogs Here] is a link to a list of workflows for various tool chains.&lt;br /&gt;
&lt;br /&gt;
=== Installing more applications ===&lt;br /&gt;
==== On the Beagle ====&lt;br /&gt;
&lt;br /&gt;
On the Beagle under Angstrom you use '''opkg''' to manage packages. Start with&lt;br /&gt;
&lt;br /&gt;
 beagle$ '''opkg update'''&lt;br /&gt;
&lt;br /&gt;
This updated the local database with the current version information.  Then&lt;br /&gt;
&lt;br /&gt;
 beagle$ '''opkg list &amp;gt; /tmp/list'''&lt;br /&gt;
 beagle$ '''less /tmp/list'''&lt;br /&gt;
&lt;br /&gt;
will list all the available packages.  You can also search here [1] to see what packages are available.&lt;br /&gt;
&lt;br /&gt;
[1] [http://www.angstrom-distribution.org/repo/ www.angstrom-distribution.org/repo/]&lt;br /&gt;
&lt;br /&gt;
==== On the host ====&lt;br /&gt;
There are tree command that I use for managing packages.&lt;br /&gt;
&lt;br /&gt;
; dpkg&lt;br /&gt;
: is used for listing what packages are installed.&lt;br /&gt;
; synaptic&lt;br /&gt;
: is a GUI-based package manager.  I used it to discover new packages to install.&lt;br /&gt;
; apt-get&lt;br /&gt;
: is used to install and update packages.&lt;br /&gt;
&lt;br /&gt;
For example, let's suppose you run '''make menuconfig''' and the error message says&lt;br /&gt;
  *** Install ncurses (ncurses-devel) and try again.&lt;br /&gt;
&lt;br /&gt;
Let's see what's installed.&lt;br /&gt;
 host$ '''dpkg -l &amp;gt; /tmp/list'''&lt;br /&gt;
 host$ '''grep curses /tmp/list'''&lt;br /&gt;
 ii  libncurses5      5.7+20090803-2ubuntu3  shared  libraries for terminal handling&lt;br /&gt;
 ii  libncursesw5     5.7+20090803-2ubuntu3  shared libraries for terminal handling (wide&lt;br /&gt;
 ii  mtr-tiny         0.75-2build1           Full screen ncurses traceroute tool&lt;br /&gt;
 ii  ncurses-base     5.7+20090803-2ubuntu3  basic terminal type definitions&lt;br /&gt;
 ii  ncurses-bin      5.7+20090803-2ubuntu3  terminal-related programs and man pages&lt;br /&gt;
&lt;br /&gt;
Hmmm... there's something related to ncurses installed, but the error says something about ncurses-devel.  Let's fire up synaptic&lt;br /&gt;
 host$ '''synaptic &amp;amp;'''&lt;br /&gt;
Enter '''ncurses-devel''' in the search field.&lt;br /&gt;
[[File:Screenshot-Synaptic Package Manager .png | 500px]]&lt;br /&gt;
&lt;br /&gt;
The green dot in the '''S''' column says the package is installed. '''libncurses5-dev''' isn't installed.  Install it with:&lt;br /&gt;
 host$ '''sudo apt-get install libncurses5-dev'''&lt;br /&gt;
&lt;br /&gt;
And now your make should work.&lt;br /&gt;
&lt;br /&gt;
=== byobu - A Screen Manager ===&lt;br /&gt;
&lt;br /&gt;
For years Unix has had &amp;lt;code&amp;gt;screen&amp;lt;/code&amp;gt; which is a screen manager.  ''byobu'' is wrapper for screen that puts a nice face on it.  You can run byobu on your host computer and on the Beagle.  With byobu you can start a long running program (bitbake for example) in one terminal and detach from the terminal and the program will keeping running in the background.  Using byobu you can later attach to the program (possibly from another terminal) and see how the program is progressing.&lt;br /&gt;
&lt;br /&gt;
Install byobu on your host with:&lt;br /&gt;
&lt;br /&gt;
 host$ '''sudo apt-get update'''&lt;br /&gt;
 host$ '''sudo apt-get install byobu'''&lt;br /&gt;
&lt;br /&gt;
It's a bit harder on the Beagle.&lt;br /&gt;
 beagle$ '''opkg update'''&lt;br /&gt;
 beagle$ '''opkg install screen'''&lt;br /&gt;
Go to [https://launchpad.net/byobu/+download here] and download the latest version to your Beagle.&lt;br /&gt;
 beagle$ '''tar zxvf byobu_*.orig.tar.gz''' &lt;br /&gt;
 beagle$ '''cd byobu*''' and follow the instructions in INSTALL. I had to hack one file.&lt;br /&gt;
 beagle$ '''gedit /usr/local/lib/byobu/.constants'''.  &lt;br /&gt;
&lt;br /&gt;
Change the last two lines to:&lt;br /&gt;
&lt;br /&gt;
 # command -v gsed &amp;gt;/dev/null &amp;amp;&amp;amp; export SED=&amp;quot;gsed&amp;quot; || export SED=&amp;quot;sed&amp;quot;&lt;br /&gt;
 # command -v greadlink &amp;gt;/dev/null &amp;amp;&amp;amp; export READLINK=&amp;quot;greadlink&amp;quot; || export READLINK=&amp;quot;readlink&amp;quot;&lt;br /&gt;
 export SED=&amp;quot;sed&amp;quot;&lt;br /&gt;
 export READLINK=&amp;quot;readlink&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Now you can run it.&lt;br /&gt;
&lt;br /&gt;
 beagle$ '''byobu'''&lt;br /&gt;
&lt;br /&gt;
You'll see a command prompt.  You'll also see some status information on the bottom two lines.  Type Ctrl-A ? for help.  Type Ctrl-A Ctrl-D to detach from the session.  Running byobu again will reattach you to the session.  Try running byobu in two windows at the same time.  You should see the same session in both.&lt;br /&gt;
&lt;br /&gt;
Hmmm....  I had to reinstall and it doesn't seem to be working now.&lt;br /&gt;
&lt;br /&gt;
=== Finding what opkg installed ===&lt;br /&gt;
&lt;br /&gt;
Once you've run opkg, how do you know what's been installed?  Take a look in '''/var/lib/opkg/info''' or '''/usr/lib/opkg/info'''.  The files that end in .list contain a list of what's been installed.&lt;br /&gt;
&lt;br /&gt;
=== Backing up an SD card with dd ===&lt;br /&gt;
&lt;br /&gt;
Here's the command I use to backup an SD card. I use '''System:Administration:Disk Utility''' to figure out the path to the card.  In this case it's ''/dev/sdc''&lt;br /&gt;
&lt;br /&gt;
 host$ '''sudo time dd if=''/dev/sdc'' of=FIE2011.img bs=4M count=1000'''&lt;br /&gt;
 host$ '''sudo chown yoder:yoder FIE2011.img'''&lt;br /&gt;
 host$ '''md5sum FIE2011.img &amp;gt; FIE2011.img.md5'''&lt;br /&gt;
 host$ '''bzip2 -k FIE2011.img'''&lt;br /&gt;
&lt;br /&gt;
It takes about 5 minutes to dd a 4G card, 1.2 minutes for md5 and bzip2 takes about 23 minutes.&lt;br /&gt;
&lt;br /&gt;
It looks like the 7z compression is becoming popular. Use it via&lt;br /&gt;
 host$ ''' 7za a FIE2011.img.7z IFE2011.img&lt;br /&gt;
&lt;br /&gt;
It took 16 minutes. The file size is 454M compared to 628M.  Wow, faster and smaller.&lt;br /&gt;
&lt;br /&gt;
=== CSSE's Linux reference page ===&lt;br /&gt;
&lt;br /&gt;
CSSE332, Operating Systems, has a nice page of Linux resources [http://www.rose-hulman.edu/class/csse/csse332/current/Resources/ here].&lt;br /&gt;
&lt;br /&gt;
=== Local Ubuntu Update Mirror ===&lt;br /&gt;
&lt;br /&gt;
Darryl Mouck in CSSE has passed this on...&lt;br /&gt;
&lt;br /&gt;
We host a local mirror for all ubuntu updates. This is from the current distro back to hardy; it hosts every distro that ubuntu currently supports.&lt;br /&gt;
&lt;br /&gt;
In order to get your system to point to our mirror, please copy and paste this rather lengthy command into a terminal:&lt;br /&gt;
&lt;br /&gt;
 host$ '''sudo cp /etc/apt/sources.list{,.old} &amp;amp;&amp;amp; \&lt;br /&gt;
     sudo sh -c '\&lt;br /&gt;
 '''. /etc/lsb-release &amp;amp;&amp;amp;'''&lt;br /&gt;
 '''echo &amp;quot;'''&lt;br /&gt;
 '''deb http://ftp.csse.rose-hulman.edu/ubuntu $DISTRIB_CODENAME main restricted universe multiverse'''&lt;br /&gt;
 '''deb http://ftp.csse.rose-hulman.edu/ubuntu $DISTRIB_CODENAME-updates main restricted universe multiverse'''&lt;br /&gt;
 '''deb http://ftp.csse.rose-hulman.edu/ubuntu $DISTRIB_CODENAME-security main restricted universe multiverse'''&lt;br /&gt;
 '''&amp;quot; &amp;gt; /etc/apt/sources.list' &amp;amp;&amp;amp; sudo apt-get update'''&lt;br /&gt;
&lt;br /&gt;
The text and further instructions are available [http://csse.rose-hulman.edu/news-mainmenu-2/27-linux-distros/102-ubuntu here].&lt;br /&gt;
&lt;br /&gt;
The script makes a backup of the updates file and replaces it with links to our mirror. The $DISTRIB_CODENAME is replaced by whatever distro you are running (eg. lucid, maverick, natty etc.). I wish I could take credit for it, but it was a joint effort with Mike McLeish :-)&lt;br /&gt;
&lt;br /&gt;
=== Using pico DLP with BBB ===&lt;br /&gt;
&lt;br /&gt;
Put this in uEnv.txt to use the BBB with a pico DLP.&lt;br /&gt;
 optargs=video=HDMI-A-1:640x480@60&lt;br /&gt;
&lt;br /&gt;
=== More tips ===&lt;br /&gt;
&lt;br /&gt;
[http://www.gigamegablog.com/2012/01/29/beaglebone-linux-101-configuring-angstrom-linux/ GigaMegaBlog] has some nice tips for the BeagleBone, many of which apply to the -xM.&lt;br /&gt;
&lt;br /&gt;
== Windows ==&lt;br /&gt;
&lt;br /&gt;
Most of the work is done under Linux; however there are some handy Windows-based tools.&lt;br /&gt;
&lt;br /&gt;
=== Serial Port ===&lt;br /&gt;
&lt;br /&gt;
[http://www.vandyke.com/products/securecrt/ SecureCRT] is a good program that gives you both access to a serial port and is also an ssh client. Rose has a license for [http://www.rose-hulman.edu/tsc/software/documentation/applications/securecrt-secureFX/installation/ SecureCRT].&lt;br /&gt;
&lt;br /&gt;
[http://www.tucows.com/preview/195282 Tera Term] also gives you access to the serial port and it's free.&lt;br /&gt;
&lt;br /&gt;
=== Notepad++ ===&lt;br /&gt;
&lt;br /&gt;
[http://notepad-plus-plus.org/ Notepad++] is a nice text editor for Windows.&lt;br /&gt;
&lt;br /&gt;
== Set up on the BeagleBoard ==&lt;br /&gt;
&lt;br /&gt;
=== Setup stuff on github ===&lt;br /&gt;
If you've cloned the course github site ([EBC Exercise 05 Getting Exercise Support Materials]]) you will find set up things in '''exercises/setup'''. '''install.sh''' is a list of various things I to to a fresh SD card to 'move in'. For example, the bone will mount a filesystem on the host computer if it's connected via USB.  You can turn this off and have the eithernet over USB run at boot time with:&lt;br /&gt;
&lt;br /&gt;
 # Turn off storage gadget, turn on network at boot time.&lt;br /&gt;
 cd /lib/systemd/system/basic.target.wants&lt;br /&gt;
 rm storage-gadget-init.service&lt;br /&gt;
 ln -s ../network-gadget-init.service .&lt;br /&gt;
&lt;br /&gt;
=== Accessing the Beagle via the Serial Port ===&lt;br /&gt;
&lt;br /&gt;
During boot up the Beagle logs various messages on the serial port.  You can see these messages by:&lt;br /&gt;
&lt;br /&gt;
* See what USB/tty devices are already attached to your host&lt;br /&gt;
 host$ '''ls /dev/ttyU*'''&lt;br /&gt;
* Attach a serial to USB converter to your host computer and the Beagle's serial port.&lt;br /&gt;
* See what new USB/tty devices appeared&lt;br /&gt;
 host$ '''ls /dev/ttyU*'''&lt;br /&gt;
* On my host, '''/dev/ttyUSB1''' appeared. On the host computer run&lt;br /&gt;
&lt;br /&gt;
 host$ '''byobu /dev/ttyUSB''1'' 115200'''&lt;br /&gt;
where '''ttyUSB1''' is what appeared when you plugged in your converter.&lt;br /&gt;
&lt;br /&gt;
You are now talking to your Beagle's serial port. Login quickly.  There appears to be a bug that makes garbage appear on your screen if you wait too long. Try&lt;br /&gt;
 beagle$ '''shutdown -r now'''&lt;br /&gt;
&lt;br /&gt;
You will see the shutdown messages, followed by the U-boot messages.  After a 3 second (or so) delay you will see the kernel booting.&lt;br /&gt;
&lt;br /&gt;
'''Tip 1''': Ctrl-a H will cause the data on the serial port to be logged.  See&lt;br /&gt;
 host$ '''man byobu'''&lt;br /&gt;
for help.&lt;br /&gt;
&lt;br /&gt;
'''Tip 2''': &amp;lt;F6&amp;gt; will disconnect from the session. You can reconnect later.&lt;br /&gt;
&lt;br /&gt;
=== Installing Ubuntu ===&lt;br /&gt;
&lt;br /&gt;
I've installed 2 different versions of Ubuntu on my SD cards. Each of my SD cards is 4GB, and this is just large enough to hold the Ubuntu images.&lt;br /&gt;
&lt;br /&gt;
I followed the instructions from [http://elinux.org/BeagleBoardUbuntu#Maverick_10.10 here] and [http://elinux.org/BeagleBoardUbuntu#Maverick_10.10_2 here].&lt;br /&gt;
&lt;br /&gt;
The first link references a Ubuntu wiki which details how to install a netbook edition of Ubuntu on ARM/OMAP processor-based systems. It is not beagle-specific. This image runs a little slowly, but not much slower than the [http://elinux.org/ECE497_Lab01_Installing_Angstrom_on_Your_Beagle_%28precompiled%29#From_beagleboard-validation.s3.amazonaws.com SPEd image].&lt;br /&gt;
&lt;br /&gt;
The second link references instructions for installing another image. This image is very minimal, and doesn't have a gui. There are instructions for installing a gui, which I did, with good success. As far as I can tell, even with the gui, this is the fastest image so far.&lt;br /&gt;
&lt;br /&gt;
=== Installing Always Innovating's Super Jumbo ===&lt;br /&gt;
&lt;br /&gt;
[http://www.alwaysinnovating.com/home/index.htm Always Innovating] works with branded products and services companies that are looking to deliver great touch devices as part of their offerings. They have published a free SD card image for the BeagleBoard that runs Angstrom, Android, Ubuntu, and ChromiumOS.  [http://www.alwaysinnovating.com/beagleboard/ Here's] a video showing what it can do.&lt;br /&gt;
&lt;br /&gt;
I've put a copy of the compressed image on my DFS site.  Feal free to play with it.  [http://www.alwaysinnovating.com/wiki/index.php/Beagleboard Here's] a wiki that shows how to switch between OS's on the fly.&lt;br /&gt;
&lt;br /&gt;
=== Resizing an SD card partition via the Beagle ===&lt;br /&gt;
&lt;br /&gt;
The following is a slick way to boot the Beagle so it isn't using the SD, then repartition the SD card.  It came from [http://groups.google.com/group/beagleboard/browse_thread/thread/3be77bc54feb08a6/b792e092e3c48989?lnk=gst&amp;amp;q=resize+partition#b792e092e3c48989]&lt;br /&gt;
		&lt;br /&gt;
Jason Kridner says ...&lt;br /&gt;
I got a related question from Mark about how to perform the partition &lt;br /&gt;
resizing, so I figured I'd address that here.  I don't believe you'd &lt;br /&gt;
be able to resize a mounted partition and that this operation would &lt;br /&gt;
require another file system to mount.  Because this image does not &lt;br /&gt;
have the ramdisk, I downloaded the one used being shipped with the xM &lt;br /&gt;
boards today [http://www.google.com/url?sa=D&amp;amp;q=http://beagleboard-validation.s3.amazonaws.com/deploy/201008201549/sd/ramdisk.gz]. &lt;br /&gt;
&lt;br /&gt;
 beagle$ '''wget http://www.google.com/url?sa=D&amp;amp;q=http://beagleboard-validation.s3.amazonaws.com/deploy/201008201549/sd/ramdisk.gz'''&lt;br /&gt;
 Connecting to beagleboard-validation.s3.amazonaws.com (72.21.214.39:80) &lt;br /&gt;
 ramdisk.gz           100% |*******************************| 19492k 00:00:00 ETA &lt;br /&gt;
 beagle$ '''cp ramdisk.gz /media/mmcblk0p1/''' &lt;br /&gt;
 beagle$ '''shutdown -r now''' &lt;br /&gt;
&lt;br /&gt;
I halted the board during reboot and did: &lt;br /&gt;
 &lt;br /&gt;
 OMAP3 beagleboard.org # '''mmc rescan 0''' &lt;br /&gt;
 OMAP3 beagleboard.org # '''run loaduimage''' &lt;br /&gt;
 Loading file &amp;quot;/boot/uImage&amp;quot; from mmc device 0:2 (xxa2) &lt;br /&gt;
 3194256 bytes read &lt;br /&gt;
 OMAP3 beagleboard.org # '''run loadramdisk''' &lt;br /&gt;
 reading ramdisk.gz &lt;br /&gt;
 19960110 bytes read &lt;br /&gt;
 OMAP3 beagleboard.org # '''run ramboot''' &lt;br /&gt;
&lt;br /&gt;
I allowed it to boot and did: &lt;br /&gt;
&lt;br /&gt;
 beagle$ '''umount /dev/mmcblk0p1'''&lt;br /&gt;
 beagle$ '''umount /dev/mmcblk0p2'''&lt;br /&gt;
 beagle$ '''fdisk /dev/mmcblk0'''&lt;br /&gt;
 Command (m for help): '''p''' &lt;br /&gt;
 Disk /dev/mmcblk0: 3965 MB, 3965190144 bytes &lt;br /&gt;
 255 heads, 63 sectors/track, 482 cylinders &lt;br /&gt;
 Units = cylinders of 16065 * 512 = 8225280 bytes &lt;br /&gt;
 Sector size (logical/physical): 512 bytes / 512 bytes &lt;br /&gt;
 Disk identifier: 0x00000000 &lt;br /&gt;
         Device Boot      Start         End      Blocks   Id  System &lt;br /&gt;
 /dev/mmcblk0p1   *           1          15      120456    c  W95 FAT32 (LBA) &lt;br /&gt;
 /dev/mmcblk0p2              16         444     3445942+  83  Linux &lt;br /&gt;
 Command (m for help): '''d''' &lt;br /&gt;
 Partition number (1-4): '''2''' &lt;br /&gt;
 Command (m for help): '''n''' &lt;br /&gt;
 Command action &lt;br /&gt;
    e   extended &lt;br /&gt;
    p   primary partition (1-4) &lt;br /&gt;
 '''p''' &lt;br /&gt;
 Partition number (1-4): '''2''' &lt;br /&gt;
 First cylinder (16-482, default 16):&lt;br /&gt;
 &lt;br /&gt;
 Using default value 16 &lt;br /&gt;
 Last cylinder, +cylinders or +size{K,M,G} (16-482, default 482):&lt;br /&gt;
 &lt;br /&gt;
 Using default value 482 &lt;br /&gt;
 Command (m for help): '''w''' &lt;br /&gt;
 The partition table has been altered! &lt;br /&gt;
 Calling ioctl() to re-read partition table. &lt;br /&gt;
 Syncing disks. &lt;br /&gt;
 beagle$ '''umount /dev/mmcblk0p2''' &lt;br /&gt;
 beagle$ '''resize2fs /dev/mmcblk0p2''' &lt;br /&gt;
 resize2fs 1.41.9 (22-Aug-2009) &lt;br /&gt;
 Resizing the filesystem on /dev/mmcblk0p2 to 937794 (4k) blocks. &lt;br /&gt;
 The filesystem on /dev/mmcblk0p2 is now 937794 blocks long. &lt;br /&gt;
 beagle$ '''shutdown -r now''' &lt;br /&gt;
&lt;br /&gt;
I then waited for the reboot.  That was all there was to it. &lt;br /&gt;
Going the other way would require performing the resize operation &lt;br /&gt;
first and specifying the size. &lt;br /&gt;
&lt;br /&gt;
Anyone care to automate this and submit this to Angstrom?&lt;br /&gt;
&lt;br /&gt;
=== Sharing Laptop Internet Connection with BeagleBoard ===&lt;br /&gt;
Two options: One uses Ubuntu's GUI network connections manager, the other requires modifying things yourself.&lt;br /&gt;
&lt;br /&gt;
==== Option 1 - Using Ubuntu Network Connections GUI ====&lt;br /&gt;
&lt;br /&gt;
# In Ubuntu, go to System -&amp;gt; Preferences -&amp;gt; Network Connections&lt;br /&gt;
# On the 'Wired' tab, select 'Auto eth0' and click 'Edit' (Note: name may be other than 'eth0'.  If nothing exists in this list, then make sure there is '''not''' an entry starting with 'auto eth0' in your /etc/network/interfaces file; such an entry prevents Network Manager from managing that interface.)&lt;br /&gt;
# Click the 'IPv4 Settings' tab and change 'Method' to 'Shared to other computers'&lt;br /&gt;
# Click apply&lt;br /&gt;
# Restart Ubuntu&lt;br /&gt;
# Connect the BeagleBoard to the laptop with the crossover Ethernet cable&lt;br /&gt;
# Boot the BeagleBoard - if Ubuntu was already running and the Ethernet cable was already plugged in, the BeagleBoard should automatically get assigned an IP address and you should be able to access the Internet on the BeagleBoard via the laptop's wireless connection&lt;br /&gt;
&lt;br /&gt;
==== Option 2 - Modifying Things Yourself (DHCP Server) ====&lt;br /&gt;
&lt;br /&gt;
This will setup a DHCP server on the host machine that will listen to the Ethernet port and assign an IP address to the BeagleBoard when it is connected with an Ethernet crossover cable.  The host machine will then act as a router using NAT to send packets out the wifi interface.&amp;lt;br /&amp;gt;&lt;br /&gt;
A number of steps were taken from the [https://help.ubuntu.com/community/Internet/ConnectionSharing Ubuntu Community Documentation].&amp;lt;br /&amp;gt;&lt;br /&gt;
Notes:&lt;br /&gt;
* 'eth0' will refer to the internal interface (connected to the BeagleBoard) and 'wlan0' will refer to the external interface (connected to the Internet).  Your interface names may differ.&lt;br /&gt;
* A number of configuration files are changed.  It's a good idea to save a backup copy of these before modifying them.&lt;br /&gt;
&lt;br /&gt;
On the host machine, configure eth0 for a static IP:&lt;br /&gt;
&lt;br /&gt;
 host$ '''sudo ifconfig eth0 192.168.1.13'''&lt;br /&gt;
&lt;br /&gt;
If you don't want to configure this after every boot, add an entry to /etc/network/interfaces with the following:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
auto eth0&lt;br /&gt;
    address 192.168.1.13&lt;br /&gt;
    netmask 255.255.255.0&lt;br /&gt;
    network 192.168.1.0&lt;br /&gt;
    broadcast 192.168.1.255 &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the host machine, configure the IP tables to use NAT translation for routing packets:&lt;br /&gt;
&lt;br /&gt;
 host$ '''sudo iptables -A FORWARD -o wlan0 -i eth0 -s 192.168.1.0/24 -m conntrack --ctstate NEW -j ACCEPT'''&lt;br /&gt;
 host$ '''sudo iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT'''&lt;br /&gt;
 host$ '''sudo iptables -A POSTROUTING -t nat -j MASQUERADE'''&lt;br /&gt;
&lt;br /&gt;
To avoid having to setup the IP tables after every boot, save the IP tables&lt;br /&gt;
&lt;br /&gt;
 host$ '''sudo iptables-save | sudo tee /etc/iptables.sav'''&lt;br /&gt;
&lt;br /&gt;
And add the following command to /etc/rc.local (or other appropriate file for your distribution) to be run at boot&lt;br /&gt;
&amp;lt;pre&amp;gt;iptables-restore &amp;lt; /etc/iptables.sav&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
IP forwarding needs to be enabled:&lt;br /&gt;
&lt;br /&gt;
 host$ '''sudo sh -c &amp;quot;echo 1 &amp;gt; /proc/sys/net/ipv4/ip_forward&amp;quot;'''&lt;br /&gt;
&lt;br /&gt;
To make sure this is set after rebooting, add these lines to /etc/sysctl.conf:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
net.ipv4.conf.default.forwarding=1&lt;br /&gt;
net.ipv4.conf.all.forwarding=1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the DHCP server software&lt;br /&gt;
&lt;br /&gt;
 host$ '''sudo apt-get install dhcp3-server'''&lt;br /&gt;
&lt;br /&gt;
And edit the configuration file /etc/dhcp3/dhcpd.conf (comment out any already existing lines other than &amp;quot;ddns-update-style none;&amp;quot;)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#Added for DHCP with BeagleBoard&lt;br /&gt;
default-lease-time 600;&lt;br /&gt;
max-lease-time 7200;&lt;br /&gt;
option subnet-mask 255.255.255.0;&lt;br /&gt;
option broadcast-address 192.168.1.255;&lt;br /&gt;
option routers 192.168.1.13;     #&amp;lt;--This must match the IP address you statically set for eth0&lt;br /&gt;
option domain-name-servers 137.112.4.196,137.112.5.28,137.112.12.11;    #&amp;lt;--Rose-Hulman's DNS servers (according to my laptop, at least)&lt;br /&gt;
option domain-name &amp;quot;rose-hulman.edu&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
subnet 192.168.1.0 netmask 255.255.255.0 {&lt;br /&gt;
range 192.168.1.14 192.168.1.14;  #&amp;lt;--You can specify a larger range; I used this to force my BeagleBoard to always have the same IP so I could add an entry for that IP in /etc/hosts&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You may need to edit /etc/default/dhcp3-server to specify the interface for the DHCP server&lt;br /&gt;
&amp;lt;pre&amp;gt;INTERFACES=&amp;quot;eth0&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
Then restart the DHCP server service&lt;br /&gt;
&lt;br /&gt;
 host$ '''sudo service dhcp3-server restart'''&lt;br /&gt;
&lt;br /&gt;
You may need to reboot your host machine, and it may be necessary to run the command above to restart the DHCP server every time you boot (I'm not sure if it starts appropriately at boot).&lt;br /&gt;
&lt;br /&gt;
Now connect the BeagleBoard to the host machine with a crossover Ethernet cable and boot the Beagle.  After booting, run 'ifconfig' to see if the Beagle was assigned an IP address.  If it does not have an IP address, try running the command 'dhclient usb0'.&lt;br /&gt;
&lt;br /&gt;
Once the Beagle does have an IP address, try&lt;br /&gt;
&lt;br /&gt;
 beagle$ '''ping -c 3 -W 10 www.google.com'''&lt;br /&gt;
&lt;br /&gt;
to test if the setup is working correctly.  If it complains about a bad name, the DNS servers are incorrect; try pinging a specific IP such as 8.8.8.8 to see if packets get through (though unless you want to rely on all IP addresses, you will need to get some DNS servers that work).&lt;br /&gt;
&lt;br /&gt;
==== Option 3 - Manual Routing, Static Beagle IP ====&lt;br /&gt;
&lt;br /&gt;
This will setup the routing on Ubuntu (sending all eth0 traffic out wlan0).  It will then set a static IP address on the BeagleBoard (so you can stick an entry for your BeagleBoard in /etc/hosts for convenience).  The key difference from Option 2 is that the DHCP server in that option supplied the BeagleBoard with DNS servers.  In this option, we add a script that gives the BeagleBoard some static DNS server addresses every time it boots.&lt;br /&gt;
&lt;br /&gt;
First, follow through the steps in Option 2 right up until it starts talking about installing the DHCP server.  Instead of installing the DHCP server, do the following.&lt;br /&gt;
&lt;br /&gt;
On your BeagleBoard, add the following entry to &amp;lt;code&amp;gt;/etc/network/interfaces&amp;lt;/code&amp;gt; (comment out any pre-existing entries regarding 'usb0')&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
auto usb0&lt;br /&gt;
iface usb0 inet static&lt;br /&gt;
      address 192.168.1.14         # This is the static IP address of your choice&lt;br /&gt;
      netmask 255.255.255.0&lt;br /&gt;
      network 192.168.1.0&lt;br /&gt;
      gateway 192.168.1.13         # This must match the static IP address you assigned to eth0 on your host machine&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
After booting, the BeagleBoard is now configured with a static IP address and knows the gateway for all its traffic is the address of your host machine.  The last thing to do is to make sure your BeagleBoard knows what DNS servers to use.  This information is stored in the &amp;lt;code&amp;gt;/etc/resolv.conf&amp;lt;/code&amp;gt; file.  You could add it manually every time after boot, but we'll make a script to do it at boot instead.&lt;br /&gt;
&lt;br /&gt;
On your BeagleBoard, navigate to the /etc/rc5.d/ directory.  In this directory, create a file named &amp;lt;code&amp;gt;S99&amp;lt;name&amp;gt;&amp;lt;/code&amp;gt; where &amp;lt;code&amp;gt;&amp;lt;name&amp;gt;&amp;lt;/code&amp;gt; can be anything you prefer.  My file was named &amp;lt;code&amp;gt;S99SetRoseHulmanNameServers&amp;lt;/code&amp;gt;.  Add the following inside that file:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#! /bin/sh&lt;br /&gt;
echo &amp;quot;nameserver 137.112.4.196&amp;quot; &amp;gt;&amp;gt; /etc/resolv.conf      # These three IP addresses are the Rose-Hulman DNS servers&lt;br /&gt;
echo &amp;quot;nameserver 137.112.5.28&amp;quot; &amp;gt;&amp;gt; /etc/resolv.conf       # Replace them with whatever DNS servers you are using&lt;br /&gt;
echo &amp;quot;nameserver 137.112.12.11&amp;quot; &amp;gt;&amp;gt; /etc/resolv.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
That should be it.  Assuming all cables are connected properly and you have a WiFi connection on the host machine, after booting the BeagleBoard should have a usable Internet connection.&lt;br /&gt;
&lt;br /&gt;
=== Using u-boot to specify a MAC address at boot ===&lt;br /&gt;
The BeagleBoard has a problem where Linux will randomly select a MAC address at boot. In order to get around this, [http://blog.galemin.com/tag/random-mac-address/ one blogger] provides a patch to enable a kernel command line parameter to set a MAC address. Below is one way to apply, your mileage may vary.&lt;br /&gt;
&lt;br /&gt;
# Make sure your kernel compiles and boots.&lt;br /&gt;
# Grab the patch, and open it with gedit&lt;br /&gt;
# Open .../git/drivers/net/usb/smsc95xx.c&lt;br /&gt;
# Go to line 64-ish, and look for a place to insert the first code with plus signs preceding each line. Remove the plus signs.&lt;br /&gt;
# Go to 656-ish, and repeat for the other block of code.&lt;br /&gt;
# Save and re-compile.&lt;br /&gt;
# Install the new kernel as normal.&lt;br /&gt;
# Edit the kernel command line. There are two ways to do this:&lt;br /&gt;
## Edit the uBoot source and recompile &lt;br /&gt;
### Go to u-boot, and edit ../include/configs/omap3_beagle.h&lt;br /&gt;
### Change mmcargs, nandargs, and ramargs to include a parameter for &amp;quot;ethaddr=...&amp;quot;, where ... is your MAC address.&lt;br /&gt;
### Save, close, recompile.&lt;br /&gt;
### Install the new u-boot as normal.&lt;br /&gt;
## Edit the boot.scr file&lt;br /&gt;
### See [[ECE497 Modifying Kernel Command Line Parameters| Modifying Kernel Command Line Parameters]]&lt;br /&gt;
# Register your MAC Address via any method that works, and enjoy reduced-hassle internet access on your Beagle.&lt;br /&gt;
# Optionally, Update opkg.&lt;br /&gt;
&lt;br /&gt;
=== Rename an External Storage Device ===&lt;br /&gt;
&lt;br /&gt;
I ran out of space on my Linux (Ubuntu) partition, so I opted to do all my development on an external hard drive. This works just fine, except that the drive is labeled &amp;quot;Expansion Drive&amp;quot; and the space in there causes problems in some of the setup scripts. It is possible to add an entry in /etc/fstab that mounts the device with a certain name, but this is very cumbersome, for many reasons. Instead, I used this [1] very helpful guide to change the label on my external drive.&lt;br /&gt;
&lt;br /&gt;
[1] [http://help.ubuntu.com/community/RenameUSBDrive help.ubuntu.com/community/RenameUSBDrive]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Setup a USB Wireless Device on Beagle ===&lt;br /&gt;
&lt;br /&gt;
([http://embeddedgeeks.wordpress.com/2012/01/03/belkin-micro-wifi-usb-dongle-on-the-beagleboard/ Here] are instructions on setting up a Belkin USB dongle.)&lt;br /&gt;
&lt;br /&gt;
The device I used to setup a wireless connection on the Beagle Board was the Linksys Compact Wireless-G USB Network Adapter with SpeedBooster.&lt;br /&gt;
&lt;br /&gt;
I first opened the wpa_supplicant.conf file to setup my networks:&lt;br /&gt;
&lt;br /&gt;
 beagle$ '''cd /etc'''&lt;br /&gt;
 beagle$ '''gedit wpa_supplicant.conf &amp;amp;'''&lt;br /&gt;
&lt;br /&gt;
This file is filled with numerous examples of possible wireless configurations for you to basically fill in. After looking at the examples, I scrolled down to the bottom of the page and set up two networks: one for home and one for school. Here are examples of my setup networks:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#Home Network&lt;br /&gt;
network={&lt;br /&gt;
        ssid=&amp;quot;YourHomeNetworkName&amp;quot;&lt;br /&gt;
        psk=&amp;quot;YourHomeNetworkPassword&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#School Network&lt;br /&gt;
network={&lt;br /&gt;
        ssid=&amp;quot;RHIT-1X&amp;quot;&lt;br /&gt;
        proto=WPA&lt;br /&gt;
        key_mgmt=WPA-EAP&lt;br /&gt;
        pairwise=CCMP&lt;br /&gt;
        group=TKIP&lt;br /&gt;
        eap=PEAP&lt;br /&gt;
        phase1=&amp;quot;peapver=0 peaplabel=0&amp;quot;&lt;br /&gt;
        phase2=&amp;quot;auth=MSCHAPV2&amp;quot;&lt;br /&gt;
        scan_ssid=1&lt;br /&gt;
        identity=&amp;quot;YourSchoolUsername&amp;quot;&lt;br /&gt;
        password=&amp;quot;YourSchoolPassword&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For the network examples above,the quotation marks actually belong there but replace the Your.... areas with your corresponding information. No &amp;lt;space&amp;gt; before the first quotation mark.When finished editing save and exit this file.&lt;br /&gt;
The information for the RHIT school network was found here:[http://lug.rose-hulman.edu/wiki/RHIT-1X RHLUG] &lt;br /&gt;
&lt;br /&gt;
Now you must specify that this is the file to use for the wireless device:&lt;br /&gt;
&lt;br /&gt;
 beagle$ '''cd network'''&lt;br /&gt;
 beagle$ '''gedit interfaces &amp;amp;'''&lt;br /&gt;
&lt;br /&gt;
This file will display all of the different types of Internet connections you have setup.&lt;br /&gt;
To use the wpa_supplicant.conf file, scroll down to around line 42 of the code and uncomment the configuration for wpasupplicant. After doing this make sure all of the above lines mentioning anything about wlan0 are commented out. Return back to where it says &amp;quot;iface wlan0 inet dhcp&amp;quot; that you uncommented around line 42.&lt;br /&gt;
Add &amp;quot;auto wlan0&amp;quot; above this line, make sure the line &amp;quot;wpa-conf /etc/wpa_supplicant.conf&amp;quot; is uncommented below the iface line, and change the wpa-driver line below that line to wext. So after all of that the code in this file for the wireless device should be the following:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
auto wlan0 &lt;br /&gt;
  iface wlan0 inet dhcp&lt;br /&gt;
     wpa-conf /etc/wpa_supplicant.conf&lt;br /&gt;
     wpa-driver wext&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
NOTE: the auto wlan0 command in this file means that this device will load at boot time. You can take the time in here now to comment out any interfaces you don't use like auto usb0 to make these devices not load at boot time, which will increase the speed at which you boot up.&lt;br /&gt;
Save and exit this file&lt;br /&gt;
&lt;br /&gt;
Once you have finished this you can either restart the Beagle Board or:&lt;br /&gt;
&lt;br /&gt;
 beagle$ '''cd'''&lt;br /&gt;
 beagle$ '''/etc/init.d/networking restart'''&lt;br /&gt;
&lt;br /&gt;
I've found that a lot of the time the interface doesn't receive an IP address when it boots up. If you run ifconfig in the terminal you should see your wireless device connected to a network. If it is connected but no IP address I do the following:&lt;br /&gt;
&lt;br /&gt;
 beagle$ '''ifdown wlan0'''&lt;br /&gt;
 # it will report messages here and then&lt;br /&gt;
 beagle$ '''ifup wlan0'''&lt;br /&gt;
 # more messages and it should report connecting and having an IP address&lt;br /&gt;
&lt;br /&gt;
This ifdown ifup method has worked every time for me so far but if anyone can find a way to prevent having to do this almost every time please feel free to edit this&lt;br /&gt;
&lt;br /&gt;
== Development tips for bitbake and oe ==&lt;br /&gt;
&lt;br /&gt;
[http://www.jumpnowtek.com/index.php?option=com_content&amp;amp;view=article&amp;amp;id=70&amp;amp;Itemid=89 Gumstix Development Tips] appears to have some good ideas that can apply to the Beagle too.&lt;br /&gt;
&lt;br /&gt;
=== Point to a given git snapshot ===&lt;br /&gt;
&lt;br /&gt;
The original SD card image came from [http://beagleboard-validation.s3.amazonaws.com/deploy/201008201549/sd/list.html here].  The file [http://beagleboard-validation.s3.amazonaws.com/deploy/201008201549/sd/ec2build.sh ec2buld.sh] shows how the image was build.  There are a couple of interesting things in this file.  &lt;br /&gt;
&lt;br /&gt;
Line 564 shows an additional git repository was used.&lt;br /&gt;
&lt;br /&gt;
 host$ '''cd sources/openembedded'''&lt;br /&gt;
 host$ '''git remote add myrepo git://gitorious.org/~Jadon/angstrom/jadon-openembedded.git'''&lt;br /&gt;
 host$ '''git remote update'''&lt;br /&gt;
&lt;br /&gt;
Run this git command to get access to this repository. (It took about 2 minutes at 6:20am.) Line 21 shows the hash tag for the build.&lt;br /&gt;
&lt;br /&gt;
 ANGSTROM_REPO_ID=24805033b1205acc35f8b4d75cc42f8b9c2a1b38&lt;br /&gt;
&lt;br /&gt;
If we pull from this tag we will have the same files as were used to generate the SD image.  So do the following&lt;br /&gt;
&lt;br /&gt;
 host$ '''git checkout 24805033b1205acc35f8b4d75cc42f8b9c2a1b38'''&lt;br /&gt;
&lt;br /&gt;
This takes about 10 seconds.&lt;br /&gt;
&lt;br /&gt;
== Fixing Problems ==&lt;br /&gt;
&lt;br /&gt;
=== Kernel Boot Problems ===&lt;br /&gt;
&lt;br /&gt;
[http://processors.wiki.ti.com/index.php/Kernel_-_Common_Problems_Booting_Linux Here] is a link with some suggestions of what to do if your kernel isn't booting properly.&lt;br /&gt;
&lt;br /&gt;
=== Serial port garbage ===&lt;br /&gt;
&lt;br /&gt;
If you are having trouble with garbage on the console, this might help. Sometimes the serial port times out.   Most of the time it just generates some junk which can be cleared with CTRL-U or backspace.  However, if it happens at the login prompt then getty thinks the terminal is 7-bit with parity (rather than 8-bit raw).  If this happens and you continue to login the whole session appears to be scrambled - if you press CTRL-D you can login again provided you don't stop typing... :] &lt;br /&gt;
I have simply added the following two lines to root's &amp;lt;code&amp;gt;.profile&amp;lt;/code&amp;gt;: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
stty -parenb -parodd cs8 -inpck -istrip &lt;br /&gt;
echo 0 &amp;gt; /sys/class/tty/ttyS2/device/sleep_timeout&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
A better fix would probably be to just add the second line to a rc.d startup script somewhere.&lt;br /&gt;
&lt;br /&gt;
This suggestion came from this [http://groups.google.com/group/beagleboard/browse_thread/thread/d23c15e3c9fcb8fc posting].&lt;br /&gt;
&lt;br /&gt;
=== Turning off gpe ===&lt;br /&gt;
The following worked last year, but doesn't seem to work now.&lt;br /&gt;
&lt;br /&gt;
Running above will write on top of what Angstrom is doing.  You can turn off the display manager by using:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/etc/init.d/gpe-dm stop&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Replace &amp;lt;code&amp;gt;stop&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;start&amp;lt;/code&amp;gt; if you want to run it again.&lt;br /&gt;
&lt;br /&gt;
== Details of making your own MLO ==&lt;br /&gt;
&lt;br /&gt;
[http://www.embedded-bits.co.uk/2011/beagleboardxmjtaghardwar/ Hardware Environment for a BeagleBoard XM with JTAG]&lt;br /&gt;
&lt;br /&gt;
[http://www.embedded-bits.co.uk/2011/beagleboardxmjtagsoftware/ Software Environment for a BeagleBoard XM with JTAG]&lt;br /&gt;
&lt;br /&gt;
[http://www.embedded-bits.co.uk/2011/writeanmlo/ This] might make a good lab.&lt;br /&gt;
&lt;br /&gt;
== Getting help from a news group == &lt;br /&gt;
&lt;br /&gt;
[http://groups.google.com/group/beagleboard/msg/db315d63de2a522a Here's] a nice tip on what to do before posting a question to a news group.&lt;br /&gt;
&lt;br /&gt;
{{YoderFoot}}&lt;/div&gt;</summary>
		<author><name>Yoder</name></author>	</entry>

	<entry>
		<id>http://www.elinux.org/BeagleBoard_Education_Workshops</id>
		<title>BeagleBoard Education Workshops</title>
		<link rel="alternate" type="text/html" href="http://www.elinux.org/BeagleBoard_Education_Workshops"/>
				<updated>2013-06-18T15:23:13Z</updated>
		
		<summary type="html">&lt;p&gt;Yoder: /* 2013 SPEN Workshop */ Added&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:ECE497 |W]]&lt;br /&gt;
[[Category:BeagleBoard]]&lt;br /&gt;
[[Category:Workshops]]&lt;br /&gt;
[[Category:Education]]&lt;br /&gt;
{{YoderHead}}&lt;br /&gt;
&lt;br /&gt;
== 2013 SPEN Workshop ==&lt;br /&gt;
{|&lt;br /&gt;
| '''Title:''' &lt;br /&gt;
| Moving Beyond the DSP and Teaching 32-bit Embedded Processors Using the BeagleBone&lt;br /&gt;
|-&lt;br /&gt;
| '''Presentor:''' &lt;br /&gt;
| Mark A. Yoder&lt;br /&gt;
|-&lt;br /&gt;
| '''Location:''' &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| '''Date:''' &lt;br /&gt;
| 13-Aug-2013&lt;br /&gt;
|-&lt;br /&gt;
| '''Link'''&lt;br /&gt;
| [http://dspe2013.engr.scu.edu/ 2013 Digital Signal Processing &amp;amp; Signal Processing Education Workshop]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Abstract:===&lt;br /&gt;
Today’s media handling embedded processors have come a long way from the limited performance of 8- or 16-bit embedded processors or the limited functionality of a dedicated DSP chip. This 2.5-hour, hands-on workshop presents ideas on how to use the BeagleBone Black ([http://www.BeagleBoard.org www.BeagleBoard.org]) for teaching embedded media processing using Open Source resources. The BeagleBone is 1) more powerful and has more I/O than a [http://www.raspberrypi.org/ Raspberry Pi], 2) is as easy to use as an [http://www.arduino.cc/ Arduino] and 3) has a thriving [http://beagleboard.org/Community/Forums Open Source Software community]. &lt;br /&gt;
&lt;br /&gt;
The workshop activities will include 1) several demonstrations of what the Beagle can do, 2) discussions of what topics to include in an embedded Linux class and 3) several hands-on exercises to get participants familiar with using the Beagle using [http://beagleboard.org/Support/BoneScript BoneScript] and Linux commands.&lt;br /&gt;
&lt;br /&gt;
Participants will receive a BeagleBone Black.&lt;br /&gt;
&lt;br /&gt;
=== Pre Workshop ===&lt;br /&gt;
&lt;br /&gt;
=== Labs ===&lt;br /&gt;
&lt;br /&gt;
[[ASEE 2013 Workshop | Afternoon labs]]&lt;br /&gt;
&lt;br /&gt;
=== Post Workshop ===&lt;br /&gt;
&lt;br /&gt;
== 2013 ASEE Workshop ==&lt;br /&gt;
{|&lt;br /&gt;
| '''Title:''' &lt;br /&gt;
| U216·WORKSHOP: BeagleBone - A Hands-on Workshop&lt;br /&gt;
|-&lt;br /&gt;
| '''Presentors:''' &lt;br /&gt;
| Dr. Steven F Barrett P.E., Jason Kridner, Mark A. Yoder&lt;br /&gt;
|-&lt;br /&gt;
| '''Location:''' &lt;br /&gt;
| Atlanta, Omni CNN Center Hotel, Omni - Chestnut&lt;br /&gt;
|-&lt;br /&gt;
| '''Date:''' &lt;br /&gt;
| 23-June-2013&lt;br /&gt;
|-&lt;br /&gt;
| '''Link'''&lt;br /&gt;
| [http://www.asee.org/public/conferences/20/registration/view_session?session_id=2420 ASEE site]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Abstract:===&lt;br /&gt;
&lt;br /&gt;
'''Ticketed event: $25.00 advanced registration and $35.00 on site registration'''&lt;br /&gt;
&lt;br /&gt;
BeagleBone is a low cost, open hardware computer first introduced in November 2011 by BeagleBoard.org, a community of developers sponsored by Texas Instruments. BeagleBone hosts a powerful 32-bit, super-scalar ARM Cortex A8 processor operating at 720 MHz. Yet it is small enough to fit in an Altoids mint tin box. The &amp;quot;Bone'' may be used in a wide variety of projects from middle school science fair projects to senior design projects to first prototypes of very complex systems. Novice users may access the power of the Bone through the user-friendly Bonescript environment. Seasoned users may take full advantage of the Bone's power using the underlying Linux-based operating system, a host of feature extension boards (Capes) and a wide variety of open source libraries. This hands on workshop provides an introduction to this powerful computer and has been designed for a wide variety of users including the first time novice through the seasoned embedded system design professional. &lt;br /&gt;
&lt;br /&gt;
Workshop participants will receive a BeagleBone board and also a BeagleBone book courtesy of BeagleBoard.org and Morgan and Claypool Publishers. This workshop is subsidized by Texas Instruments (TI).&lt;br /&gt;
&lt;br /&gt;
=== Pre Workshop ===&lt;br /&gt;
&lt;br /&gt;
=== Labs ===&lt;br /&gt;
&lt;br /&gt;
[[ASEE 2013 Workshop | Afternoon labs]]&lt;br /&gt;
&lt;br /&gt;
=== Post Workshop ===&lt;br /&gt;
&lt;br /&gt;
== 2012 Engibous Summit Workshop ==&lt;br /&gt;
{|&lt;br /&gt;
| '''Title:''' &lt;br /&gt;
| Hands-on workshop on Embedded Linux on BeagleBone&lt;br /&gt;
|-&lt;br /&gt;
| '''Presentor:''' &lt;br /&gt;
| Mark A. Yoder&lt;br /&gt;
|-&lt;br /&gt;
| '''Location:''' &lt;br /&gt;
| Dallas&lt;br /&gt;
|-&lt;br /&gt;
| '''Date:''' &lt;br /&gt;
| 30-July-2012&lt;br /&gt;
|-&lt;br /&gt;
| '''Link'''&lt;br /&gt;
| [http://www.ti.com/corp/docs/landing/universityprogram/prize.htm Engibous Summit]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Abstract:===&lt;br /&gt;
&lt;br /&gt;
???&lt;br /&gt;
&lt;br /&gt;
=== Pre Workshop ===&lt;br /&gt;
&lt;br /&gt;
You will be mailed some information about the workshop and some things for you to do before arriving.&lt;br /&gt;
&lt;br /&gt;
--Mark&lt;br /&gt;
&lt;br /&gt;
=== Labs ===&lt;br /&gt;
&lt;br /&gt;
=== Post Workshop ===&lt;br /&gt;
&lt;br /&gt;
== 2012 Chandigarh Workshop ==&lt;br /&gt;
{|&lt;br /&gt;
| '''Title:''' &lt;br /&gt;
| Hands-on workshop on Embedded Linux on Beagleboard&lt;br /&gt;
|-&lt;br /&gt;
| '''Presentor:''' &lt;br /&gt;
| Mark A. Yoder&lt;br /&gt;
|-&lt;br /&gt;
| '''Location:''' &lt;br /&gt;
| [http://www.uniti.in/events/venueevents/73-chitkara-school-of-engineering-a-technology Chitkara School of Engineering &amp;amp; Technology] - Chandigarh, India&lt;br /&gt;
|-&lt;br /&gt;
| '''Date:''' &lt;br /&gt;
| 18-20 June-2012&lt;br /&gt;
|-&lt;br /&gt;
| '''Link'''&lt;br /&gt;
| [http://www.uniti.in/events/details/128-hands-on-workshop-on-embedded-linux-on-beagleboard http://www.uniti.in/events/details/128-hands-on-workshop-on-embedded-linux-on-beagleboard]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Abstract:===&lt;br /&gt;
&lt;br /&gt;
Beagleboard is a low-cost open-source embedded system development platform. It is based on Texas Instruments DM3730 processor, which includes an on-chip ARM Cortex-A8 processor core, a Texas Instruments C6x DSP core, and a host of peripherals. Beagleboard is a single board computer, which provides adequate performance to run Linux software, yet has a power consumption lower than 2W. A large number of embedded applications have been developed on Beagleboard ([http://www.beagleboard.org www.beagleboard.org]) Module A provides a gentle introduction to the subject of Embedded Linux, Linux Systems Programming and Linux Kernel Programming. The intention of Module B is to provide a hands-on exposure to running Embedded Linux operating system on the Beagleboard and develop system software on the Beagleboard.&lt;br /&gt;
=== Pre Workshop ===&lt;br /&gt;
&lt;br /&gt;
The purpose of this page is to give you practice editing a wiki and to start building a community of BeagleBoard Educators.  Click on the '''edit''' tab above and add your name to the list. You will have to create an eLinux account before you can edit the page.&lt;br /&gt;
&lt;br /&gt;
--Mark&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
! style=&amp;quot;width:20%&amp;quot; | Name&lt;br /&gt;
! style=&amp;quot;width:20%&amp;quot; | School/Company&lt;br /&gt;
! style=&amp;quot;width:30%&amp;quot; | Linux/DSP Background&lt;br /&gt;
! style=&amp;quot;width:30%&amp;quot; | Interests&lt;br /&gt;
|-&lt;br /&gt;
| Mark A. Yoder&lt;br /&gt;
| Rose-Hulman Institute of Technology, &lt;br /&gt;
Terre Haute, Indiana, USA&lt;br /&gt;
| I've been using various flavors of Unix/Linux since the late '70s, but there is always more to learn.&lt;br /&gt;
I've taught a 'C6713 based DSP class years ago. &lt;br /&gt;
| I teach 32-bit embedded with the Beagle [[ECE497 - 32-bit Embedded Linux, Rose-Hulman]].&lt;br /&gt;
|-&lt;br /&gt;
|Cathy Wicks&lt;br /&gt;
|Texas Instruments, University Program Manager&lt;br /&gt;
|I am a HUGE fan of Beagleboard and very interested to develop a community of teachers using it. &lt;br /&gt;
|Our Program [http://www.ti.com/university www.ti.com/university] helps academics use TI Hardware, Software and Chips in their projects and curriculum.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Labs ===&lt;br /&gt;
&lt;br /&gt;
=== Post Workshop ===&lt;br /&gt;
&lt;br /&gt;
== 2012 Hyderabad Workshop ==&lt;br /&gt;
{|&lt;br /&gt;
| '''Title:''' &lt;br /&gt;
| Three-day workshop on Embedded Linux on Beagleboard&lt;br /&gt;
|-&lt;br /&gt;
| '''Presentor:''' &lt;br /&gt;
| Mark A. Yoder&lt;br /&gt;
|-&lt;br /&gt;
| '''Location:''' &lt;br /&gt;
| [http://www.uniti.in/events/venueevents/69-c-dac-hyderabad C-DAC Hyderabad] - Hyderabad, India&lt;br /&gt;
|-&lt;br /&gt;
| '''Date:''' &lt;br /&gt;
| 14-16 June-2012&lt;br /&gt;
|-&lt;br /&gt;
| '''Link'''&lt;br /&gt;
| [http://www.uniti.in/events/details/123-three-day-workshop-on-embedded-linux-on-beagleboard http://www.uniti.in/events/details/123-three-day-workshop-on-embedded-linux-on-beagleboard]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Abstract:===&lt;br /&gt;
&lt;br /&gt;
Linux, which is an “open source” operating system and enjoys considerable popularity on general-purpose computers, is becoming popular in the embedded world also. Different versions and variants of Linux are now available on embedded platforms. In this workshop, the intention is to provide a hands-on introduction to concepts of Linux Systems/Kernel Programming and Embedded Linux&lt;br /&gt;
&lt;br /&gt;
=== Pre Workshop ===&lt;br /&gt;
&lt;br /&gt;
The purpose of this page is to give you practice editing a wiki and to start building a community of BeagleBoard Educators.  Click on the '''edit''' tab above and add your name to the list. You will have to create an eLinux account before you can edit the page.&lt;br /&gt;
&lt;br /&gt;
--Mark&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
! style=&amp;quot;width:20%&amp;quot; | Name&lt;br /&gt;
! style=&amp;quot;width:20%&amp;quot; | School/Company&lt;br /&gt;
! style=&amp;quot;width:30%&amp;quot; | Linux/DSP Background&lt;br /&gt;
! style=&amp;quot;width:30%&amp;quot; | Interests&lt;br /&gt;
|-&lt;br /&gt;
| Mark A. Yoder&lt;br /&gt;
| Rose-Hulman Institute of Technology, &lt;br /&gt;
Terre Haute, Indiana, USA&lt;br /&gt;
| I've been using various flavors of Unix/Linux since the late '70s, but there is always more to learn.&lt;br /&gt;
I've taught a 'C6713 based DSP class years ago. &lt;br /&gt;
| I teach 32-bit embedded with the Beagle [[ECE497 - 32-bit Embedded Linux, Rose-Hulman]].&lt;br /&gt;
|-&lt;br /&gt;
|Cathy Wicks&lt;br /&gt;
|Texas Instruments, University Program Manager&lt;br /&gt;
|I am a HUGE fan of Beagleboard and very interested to develop a community of teachers using it. &lt;br /&gt;
|Our Program [http://www.ti.com/university www.ti.com/university] helps academics use TI Hardware, Software and Chips in their projects and curriculum.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Labs ===&lt;br /&gt;
&lt;br /&gt;
=== Post Workshop ===&lt;br /&gt;
&lt;br /&gt;
== 2012 Bangalore Workshop ==&lt;br /&gt;
{|&lt;br /&gt;
| '''Title:''' &lt;br /&gt;
| 6-day modular workshop on Embedded Linux&lt;br /&gt;
|-&lt;br /&gt;
| '''Presentor:''' &lt;br /&gt;
| Mark A. Yoder&lt;br /&gt;
|-&lt;br /&gt;
| '''Location:''' &lt;br /&gt;
| [http://www.uniti.in/events/venueevents/68-cambridge-institute-of-technology Cambridge Institute of Technology] - Bangalore, India&lt;br /&gt;
|-&lt;br /&gt;
| '''Date:''' &lt;br /&gt;
| 11-13 June-2012&lt;br /&gt;
|-&lt;br /&gt;
| '''Link'''&lt;br /&gt;
| [http://www.uniti.in/events/details/122-6-day-modular-workshop-on-embedded-linux www.uniti.in/events/details/122-6-day-modular-workshop-on-embedded-linux]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Abstract:===&lt;br /&gt;
&lt;br /&gt;
'''Module A''' provides an overview of basic concepts of Linux, Linux Systems Programming, Linux Kernel Programming, and Embedded Systems. Module A will also include an introduction to Beagleboard, an open-source, low-cost, low-power embedded system development platform. '''Module A''' will be conducted jointly by a team of experts from industry and academia. In '''Module B''', aspects of Embedded Linux on Beagleboard will be explored in greater depth. Module B will be conducted by Prof. Mark A. Yoder of Rose-Hulman Institute of Technology, USA.&lt;br /&gt;
&lt;br /&gt;
=== Pre Workshop ===&lt;br /&gt;
&lt;br /&gt;
The purpose of this page is to give you practice editing a wiki and to start building a community of BeagleBoard Educators.  Click on the '''edit''' tab above and add your name to the list. You will have to create an eLinux account before you can edit the page.&lt;br /&gt;
&lt;br /&gt;
--Mark&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
! style=&amp;quot;width:20%&amp;quot; | Name&lt;br /&gt;
! style=&amp;quot;width:20%&amp;quot; | School/Company&lt;br /&gt;
! style=&amp;quot;width:30%&amp;quot; | Linux/DSP Background&lt;br /&gt;
! style=&amp;quot;width:30%&amp;quot; | Interests&lt;br /&gt;
|-&lt;br /&gt;
| Mark A. Yoder&lt;br /&gt;
| Rose-Hulman Institute of Technology, &lt;br /&gt;
Terre Haute, Indiana, USA&lt;br /&gt;
| I've been using various flavors of Unix/Linux since the late '70s, but there is always more to learn.&lt;br /&gt;
I've taught a 'C6713 based DSP class years ago. &lt;br /&gt;
| I teach 32-bit embedded with the Beagle [[ECE497 - 32-bit Embedded Linux, Rose-Hulman]].&lt;br /&gt;
|-&lt;br /&gt;
|Cathy Wicks&lt;br /&gt;
|Texas Instruments, University Program Manager&lt;br /&gt;
|I am a HUGE fan of Beagleboard and very interested to develop a community of teachers using it. &lt;br /&gt;
|Our Program [http://www.ti.com/university www.ti.com/university] helps academics use TI Hardware, Software and Chips in their projects and curriculum.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Labs ===&lt;br /&gt;
&lt;br /&gt;
=== Post Workshop ===&lt;br /&gt;
&lt;br /&gt;
== 2011 FIE Workshop - Cancelled ==&lt;br /&gt;
{|&lt;br /&gt;
| '''Title:''' &lt;br /&gt;
| From DSP Chips to Embedded Processors for Teaching Digital Signal Processing&lt;br /&gt;
|-&lt;br /&gt;
| '''Presentor:''' &lt;br /&gt;
| Mark A. Yoder&lt;br /&gt;
|-&lt;br /&gt;
| '''Location:''' &lt;br /&gt;
| Holiday Inn Salon F, Rapid City, South Dakota&lt;br /&gt;
|-&lt;br /&gt;
| '''Date:''' &lt;br /&gt;
| Wednesday, October 12, 2011, 2:30 p.m. - 5:30 p.m&lt;br /&gt;
|-&lt;br /&gt;
| '''Link'''&lt;br /&gt;
| [http://fie-conference.org/fie2011/] [http://fie-conference.org/fie2011/Pages/workshops.htm#SCRL6]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Abstract:===&lt;br /&gt;
&lt;br /&gt;
The goal of this hands-on tutorial is to present ideas on how to use Texas Instrument’s DM 3730-based BeagleBoard xM ([www.BeagleBoard.org www.BeagleBoard.org]) for teaching embedded processing using Open Source resources. The DM 3730 is a dual core processor with an ARM Cortex-a8 core and a TI ‘c64x DSP core. The BeagleBoard is Open Source hardware that has sold over 30,000 units since its introduction less than 2 years ago and has a thriving Open Source Software community.&lt;br /&gt;
&lt;br /&gt;
The BeagleBoard has many uses in the classroom. This workshop will show some of those uses and present some of the challenges in teaching with Open Source.&lt;br /&gt;
&lt;br /&gt;
The workshop activities will include:&lt;br /&gt;
&lt;br /&gt;
* several hands-on exercises to get participants familiar with using the Beagle, and how it differs from a traditional 8- or 16-bit microcomputer.&lt;br /&gt;
* several demonstrations of what the Beagle can do, such as streaming video and programming its DSP and discussions of what topics to include in an embedded/DSP class including dealing with open source comminutes.&lt;br /&gt;
* This workshop is targeted to those who are teaching embedded processors or DSP hardware. Some Linux background would be helpful, but not required. Those with little or no Linux experience will be paired with those with more experience.&lt;br /&gt;
&lt;br /&gt;
=== Post Workshop ===&lt;br /&gt;
&lt;br /&gt;
Even though the workshop has been cancelled, you can still do the exercises.  Here ([[Getting a Workshop SD Image]]) are instructions on how to put the tutorial image on your SD card.&lt;br /&gt;
&lt;br /&gt;
Here ([[EBC Embedded Beagle Class Topics]]) is a list of topics I cover in my class.  If you have questions, please email me.&lt;br /&gt;
&lt;br /&gt;
== 2011 IEEE ICASSP Workshop ==&lt;br /&gt;
{|&lt;br /&gt;
| '''Title:''' &lt;br /&gt;
| How 32-bit Embedded Processors Change the Focus in Teaching DSP Hardware&lt;br /&gt;
|-&lt;br /&gt;
| '''Presentor:''' &lt;br /&gt;
| Mark A. Yoder&lt;br /&gt;
|-&lt;br /&gt;
| '''Location:''' &lt;br /&gt;
| Prague, Czech Republic&lt;br /&gt;
|-&lt;br /&gt;
| '''Date:''' &lt;br /&gt;
| Monday May 23rd, 2011, Afternoon&lt;br /&gt;
|-&lt;br /&gt;
| '''Link'''&lt;br /&gt;
| [http://www.icassp2011.com/en/registration]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Abstract:===&lt;br /&gt;
This hands-on tutorial presents ideas on how to use TI’s OMAP 3530-based BeagleBoard (www.BeagleBoard.org) for teaching embedded media processing using Open Source resources. The BeagleBoard is Open Source hardware that has sold over 20,000 units since its introduction less than 2 years ago and has a thriving Open Source Software community.&lt;br /&gt;
After the introduction, this workshop will complement the Sunday afternoon tutorial “From DSP Chips to Embedded Processors for Teaching Digital Signal Processing”.  The Sunday workshop examples focus on programming the ‘C64 DSP on the OMAP3530.  This workshop will focus on using Open Source software for media processing  (such as GStreamer, OpenCV, etc.) and using the OMAP display subsystem for handling video. &lt;br /&gt;
The workshop activities will include:&lt;br /&gt;
# Several hands-on exercises to get participants familiar with using the Beagle, (same as tutorial)&lt;br /&gt;
# Several demonstrations of what the Beagle can do using Open Source software, including using the display subsystem, recognizing speech, computer vision&lt;br /&gt;
# Discussions of what topics to include in an embedded Linux class.&lt;br /&gt;
No BeagleBoards will given out.&lt;br /&gt;
&lt;br /&gt;
=== Pre Workshop ===&lt;br /&gt;
&lt;br /&gt;
The purpose of this page is to give you practice editing a wiki and to start building a community of BeagleBoard Educators.  Click on the '''edit''' tab above and add your name to the list. You will have to create an eLinux account before you can edit the page.&lt;br /&gt;
&lt;br /&gt;
--Mark&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
! style=&amp;quot;width:20%&amp;quot; | Name&lt;br /&gt;
! style=&amp;quot;width:20%&amp;quot; | School/Company&lt;br /&gt;
! style=&amp;quot;width:30%&amp;quot; | Linux/DSP Background&lt;br /&gt;
! style=&amp;quot;width:30%&amp;quot; | Interests&lt;br /&gt;
|-&lt;br /&gt;
| Mark A. Yoder&lt;br /&gt;
| Rose-Hulman Institute of Technology, &lt;br /&gt;
Terre Haute, Indiana, USA&lt;br /&gt;
| I've been using various flavors of Unix/Linux since the late '70s, but there is always more to learn.&lt;br /&gt;
I've taught a 'C6713 based DSP class years ago. &lt;br /&gt;
| I teach 32-bit embedded with the Beagle [[ECE497 - 32-bit Embedded Linux, Rose-Hulman]].  DSP is appearing everywhere now.  The BeagleBoard is a great environment to teach DSP.&lt;br /&gt;
|-&lt;br /&gt;
|Cathy Wicks&lt;br /&gt;
|Texas Instruments, University Program Manager&lt;br /&gt;
|I am a HUGE fan of Beagleboard and very interested to develop a community of teachers using it. &lt;br /&gt;
|Our Program [http://www.ti.com/university www.ti.com/university] helps academics use TI Hardware, Software and Chips in their projects and curriculum.  &lt;br /&gt;
|-&lt;br /&gt;
|Melani Plett&lt;br /&gt;
|Seattle Pacific University,&lt;br /&gt;
Seattle, Washington, USA&lt;br /&gt;
|I teach an undergraduate signals and systems course.  I have no Linux experience, though I did use Unix years ago.&lt;br /&gt;
|I am thinking of generating a technical elective follow-on class to illustrate the signals and systems concepts on the Beagleboard.&lt;br /&gt;
|-&lt;br /&gt;
|Monty Hayes&lt;br /&gt;
|Georgia Tech, Professor, Atlanta, GA and&lt;br /&gt;
Chung-Ang University Distinguished Foreign Professor, Seoul, Korea&lt;br /&gt;
|I have no linux experience, have taught courses on DSP chips before&lt;br /&gt;
|I would like to develop an undergraduate course using the Beagleboard to teach DSP.&lt;br /&gt;
|-&lt;br /&gt;
|Oleg Muratov&lt;br /&gt;
|University of Trento, Itay&lt;br /&gt;
|I am a PhD student and I have limited Linux experience.&lt;br /&gt;
|I am planning to give a course to undergraduate students on DSP probably using some hardware.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Labs ===&lt;br /&gt;
&lt;br /&gt;
Here's an additional handout that didn't make it in time for the printers.&lt;br /&gt;
&lt;br /&gt;
[[VideoThru Lab]]&lt;br /&gt;
&lt;br /&gt;
=== Post Workshop ===&lt;br /&gt;
&lt;br /&gt;
Here ([[Getting_a_Workshop_SD_Image]]) are instructions on how to put the tutorial image on your SD card.&lt;br /&gt;
&lt;br /&gt;
== 2011 IEEE ICASSP Tutorial ==&lt;br /&gt;
{|&lt;br /&gt;
| '''Title:''' &lt;br /&gt;
| From DSP Chips to Embedded Processors for Teaching Digital Signal Processing&lt;br /&gt;
|-&lt;br /&gt;
| '''Presentor:''' &lt;br /&gt;
| Mark A. Yoder&lt;br /&gt;
|-&lt;br /&gt;
| '''Location:''' &lt;br /&gt;
| Prague, Czech Republic&lt;br /&gt;
|-&lt;br /&gt;
| '''Date:''' &lt;br /&gt;
| Sunday May 22nd, 2011, Afternoon&lt;br /&gt;
|-&lt;br /&gt;
| '''Link'''&lt;br /&gt;
| [http://www.icassp2011.com/en/tutorials/tutorial-5]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Abstract:===&lt;br /&gt;
This hands-on tutorial presents ideas on how to use TI’s OMAP 3530-based BeagleBoard (www.BeagleBoard.org) for teaching embedded media processing using Open Source resources. The BeagleBoard is Open Source hardware that has sold over 16,000 units since its introduction less than 2 years ago and has a thriving Open Source Software community.&lt;br /&gt;
Today’s media handling embedded processors have come a long way from the limited performance of 8- or 16-bit embedded processors or the limited functionality of a dedicated DSP chip. Our students need to see that the days of the single DSP chip are almost over and they need to be prepared for working with DSPs embedded with other processors.&lt;br /&gt;
The OMAP3530 processor contains both an ARM Cortex-A9 processor and a ‘C6400 DSP and it and chips like it are being used in products today. &lt;br /&gt;
The workshop activities include:&lt;br /&gt;
#      hands-on exercises to get participants familiar with using the Beagle,&lt;br /&gt;
#      demonstrations of what the Beagle can do, including streaming video and synthesizing speech and&lt;br /&gt;
#      discussions of what topics to include in an embedded Linux class.&lt;br /&gt;
Participants will receive a BeagleBoard and course materials.&lt;br /&gt;
&lt;br /&gt;
=== Pre Tutorial ===&lt;br /&gt;
&lt;br /&gt;
The purpose of this page is to give you practice editing a wiki and to start building a community of BeagleBoard Educators.  Click on the '''edit''' tab above and add your name to the list. You will have to create an eLinux account before you can edit the page.&lt;br /&gt;
&lt;br /&gt;
--Mark&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
! style=&amp;quot;width:20%&amp;quot; | Name&lt;br /&gt;
! style=&amp;quot;width:20%&amp;quot; | School/Company&lt;br /&gt;
! style=&amp;quot;width:30%&amp;quot; | Linux/DSP Background&lt;br /&gt;
! style=&amp;quot;width:30%&amp;quot; | Interests&lt;br /&gt;
|-&lt;br /&gt;
| Mark A. Yoder&lt;br /&gt;
| Rose-Hulman Institute of Technology, &lt;br /&gt;
Terre Haute, Indiana, USA&lt;br /&gt;
| I've been using various flavors of Unix/Linux since the late '70s, but there is always more to learn.&lt;br /&gt;
I've taught a 'C6713 based DSP class years ago. &lt;br /&gt;
| I teach 32-bit embedded with the Beagle [[ECE497 - 32-bit Embedded Linux, Rose-Hulman]].  DSP is appearing everywhere now.  The BeagleBoard is a great environment to teach DSP.&lt;br /&gt;
|-&lt;br /&gt;
|Cathy Wicks&lt;br /&gt;
|Texas Instruments, University Program Manager&lt;br /&gt;
|I am a HUGE fan of Beagleboard and very interested to develop a community of teachers using it. &lt;br /&gt;
|Our Program [http://www.ti.com/university www.ti.com/university] helps academics use TI Hardware, Software and Chips in their projects and curriculum.  &lt;br /&gt;
|-&lt;br /&gt;
|Melani Plett&lt;br /&gt;
|Seattle Pacific University,&lt;br /&gt;
Seattle, Washington, USA&lt;br /&gt;
|I teach an undergraduate signals and systems course.  I have no Linux experience, though I did use Unix years ago.&lt;br /&gt;
|I am thinking of generating a technical elective follow-on class to illustrate the signals and systems concepts on the Beagleboard.&lt;br /&gt;
|-&lt;br /&gt;
|Matt Gately&lt;br /&gt;
|University of Oklahoma, Norman, OK, USA&lt;br /&gt;
|I am a PhD student and I use Linux in my research. &lt;br /&gt;
|I would love to someday teach a DSP course using embedded systems such as FPGA or microcontroller boards. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Labs ===&lt;br /&gt;
&lt;br /&gt;
Here's an additional handout that didn't make it in time for the printers.&lt;br /&gt;
&lt;br /&gt;
[[AudioThru Lab]]&lt;br /&gt;
&lt;br /&gt;
=== Post Tutorial ===&lt;br /&gt;
&lt;br /&gt;
Here ([[Getting_a_Workshop_SD_Image]]) are instructions on how to put the tutorial image on your SD card.&lt;br /&gt;
&lt;br /&gt;
== 2011 IEEE SPEd (Signal Processing Society 14th DSP Workshop &amp;amp; 6th SPEd Workshop) ==&lt;br /&gt;
{|&lt;br /&gt;
| '''Title:''' &lt;br /&gt;
| Moving Beyond the DSP and Teaching 32-bit Embedded Processors Using the BeagleBoard&lt;br /&gt;
|-&lt;br /&gt;
| '''Presentor:''' &lt;br /&gt;
| Mark A. Yoder&lt;br /&gt;
|-&lt;br /&gt;
| '''Location:''' &lt;br /&gt;
| Enchantment Resort, Sedona, Arizona&lt;br /&gt;
|-&lt;br /&gt;
| '''Date:''' &lt;br /&gt;
| Thursday 6 January, 2011  Time: 14:00 - 17:30&lt;br /&gt;
|-&lt;br /&gt;
| '''Link'''&lt;br /&gt;
| [http://enpub.fulton.asu.edu/ivu/Workshops/DSPE2011/training.html#TI2]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Abstract ===&lt;br /&gt;
Today’s media handling embedded processors have come a long way from the limited performance of 8- or 16-bit embedded processors or the limited functionality of a dedicated DSP chip. This 3-hour, hands-on workshop presents ideas on how to use TI’s OMAP 3530-based BeagleBoard ([www.BeagleBoard.org www.BeagleBoard.org]) for teaching embedded media processing using Open Source resources. The OMAP3530 processor contains both an ARM Cortex-A9 processor and a ‘C6400 DSP. The BeagleBoard is Open Source hardware that has sold over 20,000 units since its introduction less than 2 years ago and has a thriving Open Source Software community. The 3-hour workshop activities will include 1) several demonstrations of what the Beagle can do, including streaming video and synthesizing speech, 2) Discussions of what topics to include in an embedded Linux class and 3) Several hands-on exercises to get participants familiar with using the Beagle. Participants will receive a Beagleboard. &lt;br /&gt;
&lt;br /&gt;
=== Post Workshop ===&lt;br /&gt;
Here are some things you might want to do now that the workshop is over.  &lt;br /&gt;
&lt;br /&gt;
Here are instructions on how to create the SD card that was used in the workshop.&lt;br /&gt;
* Go here ([[ECE597_Getting_your_Beagle_running_(precompiled)#From_beagleboard-validation.s3.amazonaws.com]]) to download and install the base image for the Beagle.  This will install the kernel and all the files needed to run many of the demos.&lt;br /&gt;
* Download [http://www.rose-hulman.edu/~yoder/Beagle/SPEd2011WorkshopFiles.zip this zip file] to get the extra files used in the workshop. Copy it to your BeagleBoard and unzip it there.  This file contains the '''VideoThru''', '''c6run_target''', '''hello.c''' and '''helloBeagle.c''' files.&lt;br /&gt;
* Download the workshop pptx [http://www.rose-hulman.edu/~yoder/Beagle/SPEd2011WorkshopPPTX.zip here].&lt;br /&gt;
&lt;br /&gt;
=== Pre Workshop === &lt;br /&gt;
If you are an overachiever (not required) go here ([[ECE497 Lab13 Using the DSP via c6run]]) to learn how to install the ARM and DSP development tools on your Linux system (Ubuntu 10.4 LTS is required).  If you don't have Ubuntu installed, go [http://processors.wiki.ti.com/index.php/How_to_Build_a_Ubuntu_Linux_host_under_VirtualBox here] to learn how to install it in a virtual machine under windows.&lt;br /&gt;
&lt;br /&gt;
These installs are not required for the workshop; however editing the the table below ''is''.&lt;br /&gt;
&lt;br /&gt;
The purpose of this page is to give you practice editing a wiki and to start building a community of BeagleBoard Educators.  Click on the '''edit''' tab above and add your name to the list. You will have to create an eLinux account before you can edit the page.&lt;br /&gt;
&lt;br /&gt;
--Mark&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
! style=&amp;quot;width:20%&amp;quot; | Name&lt;br /&gt;
! style=&amp;quot;width:20%&amp;quot; | School/Company&lt;br /&gt;
! style=&amp;quot;width:30%&amp;quot; | Linux/DSP Background&lt;br /&gt;
! style=&amp;quot;width:30%&amp;quot; | Interests&lt;br /&gt;
|-&lt;br /&gt;
| Mark A. Yoder&lt;br /&gt;
| Rose-Hulman Institute of Technology, &lt;br /&gt;
Terre Haute, Indiana, USA&lt;br /&gt;
| I've been using various flavors of Unix/Linux since the late '70s, but there is always more to learn.&lt;br /&gt;
I've taught a 'C6713 based DSP class years ago. &lt;br /&gt;
| I teach 32-bit embedded with the Beagle.  DSP is appearing everywhere now.  The BeagleBoard is a great environment to teach DSP.&lt;br /&gt;
|-&lt;br /&gt;
|Cathy Wicks&lt;br /&gt;
|Texas Instruments, University Program Manager&lt;br /&gt;
|I am a HUGE fan of Beagleboard and very interested to develop a community of teachers using it. &lt;br /&gt;
|Our Program www.ti.com/university helps academics use TI Hardware, Software and Chips in their projects and curriculum.  &lt;br /&gt;
|-&lt;br /&gt;
| Steve Chadwick&lt;br /&gt;
| Embry-Riddle Aeronautical University, Prescott, AZ &lt;br /&gt;
| Very new to DSP and hoping develop sufficient depth to teach it next academic year. &lt;br /&gt;
| Interests: Pretty much everything in science. &lt;br /&gt;
|-&lt;br /&gt;
| Mark Wickert&lt;br /&gt;
| University of Colorado, Colorado Springs, CO, USA&lt;br /&gt;
| I have played on and off with Linux for about 10 years, never done any real-time DSP under this OS however.&lt;br /&gt;
| I regularly teach DSP and related courses. I am using the C6713 today, but ready to move forward. I recently started playing with ARM processors (not the BeagleBoard until now).&lt;br /&gt;
|-&lt;br /&gt;
| Shane Cotter&lt;br /&gt;
| Union College, Schenectady, NY&lt;br /&gt;
| I have taught DSP courses. I have used Unix/Linux in the past but not for real-time DSP.&lt;br /&gt;
| The Beagleboard seems like a great platform and I'm interested in learning about it and its potential uses in courses.&lt;br /&gt;
|-&lt;br /&gt;
| Jake Gunther&lt;br /&gt;
| Utah State University&lt;br /&gt;
| I have taught DSP and communication systems for over ten years.&lt;br /&gt;
| I want to move from a simulation-based teaching approach to a real-time approach.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== 2010 ICASSP Workshop ==&lt;br /&gt;
{|&lt;br /&gt;
| '''Title:''' &lt;br /&gt;
| 32-bit Embedded Linux-based Signal Processing – Hands on Workshop&lt;br /&gt;
|-&lt;br /&gt;
| '''Presentor:''' &lt;br /&gt;
| Mark A. Yoder&lt;br /&gt;
|-&lt;br /&gt;
| '''Location:''' &lt;br /&gt;
| ICASSP 2010, Dallas, Texas&lt;br /&gt;
|-&lt;br /&gt;
| '''Date:''' &lt;br /&gt;
| Monday, March 15 2010, 13:30 - 17:00&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The purpose of this page is to give you practice editing a wiki and to start building a community of BeagleBoard Educators.  Click on the '''edit''' tab above and add your name to the list.&lt;br /&gt;
&lt;br /&gt;
--Mark&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
! style=&amp;quot;width:20%&amp;quot; | Name&lt;br /&gt;
! style=&amp;quot;width:20%&amp;quot; | School/Company&lt;br /&gt;
! style=&amp;quot;width:20%&amp;quot; | email&lt;br /&gt;
! style=&amp;quot;width:40%&amp;quot; | Interests&lt;br /&gt;
|-&lt;br /&gt;
| Mark A. Yoder&lt;br /&gt;
| Rose-Hulman Institute of Technology, &lt;br /&gt;
Terre Haute, Indiana, USA&lt;br /&gt;
| [http://www.rose-hulman.edu/~yoder]&lt;br /&gt;
| I teach 32-bit embedded with the Beagle.  DSP is appearing everywhere now.  The BeagleBoard is a great environment to teach DSP.&lt;br /&gt;
|-&lt;br /&gt;
|David V. Anderson&lt;br /&gt;
|Georgia Institute of Technology&lt;br /&gt;
|&lt;br /&gt;
|Teaching DSP using BeagleBoard as a real-time platform.&lt;br /&gt;
|-&lt;br /&gt;
|Andres Kwasinski&lt;br /&gt;
|Rochester Institute of Technology&lt;br /&gt;
|[http://people.rit.edu/axkeec/]&lt;br /&gt;
|Teaching DSP to Computer Engineers using real-world platforms.&lt;br /&gt;
|-&lt;br /&gt;
|Roger West&lt;br /&gt;
|Utah State University&lt;br /&gt;
|&lt;br /&gt;
|Teaching DSP to ECE students using real-time platforms.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Labs ===&lt;br /&gt;
Here is a list of the hands on exercises we will be doing in the 2010 workshop.  Many have suggestions for additional homework that you can do once you are back home and have a network connection.&lt;br /&gt;
&lt;br /&gt;
# [[2010 ICASSP Lab 1 Wiring_and_Running the Beagle]]&lt;br /&gt;
# [[2010 ICASSP Lab 2 The Boot Sequence]]&lt;br /&gt;
&lt;br /&gt;
{{YoderFoot}}&lt;/div&gt;</summary>
		<author><name>Yoder</name></author>	</entry>

	<entry>
		<id>http://www.elinux.org/BeagleBoard_Education_Workshops</id>
		<title>BeagleBoard Education Workshops</title>
		<link rel="alternate" type="text/html" href="http://www.elinux.org/BeagleBoard_Education_Workshops"/>
				<updated>2013-06-18T15:04:48Z</updated>
		
		<summary type="html">&lt;p&gt;Yoder: Added Abstract&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:ECE497 |W]]&lt;br /&gt;
[[Category:BeagleBoard]]&lt;br /&gt;
[[Category:Workshops]]&lt;br /&gt;
[[Category:Education]]&lt;br /&gt;
{{YoderHead}}&lt;br /&gt;
&lt;br /&gt;
== 2013 ASEE Workshop ==&lt;br /&gt;
{|&lt;br /&gt;
| '''Title:''' &lt;br /&gt;
| U216·WORKSHOP: BeagleBone - A Hands-on Workshop&lt;br /&gt;
|-&lt;br /&gt;
| '''Presentors:''' &lt;br /&gt;
| Dr. Steven F Barrett P.E., Jason Kridner, Mark A. Yoder&lt;br /&gt;
|-&lt;br /&gt;
| '''Location:''' &lt;br /&gt;
| Atlanta, Omni CNN Center Hotel, Omni - Chestnut&lt;br /&gt;
|-&lt;br /&gt;
| '''Date:''' &lt;br /&gt;
| 23-June-2013&lt;br /&gt;
|-&lt;br /&gt;
| '''Link'''&lt;br /&gt;
| [http://www.asee.org/public/conferences/20/registration/view_session?session_id=2420 ASEE site]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Abstract:===&lt;br /&gt;
&lt;br /&gt;
'''Ticketed event: $25.00 advanced registration and $35.00 on site registration'''&lt;br /&gt;
&lt;br /&gt;
BeagleBone is a low cost, open hardware computer first introduced in November 2011 by BeagleBoard.org, a community of developers sponsored by Texas Instruments. BeagleBone hosts a powerful 32-bit, super-scalar ARM Cortex A8 processor operating at 720 MHz. Yet it is small enough to fit in an Altoids mint tin box. The &amp;quot;Bone'' may be used in a wide variety of projects from middle school science fair projects to senior design projects to first prototypes of very complex systems. Novice users may access the power of the Bone through the user-friendly Bonescript environment. Seasoned users may take full advantage of the Bone's power using the underlying Linux-based operating system, a host of feature extension boards (Capes) and a wide variety of open source libraries. This hands on workshop provides an introduction to this powerful computer and has been designed for a wide variety of users including the first time novice through the seasoned embedded system design professional. &lt;br /&gt;
&lt;br /&gt;
Workshop participants will receive a BeagleBone board and also a BeagleBone book courtesy of BeagleBoard.org and Morgan and Claypool Publishers. This workshop is subsidized by Texas Instruments (TI).&lt;br /&gt;
&lt;br /&gt;
=== Pre Workshop ===&lt;br /&gt;
&lt;br /&gt;
=== Labs ===&lt;br /&gt;
&lt;br /&gt;
[[ASEE 2013 Workshop | Afternoon labs]]&lt;br /&gt;
&lt;br /&gt;
=== Post Workshop ===&lt;br /&gt;
&lt;br /&gt;
== 2012 Engibous Summit Workshop ==&lt;br /&gt;
{|&lt;br /&gt;
| '''Title:''' &lt;br /&gt;
| Hands-on workshop on Embedded Linux on BeagleBone&lt;br /&gt;
|-&lt;br /&gt;
| '''Presentor:''' &lt;br /&gt;
| Mark A. Yoder&lt;br /&gt;
|-&lt;br /&gt;
| '''Location:''' &lt;br /&gt;
| Dallas&lt;br /&gt;
|-&lt;br /&gt;
| '''Date:''' &lt;br /&gt;
| 30-July-2012&lt;br /&gt;
|-&lt;br /&gt;
| '''Link'''&lt;br /&gt;
| [http://www.ti.com/corp/docs/landing/universityprogram/prize.htm Engibous Summit]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Abstract:===&lt;br /&gt;
&lt;br /&gt;
???&lt;br /&gt;
&lt;br /&gt;
=== Pre Workshop ===&lt;br /&gt;
&lt;br /&gt;
You will be mailed some information about the workshop and some things for you to do before arriving.&lt;br /&gt;
&lt;br /&gt;
--Mark&lt;br /&gt;
&lt;br /&gt;
=== Labs ===&lt;br /&gt;
&lt;br /&gt;
=== Post Workshop ===&lt;br /&gt;
&lt;br /&gt;
== 2012 Chandigarh Workshop ==&lt;br /&gt;
{|&lt;br /&gt;
| '''Title:''' &lt;br /&gt;
| Hands-on workshop on Embedded Linux on Beagleboard&lt;br /&gt;
|-&lt;br /&gt;
| '''Presentor:''' &lt;br /&gt;
| Mark A. Yoder&lt;br /&gt;
|-&lt;br /&gt;
| '''Location:''' &lt;br /&gt;
| [http://www.uniti.in/events/venueevents/73-chitkara-school-of-engineering-a-technology Chitkara School of Engineering &amp;amp; Technology] - Chandigarh, India&lt;br /&gt;
|-&lt;br /&gt;
| '''Date:''' &lt;br /&gt;
| 18-20 June-2012&lt;br /&gt;
|-&lt;br /&gt;
| '''Link'''&lt;br /&gt;
| [http://www.uniti.in/events/details/128-hands-on-workshop-on-embedded-linux-on-beagleboard http://www.uniti.in/events/details/128-hands-on-workshop-on-embedded-linux-on-beagleboard]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Abstract:===&lt;br /&gt;
&lt;br /&gt;
Beagleboard is a low-cost open-source embedded system development platform. It is based on Texas Instruments DM3730 processor, which includes an on-chip ARM Cortex-A8 processor core, a Texas Instruments C6x DSP core, and a host of peripherals. Beagleboard is a single board computer, which provides adequate performance to run Linux software, yet has a power consumption lower than 2W. A large number of embedded applications have been developed on Beagleboard ([http://www.beagleboard.org www.beagleboard.org]) Module A provides a gentle introduction to the subject of Embedded Linux, Linux Systems Programming and Linux Kernel Programming. The intention of Module B is to provide a hands-on exposure to running Embedded Linux operating system on the Beagleboard and develop system software on the Beagleboard.&lt;br /&gt;
=== Pre Workshop ===&lt;br /&gt;
&lt;br /&gt;
The purpose of this page is to give you practice editing a wiki and to start building a community of BeagleBoard Educators.  Click on the '''edit''' tab above and add your name to the list. You will have to create an eLinux account before you can edit the page.&lt;br /&gt;
&lt;br /&gt;
--Mark&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
! style=&amp;quot;width:20%&amp;quot; | Name&lt;br /&gt;
! style=&amp;quot;width:20%&amp;quot; | School/Company&lt;br /&gt;
! style=&amp;quot;width:30%&amp;quot; | Linux/DSP Background&lt;br /&gt;
! style=&amp;quot;width:30%&amp;quot; | Interests&lt;br /&gt;
|-&lt;br /&gt;
| Mark A. Yoder&lt;br /&gt;
| Rose-Hulman Institute of Technology, &lt;br /&gt;
Terre Haute, Indiana, USA&lt;br /&gt;
| I've been using various flavors of Unix/Linux since the late '70s, but there is always more to learn.&lt;br /&gt;
I've taught a 'C6713 based DSP class years ago. &lt;br /&gt;
| I teach 32-bit embedded with the Beagle [[ECE497 - 32-bit Embedded Linux, Rose-Hulman]].&lt;br /&gt;
|-&lt;br /&gt;
|Cathy Wicks&lt;br /&gt;
|Texas Instruments, University Program Manager&lt;br /&gt;
|I am a HUGE fan of Beagleboard and very interested to develop a community of teachers using it. &lt;br /&gt;
|Our Program [http://www.ti.com/university www.ti.com/university] helps academics use TI Hardware, Software and Chips in their projects and curriculum.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Labs ===&lt;br /&gt;
&lt;br /&gt;
=== Post Workshop ===&lt;br /&gt;
&lt;br /&gt;
== 2012 Hyderabad Workshop ==&lt;br /&gt;
{|&lt;br /&gt;
| '''Title:''' &lt;br /&gt;
| Three-day workshop on Embedded Linux on Beagleboard&lt;br /&gt;
|-&lt;br /&gt;
| '''Presentor:''' &lt;br /&gt;
| Mark A. Yoder&lt;br /&gt;
|-&lt;br /&gt;
| '''Location:''' &lt;br /&gt;
| [http://www.uniti.in/events/venueevents/69-c-dac-hyderabad C-DAC Hyderabad] - Hyderabad, India&lt;br /&gt;
|-&lt;br /&gt;
| '''Date:''' &lt;br /&gt;
| 14-16 June-2012&lt;br /&gt;
|-&lt;br /&gt;
| '''Link'''&lt;br /&gt;
| [http://www.uniti.in/events/details/123-three-day-workshop-on-embedded-linux-on-beagleboard http://www.uniti.in/events/details/123-three-day-workshop-on-embedded-linux-on-beagleboard]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Abstract:===&lt;br /&gt;
&lt;br /&gt;
Linux, which is an “open source” operating system and enjoys considerable popularity on general-purpose computers, is becoming popular in the embedded world also. Different versions and variants of Linux are now available on embedded platforms. In this workshop, the intention is to provide a hands-on introduction to concepts of Linux Systems/Kernel Programming and Embedded Linux&lt;br /&gt;
&lt;br /&gt;
=== Pre Workshop ===&lt;br /&gt;
&lt;br /&gt;
The purpose of this page is to give you practice editing a wiki and to start building a community of BeagleBoard Educators.  Click on the '''edit''' tab above and add your name to the list. You will have to create an eLinux account before you can edit the page.&lt;br /&gt;
&lt;br /&gt;
--Mark&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
! style=&amp;quot;width:20%&amp;quot; | Name&lt;br /&gt;
! style=&amp;quot;width:20%&amp;quot; | School/Company&lt;br /&gt;
! style=&amp;quot;width:30%&amp;quot; | Linux/DSP Background&lt;br /&gt;
! style=&amp;quot;width:30%&amp;quot; | Interests&lt;br /&gt;
|-&lt;br /&gt;
| Mark A. Yoder&lt;br /&gt;
| Rose-Hulman Institute of Technology, &lt;br /&gt;
Terre Haute, Indiana, USA&lt;br /&gt;
| I've been using various flavors of Unix/Linux since the late '70s, but there is always more to learn.&lt;br /&gt;
I've taught a 'C6713 based DSP class years ago. &lt;br /&gt;
| I teach 32-bit embedded with the Beagle [[ECE497 - 32-bit Embedded Linux, Rose-Hulman]].&lt;br /&gt;
|-&lt;br /&gt;
|Cathy Wicks&lt;br /&gt;
|Texas Instruments, University Program Manager&lt;br /&gt;
|I am a HUGE fan of Beagleboard and very interested to develop a community of teachers using it. &lt;br /&gt;
|Our Program [http://www.ti.com/university www.ti.com/university] helps academics use TI Hardware, Software and Chips in their projects and curriculum.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Labs ===&lt;br /&gt;
&lt;br /&gt;
=== Post Workshop ===&lt;br /&gt;
&lt;br /&gt;
== 2012 Bangalore Workshop ==&lt;br /&gt;
{|&lt;br /&gt;
| '''Title:''' &lt;br /&gt;
| 6-day modular workshop on Embedded Linux&lt;br /&gt;
|-&lt;br /&gt;
| '''Presentor:''' &lt;br /&gt;
| Mark A. Yoder&lt;br /&gt;
|-&lt;br /&gt;
| '''Location:''' &lt;br /&gt;
| [http://www.uniti.in/events/venueevents/68-cambridge-institute-of-technology Cambridge Institute of Technology] - Bangalore, India&lt;br /&gt;
|-&lt;br /&gt;
| '''Date:''' &lt;br /&gt;
| 11-13 June-2012&lt;br /&gt;
|-&lt;br /&gt;
| '''Link'''&lt;br /&gt;
| [http://www.uniti.in/events/details/122-6-day-modular-workshop-on-embedded-linux www.uniti.in/events/details/122-6-day-modular-workshop-on-embedded-linux]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Abstract:===&lt;br /&gt;
&lt;br /&gt;
'''Module A''' provides an overview of basic concepts of Linux, Linux Systems Programming, Linux Kernel Programming, and Embedded Systems. Module A will also include an introduction to Beagleboard, an open-source, low-cost, low-power embedded system development platform. '''Module A''' will be conducted jointly by a team of experts from industry and academia. In '''Module B''', aspects of Embedded Linux on Beagleboard will be explored in greater depth. Module B will be conducted by Prof. Mark A. Yoder of Rose-Hulman Institute of Technology, USA.&lt;br /&gt;
&lt;br /&gt;
=== Pre Workshop ===&lt;br /&gt;
&lt;br /&gt;
The purpose of this page is to give you practice editing a wiki and to start building a community of BeagleBoard Educators.  Click on the '''edit''' tab above and add your name to the list. You will have to create an eLinux account before you can edit the page.&lt;br /&gt;
&lt;br /&gt;
--Mark&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
! style=&amp;quot;width:20%&amp;quot; | Name&lt;br /&gt;
! style=&amp;quot;width:20%&amp;quot; | School/Company&lt;br /&gt;
! style=&amp;quot;width:30%&amp;quot; | Linux/DSP Background&lt;br /&gt;
! style=&amp;quot;width:30%&amp;quot; | Interests&lt;br /&gt;
|-&lt;br /&gt;
| Mark A. Yoder&lt;br /&gt;
| Rose-Hulman Institute of Technology, &lt;br /&gt;
Terre Haute, Indiana, USA&lt;br /&gt;
| I've been using various flavors of Unix/Linux since the late '70s, but there is always more to learn.&lt;br /&gt;
I've taught a 'C6713 based DSP class years ago. &lt;br /&gt;
| I teach 32-bit embedded with the Beagle [[ECE497 - 32-bit Embedded Linux, Rose-Hulman]].&lt;br /&gt;
|-&lt;br /&gt;
|Cathy Wicks&lt;br /&gt;
|Texas Instruments, University Program Manager&lt;br /&gt;
|I am a HUGE fan of Beagleboard and very interested to develop a community of teachers using it. &lt;br /&gt;
|Our Program [http://www.ti.com/university www.ti.com/university] helps academics use TI Hardware, Software and Chips in their projects and curriculum.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Labs ===&lt;br /&gt;
&lt;br /&gt;
=== Post Workshop ===&lt;br /&gt;
&lt;br /&gt;
== 2011 FIE Workshop - Cancelled ==&lt;br /&gt;
{|&lt;br /&gt;
| '''Title:''' &lt;br /&gt;
| From DSP Chips to Embedded Processors for Teaching Digital Signal Processing&lt;br /&gt;
|-&lt;br /&gt;
| '''Presentor:''' &lt;br /&gt;
| Mark A. Yoder&lt;br /&gt;
|-&lt;br /&gt;
| '''Location:''' &lt;br /&gt;
| Holiday Inn Salon F, Rapid City, South Dakota&lt;br /&gt;
|-&lt;br /&gt;
| '''Date:''' &lt;br /&gt;
| Wednesday, October 12, 2011, 2:30 p.m. - 5:30 p.m&lt;br /&gt;
|-&lt;br /&gt;
| '''Link'''&lt;br /&gt;
| [http://fie-conference.org/fie2011/] [http://fie-conference.org/fie2011/Pages/workshops.htm#SCRL6]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Abstract:===&lt;br /&gt;
&lt;br /&gt;
The goal of this hands-on tutorial is to present ideas on how to use Texas Instrument’s DM 3730-based BeagleBoard xM ([www.BeagleBoard.org www.BeagleBoard.org]) for teaching embedded processing using Open Source resources. The DM 3730 is a dual core processor with an ARM Cortex-a8 core and a TI ‘c64x DSP core. The BeagleBoard is Open Source hardware that has sold over 30,000 units since its introduction less than 2 years ago and has a thriving Open Source Software community.&lt;br /&gt;
&lt;br /&gt;
The BeagleBoard has many uses in the classroom. This workshop will show some of those uses and present some of the challenges in teaching with Open Source.&lt;br /&gt;
&lt;br /&gt;
The workshop activities will include:&lt;br /&gt;
&lt;br /&gt;
* several hands-on exercises to get participants familiar with using the Beagle, and how it differs from a traditional 8- or 16-bit microcomputer.&lt;br /&gt;
* several demonstrations of what the Beagle can do, such as streaming video and programming its DSP and discussions of what topics to include in an embedded/DSP class including dealing with open source comminutes.&lt;br /&gt;
* This workshop is targeted to those who are teaching embedded processors or DSP hardware. Some Linux background would be helpful, but not required. Those with little or no Linux experience will be paired with those with more experience.&lt;br /&gt;
&lt;br /&gt;
=== Post Workshop ===&lt;br /&gt;
&lt;br /&gt;
Even though the workshop has been cancelled, you can still do the exercises.  Here ([[Getting a Workshop SD Image]]) are instructions on how to put the tutorial image on your SD card.&lt;br /&gt;
&lt;br /&gt;
Here ([[EBC Embedded Beagle Class Topics]]) is a list of topics I cover in my class.  If you have questions, please email me.&lt;br /&gt;
&lt;br /&gt;
== 2011 IEEE ICASSP Workshop ==&lt;br /&gt;
{|&lt;br /&gt;
| '''Title:''' &lt;br /&gt;
| How 32-bit Embedded Processors Change the Focus in Teaching DSP Hardware&lt;br /&gt;
|-&lt;br /&gt;
| '''Presentor:''' &lt;br /&gt;
| Mark A. Yoder&lt;br /&gt;
|-&lt;br /&gt;
| '''Location:''' &lt;br /&gt;
| Prague, Czech Republic&lt;br /&gt;
|-&lt;br /&gt;
| '''Date:''' &lt;br /&gt;
| Monday May 23rd, 2011, Afternoon&lt;br /&gt;
|-&lt;br /&gt;
| '''Link'''&lt;br /&gt;
| [http://www.icassp2011.com/en/registration]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Abstract:===&lt;br /&gt;
This hands-on tutorial presents ideas on how to use TI’s OMAP 3530-based BeagleBoard (www.BeagleBoard.org) for teaching embedded media processing using Open Source resources. The BeagleBoard is Open Source hardware that has sold over 20,000 units since its introduction less than 2 years ago and has a thriving Open Source Software community.&lt;br /&gt;
After the introduction, this workshop will complement the Sunday afternoon tutorial “From DSP Chips to Embedded Processors for Teaching Digital Signal Processing”.  The Sunday workshop examples focus on programming the ‘C64 DSP on the OMAP3530.  This workshop will focus on using Open Source software for media processing  (such as GStreamer, OpenCV, etc.) and using the OMAP display subsystem for handling video. &lt;br /&gt;
The workshop activities will include:&lt;br /&gt;
# Several hands-on exercises to get participants familiar with using the Beagle, (same as tutorial)&lt;br /&gt;
# Several demonstrations of what the Beagle can do using Open Source software, including using the display subsystem, recognizing speech, computer vision&lt;br /&gt;
# Discussions of what topics to include in an embedded Linux class.&lt;br /&gt;
No BeagleBoards will given out.&lt;br /&gt;
&lt;br /&gt;
=== Pre Workshop ===&lt;br /&gt;
&lt;br /&gt;
The purpose of this page is to give you practice editing a wiki and to start building a community of BeagleBoard Educators.  Click on the '''edit''' tab above and add your name to the list. You will have to create an eLinux account before you can edit the page.&lt;br /&gt;
&lt;br /&gt;
--Mark&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
! style=&amp;quot;width:20%&amp;quot; | Name&lt;br /&gt;
! style=&amp;quot;width:20%&amp;quot; | School/Company&lt;br /&gt;
! style=&amp;quot;width:30%&amp;quot; | Linux/DSP Background&lt;br /&gt;
! style=&amp;quot;width:30%&amp;quot; | Interests&lt;br /&gt;
|-&lt;br /&gt;
| Mark A. Yoder&lt;br /&gt;
| Rose-Hulman Institute of Technology, &lt;br /&gt;
Terre Haute, Indiana, USA&lt;br /&gt;
| I've been using various flavors of Unix/Linux since the late '70s, but there is always more to learn.&lt;br /&gt;
I've taught a 'C6713 based DSP class years ago. &lt;br /&gt;
| I teach 32-bit embedded with the Beagle [[ECE497 - 32-bit Embedded Linux, Rose-Hulman]].  DSP is appearing everywhere now.  The BeagleBoard is a great environment to teach DSP.&lt;br /&gt;
|-&lt;br /&gt;
|Cathy Wicks&lt;br /&gt;
|Texas Instruments, University Program Manager&lt;br /&gt;
|I am a HUGE fan of Beagleboard and very interested to develop a community of teachers using it. &lt;br /&gt;
|Our Program [http://www.ti.com/university www.ti.com/university] helps academics use TI Hardware, Software and Chips in their projects and curriculum.  &lt;br /&gt;
|-&lt;br /&gt;
|Melani Plett&lt;br /&gt;
|Seattle Pacific University,&lt;br /&gt;
Seattle, Washington, USA&lt;br /&gt;
|I teach an undergraduate signals and systems course.  I have no Linux experience, though I did use Unix years ago.&lt;br /&gt;
|I am thinking of generating a technical elective follow-on class to illustrate the signals and systems concepts on the Beagleboard.&lt;br /&gt;
|-&lt;br /&gt;
|Monty Hayes&lt;br /&gt;
|Georgia Tech, Professor, Atlanta, GA and&lt;br /&gt;
Chung-Ang University Distinguished Foreign Professor, Seoul, Korea&lt;br /&gt;
|I have no linux experience, have taught courses on DSP chips before&lt;br /&gt;
|I would like to develop an undergraduate course using the Beagleboard to teach DSP.&lt;br /&gt;
|-&lt;br /&gt;
|Oleg Muratov&lt;br /&gt;
|University of Trento, Itay&lt;br /&gt;
|I am a PhD student and I have limited Linux experience.&lt;br /&gt;
|I am planning to give a course to undergraduate students on DSP probably using some hardware.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Labs ===&lt;br /&gt;
&lt;br /&gt;
Here's an additional handout that didn't make it in time for the printers.&lt;br /&gt;
&lt;br /&gt;
[[VideoThru Lab]]&lt;br /&gt;
&lt;br /&gt;
=== Post Workshop ===&lt;br /&gt;
&lt;br /&gt;
Here ([[Getting_a_Workshop_SD_Image]]) are instructions on how to put the tutorial image on your SD card.&lt;br /&gt;
&lt;br /&gt;
== 2011 IEEE ICASSP Tutorial ==&lt;br /&gt;
{|&lt;br /&gt;
| '''Title:''' &lt;br /&gt;
| From DSP Chips to Embedded Processors for Teaching Digital Signal Processing&lt;br /&gt;
|-&lt;br /&gt;
| '''Presentor:''' &lt;br /&gt;
| Mark A. Yoder&lt;br /&gt;
|-&lt;br /&gt;
| '''Location:''' &lt;br /&gt;
| Prague, Czech Republic&lt;br /&gt;
|-&lt;br /&gt;
| '''Date:''' &lt;br /&gt;
| Sunday May 22nd, 2011, Afternoon&lt;br /&gt;
|-&lt;br /&gt;
| '''Link'''&lt;br /&gt;
| [http://www.icassp2011.com/en/tutorials/tutorial-5]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Abstract:===&lt;br /&gt;
This hands-on tutorial presents ideas on how to use TI’s OMAP 3530-based BeagleBoard (www.BeagleBoard.org) for teaching embedded media processing using Open Source resources. The BeagleBoard is Open Source hardware that has sold over 16,000 units since its introduction less than 2 years ago and has a thriving Open Source Software community.&lt;br /&gt;
Today’s media handling embedded processors have come a long way from the limited performance of 8- or 16-bit embedded processors or the limited functionality of a dedicated DSP chip. Our students need to see that the days of the single DSP chip are almost over and they need to be prepared for working with DSPs embedded with other processors.&lt;br /&gt;
The OMAP3530 processor contains both an ARM Cortex-A9 processor and a ‘C6400 DSP and it and chips like it are being used in products today. &lt;br /&gt;
The workshop activities include:&lt;br /&gt;
#      hands-on exercises to get participants familiar with using the Beagle,&lt;br /&gt;
#      demonstrations of what the Beagle can do, including streaming video and synthesizing speech and&lt;br /&gt;
#      discussions of what topics to include in an embedded Linux class.&lt;br /&gt;
Participants will receive a BeagleBoard and course materials.&lt;br /&gt;
&lt;br /&gt;
=== Pre Tutorial ===&lt;br /&gt;
&lt;br /&gt;
The purpose of this page is to give you practice editing a wiki and to start building a community of BeagleBoard Educators.  Click on the '''edit''' tab above and add your name to the list. You will have to create an eLinux account before you can edit the page.&lt;br /&gt;
&lt;br /&gt;
--Mark&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
! style=&amp;quot;width:20%&amp;quot; | Name&lt;br /&gt;
! style=&amp;quot;width:20%&amp;quot; | School/Company&lt;br /&gt;
! style=&amp;quot;width:30%&amp;quot; | Linux/DSP Background&lt;br /&gt;
! style=&amp;quot;width:30%&amp;quot; | Interests&lt;br /&gt;
|-&lt;br /&gt;
| Mark A. Yoder&lt;br /&gt;
| Rose-Hulman Institute of Technology, &lt;br /&gt;
Terre Haute, Indiana, USA&lt;br /&gt;
| I've been using various flavors of Unix/Linux since the late '70s, but there is always more to learn.&lt;br /&gt;
I've taught a 'C6713 based DSP class years ago. &lt;br /&gt;
| I teach 32-bit embedded with the Beagle [[ECE497 - 32-bit Embedded Linux, Rose-Hulman]].  DSP is appearing everywhere now.  The BeagleBoard is a great environment to teach DSP.&lt;br /&gt;
|-&lt;br /&gt;
|Cathy Wicks&lt;br /&gt;
|Texas Instruments, University Program Manager&lt;br /&gt;
|I am a HUGE fan of Beagleboard and very interested to develop a community of teachers using it. &lt;br /&gt;
|Our Program [http://www.ti.com/university www.ti.com/university] helps academics use TI Hardware, Software and Chips in their projects and curriculum.  &lt;br /&gt;
|-&lt;br /&gt;
|Melani Plett&lt;br /&gt;
|Seattle Pacific University,&lt;br /&gt;
Seattle, Washington, USA&lt;br /&gt;
|I teach an undergraduate signals and systems course.  I have no Linux experience, though I did use Unix years ago.&lt;br /&gt;
|I am thinking of generating a technical elective follow-on class to illustrate the signals and systems concepts on the Beagleboard.&lt;br /&gt;
|-&lt;br /&gt;
|Matt Gately&lt;br /&gt;
|University of Oklahoma, Norman, OK, USA&lt;br /&gt;
|I am a PhD student and I use Linux in my research. &lt;br /&gt;
|I would love to someday teach a DSP course using embedded systems such as FPGA or microcontroller boards. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Labs ===&lt;br /&gt;
&lt;br /&gt;
Here's an additional handout that didn't make it in time for the printers.&lt;br /&gt;
&lt;br /&gt;
[[AudioThru Lab]]&lt;br /&gt;
&lt;br /&gt;
=== Post Tutorial ===&lt;br /&gt;
&lt;br /&gt;
Here ([[Getting_a_Workshop_SD_Image]]) are instructions on how to put the tutorial image on your SD card.&lt;br /&gt;
&lt;br /&gt;
== 2011 IEEE SPEd (Signal Processing Society 14th DSP Workshop &amp;amp; 6th SPEd Workshop) ==&lt;br /&gt;
{|&lt;br /&gt;
| '''Title:''' &lt;br /&gt;
| Moving Beyond the DSP and Teaching 32-bit Embedded Processors Using the BeagleBoard&lt;br /&gt;
|-&lt;br /&gt;
| '''Presentor:''' &lt;br /&gt;
| Mark A. Yoder&lt;br /&gt;
|-&lt;br /&gt;
| '''Location:''' &lt;br /&gt;
| Enchantment Resort, Sedona, Arizona&lt;br /&gt;
|-&lt;br /&gt;
| '''Date:''' &lt;br /&gt;
| Thursday 6 January, 2011  Time: 14:00 - 17:30&lt;br /&gt;
|-&lt;br /&gt;
| '''Link'''&lt;br /&gt;
| [http://enpub.fulton.asu.edu/ivu/Workshops/DSPE2011/training.html#TI2]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Abstract ===&lt;br /&gt;
Today’s media handling embedded processors have come a long way from the limited performance of 8- or 16-bit embedded processors or the limited functionality of a dedicated DSP chip. This 3-hour, hands-on workshop presents ideas on how to use TI’s OMAP 3530-based BeagleBoard ([www.BeagleBoard.org www.BeagleBoard.org]) for teaching embedded media processing using Open Source resources. The OMAP3530 processor contains both an ARM Cortex-A9 processor and a ‘C6400 DSP. The BeagleBoard is Open Source hardware that has sold over 20,000 units since its introduction less than 2 years ago and has a thriving Open Source Software community. The 3-hour workshop activities will include 1) several demonstrations of what the Beagle can do, including streaming video and synthesizing speech, 2) Discussions of what topics to include in an embedded Linux class and 3) Several hands-on exercises to get participants familiar with using the Beagle. Participants will receive a Beagleboard. &lt;br /&gt;
&lt;br /&gt;
=== Post Workshop ===&lt;br /&gt;
Here are some things you might want to do now that the workshop is over.  &lt;br /&gt;
&lt;br /&gt;
Here are instructions on how to create the SD card that was used in the workshop.&lt;br /&gt;
* Go here ([[ECE597_Getting_your_Beagle_running_(precompiled)#From_beagleboard-validation.s3.amazonaws.com]]) to download and install the base image for the Beagle.  This will install the kernel and all the files needed to run many of the demos.&lt;br /&gt;
* Download [http://www.rose-hulman.edu/~yoder/Beagle/SPEd2011WorkshopFiles.zip this zip file] to get the extra files used in the workshop. Copy it to your BeagleBoard and unzip it there.  This file contains the '''VideoThru''', '''c6run_target''', '''hello.c''' and '''helloBeagle.c''' files.&lt;br /&gt;
* Download the workshop pptx [http://www.rose-hulman.edu/~yoder/Beagle/SPEd2011WorkshopPPTX.zip here].&lt;br /&gt;
&lt;br /&gt;
=== Pre Workshop === &lt;br /&gt;
If you are an overachiever (not required) go here ([[ECE497 Lab13 Using the DSP via c6run]]) to learn how to install the ARM and DSP development tools on your Linux system (Ubuntu 10.4 LTS is required).  If you don't have Ubuntu installed, go [http://processors.wiki.ti.com/index.php/How_to_Build_a_Ubuntu_Linux_host_under_VirtualBox here] to learn how to install it in a virtual machine under windows.&lt;br /&gt;
&lt;br /&gt;
These installs are not required for the workshop; however editing the the table below ''is''.&lt;br /&gt;
&lt;br /&gt;
The purpose of this page is to give you practice editing a wiki and to start building a community of BeagleBoard Educators.  Click on the '''edit''' tab above and add your name to the list. You will have to create an eLinux account before you can edit the page.&lt;br /&gt;
&lt;br /&gt;
--Mark&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
! style=&amp;quot;width:20%&amp;quot; | Name&lt;br /&gt;
! style=&amp;quot;width:20%&amp;quot; | School/Company&lt;br /&gt;
! style=&amp;quot;width:30%&amp;quot; | Linux/DSP Background&lt;br /&gt;
! style=&amp;quot;width:30%&amp;quot; | Interests&lt;br /&gt;
|-&lt;br /&gt;
| Mark A. Yoder&lt;br /&gt;
| Rose-Hulman Institute of Technology, &lt;br /&gt;
Terre Haute, Indiana, USA&lt;br /&gt;
| I've been using various flavors of Unix/Linux since the late '70s, but there is always more to learn.&lt;br /&gt;
I've taught a 'C6713 based DSP class years ago. &lt;br /&gt;
| I teach 32-bit embedded with the Beagle.  DSP is appearing everywhere now.  The BeagleBoard is a great environment to teach DSP.&lt;br /&gt;
|-&lt;br /&gt;
|Cathy Wicks&lt;br /&gt;
|Texas Instruments, University Program Manager&lt;br /&gt;
|I am a HUGE fan of Beagleboard and very interested to develop a community of teachers using it. &lt;br /&gt;
|Our Program www.ti.com/university helps academics use TI Hardware, Software and Chips in their projects and curriculum.  &lt;br /&gt;
|-&lt;br /&gt;
| Steve Chadwick&lt;br /&gt;
| Embry-Riddle Aeronautical University, Prescott, AZ &lt;br /&gt;
| Very new to DSP and hoping develop sufficient depth to teach it next academic year. &lt;br /&gt;
| Interests: Pretty much everything in science. &lt;br /&gt;
|-&lt;br /&gt;
| Mark Wickert&lt;br /&gt;
| University of Colorado, Colorado Springs, CO, USA&lt;br /&gt;
| I have played on and off with Linux for about 10 years, never done any real-time DSP under this OS however.&lt;br /&gt;
| I regularly teach DSP and related courses. I am using the C6713 today, but ready to move forward. I recently started playing with ARM processors (not the BeagleBoard until now).&lt;br /&gt;
|-&lt;br /&gt;
| Shane Cotter&lt;br /&gt;
| Union College, Schenectady, NY&lt;br /&gt;
| I have taught DSP courses. I have used Unix/Linux in the past but not for real-time DSP.&lt;br /&gt;
| The Beagleboard seems like a great platform and I'm interested in learning about it and its potential uses in courses.&lt;br /&gt;
|-&lt;br /&gt;
| Jake Gunther&lt;br /&gt;
| Utah State University&lt;br /&gt;
| I have taught DSP and communication systems for over ten years.&lt;br /&gt;
| I want to move from a simulation-based teaching approach to a real-time approach.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== 2010 ICASSP Workshop ==&lt;br /&gt;
{|&lt;br /&gt;
| '''Title:''' &lt;br /&gt;
| 32-bit Embedded Linux-based Signal Processing – Hands on Workshop&lt;br /&gt;
|-&lt;br /&gt;
| '''Presentor:''' &lt;br /&gt;
| Mark A. Yoder&lt;br /&gt;
|-&lt;br /&gt;
| '''Location:''' &lt;br /&gt;
| ICASSP 2010, Dallas, Texas&lt;br /&gt;
|-&lt;br /&gt;
| '''Date:''' &lt;br /&gt;
| Monday, March 15 2010, 13:30 - 17:00&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The purpose of this page is to give you practice editing a wiki and to start building a community of BeagleBoard Educators.  Click on the '''edit''' tab above and add your name to the list.&lt;br /&gt;
&lt;br /&gt;
--Mark&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
! style=&amp;quot;width:20%&amp;quot; | Name&lt;br /&gt;
! style=&amp;quot;width:20%&amp;quot; | School/Company&lt;br /&gt;
! style=&amp;quot;width:20%&amp;quot; | email&lt;br /&gt;
! style=&amp;quot;width:40%&amp;quot; | Interests&lt;br /&gt;
|-&lt;br /&gt;
| Mark A. Yoder&lt;br /&gt;
| Rose-Hulman Institute of Technology, &lt;br /&gt;
Terre Haute, Indiana, USA&lt;br /&gt;
| [http://www.rose-hulman.edu/~yoder]&lt;br /&gt;
| I teach 32-bit embedded with the Beagle.  DSP is appearing everywhere now.  The BeagleBoard is a great environment to teach DSP.&lt;br /&gt;
|-&lt;br /&gt;
|David V. Anderson&lt;br /&gt;
|Georgia Institute of Technology&lt;br /&gt;
|&lt;br /&gt;
|Teaching DSP using BeagleBoard as a real-time platform.&lt;br /&gt;
|-&lt;br /&gt;
|Andres Kwasinski&lt;br /&gt;
|Rochester Institute of Technology&lt;br /&gt;
|[http://people.rit.edu/axkeec/]&lt;br /&gt;
|Teaching DSP to Computer Engineers using real-world platforms.&lt;br /&gt;
|-&lt;br /&gt;
|Roger West&lt;br /&gt;
|Utah State University&lt;br /&gt;
|&lt;br /&gt;
|Teaching DSP to ECE students using real-time platforms.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Labs ===&lt;br /&gt;
Here is a list of the hands on exercises we will be doing in the 2010 workshop.  Many have suggestions for additional homework that you can do once you are back home and have a network connection.&lt;br /&gt;
&lt;br /&gt;
# [[2010 ICASSP Lab 1 Wiring_and_Running the Beagle]]&lt;br /&gt;
# [[2010 ICASSP Lab 2 The Boot Sequence]]&lt;br /&gt;
&lt;br /&gt;
{{YoderFoot}}&lt;/div&gt;</summary>
		<author><name>Yoder</name></author>	</entry>

	<entry>
		<id>http://www.elinux.org/ASEE_2013_Workshop</id>
		<title>ASEE 2013 Workshop</title>
		<link rel="alternate" type="text/html" href="http://www.elinux.org/ASEE_2013_Workshop"/>
				<updated>2013-06-17T16:19:36Z</updated>
		
		<summary type="html">&lt;p&gt;Yoder: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:ECE497 |Workshop]]&lt;br /&gt;
{{YoderHead}}&lt;br /&gt;
Here are the labs for the afternoon Linux part of the [http://www.asee.org/public/conferences/20/registration/view_session?session_id=2420 ASEE 2013 Workshop]&lt;br /&gt;
&lt;br /&gt;
== Warm Up ==&lt;br /&gt;
[[File:PuTTYconfiguration.jpg|thumbnail]]&lt;br /&gt;
Before we can interact with LEDs and switches we need to learn some simple Linux commands. &lt;br /&gt;
# On your host computer, running Windows, start up '''puTTY'''.  &lt;br /&gt;
# If you get a ''Security Warning'', click '''Run'''.&lt;br /&gt;
# Enter '''192.167.7.2''' in the '''Host Name''' field and click '''Open'''&lt;br /&gt;
# Login as '''root''' with no password.&lt;br /&gt;
# Enter '''ls'''  to list what files you have. You shouldn't see much.&lt;br /&gt;
[[File:PuTTYloging.jpg|thumbnail]]&lt;br /&gt;
&lt;br /&gt;
At this point you need to learn a few simple Linux commands for creating and displaying files. Once you know these commands it's easy to turn an LED on and off.&lt;br /&gt;
&lt;br /&gt;
First, let's edit a file using the '''nano''' editor.  Nano is a simple editor that easy to learn. This will edit (and create) the file '''play.txt'''.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''nano play.txt'''&lt;br /&gt;
&lt;br /&gt;
Add a couple of lines of text to the file, it doesn't really matter what and then Exit. You can list the files in the current directory with '''ls''' and show the contents of a file with '''cat'''.&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 Desktop  play.txt&lt;br /&gt;
 bone$ '''cat play.txt'''&lt;br /&gt;
 A couple of lines&lt;br /&gt;
 of text.&lt;br /&gt;
&lt;br /&gt;
Use '''echo''' to print a line of text.&lt;br /&gt;
 bone$ '''echo This is a line of text'''&lt;br /&gt;
 This is a line of text&lt;br /&gt;
&lt;br /&gt;
Here's a powerful operator.  You can take the output of any command and redirect it to a file with '''&amp;gt;'''.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo This is a line of text &amp;gt; here.txt'''&lt;br /&gt;
 bone$ '''cat here.txt'''&lt;br /&gt;
 This is a line of text&lt;br /&gt;
&lt;br /&gt;
We are almost there.  Use '''cd''' to change directories.  '''/''' is the top level directory.&lt;br /&gt;
 bone$ '''cd /'''&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 bin   dev  home  lost+found  mnt   run   sys  usr&lt;br /&gt;
 boot  etc  lib   media       proc  sbin  tmp  var&lt;br /&gt;
&lt;br /&gt;
If you ever get lost, '''cd''' alone takes you home.&lt;br /&gt;
 bone$ '''cd'''&lt;br /&gt;
 gone$ '''ls'''&lt;br /&gt;
 Desktop  here.txt  play.txt&lt;br /&gt;
&lt;br /&gt;
Now you are ready to flash an LED.&lt;br /&gt;
&lt;br /&gt;
== Blinking an LED ==&lt;br /&gt;
=== gpio via the Shell Command Line and sysfs ===&lt;br /&gt;
&lt;br /&gt;
Another easy way to do general purpose I/O (gpio) on the Beagle is through a terminal window and a shell prompt. In Linux, almost everything is treated as a file, even things that aren't files. Here we'll use a virtual file system called '''sysfs'''.  sysfs exposes the drivers for the hardware so you can easily use them.&lt;br /&gt;
&lt;br /&gt;
Try this:&lt;br /&gt;
 bone$ '''cd /sys'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 block/  bus/  class/  dev/  devices/  firmware/  fs/  kernel/  module/  power/&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;'''/'''&amp;quot; after the name means it's a directory. Here we see several directories that represent hardware we can control. Explore a bit and see what you find.&lt;br /&gt;
&lt;br /&gt;
Now try:&lt;br /&gt;
&lt;br /&gt;
 beagle$ '''cd /sys/class'''&lt;br /&gt;
 beagle$ '''ls -F'''&lt;br /&gt;
 backlight/  firmware/     lcd/       mtd/           scsi_disk/   ubi/&lt;br /&gt;
 bdi/        gpio/         leds/      net/           scsi_host/   udc/&lt;br /&gt;
 block/      graphics/     mbox/      power_supply/  sound/       uio/&lt;br /&gt;
 bluetooth/  hwmon/        mdio_bus/  regulator/     spi_master/  usbmon/&lt;br /&gt;
 bsg/        i2c-adapter/  mem/       rfkill/        spidev/      vc/&lt;br /&gt;
 dma/        i2c-dev/      misc/      rtc/           thermal/     vtconsole/&lt;br /&gt;
 drm/        input/        mmc_host/  scsi_device/   tty/         watchdog/&lt;br /&gt;
&lt;br /&gt;
Explore some.  &lt;br /&gt;
&lt;br /&gt;
=== Blinking a USR LED ===&lt;br /&gt;
The Beagle Black has four user LEDS, '''user0''' - '''user3''', that you can control. Try this:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/class/leds'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 beaglebone:green:usr0  beaglebone:green:usr2&lt;br /&gt;
 beaglebone:green:usr1  beaglebone:green:usr3&lt;br /&gt;
&lt;br /&gt;
Here you see the directories for controlling each of the usr LEDs. By default, usr0 flashes a heartbeat pattern and usr1 flashes when the micro SD card is accessed.  Let's control usr0.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd beagleboard\:\:usr0'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 brightness  device@  max_brightness  power/  subsystem@  trigger  uevent&lt;br /&gt;
&lt;br /&gt;
(The &amp;quot;'''@'''&amp;quot; after the name means it's a link.)  See what's in '''brightness''', '''max_brightness''' and '''trigger''' by using the &amp;lt;code&amp;gt;cat&amp;lt;/code&amp;gt; command.  For example:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cat trigger'''&lt;br /&gt;
 none nand-disk mmc0 timer oneshot [heartbeat] backlight gpio cpu0 default-on transient&lt;br /&gt;
&lt;br /&gt;
This shows trigger can have many values.  The present value is '''heartbeat'''.  Check the LED, is it beating?  You can stop the heartbeat via:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo none &amp;gt; trigger'''&lt;br /&gt;
 bone$ '''cat trigger'''&lt;br /&gt;
 [none] nand-disk mmc0 timer oneshot heartbeat backlight gpio cpu0 default-on transient &lt;br /&gt;
&lt;br /&gt;
Did it stop beating?  You can now turn it on and off with:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; brightness'''&lt;br /&gt;
 bone$ '''echo 0 &amp;gt; brightness'''&lt;br /&gt;
&lt;br /&gt;
Is it responding correctly?&lt;br /&gt;
&lt;br /&gt;
The Bone has more trigger options.  Try:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cat trigger'''&lt;br /&gt;
 [none] mmc0 timer heartbeat backlight gpio default-on &lt;br /&gt;
 bone$ '''echo timer &amp;gt; trigger'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 brightness  delay_on  max_brightness  subsystem@  uevent&lt;br /&gt;
 delay_off   device@   power/          trigger&lt;br /&gt;
 bone$ '''echo 100 &amp;gt; delay_on'''&lt;br /&gt;
 bone$ '''echo 900 &amp;gt; delay_off'''&lt;br /&gt;
&lt;br /&gt;
What does this do?&lt;br /&gt;
&lt;br /&gt;
=== Blinking an External LED via gpio ===&lt;br /&gt;
&lt;br /&gt;
In the AM lab we wired an LED to the P9_12 General Purpose IO (gpio) port and controlled it via BoneScript.  Here we'll control it via a shell command. First we need to figure out which gpio pin P9_12 is attached to.  The following figure shows it attached to gpio_60.&lt;br /&gt;
&lt;br /&gt;
[[File:P9PWMs.jpg | 600px]]&lt;br /&gt;
&lt;br /&gt;
Here's how you turn it on&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/class/gpio'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  gpiochip0@  gpiochip32@  gpiochip64@  gpiochip96@  unexport&lt;br /&gt;
&lt;br /&gt;
Presently no gpio pins are visible.  You need to tell it which pin to export&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo 60 &amp;gt; export'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  gpio60@  gpiochip0@  gpiochip32@  gpiochip64@  gpiochip96@  unexport&lt;br /&gt;
&lt;br /&gt;
Notice '''gpio60''' has appeared.  All we need to do is tell it which direction and then turn it on.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd gpio60'''&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 active_low  direction  edge  power  subsystem  uevent  value&lt;br /&gt;
 bone$ '''echo out &amp;gt; direction'''&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; value'''&lt;br /&gt;
Your LED should be on!&lt;br /&gt;
 bone$ '''echo 0 &amp;gt; value'''&lt;br /&gt;
Now it's off.&lt;br /&gt;
&lt;br /&gt;
== Reading a switch ==&lt;br /&gt;
&lt;br /&gt;
Now that you have an LED working, wiring in a switch is easy.  In the AM lab you wired a switch to P9_42, which from the table above is '''gpio_7'''. &lt;br /&gt;
&lt;br /&gt;
Based on what you saw above.&lt;br /&gt;
 bone$ '''cd /sys/class/gpio'''&lt;br /&gt;
 bone$ '''echo 7 &amp;gt; export'''&lt;br /&gt;
 bone$ '''cd gpio7'''&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 bone$ '''echo in &amp;gt; direction'''&lt;br /&gt;
 bone$ '''cat value'''&lt;br /&gt;
 0&lt;br /&gt;
Now hold the button down and try again.&lt;br /&gt;
 bone$ '''cat value'''&lt;br /&gt;
 1&lt;br /&gt;
Once you have the switch and LED working use '''nano''' and put the following in a file.&lt;br /&gt;
 bone$ '''cd'''  (Go back home)&lt;br /&gt;
 bone$ '''nano button.sh'''&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 cd /sys/class/gpio&lt;br /&gt;
 while [ 1 ]&lt;br /&gt;
 do&lt;br /&gt;
    cat gpio7/value&lt;br /&gt;
    sleep 0.25&lt;br /&gt;
 done&lt;br /&gt;
Quit nano and run&lt;br /&gt;
 bone$ '''chmod +x button.sh'''  (This makes button.sh executable)&lt;br /&gt;
 bone$ '''./button.sh'''&lt;br /&gt;
What happens when you push the button? Hit '''Ctrl-C''' to quit button.sh.&lt;br /&gt;
&lt;br /&gt;
Now experiment around. Can you flash the LED? How fast? Make the LED read the switch.&lt;br /&gt;
&lt;br /&gt;
== Analog In ==&lt;br /&gt;
The bone has eight Analog Inputs.  Several are exposed on P9.  They are labeled '''AIN''' in the table below.  How many do you find?&lt;br /&gt;
&lt;br /&gt;
[[File:P9PWMs.jpg|800px]]&lt;br /&gt;
&lt;br /&gt;
The AIN pins are sampled at 12 bits and 100k samples per second.  The input voltage is between 0 and 1.8V.  Fortunately, both voltages are available on P9.&lt;br /&gt;
&lt;br /&gt;
You've already wired up P9_39 for AIN0 in the AM lab. You interact with the analog in much like the gpio, but it appears in a different place. We have to run a command before the AIN interface appears.  Just run them now, later I'll explain what you did if you are interested.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''SLOTS=/sys/devices/bone_capemgr.*/slots'''&lt;br /&gt;
 bone$ '''echo cape-bone-iio &amp;gt; $SLOTS'''&lt;br /&gt;
&lt;br /&gt;
You can now access the analog interface, let's explore.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/devices/ocp.2/helper.14'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 AIN0  AIN2  AIN4  AIN6  driver@   power/      uevent&lt;br /&gt;
 AIN1  AIN3  AIN5  AIN7  modalias  subsystem@&lt;br /&gt;
 bone$ '''cat AIN0'''&lt;br /&gt;
 1185&lt;br /&gt;
&lt;br /&gt;
Change the pot and rerun '''cat'''.  What's the min and max value you get?  Is it 12 bits?&lt;br /&gt;
&lt;br /&gt;
You can use the following script to continuously read the input and print it on the same line.&lt;br /&gt;
 bone$ '''cd'''&lt;br /&gt;
 bone$ '''nano ainOut.sh'''&lt;br /&gt;
&lt;br /&gt;
 cd /sys/devices/ocp.2/helper.14&lt;br /&gt;
 while [ 1 ]&lt;br /&gt;
   do &lt;br /&gt;
   tr '\n' '\r' &amp;lt; AIN0&lt;br /&gt;
 done&lt;br /&gt;
&lt;br /&gt;
 bone$ '''chmod +x ainOut.sh'''&lt;br /&gt;
 bone$ '''./ainOut.sh'''&lt;br /&gt;
Use '''Ctrl-C''' to quit ainOut.sh&lt;br /&gt;
&lt;br /&gt;
== Pulse Width Modulation ==&lt;br /&gt;
&lt;br /&gt;
(Note: The pwm interface seems to changing. Some of this may not apply in the future.)&lt;br /&gt;
&lt;br /&gt;
We have to run a couple of commands to make the PWM interface appear.  Try&lt;br /&gt;
 bone$ '''SLOTS=/sys/devices/bone_capemgr.*/slots'''&lt;br /&gt;
 bone$ '''echo am33xx_pwm     &amp;gt; $SLOTS'''&lt;br /&gt;
 bone$ '''echo bone_pwm_P9_21 &amp;gt; $SLOTS'''&lt;br /&gt;
 bone$ '''cd /sys/devices/ocp.2/pwm_test_P9_21.14'''&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 driver  duty  modalias  period  polarity  power  run  subsystem  uevent&lt;br /&gt;
&lt;br /&gt;
The units are in ns.&lt;br /&gt;
Try a 1Hz frequency with a 25% duty cycle&lt;br /&gt;
 bone$ '''echo 1000000000 &amp;gt; period'''&lt;br /&gt;
 bone$ '''echo  250000000 &amp;gt; duty'''&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; run'''&lt;br /&gt;
&lt;br /&gt;
Connect the LED from and watch it flash.  Try changing the frequency and duty cycle.  You may have to set the duty cycle to 0 to change the frequency.  Can you guess why?&lt;br /&gt;
&lt;br /&gt;
=== Challenge ===&lt;br /&gt;
Combine the analog in and the PWM by having the pot control the frequency or the duty cycle of the LED.&lt;br /&gt;
 &lt;br /&gt;
== Other Languages ==&lt;br /&gt;
Out-of-the-box the bone can run&lt;br /&gt;
* C&lt;br /&gt;
* C++&lt;br /&gt;
* bash&lt;br /&gt;
* perl&lt;br /&gt;
* python&lt;br /&gt;
* Javascript&lt;br /&gt;
&lt;br /&gt;
Here's a simple C example&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd'''&lt;br /&gt;
 bone$ '''nano hello.c'''&lt;br /&gt;
 '''#include &amp;lt;stdio.h&amp;gt;'''&lt;br /&gt;
 '''main ()'''&lt;br /&gt;
 '''{'''&lt;br /&gt;
 '''        printf(&amp;quot;hello, world\n&amp;quot;);'''&lt;br /&gt;
 '''}'''&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cc hello.c'''&lt;br /&gt;
 bone$ '''./a.out'''&lt;br /&gt;
 hello, world&lt;br /&gt;
&lt;br /&gt;
Try your favorite language.&lt;br /&gt;
&lt;br /&gt;
{{YoderFoot}}&lt;/div&gt;</summary>
		<author><name>Yoder</name></author>	</entry>

	<entry>
		<id>http://www.elinux.org/ASEE_2013_Workshop</id>
		<title>ASEE 2013 Workshop</title>
		<link rel="alternate" type="text/html" href="http://www.elinux.org/ASEE_2013_Workshop"/>
				<updated>2013-06-17T16:15:06Z</updated>
		
		<summary type="html">&lt;p&gt;Yoder: /* Other Languages */ Added hello, world&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:ECE497 |Workshop]]&lt;br /&gt;
{{YoderHead}}&lt;br /&gt;
Here are the labs for the afternoon Linux part of the [http://www.asee.org/public/conferences/20/registration/view_session?session_id=2420 ASEE 2013 Workshop]&lt;br /&gt;
&lt;br /&gt;
== Warm Up ==&lt;br /&gt;
[[File:PuTTYconfiguration.jpg|thumbnail]]&lt;br /&gt;
Before we can interact with LEDs and switches we need to learn some simple Linux commands. &lt;br /&gt;
# On your host computer, running Windows, start up '''puTTY'''.  &lt;br /&gt;
# If you get a ''Security Warning'', click '''Run'''.&lt;br /&gt;
# Enter '''192.167.7.2''' in the '''Host Name''' field and click '''Open'''&lt;br /&gt;
# Login as '''root''' with no password.&lt;br /&gt;
# Enter '''ls'''  to list what files you have. You shouldn't see much.&lt;br /&gt;
[[File:PuTTYloging.jpg|thumbnail]]&lt;br /&gt;
&lt;br /&gt;
At this point you need to learn a few simple Linux commands for creating and displaying files. Once you know these commands it's easy to turn an LED on and off.&lt;br /&gt;
&lt;br /&gt;
First, let's edit a file using the '''nano''' editor.  Nano is a simple editor that easy to learn. This will edit (and create) the file '''play.txt'''.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''nano play.txt'''&lt;br /&gt;
&lt;br /&gt;
Add a couple of lines of text to the file, it doesn't really matter what and then Exit. You can list the files in the current directory with '''ls''' and show the contents of a file with '''cat'''.&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 Desktop  play.txt&lt;br /&gt;
 bone$ '''cat play.txt'''&lt;br /&gt;
 A couple of lines&lt;br /&gt;
 of text.&lt;br /&gt;
&lt;br /&gt;
Use '''echo''' to print a line of text.&lt;br /&gt;
 bone$ '''echo This is a line of text'''&lt;br /&gt;
 This is a line of text&lt;br /&gt;
&lt;br /&gt;
Here's a powerful operator.  You can take the output of any command and redirect it to a file with '''&amp;gt;'''.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo This is a line of text &amp;gt; here.txt'''&lt;br /&gt;
 bone$ '''cat here.txt'''&lt;br /&gt;
 This is a line of text&lt;br /&gt;
&lt;br /&gt;
We are almost there.  Use '''cd''' to change directories.  '''/''' is the top level directory.&lt;br /&gt;
 bone$ '''cd /'''&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 bin   dev  home  lost+found  mnt   run   sys  usr&lt;br /&gt;
 boot  etc  lib   media       proc  sbin  tmp  var&lt;br /&gt;
&lt;br /&gt;
If you ever get lost, '''cd''' alone takes you home.&lt;br /&gt;
 bone$ '''cd'''&lt;br /&gt;
 gone$ '''ls'''&lt;br /&gt;
 Desktop  here.txt  play.txt&lt;br /&gt;
&lt;br /&gt;
Now you are ready to flash an LED.&lt;br /&gt;
&lt;br /&gt;
== Blinking an LED ==&lt;br /&gt;
=== gpio via the Shell Command Line and sysfs ===&lt;br /&gt;
&lt;br /&gt;
Another easy way to do general purpose I/O (gpio) on the Beagle is through a terminal window and a shell prompt. In Linux, almost everything is treated as a file, even things that aren't files. Here we'll use a virtual file system called '''sysfs'''.  sysfs exposes the drivers for the hardware so you can easily use them.&lt;br /&gt;
&lt;br /&gt;
Try this:&lt;br /&gt;
 bone$ '''cd /sys'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 block/  bus/  class/  dev/  devices/  firmware/  fs/  kernel/  module/  power/&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;'''/'''&amp;quot; after the name means it's a directory. Here we see several directories that represent hardware we can control. Explore a bit and see what you find.&lt;br /&gt;
&lt;br /&gt;
Now try:&lt;br /&gt;
&lt;br /&gt;
 beagle$ '''cd /sys/class'''&lt;br /&gt;
 beagle$ '''ls -F'''&lt;br /&gt;
 backlight/  firmware/     lcd/       mtd/           scsi_disk/   ubi/&lt;br /&gt;
 bdi/        gpio/         leds/      net/           scsi_host/   udc/&lt;br /&gt;
 block/      graphics/     mbox/      power_supply/  sound/       uio/&lt;br /&gt;
 bluetooth/  hwmon/        mdio_bus/  regulator/     spi_master/  usbmon/&lt;br /&gt;
 bsg/        i2c-adapter/  mem/       rfkill/        spidev/      vc/&lt;br /&gt;
 dma/        i2c-dev/      misc/      rtc/           thermal/     vtconsole/&lt;br /&gt;
 drm/        input/        mmc_host/  scsi_device/   tty/         watchdog/&lt;br /&gt;
&lt;br /&gt;
Explore some.  &lt;br /&gt;
&lt;br /&gt;
=== Blinking a USR LED ===&lt;br /&gt;
The Beagle Black has four user LEDS, '''user0''' - '''user3''', that you can control. Try this:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/class/leds'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 beaglebone:green:usr0  beaglebone:green:usr2&lt;br /&gt;
 beaglebone:green:usr1  beaglebone:green:usr3&lt;br /&gt;
&lt;br /&gt;
Here you see the directories for controlling each of the usr LEDs. By default, usr0 flashes a heartbeat pattern and usr1 flashes when the micro SD card is accessed.  Let's control usr0.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd beagleboard\:\:usr0'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 brightness  device@  max_brightness  power/  subsystem@  trigger  uevent&lt;br /&gt;
&lt;br /&gt;
(The &amp;quot;'''@'''&amp;quot; after the name means it's a link.)  See what's in '''brightness''', '''max_brightness''' and '''trigger''' by using the &amp;lt;code&amp;gt;cat&amp;lt;/code&amp;gt; command.  For example:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cat trigger'''&lt;br /&gt;
 none nand-disk mmc0 timer oneshot [heartbeat] backlight gpio cpu0 default-on transient&lt;br /&gt;
&lt;br /&gt;
This shows trigger can have many values.  The present value is '''heartbeat'''.  Check the LED, is it beating?  You can stop the heartbeat via:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo none &amp;gt; trigger'''&lt;br /&gt;
 bone$ '''cat trigger'''&lt;br /&gt;
 [none] nand-disk mmc0 timer oneshot heartbeat backlight gpio cpu0 default-on transient &lt;br /&gt;
&lt;br /&gt;
Did it stop beating?  You can now turn it on and off with:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; brightness'''&lt;br /&gt;
 bone$ '''echo 0 &amp;gt; brightness'''&lt;br /&gt;
&lt;br /&gt;
Is it responding correctly?&lt;br /&gt;
&lt;br /&gt;
The Bone has more trigger options.  Try:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cat trigger'''&lt;br /&gt;
 [none] mmc0 timer heartbeat backlight gpio default-on &lt;br /&gt;
 bone$ '''echo timer &amp;gt; trigger'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 brightness  delay_on  max_brightness  subsystem@  uevent&lt;br /&gt;
 delay_off   device@   power/          trigger&lt;br /&gt;
 bone$ '''echo 100 &amp;gt; delay_on'''&lt;br /&gt;
 bone$ '''echo 900 &amp;gt; delay_off'''&lt;br /&gt;
&lt;br /&gt;
What does this do?&lt;br /&gt;
&lt;br /&gt;
=== Blinking an External LED via gpio ===&lt;br /&gt;
&lt;br /&gt;
In the AM lab we wired an LED to the P9_12 General Purpose IO (gpio) port and controlled it via BoneScript.  Here we'll control it via a shell command. First we need to figure out which gpio pin P9_12 is attached to.  The following figure shows it attached to gpio_60.&lt;br /&gt;
&lt;br /&gt;
[[File:P9PWMs.jpg | 600px]]&lt;br /&gt;
&lt;br /&gt;
Here's how you turn it on&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/class/gpio'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  gpiochip0@  gpiochip32@  gpiochip64@  gpiochip96@  unexport&lt;br /&gt;
&lt;br /&gt;
Presently no gpio pins are visible.  You need to tell it which pin to export&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo 60 &amp;gt; export'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  gpio60@  gpiochip0@  gpiochip32@  gpiochip64@  gpiochip96@  unexport&lt;br /&gt;
&lt;br /&gt;
Notice '''gpio60''' has appeared.  All we need to do is tell it which direction and then turn it on.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd gpio60'''&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 active_low  direction  edge  power  subsystem  uevent  value&lt;br /&gt;
 bone$ '''echo out &amp;gt; direction'''&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; value'''&lt;br /&gt;
Your LED should be on!&lt;br /&gt;
 bone$ '''echo 0 &amp;gt; value'''&lt;br /&gt;
Now it's off.&lt;br /&gt;
&lt;br /&gt;
== Reading a switch ==&lt;br /&gt;
&lt;br /&gt;
Now that you have an LED working, wiring in a switch is easy.  In the AM lab you wired a switch to P9_42, which from the table above is '''gpio_7'''. &lt;br /&gt;
&lt;br /&gt;
Based on what you saw above.&lt;br /&gt;
 bone$ '''cd /sys/class/gpio'''&lt;br /&gt;
 bone$ '''echo 7 &amp;gt; export'''&lt;br /&gt;
 bone$ '''cd gpio7'''&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 bone$ '''echo in &amp;gt; direction'''&lt;br /&gt;
 bone$ '''cat value'''&lt;br /&gt;
 0&lt;br /&gt;
Now hold the button down and try again.&lt;br /&gt;
 bone$ '''cat value'''&lt;br /&gt;
 1&lt;br /&gt;
Once you have the switch and LED working use '''nano''' and put the following in a file.&lt;br /&gt;
 bone$ '''cd'''  (Go back home)&lt;br /&gt;
 bone$ '''nano button.sh'''&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 cd /sys/class/gpio&lt;br /&gt;
 while [ 1 ]&lt;br /&gt;
 do&lt;br /&gt;
    cat gpio7/value&lt;br /&gt;
    sleep 0.25&lt;br /&gt;
 done&lt;br /&gt;
Quit nano and run&lt;br /&gt;
 bone$ '''chmod +x button.sh'''  (This makes button.sh executable)&lt;br /&gt;
 bone$ '''./button.sh'''&lt;br /&gt;
What happens when you push the button? Hit '''Ctrl-C''' to quit button.sh.&lt;br /&gt;
&lt;br /&gt;
Now experiment around. Can you flash the LED? How fast? Make the LED read the switch.&lt;br /&gt;
&lt;br /&gt;
== Analog In ==&lt;br /&gt;
The bone has eight Analog Inputs.  Several are exposed on P9.  They are labeled '''AIN''' in the table below.  How many do you find?&lt;br /&gt;
&lt;br /&gt;
[[File:P9PWMs.jpg|800px]]&lt;br /&gt;
&lt;br /&gt;
The AIN pins are sampled at 12 bits and 100k samples per second.  The input voltage is between 0 and 1.8V.  Fortunately, both voltages are available on P9.&lt;br /&gt;
&lt;br /&gt;
You've already wired up P9_39 for AIN0 in the AM lab. You interact with the analog in much like the gpio, but it appears in a different place. We have to run a command before the AIN interface appears.  Just run them now, later I'll explain what you did if you are interested.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''SLOTS=/sys/devices/bone_capemgr.*/slots'''&lt;br /&gt;
 bone$ '''echo cape-bone-iio &amp;gt; $SLOTS'''&lt;br /&gt;
&lt;br /&gt;
You can now access the analog interface, let's explore.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/devices/ocp.2/helper.14'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 AIN0  AIN2  AIN4  AIN6  driver@   power/      uevent&lt;br /&gt;
 AIN1  AIN3  AIN5  AIN7  modalias  subsystem@&lt;br /&gt;
 bone$ '''cat AIN0'''&lt;br /&gt;
 1185&lt;br /&gt;
&lt;br /&gt;
Change the pot and rerun '''cat'''.  What's the min and max value you get?  Is it 12 bits?&lt;br /&gt;
&lt;br /&gt;
You can use the following script to continuously read the input and print it on the same line.&lt;br /&gt;
 bone$ '''cd'''&lt;br /&gt;
 bone$ '''nano ainOut.sh'''&lt;br /&gt;
&lt;br /&gt;
 cd /sys/devices/ocp.2/helper.14&lt;br /&gt;
 while [ 1 ]&lt;br /&gt;
   do &lt;br /&gt;
   tr '\n' '\r' &amp;lt; AIN0&lt;br /&gt;
 done&lt;br /&gt;
&lt;br /&gt;
 bone$ '''chmod +x ainOut.sh'''&lt;br /&gt;
 bone$ '''./ainOut.sh'''&lt;br /&gt;
Use '''Ctrl-C''' to quit ainOut.sh&lt;br /&gt;
&lt;br /&gt;
== Pulse Width Modulation ==&lt;br /&gt;
&lt;br /&gt;
(Note: The pwm interface seems to changing. Some of this may not apply in the future.)&lt;br /&gt;
&lt;br /&gt;
We have to run a couple of commands to make the PWM interface appear.  Try&lt;br /&gt;
 bone$ '''SLOTS=/sys/devices/bone_capemgr.*/slots'''&lt;br /&gt;
 bone$ '''echo am33xx_pwm     &amp;gt; $SLOTS'''&lt;br /&gt;
 bone$ '''echo bone_pwm_P9_21 &amp;gt; $SLOTS'''&lt;br /&gt;
 bone$ '''cd /sys/devices/ocp.2/pwm_test_P9_21.14'''&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 driver  duty  modalias  period  polarity  power  run  subsystem  uevent&lt;br /&gt;
&lt;br /&gt;
The units are in ns.&lt;br /&gt;
Try a 1Hz frequency with a 25% duty cycle&lt;br /&gt;
 bone$ '''echo 1000000000 &amp;gt; period'''&lt;br /&gt;
 bone$ '''echo  250000000 &amp;gt; duty'''&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; run'''&lt;br /&gt;
&lt;br /&gt;
Connect the LED from and watch it flash.  Try changing the frequency and duty cycle.  You may have to set the duty cycle to 0 to change the frequency.  Can you guess why?&lt;br /&gt;
&lt;br /&gt;
=== Challenge ===&lt;br /&gt;
Combine the analog in and the PWM by having the pot control the frequency or the duty cycle of the LED.&lt;br /&gt;
 &lt;br /&gt;
== Other Languages ==&lt;br /&gt;
Out-of-the-box the bone can run&lt;br /&gt;
* C&lt;br /&gt;
* C++&lt;br /&gt;
* bash&lt;br /&gt;
* perl&lt;br /&gt;
* python&lt;br /&gt;
* Javascript&lt;br /&gt;
&lt;br /&gt;
Here's a simple C example&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd'''&lt;br /&gt;
 bone$ '''nano'''&lt;br /&gt;
 '''#include &amp;lt;stdio.h&amp;gt;'''&lt;br /&gt;
 '''main ()'''&lt;br /&gt;
 '''{'''&lt;br /&gt;
 '''        printf(&amp;quot;hello, world\n&amp;quot;);'''&lt;br /&gt;
 '''}'''&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cc hello.c'''&lt;br /&gt;
 bone$ '''./a.out'''&lt;br /&gt;
 hello, world&lt;br /&gt;
&lt;br /&gt;
Try your favorite language.&lt;br /&gt;
&lt;br /&gt;
{{YoderFoot}}&lt;/div&gt;</summary>
		<author><name>Yoder</name></author>	</entry>

	<entry>
		<id>http://www.elinux.org/ASEE_2013_Workshop</id>
		<title>ASEE 2013 Workshop</title>
		<link rel="alternate" type="text/html" href="http://www.elinux.org/ASEE_2013_Workshop"/>
				<updated>2013-06-17T16:10:06Z</updated>
		
		<summary type="html">&lt;p&gt;Yoder: /* Other Languages */ Added&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:ECE497 |Workshop]]&lt;br /&gt;
{{YoderHead}}&lt;br /&gt;
Here are the labs for the afternoon Linux part of the [http://www.asee.org/public/conferences/20/registration/view_session?session_id=2420 ASEE 2013 Workshop]&lt;br /&gt;
&lt;br /&gt;
== Warm Up ==&lt;br /&gt;
[[File:PuTTYconfiguration.jpg|thumbnail]]&lt;br /&gt;
Before we can interact with LEDs and switches we need to learn some simple Linux commands. &lt;br /&gt;
# On your host computer, running Windows, start up '''puTTY'''.  &lt;br /&gt;
# If you get a ''Security Warning'', click '''Run'''.&lt;br /&gt;
# Enter '''192.167.7.2''' in the '''Host Name''' field and click '''Open'''&lt;br /&gt;
# Login as '''root''' with no password.&lt;br /&gt;
# Enter '''ls'''  to list what files you have. You shouldn't see much.&lt;br /&gt;
[[File:PuTTYloging.jpg|thumbnail]]&lt;br /&gt;
&lt;br /&gt;
At this point you need to learn a few simple Linux commands for creating and displaying files. Once you know these commands it's easy to turn an LED on and off.&lt;br /&gt;
&lt;br /&gt;
First, let's edit a file using the '''nano''' editor.  Nano is a simple editor that easy to learn. This will edit (and create) the file '''play.txt'''.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''nano play.txt'''&lt;br /&gt;
&lt;br /&gt;
Add a couple of lines of text to the file, it doesn't really matter what and then Exit. You can list the files in the current directory with '''ls''' and show the contents of a file with '''cat'''.&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 Desktop  play.txt&lt;br /&gt;
 bone$ '''cat play.txt'''&lt;br /&gt;
 A couple of lines&lt;br /&gt;
 of text.&lt;br /&gt;
&lt;br /&gt;
Use '''echo''' to print a line of text.&lt;br /&gt;
 bone$ '''echo This is a line of text'''&lt;br /&gt;
 This is a line of text&lt;br /&gt;
&lt;br /&gt;
Here's a powerful operator.  You can take the output of any command and redirect it to a file with '''&amp;gt;'''.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo This is a line of text &amp;gt; here.txt'''&lt;br /&gt;
 bone$ '''cat here.txt'''&lt;br /&gt;
 This is a line of text&lt;br /&gt;
&lt;br /&gt;
We are almost there.  Use '''cd''' to change directories.  '''/''' is the top level directory.&lt;br /&gt;
 bone$ '''cd /'''&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 bin   dev  home  lost+found  mnt   run   sys  usr&lt;br /&gt;
 boot  etc  lib   media       proc  sbin  tmp  var&lt;br /&gt;
&lt;br /&gt;
If you ever get lost, '''cd''' alone takes you home.&lt;br /&gt;
 bone$ '''cd'''&lt;br /&gt;
 gone$ '''ls'''&lt;br /&gt;
 Desktop  here.txt  play.txt&lt;br /&gt;
&lt;br /&gt;
Now you are ready to flash an LED.&lt;br /&gt;
&lt;br /&gt;
== Blinking an LED ==&lt;br /&gt;
=== gpio via the Shell Command Line and sysfs ===&lt;br /&gt;
&lt;br /&gt;
Another easy way to do general purpose I/O (gpio) on the Beagle is through a terminal window and a shell prompt. In Linux, almost everything is treated as a file, even things that aren't files. Here we'll use a virtual file system called '''sysfs'''.  sysfs exposes the drivers for the hardware so you can easily use them.&lt;br /&gt;
&lt;br /&gt;
Try this:&lt;br /&gt;
 bone$ '''cd /sys'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 block/  bus/  class/  dev/  devices/  firmware/  fs/  kernel/  module/  power/&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;'''/'''&amp;quot; after the name means it's a directory. Here we see several directories that represent hardware we can control. Explore a bit and see what you find.&lt;br /&gt;
&lt;br /&gt;
Now try:&lt;br /&gt;
&lt;br /&gt;
 beagle$ '''cd /sys/class'''&lt;br /&gt;
 beagle$ '''ls -F'''&lt;br /&gt;
 backlight/  firmware/     lcd/       mtd/           scsi_disk/   ubi/&lt;br /&gt;
 bdi/        gpio/         leds/      net/           scsi_host/   udc/&lt;br /&gt;
 block/      graphics/     mbox/      power_supply/  sound/       uio/&lt;br /&gt;
 bluetooth/  hwmon/        mdio_bus/  regulator/     spi_master/  usbmon/&lt;br /&gt;
 bsg/        i2c-adapter/  mem/       rfkill/        spidev/      vc/&lt;br /&gt;
 dma/        i2c-dev/      misc/      rtc/           thermal/     vtconsole/&lt;br /&gt;
 drm/        input/        mmc_host/  scsi_device/   tty/         watchdog/&lt;br /&gt;
&lt;br /&gt;
Explore some.  &lt;br /&gt;
&lt;br /&gt;
=== Blinking a USR LED ===&lt;br /&gt;
The Beagle Black has four user LEDS, '''user0''' - '''user3''', that you can control. Try this:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/class/leds'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 beaglebone:green:usr0  beaglebone:green:usr2&lt;br /&gt;
 beaglebone:green:usr1  beaglebone:green:usr3&lt;br /&gt;
&lt;br /&gt;
Here you see the directories for controlling each of the usr LEDs. By default, usr0 flashes a heartbeat pattern and usr1 flashes when the micro SD card is accessed.  Let's control usr0.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd beagleboard\:\:usr0'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 brightness  device@  max_brightness  power/  subsystem@  trigger  uevent&lt;br /&gt;
&lt;br /&gt;
(The &amp;quot;'''@'''&amp;quot; after the name means it's a link.)  See what's in '''brightness''', '''max_brightness''' and '''trigger''' by using the &amp;lt;code&amp;gt;cat&amp;lt;/code&amp;gt; command.  For example:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cat trigger'''&lt;br /&gt;
 none nand-disk mmc0 timer oneshot [heartbeat] backlight gpio cpu0 default-on transient&lt;br /&gt;
&lt;br /&gt;
This shows trigger can have many values.  The present value is '''heartbeat'''.  Check the LED, is it beating?  You can stop the heartbeat via:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo none &amp;gt; trigger'''&lt;br /&gt;
 bone$ '''cat trigger'''&lt;br /&gt;
 [none] nand-disk mmc0 timer oneshot heartbeat backlight gpio cpu0 default-on transient &lt;br /&gt;
&lt;br /&gt;
Did it stop beating?  You can now turn it on and off with:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; brightness'''&lt;br /&gt;
 bone$ '''echo 0 &amp;gt; brightness'''&lt;br /&gt;
&lt;br /&gt;
Is it responding correctly?&lt;br /&gt;
&lt;br /&gt;
The Bone has more trigger options.  Try:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cat trigger'''&lt;br /&gt;
 [none] mmc0 timer heartbeat backlight gpio default-on &lt;br /&gt;
 bone$ '''echo timer &amp;gt; trigger'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 brightness  delay_on  max_brightness  subsystem@  uevent&lt;br /&gt;
 delay_off   device@   power/          trigger&lt;br /&gt;
 bone$ '''echo 100 &amp;gt; delay_on'''&lt;br /&gt;
 bone$ '''echo 900 &amp;gt; delay_off'''&lt;br /&gt;
&lt;br /&gt;
What does this do?&lt;br /&gt;
&lt;br /&gt;
=== Blinking an External LED via gpio ===&lt;br /&gt;
&lt;br /&gt;
In the AM lab we wired an LED to the P9_12 General Purpose IO (gpio) port and controlled it via BoneScript.  Here we'll control it via a shell command. First we need to figure out which gpio pin P9_12 is attached to.  The following figure shows it attached to gpio_60.&lt;br /&gt;
&lt;br /&gt;
[[File:P9PWMs.jpg | 600px]]&lt;br /&gt;
&lt;br /&gt;
Here's how you turn it on&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/class/gpio'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  gpiochip0@  gpiochip32@  gpiochip64@  gpiochip96@  unexport&lt;br /&gt;
&lt;br /&gt;
Presently no gpio pins are visible.  You need to tell it which pin to export&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo 60 &amp;gt; export'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  gpio60@  gpiochip0@  gpiochip32@  gpiochip64@  gpiochip96@  unexport&lt;br /&gt;
&lt;br /&gt;
Notice '''gpio60''' has appeared.  All we need to do is tell it which direction and then turn it on.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd gpio60'''&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 active_low  direction  edge  power  subsystem  uevent  value&lt;br /&gt;
 bone$ '''echo out &amp;gt; direction'''&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; value'''&lt;br /&gt;
Your LED should be on!&lt;br /&gt;
 bone$ '''echo 0 &amp;gt; value'''&lt;br /&gt;
Now it's off.&lt;br /&gt;
&lt;br /&gt;
== Reading a switch ==&lt;br /&gt;
&lt;br /&gt;
Now that you have an LED working, wiring in a switch is easy.  In the AM lab you wired a switch to P9_42, which from the table above is '''gpio_7'''. &lt;br /&gt;
&lt;br /&gt;
Based on what you saw above.&lt;br /&gt;
 bone$ '''cd /sys/class/gpio'''&lt;br /&gt;
 bone$ '''echo 7 &amp;gt; export'''&lt;br /&gt;
 bone$ '''cd gpio7'''&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 bone$ '''echo in &amp;gt; direction'''&lt;br /&gt;
 bone$ '''cat value'''&lt;br /&gt;
 0&lt;br /&gt;
Now hold the button down and try again.&lt;br /&gt;
 bone$ '''cat value'''&lt;br /&gt;
 1&lt;br /&gt;
Once you have the switch and LED working use '''nano''' and put the following in a file.&lt;br /&gt;
 bone$ '''cd'''  (Go back home)&lt;br /&gt;
 bone$ '''nano button.sh'''&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 cd /sys/class/gpio&lt;br /&gt;
 while [ 1 ]&lt;br /&gt;
 do&lt;br /&gt;
    cat gpio7/value&lt;br /&gt;
    sleep 0.25&lt;br /&gt;
 done&lt;br /&gt;
Quit nano and run&lt;br /&gt;
 bone$ '''chmod +x button.sh'''  (This makes button.sh executable)&lt;br /&gt;
 bone$ '''./button.sh'''&lt;br /&gt;
What happens when you push the button? Hit '''Ctrl-C''' to quit button.sh.&lt;br /&gt;
&lt;br /&gt;
Now experiment around. Can you flash the LED? How fast? Make the LED read the switch.&lt;br /&gt;
&lt;br /&gt;
== Analog In ==&lt;br /&gt;
The bone has eight Analog Inputs.  Several are exposed on P9.  They are labeled '''AIN''' in the table below.  How many do you find?&lt;br /&gt;
&lt;br /&gt;
[[File:P9PWMs.jpg|800px]]&lt;br /&gt;
&lt;br /&gt;
The AIN pins are sampled at 12 bits and 100k samples per second.  The input voltage is between 0 and 1.8V.  Fortunately, both voltages are available on P9.&lt;br /&gt;
&lt;br /&gt;
You've already wired up P9_39 for AIN0 in the AM lab. You interact with the analog in much like the gpio, but it appears in a different place. We have to run a command before the AIN interface appears.  Just run them now, later I'll explain what you did if you are interested.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''SLOTS=/sys/devices/bone_capemgr.*/slots'''&lt;br /&gt;
 bone$ '''echo cape-bone-iio &amp;gt; $SLOTS'''&lt;br /&gt;
&lt;br /&gt;
You can now access the analog interface, let's explore.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/devices/ocp.2/helper.14'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 AIN0  AIN2  AIN4  AIN6  driver@   power/      uevent&lt;br /&gt;
 AIN1  AIN3  AIN5  AIN7  modalias  subsystem@&lt;br /&gt;
 bone$ '''cat AIN0'''&lt;br /&gt;
 1185&lt;br /&gt;
&lt;br /&gt;
Change the pot and rerun '''cat'''.  What's the min and max value you get?  Is it 12 bits?&lt;br /&gt;
&lt;br /&gt;
You can use the following script to continuously read the input and print it on the same line.&lt;br /&gt;
 bone$ '''cd'''&lt;br /&gt;
 bone$ '''nano ainOut.sh'''&lt;br /&gt;
&lt;br /&gt;
 cd /sys/devices/ocp.2/helper.14&lt;br /&gt;
 while [ 1 ]&lt;br /&gt;
   do &lt;br /&gt;
   tr '\n' '\r' &amp;lt; AIN0&lt;br /&gt;
 done&lt;br /&gt;
&lt;br /&gt;
 bone$ '''chmod +x ainOut.sh'''&lt;br /&gt;
 bone$ '''./ainOut.sh'''&lt;br /&gt;
Use '''Ctrl-C''' to quit ainOut.sh&lt;br /&gt;
&lt;br /&gt;
== Pulse Width Modulation ==&lt;br /&gt;
&lt;br /&gt;
(Note: The pwm interface seems to changing. Some of this may not apply in the future.)&lt;br /&gt;
&lt;br /&gt;
We have to run a couple of commands to make the PWM interface appear.  Try&lt;br /&gt;
 bone$ '''SLOTS=/sys/devices/bone_capemgr.*/slots'''&lt;br /&gt;
 bone$ '''echo am33xx_pwm     &amp;gt; $SLOTS'''&lt;br /&gt;
 bone$ '''echo bone_pwm_P9_21 &amp;gt; $SLOTS'''&lt;br /&gt;
 bone$ '''cd /sys/devices/ocp.2/pwm_test_P9_21.14'''&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 driver  duty  modalias  period  polarity  power  run  subsystem  uevent&lt;br /&gt;
&lt;br /&gt;
The units are in ns.&lt;br /&gt;
Try a 1Hz frequency with a 25% duty cycle&lt;br /&gt;
 bone$ '''echo 1000000000 &amp;gt; period'''&lt;br /&gt;
 bone$ '''echo  250000000 &amp;gt; duty'''&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; run'''&lt;br /&gt;
&lt;br /&gt;
Connect the LED from and watch it flash.  Try changing the frequency and duty cycle.  You may have to set the duty cycle to 0 to change the frequency.  Can you guess why?&lt;br /&gt;
&lt;br /&gt;
=== Challenge ===&lt;br /&gt;
Combine the analog in and the PWM by having the pot control the frequency or the duty cycle of the LED.&lt;br /&gt;
 &lt;br /&gt;
== Other Languages ==&lt;br /&gt;
&lt;br /&gt;
{{YoderFoot}}&lt;/div&gt;</summary>
		<author><name>Yoder</name></author>	</entry>

	<entry>
		<id>http://www.elinux.org/ASEE_2013_Workshop</id>
		<title>ASEE 2013 Workshop</title>
		<link rel="alternate" type="text/html" href="http://www.elinux.org/ASEE_2013_Workshop"/>
				<updated>2013-06-17T16:08:21Z</updated>
		
		<summary type="html">&lt;p&gt;Yoder: /* Pulse Width Modulation */ Updated instructions&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:ECE497 |Workshop]]&lt;br /&gt;
{{YoderHead}}&lt;br /&gt;
Here are the labs for the afternoon Linux part of the [http://www.asee.org/public/conferences/20/registration/view_session?session_id=2420 ASEE 2013 Workshop]&lt;br /&gt;
&lt;br /&gt;
== Warm Up ==&lt;br /&gt;
[[File:PuTTYconfiguration.jpg|thumbnail]]&lt;br /&gt;
Before we can interact with LEDs and switches we need to learn some simple Linux commands. &lt;br /&gt;
# On your host computer, running Windows, start up '''puTTY'''.  &lt;br /&gt;
# If you get a ''Security Warning'', click '''Run'''.&lt;br /&gt;
# Enter '''192.167.7.2''' in the '''Host Name''' field and click '''Open'''&lt;br /&gt;
# Login as '''root''' with no password.&lt;br /&gt;
# Enter '''ls'''  to list what files you have. You shouldn't see much.&lt;br /&gt;
[[File:PuTTYloging.jpg|thumbnail]]&lt;br /&gt;
&lt;br /&gt;
At this point you need to learn a few simple Linux commands for creating and displaying files. Once you know these commands it's easy to turn an LED on and off.&lt;br /&gt;
&lt;br /&gt;
First, let's edit a file using the '''nano''' editor.  Nano is a simple editor that easy to learn. This will edit (and create) the file '''play.txt'''.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''nano play.txt'''&lt;br /&gt;
&lt;br /&gt;
Add a couple of lines of text to the file, it doesn't really matter what and then Exit. You can list the files in the current directory with '''ls''' and show the contents of a file with '''cat'''.&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 Desktop  play.txt&lt;br /&gt;
 bone$ '''cat play.txt'''&lt;br /&gt;
 A couple of lines&lt;br /&gt;
 of text.&lt;br /&gt;
&lt;br /&gt;
Use '''echo''' to print a line of text.&lt;br /&gt;
 bone$ '''echo This is a line of text'''&lt;br /&gt;
 This is a line of text&lt;br /&gt;
&lt;br /&gt;
Here's a powerful operator.  You can take the output of any command and redirect it to a file with '''&amp;gt;'''.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo This is a line of text &amp;gt; here.txt'''&lt;br /&gt;
 bone$ '''cat here.txt'''&lt;br /&gt;
 This is a line of text&lt;br /&gt;
&lt;br /&gt;
We are almost there.  Use '''cd''' to change directories.  '''/''' is the top level directory.&lt;br /&gt;
 bone$ '''cd /'''&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 bin   dev  home  lost+found  mnt   run   sys  usr&lt;br /&gt;
 boot  etc  lib   media       proc  sbin  tmp  var&lt;br /&gt;
&lt;br /&gt;
If you ever get lost, '''cd''' alone takes you home.&lt;br /&gt;
 bone$ '''cd'''&lt;br /&gt;
 gone$ '''ls'''&lt;br /&gt;
 Desktop  here.txt  play.txt&lt;br /&gt;
&lt;br /&gt;
Now you are ready to flash an LED.&lt;br /&gt;
&lt;br /&gt;
== Blinking an LED ==&lt;br /&gt;
=== gpio via the Shell Command Line and sysfs ===&lt;br /&gt;
&lt;br /&gt;
Another easy way to do general purpose I/O (gpio) on the Beagle is through a terminal window and a shell prompt. In Linux, almost everything is treated as a file, even things that aren't files. Here we'll use a virtual file system called '''sysfs'''.  sysfs exposes the drivers for the hardware so you can easily use them.&lt;br /&gt;
&lt;br /&gt;
Try this:&lt;br /&gt;
 bone$ '''cd /sys'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 block/  bus/  class/  dev/  devices/  firmware/  fs/  kernel/  module/  power/&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;'''/'''&amp;quot; after the name means it's a directory. Here we see several directories that represent hardware we can control. Explore a bit and see what you find.&lt;br /&gt;
&lt;br /&gt;
Now try:&lt;br /&gt;
&lt;br /&gt;
 beagle$ '''cd /sys/class'''&lt;br /&gt;
 beagle$ '''ls -F'''&lt;br /&gt;
 backlight/  firmware/     lcd/       mtd/           scsi_disk/   ubi/&lt;br /&gt;
 bdi/        gpio/         leds/      net/           scsi_host/   udc/&lt;br /&gt;
 block/      graphics/     mbox/      power_supply/  sound/       uio/&lt;br /&gt;
 bluetooth/  hwmon/        mdio_bus/  regulator/     spi_master/  usbmon/&lt;br /&gt;
 bsg/        i2c-adapter/  mem/       rfkill/        spidev/      vc/&lt;br /&gt;
 dma/        i2c-dev/      misc/      rtc/           thermal/     vtconsole/&lt;br /&gt;
 drm/        input/        mmc_host/  scsi_device/   tty/         watchdog/&lt;br /&gt;
&lt;br /&gt;
Explore some.  &lt;br /&gt;
&lt;br /&gt;
=== Blinking a USR LED ===&lt;br /&gt;
The Beagle Black has four user LEDS, '''user0''' - '''user3''', that you can control. Try this:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/class/leds'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 beaglebone:green:usr0  beaglebone:green:usr2&lt;br /&gt;
 beaglebone:green:usr1  beaglebone:green:usr3&lt;br /&gt;
&lt;br /&gt;
Here you see the directories for controlling each of the usr LEDs. By default, usr0 flashes a heartbeat pattern and usr1 flashes when the micro SD card is accessed.  Let's control usr0.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd beagleboard\:\:usr0'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 brightness  device@  max_brightness  power/  subsystem@  trigger  uevent&lt;br /&gt;
&lt;br /&gt;
(The &amp;quot;'''@'''&amp;quot; after the name means it's a link.)  See what's in '''brightness''', '''max_brightness''' and '''trigger''' by using the &amp;lt;code&amp;gt;cat&amp;lt;/code&amp;gt; command.  For example:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cat trigger'''&lt;br /&gt;
 none nand-disk mmc0 timer oneshot [heartbeat] backlight gpio cpu0 default-on transient&lt;br /&gt;
&lt;br /&gt;
This shows trigger can have many values.  The present value is '''heartbeat'''.  Check the LED, is it beating?  You can stop the heartbeat via:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo none &amp;gt; trigger'''&lt;br /&gt;
 bone$ '''cat trigger'''&lt;br /&gt;
 [none] nand-disk mmc0 timer oneshot heartbeat backlight gpio cpu0 default-on transient &lt;br /&gt;
&lt;br /&gt;
Did it stop beating?  You can now turn it on and off with:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; brightness'''&lt;br /&gt;
 bone$ '''echo 0 &amp;gt; brightness'''&lt;br /&gt;
&lt;br /&gt;
Is it responding correctly?&lt;br /&gt;
&lt;br /&gt;
The Bone has more trigger options.  Try:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cat trigger'''&lt;br /&gt;
 [none] mmc0 timer heartbeat backlight gpio default-on &lt;br /&gt;
 bone$ '''echo timer &amp;gt; trigger'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 brightness  delay_on  max_brightness  subsystem@  uevent&lt;br /&gt;
 delay_off   device@   power/          trigger&lt;br /&gt;
 bone$ '''echo 100 &amp;gt; delay_on'''&lt;br /&gt;
 bone$ '''echo 900 &amp;gt; delay_off'''&lt;br /&gt;
&lt;br /&gt;
What does this do?&lt;br /&gt;
&lt;br /&gt;
=== Blinking an External LED via gpio ===&lt;br /&gt;
&lt;br /&gt;
In the AM lab we wired an LED to the P9_12 General Purpose IO (gpio) port and controlled it via BoneScript.  Here we'll control it via a shell command. First we need to figure out which gpio pin P9_12 is attached to.  The following figure shows it attached to gpio_60.&lt;br /&gt;
&lt;br /&gt;
[[File:P9PWMs.jpg | 600px]]&lt;br /&gt;
&lt;br /&gt;
Here's how you turn it on&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/class/gpio'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  gpiochip0@  gpiochip32@  gpiochip64@  gpiochip96@  unexport&lt;br /&gt;
&lt;br /&gt;
Presently no gpio pins are visible.  You need to tell it which pin to export&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo 60 &amp;gt; export'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  gpio60@  gpiochip0@  gpiochip32@  gpiochip64@  gpiochip96@  unexport&lt;br /&gt;
&lt;br /&gt;
Notice '''gpio60''' has appeared.  All we need to do is tell it which direction and then turn it on.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd gpio60'''&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 active_low  direction  edge  power  subsystem  uevent  value&lt;br /&gt;
 bone$ '''echo out &amp;gt; direction'''&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; value'''&lt;br /&gt;
Your LED should be on!&lt;br /&gt;
 bone$ '''echo 0 &amp;gt; value'''&lt;br /&gt;
Now it's off.&lt;br /&gt;
&lt;br /&gt;
== Reading a switch ==&lt;br /&gt;
&lt;br /&gt;
Now that you have an LED working, wiring in a switch is easy.  In the AM lab you wired a switch to P9_42, which from the table above is '''gpio_7'''. &lt;br /&gt;
&lt;br /&gt;
Based on what you saw above.&lt;br /&gt;
 bone$ '''cd /sys/class/gpio'''&lt;br /&gt;
 bone$ '''echo 7 &amp;gt; export'''&lt;br /&gt;
 bone$ '''cd gpio7'''&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 bone$ '''echo in &amp;gt; direction'''&lt;br /&gt;
 bone$ '''cat value'''&lt;br /&gt;
 0&lt;br /&gt;
Now hold the button down and try again.&lt;br /&gt;
 bone$ '''cat value'''&lt;br /&gt;
 1&lt;br /&gt;
Once you have the switch and LED working use '''nano''' and put the following in a file.&lt;br /&gt;
 bone$ '''cd'''  (Go back home)&lt;br /&gt;
 bone$ '''nano button.sh'''&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 cd /sys/class/gpio&lt;br /&gt;
 while [ 1 ]&lt;br /&gt;
 do&lt;br /&gt;
    cat gpio7/value&lt;br /&gt;
    sleep 0.25&lt;br /&gt;
 done&lt;br /&gt;
Quit nano and run&lt;br /&gt;
 bone$ '''chmod +x button.sh'''  (This makes button.sh executable)&lt;br /&gt;
 bone$ '''./button.sh'''&lt;br /&gt;
What happens when you push the button? Hit '''Ctrl-C''' to quit button.sh.&lt;br /&gt;
&lt;br /&gt;
Now experiment around. Can you flash the LED? How fast? Make the LED read the switch.&lt;br /&gt;
&lt;br /&gt;
== Analog In ==&lt;br /&gt;
The bone has eight Analog Inputs.  Several are exposed on P9.  They are labeled '''AIN''' in the table below.  How many do you find?&lt;br /&gt;
&lt;br /&gt;
[[File:P9PWMs.jpg|800px]]&lt;br /&gt;
&lt;br /&gt;
The AIN pins are sampled at 12 bits and 100k samples per second.  The input voltage is between 0 and 1.8V.  Fortunately, both voltages are available on P9.&lt;br /&gt;
&lt;br /&gt;
You've already wired up P9_39 for AIN0 in the AM lab. You interact with the analog in much like the gpio, but it appears in a different place. We have to run a command before the AIN interface appears.  Just run them now, later I'll explain what you did if you are interested.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''SLOTS=/sys/devices/bone_capemgr.*/slots'''&lt;br /&gt;
 bone$ '''echo cape-bone-iio &amp;gt; $SLOTS'''&lt;br /&gt;
&lt;br /&gt;
You can now access the analog interface, let's explore.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/devices/ocp.2/helper.14'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 AIN0  AIN2  AIN4  AIN6  driver@   power/      uevent&lt;br /&gt;
 AIN1  AIN3  AIN5  AIN7  modalias  subsystem@&lt;br /&gt;
 bone$ '''cat AIN0'''&lt;br /&gt;
 1185&lt;br /&gt;
&lt;br /&gt;
Change the pot and rerun '''cat'''.  What's the min and max value you get?  Is it 12 bits?&lt;br /&gt;
&lt;br /&gt;
You can use the following script to continuously read the input and print it on the same line.&lt;br /&gt;
 bone$ '''cd'''&lt;br /&gt;
 bone$ '''nano ainOut.sh'''&lt;br /&gt;
&lt;br /&gt;
 cd /sys/devices/ocp.2/helper.14&lt;br /&gt;
 while [ 1 ]&lt;br /&gt;
   do &lt;br /&gt;
   tr '\n' '\r' &amp;lt; AIN0&lt;br /&gt;
 done&lt;br /&gt;
&lt;br /&gt;
 bone$ '''chmod +x ainOut.sh'''&lt;br /&gt;
 bone$ '''./ainOut.sh'''&lt;br /&gt;
Use '''Ctrl-C''' to quit ainOut.sh&lt;br /&gt;
&lt;br /&gt;
== Pulse Width Modulation ==&lt;br /&gt;
&lt;br /&gt;
(Note: The pwm interface seems to changing. Some of this may not apply in the future.)&lt;br /&gt;
&lt;br /&gt;
We have to run a couple of commands to make the PWM interface appear.  Try&lt;br /&gt;
 bone$ '''SLOTS=/sys/devices/bone_capemgr.*/slots'''&lt;br /&gt;
 bone$ '''echo am33xx_pwm     &amp;gt; $SLOTS'''&lt;br /&gt;
 bone$ '''echo bone_pwm_P9_21 &amp;gt; $SLOTS'''&lt;br /&gt;
 bone$ '''cd /sys/devices/ocp.2/pwm_test_P9_21.14'''&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 driver  duty  modalias  period  polarity  power  run  subsystem  uevent&lt;br /&gt;
&lt;br /&gt;
The units are in ns.&lt;br /&gt;
Try a 1Hz frequency with a 25% duty cycle&lt;br /&gt;
 bone$ '''echo 1000000000 &amp;gt; period'''&lt;br /&gt;
 bone$ '''echo  250000000 &amp;gt; duty'''&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; run'''&lt;br /&gt;
&lt;br /&gt;
Connect the LED from and watch it flash.  Try changing the frequency and duty cycle.  You may have to set the duty cycle to 0 to change the frequency.  Can you guess why?&lt;br /&gt;
&lt;br /&gt;
=== Challenge ===&lt;br /&gt;
Combine the analog in and the PWM by having the pot control the frequency or the duty cycle of the LED.&lt;br /&gt;
 &lt;br /&gt;
{{YoderFoot}}&lt;/div&gt;</summary>
		<author><name>Yoder</name></author>	</entry>

	<entry>
		<id>http://www.elinux.org/ASEE_2013_Workshop</id>
		<title>ASEE 2013 Workshop</title>
		<link rel="alternate" type="text/html" href="http://www.elinux.org/ASEE_2013_Workshop"/>
				<updated>2013-06-14T16:59:56Z</updated>
		
		<summary type="html">&lt;p&gt;Yoder: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:ECE497 |Workshop]]&lt;br /&gt;
{{YoderHead}}&lt;br /&gt;
Here are the labs for the afternoon Linux part of the [http://www.asee.org/public/conferences/20/registration/view_session?session_id=2420 ASEE 2013 Workshop]&lt;br /&gt;
&lt;br /&gt;
== Warm Up ==&lt;br /&gt;
[[File:PuTTYconfiguration.jpg|thumbnail]]&lt;br /&gt;
Before we can interact with LEDs and switches we need to learn some simple Linux commands. &lt;br /&gt;
# On your host computer, running Windows, start up '''puTTY'''.  &lt;br /&gt;
# If you get a ''Security Warning'', click '''Run'''.&lt;br /&gt;
# Enter '''192.167.7.2''' in the '''Host Name''' field and click '''Open'''&lt;br /&gt;
# Login as '''root''' with no password.&lt;br /&gt;
# Enter '''ls'''  to list what files you have. You shouldn't see much.&lt;br /&gt;
[[File:PuTTYloging.jpg|thumbnail]]&lt;br /&gt;
&lt;br /&gt;
At this point you need to learn a few simple Linux commands for creating and displaying files. Once you know these commands it's easy to turn an LED on and off.&lt;br /&gt;
&lt;br /&gt;
First, let's edit a file using the '''nano''' editor.  Nano is a simple editor that easy to learn. This will edit (and create) the file '''play.txt'''.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''nano play.txt'''&lt;br /&gt;
&lt;br /&gt;
Add a couple of lines of text to the file, it doesn't really matter what and then Exit. You can list the files in the current directory with '''ls''' and show the contents of a file with '''cat'''.&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 Desktop  play.txt&lt;br /&gt;
 bone$ '''cat play.txt'''&lt;br /&gt;
 A couple of lines&lt;br /&gt;
 of text.&lt;br /&gt;
&lt;br /&gt;
Use '''echo''' to print a line of text.&lt;br /&gt;
 bone$ '''echo This is a line of text'''&lt;br /&gt;
 This is a line of text&lt;br /&gt;
&lt;br /&gt;
Here's a powerful operator.  You can take the output of any command and redirect it to a file with '''&amp;gt;'''.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo This is a line of text &amp;gt; here.txt'''&lt;br /&gt;
 bone$ '''cat here.txt'''&lt;br /&gt;
 This is a line of text&lt;br /&gt;
&lt;br /&gt;
We are almost there.  Use '''cd''' to change directories.  '''/''' is the top level directory.&lt;br /&gt;
 bone$ '''cd /'''&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 bin   dev  home  lost+found  mnt   run   sys  usr&lt;br /&gt;
 boot  etc  lib   media       proc  sbin  tmp  var&lt;br /&gt;
&lt;br /&gt;
If you ever get lost, '''cd''' alone takes you home.&lt;br /&gt;
 bone$ '''cd'''&lt;br /&gt;
 gone$ '''ls'''&lt;br /&gt;
 Desktop  here.txt  play.txt&lt;br /&gt;
&lt;br /&gt;
Now you are ready to flash an LED.&lt;br /&gt;
&lt;br /&gt;
== Blinking an LED ==&lt;br /&gt;
=== gpio via the Shell Command Line and sysfs ===&lt;br /&gt;
&lt;br /&gt;
Another easy way to do general purpose I/O (gpio) on the Beagle is through a terminal window and a shell prompt. In Linux, almost everything is treated as a file, even things that aren't files. Here we'll use a virtual file system called '''sysfs'''.  sysfs exposes the drivers for the hardware so you can easily use them.&lt;br /&gt;
&lt;br /&gt;
Try this:&lt;br /&gt;
 bone$ '''cd /sys'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 block/  bus/  class/  dev/  devices/  firmware/  fs/  kernel/  module/  power/&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;'''/'''&amp;quot; after the name means it's a directory. Here we see several directories that represent hardware we can control. Explore a bit and see what you find.&lt;br /&gt;
&lt;br /&gt;
Now try:&lt;br /&gt;
&lt;br /&gt;
 beagle$ '''cd /sys/class'''&lt;br /&gt;
 beagle$ '''ls -F'''&lt;br /&gt;
 backlight/  firmware/     lcd/       mtd/           scsi_disk/   ubi/&lt;br /&gt;
 bdi/        gpio/         leds/      net/           scsi_host/   udc/&lt;br /&gt;
 block/      graphics/     mbox/      power_supply/  sound/       uio/&lt;br /&gt;
 bluetooth/  hwmon/        mdio_bus/  regulator/     spi_master/  usbmon/&lt;br /&gt;
 bsg/        i2c-adapter/  mem/       rfkill/        spidev/      vc/&lt;br /&gt;
 dma/        i2c-dev/      misc/      rtc/           thermal/     vtconsole/&lt;br /&gt;
 drm/        input/        mmc_host/  scsi_device/   tty/         watchdog/&lt;br /&gt;
&lt;br /&gt;
Explore some.  &lt;br /&gt;
&lt;br /&gt;
=== Blinking a USR LED ===&lt;br /&gt;
The Beagle Black has four user LEDS, '''user0''' - '''user3''', that you can control. Try this:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/class/leds'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 beaglebone:green:usr0  beaglebone:green:usr2&lt;br /&gt;
 beaglebone:green:usr1  beaglebone:green:usr3&lt;br /&gt;
&lt;br /&gt;
Here you see the directories for controlling each of the usr LEDs. By default, usr0 flashes a heartbeat pattern and usr1 flashes when the micro SD card is accessed.  Let's control usr0.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd beagleboard\:\:usr0'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 brightness  device@  max_brightness  power/  subsystem@  trigger  uevent&lt;br /&gt;
&lt;br /&gt;
(The &amp;quot;'''@'''&amp;quot; after the name means it's a link.)  See what's in '''brightness''', '''max_brightness''' and '''trigger''' by using the &amp;lt;code&amp;gt;cat&amp;lt;/code&amp;gt; command.  For example:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cat trigger'''&lt;br /&gt;
 none nand-disk mmc0 timer oneshot [heartbeat] backlight gpio cpu0 default-on transient&lt;br /&gt;
&lt;br /&gt;
This shows trigger can have many values.  The present value is '''heartbeat'''.  Check the LED, is it beating?  You can stop the heartbeat via:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo none &amp;gt; trigger'''&lt;br /&gt;
 bone$ '''cat trigger'''&lt;br /&gt;
 [none] nand-disk mmc0 timer oneshot heartbeat backlight gpio cpu0 default-on transient &lt;br /&gt;
&lt;br /&gt;
Did it stop beating?  You can now turn it on and off with:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; brightness'''&lt;br /&gt;
 bone$ '''echo 0 &amp;gt; brightness'''&lt;br /&gt;
&lt;br /&gt;
Is it responding correctly?&lt;br /&gt;
&lt;br /&gt;
The Bone has more trigger options.  Try:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cat trigger'''&lt;br /&gt;
 [none] mmc0 timer heartbeat backlight gpio default-on &lt;br /&gt;
 bone$ '''echo timer &amp;gt; trigger'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 brightness  delay_on  max_brightness  subsystem@  uevent&lt;br /&gt;
 delay_off   device@   power/          trigger&lt;br /&gt;
 bone$ '''echo 100 &amp;gt; delay_on'''&lt;br /&gt;
 bone$ '''echo 900 &amp;gt; delay_off'''&lt;br /&gt;
&lt;br /&gt;
What does this do?&lt;br /&gt;
&lt;br /&gt;
=== Blinking an External LED via gpio ===&lt;br /&gt;
&lt;br /&gt;
In the AM lab we wired an LED to the P9_12 General Purpose IO (gpio) port and controlled it via BoneScript.  Here we'll control it via a shell command. First we need to figure out which gpio pin P9_12 is attached to.  The following figure shows it attached to gpio_60.&lt;br /&gt;
&lt;br /&gt;
[[File:P9PWMs.jpg | 600px]]&lt;br /&gt;
&lt;br /&gt;
Here's how you turn it on&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/class/gpio'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  gpiochip0@  gpiochip32@  gpiochip64@  gpiochip96@  unexport&lt;br /&gt;
&lt;br /&gt;
Presently no gpio pins are visible.  You need to tell it which pin to export&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo 60 &amp;gt; export'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  gpio60@  gpiochip0@  gpiochip32@  gpiochip64@  gpiochip96@  unexport&lt;br /&gt;
&lt;br /&gt;
Notice '''gpio60''' has appeared.  All we need to do is tell it which direction and then turn it on.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd gpio60'''&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 active_low  direction  edge  power  subsystem  uevent  value&lt;br /&gt;
 bone$ '''echo out &amp;gt; direction'''&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; value'''&lt;br /&gt;
Your LED should be on!&lt;br /&gt;
 bone$ '''echo 0 &amp;gt; value'''&lt;br /&gt;
Now it's off.&lt;br /&gt;
&lt;br /&gt;
== Reading a switch ==&lt;br /&gt;
&lt;br /&gt;
Now that you have an LED working, wiring in a switch is easy.  In the AM lab you wired a switch to P9_42, which from the table above is '''gpio_7'''. &lt;br /&gt;
&lt;br /&gt;
Based on what you saw above.&lt;br /&gt;
 bone$ '''cd /sys/class/gpio'''&lt;br /&gt;
 bone$ '''echo 7 &amp;gt; export'''&lt;br /&gt;
 bone$ '''cd gpio7'''&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 bone$ '''echo in &amp;gt; direction'''&lt;br /&gt;
 bone$ '''cat value'''&lt;br /&gt;
 0&lt;br /&gt;
Now hold the button down and try again.&lt;br /&gt;
 bone$ '''cat value'''&lt;br /&gt;
 1&lt;br /&gt;
Once you have the switch and LED working use '''nano''' and put the following in a file.&lt;br /&gt;
 bone$ '''cd'''  (Go back home)&lt;br /&gt;
 bone$ '''nano button.sh'''&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 cd /sys/class/gpio&lt;br /&gt;
 while [ 1 ]&lt;br /&gt;
 do&lt;br /&gt;
    cat gpio7/value&lt;br /&gt;
    sleep 0.25&lt;br /&gt;
 done&lt;br /&gt;
Quit nano and run&lt;br /&gt;
 bone$ '''chmod +x button.sh'''  (This makes button.sh executable)&lt;br /&gt;
 bone$ '''./button.sh'''&lt;br /&gt;
What happens when you push the button? Hit '''Ctrl-C''' to quit button.sh.&lt;br /&gt;
&lt;br /&gt;
Now experiment around. Can you flash the LED? How fast? Make the LED read the switch.&lt;br /&gt;
&lt;br /&gt;
== Analog In ==&lt;br /&gt;
The bone has eight Analog Inputs.  Several are exposed on P9.  They are labeled '''AIN''' in the table below.  How many do you find?&lt;br /&gt;
&lt;br /&gt;
[[File:P9PWMs.jpg|800px]]&lt;br /&gt;
&lt;br /&gt;
The AIN pins are sampled at 12 bits and 100k samples per second.  The input voltage is between 0 and 1.8V.  Fortunately, both voltages are available on P9.&lt;br /&gt;
&lt;br /&gt;
You've already wired up P9_39 for AIN0 in the AM lab. You interact with the analog in much like the gpio, but it appears in a different place. We have to run a command before the AIN interface appears.  Just run them now, later I'll explain what you did if you are interested.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''SLOTS=/sys/devices/bone_capemgr.*/slots'''&lt;br /&gt;
 bone$ '''echo cape-bone-iio &amp;gt; $SLOTS'''&lt;br /&gt;
&lt;br /&gt;
You can now access the analog interface, let's explore.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/devices/ocp.2/helper.14'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 AIN0  AIN2  AIN4  AIN6  driver@   power/      uevent&lt;br /&gt;
 AIN1  AIN3  AIN5  AIN7  modalias  subsystem@&lt;br /&gt;
 bone$ '''cat AIN0'''&lt;br /&gt;
 1185&lt;br /&gt;
&lt;br /&gt;
Change the pot and rerun '''cat'''.  What's the min and max value you get?  Is it 12 bits?&lt;br /&gt;
&lt;br /&gt;
You can use the following script to continuously read the input and print it on the same line.&lt;br /&gt;
 bone$ '''cd'''&lt;br /&gt;
 bone$ '''nano ainOut.sh'''&lt;br /&gt;
&lt;br /&gt;
 cd /sys/devices/ocp.2/helper.14&lt;br /&gt;
 while [ 1 ]&lt;br /&gt;
   do &lt;br /&gt;
   tr '\n' '\r' &amp;lt; AIN0&lt;br /&gt;
 done&lt;br /&gt;
&lt;br /&gt;
 bone$ '''chmod +x ainOut.sh'''&lt;br /&gt;
 bone$ '''./ainOut.sh'''&lt;br /&gt;
Use '''Ctrl-C''' to quit ainOut.sh&lt;br /&gt;
&lt;br /&gt;
== Pulse Width Modulation ==&lt;br /&gt;
&lt;br /&gt;
(Note: The pwm interface seems to changing. Some of this may not apply in the future.)&lt;br /&gt;
&lt;br /&gt;
The Bone has a PWM interface at &amp;lt;code&amp;gt;/sys/class/pwm/&amp;lt;/code&amp;gt;. You can see what's there by:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/class/pwm'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  unexport&lt;br /&gt;
Hmmm, there isn't much there.  We have to run a command to make something appear.  Try&lt;br /&gt;
 bone$ '''SLOTS=/sys/devices/bone_capemgr.*/slots'''&lt;br /&gt;
 bone$ '''echo am33xx_pwm &amp;gt; $SLOTS'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  pwmchip0@  pwmchip2@  pwmchip3@  pwmchip5@  pwmchip7@  unexport&lt;br /&gt;
Now we need to run another command to say which pwm pin we want to use.  I'm using P9_21.&lt;br /&gt;
 bone$ '''echo bone_pwm_P9_21 &amp;gt; $SLOTS&lt;br /&gt;
Now you can export a pwm much list you export a gpio port&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; export'''&lt;br /&gt;
 bone$ '''cd pwm1'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 device@  duty_ns  period_ns  polarity  power/  run  subsystem@  uevent&lt;br /&gt;
Try a 1Hz frequency with a 25% duty cycle&lt;br /&gt;
 bone$ '''echo 1000000000 &amp;gt; period_ns'''&lt;br /&gt;
 bone$ '''echo  250000000 &amp;gt; duty_ns'''&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; run'''&lt;br /&gt;
&lt;br /&gt;
Connect the LED from and watch it flash.  Try changing the frequency and duty cycle.  You may have to set the duty cycle to 0 to change the frequency.  Can you guess why?&lt;br /&gt;
&lt;br /&gt;
=== Challenge ===&lt;br /&gt;
Combine the analog in and the PWM by having the pot control the frequency or the duty cycle of the LED.&lt;br /&gt;
 &lt;br /&gt;
{{YoderFoot}}&lt;/div&gt;</summary>
		<author><name>Yoder</name></author>	</entry>

	<entry>
		<id>http://www.elinux.org/ASEE_2013_Workshop</id>
		<title>ASEE 2013 Workshop</title>
		<link rel="alternate" type="text/html" href="http://www.elinux.org/ASEE_2013_Workshop"/>
				<updated>2013-06-14T16:54:35Z</updated>
		
		<summary type="html">&lt;p&gt;Yoder: /* Reading a switch */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:ECE497 |Workshop]]&lt;br /&gt;
{{YoderHead}}&lt;br /&gt;
Here are the labs for the afternoon Linux part of the [http://www.asee.org/public/conferences/20/registration/view_session?session_id=2420 ASEE 2013 Workshop]&lt;br /&gt;
&lt;br /&gt;
== Warm Up ==&lt;br /&gt;
[[File:PuTTYconfiguration.jpg|thumbnail]]&lt;br /&gt;
Before we can interact with LEDs and switches we need to learn some simple Linux commands. &lt;br /&gt;
# On your host computer, running Windows, start up '''puTTY'''.  &lt;br /&gt;
# If you get a ''Security Warning'', click '''Run'''.&lt;br /&gt;
# Enter '''192.167.7.2''' in the '''Host Name''' field and click '''Open'''&lt;br /&gt;
# Login as '''root''' with no password.&lt;br /&gt;
# Enter '''ls'''  to list what files you have. You shouldn't see much.&lt;br /&gt;
[[File:PuTTYloging.jpg|thumbnail]]&lt;br /&gt;
&lt;br /&gt;
At this point you need to learn a few simple Linux commands for creating and displaying files. Once you know these commands it's easy to turn an LED on and off.&lt;br /&gt;
&lt;br /&gt;
First, let's edit a file using the '''nano''' editor.  Nano is a simple editor that easy to learn. This will edit (and create) the file '''play.txt'''.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''nano play.txt'''&lt;br /&gt;
&lt;br /&gt;
Add a couple of lines of text to the file, it doesn't really matter what and then Exit. You can list the files in the current directory with '''ls''' and show the contents of a file with '''cat'''.&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 Desktop  play.txt&lt;br /&gt;
 bone$ '''cat play.txt'''&lt;br /&gt;
 A couple of lines&lt;br /&gt;
 of text.&lt;br /&gt;
&lt;br /&gt;
Use '''echo''' to print a line of text.&lt;br /&gt;
 bone$ '''echo This is a line of text'''&lt;br /&gt;
 This is a line of text&lt;br /&gt;
&lt;br /&gt;
Here's a powerful operator.  You can take the output of any command and redirect it to a file with '''&amp;gt;'''.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo This is a line of text &amp;gt; here.txt'''&lt;br /&gt;
 bone$ '''cat here.txt'''&lt;br /&gt;
 This is a line of text&lt;br /&gt;
&lt;br /&gt;
We are almost there.  Use '''cd''' to change directories.  '''/''' is the top level directory.&lt;br /&gt;
 bone$ '''cd /'''&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 bin   dev  home  lost+found  mnt   run   sys  usr&lt;br /&gt;
 boot  etc  lib   media       proc  sbin  tmp  var&lt;br /&gt;
&lt;br /&gt;
If you ever get lost, '''cd''' alone takes you home.&lt;br /&gt;
 bone$ '''cd'''&lt;br /&gt;
 gone$ '''ls'''&lt;br /&gt;
 Desktop  here.txt  play.txt&lt;br /&gt;
&lt;br /&gt;
Now you are ready to flash an LED.&lt;br /&gt;
&lt;br /&gt;
== Blinking an LED ==&lt;br /&gt;
=== gpio via the Shell Command Line and sysfs ===&lt;br /&gt;
&lt;br /&gt;
Another easy way to do general purpose I/O (gpio) on the Beagle is through a terminal window and a shell prompt. In Linux, almost everything is treated as a file, even things that aren't files. Here we'll use a virtual file system called '''sysfs'''.  sysfs exposes the drivers for the hardware so you can easily use them.&lt;br /&gt;
&lt;br /&gt;
Try this:&lt;br /&gt;
 bone$ '''cd /sys'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 block/  bus/  class/  dev/  devices/  firmware/  fs/  kernel/  module/  power/&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;'''/'''&amp;quot; after the name means it's a directory. Here we see several directories that represent hardware we can control. Explore a bit and see what you find.&lt;br /&gt;
&lt;br /&gt;
Now try:&lt;br /&gt;
&lt;br /&gt;
 beagle$ '''cd /sys/class'''&lt;br /&gt;
 beagle$ '''ls -F'''&lt;br /&gt;
 backlight/  firmware/     lcd/       mtd/           scsi_disk/   ubi/&lt;br /&gt;
 bdi/        gpio/         leds/      net/           scsi_host/   udc/&lt;br /&gt;
 block/      graphics/     mbox/      power_supply/  sound/       uio/&lt;br /&gt;
 bluetooth/  hwmon/        mdio_bus/  regulator/     spi_master/  usbmon/&lt;br /&gt;
 bsg/        i2c-adapter/  mem/       rfkill/        spidev/      vc/&lt;br /&gt;
 dma/        i2c-dev/      misc/      rtc/           thermal/     vtconsole/&lt;br /&gt;
 drm/        input/        mmc_host/  scsi_device/   tty/         watchdog/&lt;br /&gt;
&lt;br /&gt;
Explore some.  &lt;br /&gt;
&lt;br /&gt;
=== Blinking a USR LED ===&lt;br /&gt;
The Beagle Black has four user LEDS, '''user0''' - '''user3''', that you can control. Try this:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/class/leds'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 beaglebone:green:usr0  beaglebone:green:usr2&lt;br /&gt;
 beaglebone:green:usr1  beaglebone:green:usr3&lt;br /&gt;
&lt;br /&gt;
Here you see the directories for controlling each of the usr LEDs. By default, usr0 flashes a heartbeat pattern and usr1 flashes when the micro SD card is accessed.  Let's control usr0.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd beagleboard\:\:usr0'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 brightness  device@  max_brightness  power/  subsystem@  trigger  uevent&lt;br /&gt;
&lt;br /&gt;
(The &amp;quot;'''@'''&amp;quot; after the name means it's a link.)  See what's in '''brightness''', '''max_brightness''' and '''trigger''' by using the &amp;lt;code&amp;gt;cat&amp;lt;/code&amp;gt; command.  For example:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cat trigger'''&lt;br /&gt;
 none nand-disk mmc0 timer oneshot [heartbeat] backlight gpio cpu0 default-on transient&lt;br /&gt;
&lt;br /&gt;
This shows trigger can have many values.  The present value is '''heartbeat'''.  Check the LED, is it beating?  You can stop the heartbeat via:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo none &amp;gt; trigger'''&lt;br /&gt;
 bone$ '''cat trigger'''&lt;br /&gt;
 [none] nand-disk mmc0 timer oneshot heartbeat backlight gpio cpu0 default-on transient &lt;br /&gt;
&lt;br /&gt;
Did it stop beating?  You can now turn it on and off with:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; brightness'''&lt;br /&gt;
 bone$ '''echo 0 &amp;gt; brightness'''&lt;br /&gt;
&lt;br /&gt;
Is it responding correctly?&lt;br /&gt;
&lt;br /&gt;
The Bone has more trigger options.  Try:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cat trigger'''&lt;br /&gt;
 [none] mmc0 timer heartbeat backlight gpio default-on &lt;br /&gt;
 bone$ '''echo timer &amp;gt; trigger'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 brightness  delay_on  max_brightness  subsystem@  uevent&lt;br /&gt;
 delay_off   device@   power/          trigger&lt;br /&gt;
 bone$ '''echo 100 &amp;gt; delay_on'''&lt;br /&gt;
 bone$ '''echo 900 &amp;gt; delay_off'''&lt;br /&gt;
&lt;br /&gt;
What does this do?&lt;br /&gt;
&lt;br /&gt;
=== Blinking an External LED via gpio ===&lt;br /&gt;
&lt;br /&gt;
In the AM lab we wired an LED to the P9_12 General Purpose IO (gpio) port and controlled it via BoneScript.  Here we'll control it via a shell command. First we need to figure out which gpio pin P9_12 is attached to.  The following figure shows it attached to gpio_60.&lt;br /&gt;
&lt;br /&gt;
[[File:P9PWMs.jpg | 600px]]&lt;br /&gt;
&lt;br /&gt;
Here's how you turn it on&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/class/gpio'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  gpiochip0@  gpiochip32@  gpiochip64@  gpiochip96@  unexport&lt;br /&gt;
&lt;br /&gt;
Presently no gpio pins are visible.  You need to tell it which pin to export&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo 60 &amp;gt; export'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  gpio60@  gpiochip0@  gpiochip32@  gpiochip64@  gpiochip96@  unexport&lt;br /&gt;
&lt;br /&gt;
Notice '''gpio60''' has appeared.  All we need to do is tell it which direction and then turn it on.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd gpio60'''&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 active_low  direction  edge  power  subsystem  uevent  value&lt;br /&gt;
 bone$ '''echo out &amp;gt; direction'''&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; value'''&lt;br /&gt;
Your LED should be on!&lt;br /&gt;
 bone$ '''echo 0 &amp;gt; value'''&lt;br /&gt;
Now it's off.&lt;br /&gt;
&lt;br /&gt;
== Reading a switch ==&lt;br /&gt;
&lt;br /&gt;
Now that you have an LED working, wiring in a switch is easy.  In the AM lab you wired a switch to P9_42, which from the table above is '''gpio_7'''. &lt;br /&gt;
&lt;br /&gt;
Based on what you saw above.&lt;br /&gt;
 bone$ '''cd /sys/class/gpio'''&lt;br /&gt;
 bone$ '''echo 7 &amp;gt; export'''&lt;br /&gt;
 bone$ '''cd gpio7'''&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 bone$ '''echo in &amp;gt; direction'''&lt;br /&gt;
 bone$ '''cat value'''&lt;br /&gt;
 0&lt;br /&gt;
Now hold the button down and try again.&lt;br /&gt;
 bone$ '''cat value'''&lt;br /&gt;
 1&lt;br /&gt;
Once you have the switch and LED working use '''nano''' and put the following in a file.&lt;br /&gt;
 bone$ '''cd'''  (Go back home)&lt;br /&gt;
 bone$ '''nano button.sh'''&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 cd /sys/class/gpio&lt;br /&gt;
 while [ 1 ]&lt;br /&gt;
 do&lt;br /&gt;
    cat gpio7/value&lt;br /&gt;
    sleep 0.25&lt;br /&gt;
 done&lt;br /&gt;
Quit nano and run&lt;br /&gt;
 bone$ '''chmod +x button.sh'''  (This makes button.sh executable)&lt;br /&gt;
 bone$ '''./button.sh'''&lt;br /&gt;
What happens when you push the button? Hit '''Ctrl-C''' to quit button.sh.&lt;br /&gt;
&lt;br /&gt;
Now experiment around. Can you flash the LED? How fast? Make the LED read the switch.&lt;br /&gt;
&lt;br /&gt;
== Analog In ==&lt;br /&gt;
The bone has eight Analog Inputs.  Several are exposed on P9.  They are labeled '''AIN''' in the table below.  How many do you find?&lt;br /&gt;
&lt;br /&gt;
[[File:P9PWMs.jpg|800px]]&lt;br /&gt;
&lt;br /&gt;
The AIN pins are sampled at 12 bits and 100k samples per second.  The input voltage is between 0 and 1.8V.  Fortunately, both voltages are available on P9.&lt;br /&gt;
&lt;br /&gt;
You've already wired up P9_39 for AIN0 in the AM lab. You interact with the analog in much like the gpio, but it appears in a different place. We have to run a command before the AIN interface appears.  Just run them now, later I'll explain what you did if you are interested.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''SLOTS=/sys/devices/bone_capemgr.*/slots'''&lt;br /&gt;
 bone$ '''echo cape-bone-iio &amp;gt; $SLOTS'''&lt;br /&gt;
&lt;br /&gt;
You can now access the analog interface, let's explore.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/devices/ocp.2/helper.14'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 AIN0  AIN2  AIN4  AIN6  driver@   power/      uevent&lt;br /&gt;
 AIN1  AIN3  AIN5  AIN7  modalias  subsystem@&lt;br /&gt;
 bone$ '''cat AIN0'''&lt;br /&gt;
 1185&lt;br /&gt;
&lt;br /&gt;
Change the pot and rerun '''cat'''.  What's the min and max value you get?  Is it 12 bits?&lt;br /&gt;
&lt;br /&gt;
You can use the following script to continuously read the input.&lt;br /&gt;
 while [ 1 ]&lt;br /&gt;
   do &lt;br /&gt;
   tr '\n' '\r' &amp;lt; AIN0&lt;br /&gt;
 done&lt;br /&gt;
&lt;br /&gt;
== Pulse Width Modulation ==&lt;br /&gt;
&lt;br /&gt;
(Note: The pwm interface seems to changing. Some of this may not apply in the future.)&lt;br /&gt;
&lt;br /&gt;
The Bone has a PWM interface at &amp;lt;code&amp;gt;/sys/class/pwm/&amp;lt;/code&amp;gt;. You can see what's there by:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/class/pwm'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  unexport&lt;br /&gt;
Hmmm, there isn't much there.  We have to run a command to make something appear.  Try&lt;br /&gt;
 bone$ '''SLOTS=/sys/devices/bone_capemgr.*/slots'''&lt;br /&gt;
 bone$ '''echo am33xx_pwm &amp;gt; $SLOTS'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  pwmchip0@  pwmchip2@  pwmchip3@  pwmchip5@  pwmchip7@  unexport&lt;br /&gt;
Now we need to run another command to say which pwm pin we want to use.  I'm using P9_21.&lt;br /&gt;
 bone$ '''echo bone_pwm_P9_21 &amp;gt; $SLOTS&lt;br /&gt;
Now you can export a pwm much list you export a gpio port&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; export'''&lt;br /&gt;
 bone$ '''cd pwm1'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 device@  duty_ns  period_ns  polarity  power/  run  subsystem@  uevent&lt;br /&gt;
Try a 1Hz frequency with a 25% duty cycle&lt;br /&gt;
 bone$ '''echo 1000000000 &amp;gt; period_ns'''&lt;br /&gt;
 bone$ '''echo  250000000 &amp;gt; duty_ns'''&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; run'''&lt;br /&gt;
&lt;br /&gt;
Connect the LED from and watch it flash.  Try changing the frequency and duty cycle.  You may have to set the duty cycle to 0 to change the frequency.  Can you guess why?&lt;br /&gt;
&lt;br /&gt;
=== Challenge ===&lt;br /&gt;
Combine the analog in and the PWM by having the pot control the frequency or the duty cycle of the LED.&lt;br /&gt;
 &lt;br /&gt;
{{YoderFoot}}&lt;/div&gt;</summary>
		<author><name>Yoder</name></author>	</entry>

	<entry>
		<id>http://www.elinux.org/ASEE_2013_Workshop</id>
		<title>ASEE 2013 Workshop</title>
		<link rel="alternate" type="text/html" href="http://www.elinux.org/ASEE_2013_Workshop"/>
				<updated>2013-06-14T16:47:19Z</updated>
		
		<summary type="html">&lt;p&gt;Yoder: /* Analog In */ Moved to AIN0&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:ECE497 |Workshop]]&lt;br /&gt;
{{YoderHead}}&lt;br /&gt;
Here are the labs for the afternoon Linux part of the [http://www.asee.org/public/conferences/20/registration/view_session?session_id=2420 ASEE 2013 Workshop]&lt;br /&gt;
&lt;br /&gt;
== Warm Up ==&lt;br /&gt;
[[File:PuTTYconfiguration.jpg|thumbnail]]&lt;br /&gt;
Before we can interact with LEDs and switches we need to learn some simple Linux commands. &lt;br /&gt;
# On your host computer, running Windows, start up '''puTTY'''.  &lt;br /&gt;
# If you get a ''Security Warning'', click '''Run'''.&lt;br /&gt;
# Enter '''192.167.7.2''' in the '''Host Name''' field and click '''Open'''&lt;br /&gt;
# Login as '''root''' with no password.&lt;br /&gt;
# Enter '''ls'''  to list what files you have. You shouldn't see much.&lt;br /&gt;
[[File:PuTTYloging.jpg|thumbnail]]&lt;br /&gt;
&lt;br /&gt;
At this point you need to learn a few simple Linux commands for creating and displaying files. Once you know these commands it's easy to turn an LED on and off.&lt;br /&gt;
&lt;br /&gt;
First, let's edit a file using the '''nano''' editor.  Nano is a simple editor that easy to learn. This will edit (and create) the file '''play.txt'''.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''nano play.txt'''&lt;br /&gt;
&lt;br /&gt;
Add a couple of lines of text to the file, it doesn't really matter what and then Exit. You can list the files in the current directory with '''ls''' and show the contents of a file with '''cat'''.&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 Desktop  play.txt&lt;br /&gt;
 bone$ '''cat play.txt'''&lt;br /&gt;
 A couple of lines&lt;br /&gt;
 of text.&lt;br /&gt;
&lt;br /&gt;
Use '''echo''' to print a line of text.&lt;br /&gt;
 bone$ '''echo This is a line of text'''&lt;br /&gt;
 This is a line of text&lt;br /&gt;
&lt;br /&gt;
Here's a powerful operator.  You can take the output of any command and redirect it to a file with '''&amp;gt;'''.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo This is a line of text &amp;gt; here.txt'''&lt;br /&gt;
 bone$ '''cat here.txt'''&lt;br /&gt;
 This is a line of text&lt;br /&gt;
&lt;br /&gt;
We are almost there.  Use '''cd''' to change directories.  '''/''' is the top level directory.&lt;br /&gt;
 bone$ '''cd /'''&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 bin   dev  home  lost+found  mnt   run   sys  usr&lt;br /&gt;
 boot  etc  lib   media       proc  sbin  tmp  var&lt;br /&gt;
&lt;br /&gt;
If you ever get lost, '''cd''' alone takes you home.&lt;br /&gt;
 bone$ '''cd'''&lt;br /&gt;
 gone$ '''ls'''&lt;br /&gt;
 Desktop  here.txt  play.txt&lt;br /&gt;
&lt;br /&gt;
Now you are ready to flash an LED.&lt;br /&gt;
&lt;br /&gt;
== Blinking an LED ==&lt;br /&gt;
=== gpio via the Shell Command Line and sysfs ===&lt;br /&gt;
&lt;br /&gt;
Another easy way to do general purpose I/O (gpio) on the Beagle is through a terminal window and a shell prompt. In Linux, almost everything is treated as a file, even things that aren't files. Here we'll use a virtual file system called '''sysfs'''.  sysfs exposes the drivers for the hardware so you can easily use them.&lt;br /&gt;
&lt;br /&gt;
Try this:&lt;br /&gt;
 bone$ '''cd /sys'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 block/  bus/  class/  dev/  devices/  firmware/  fs/  kernel/  module/  power/&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;'''/'''&amp;quot; after the name means it's a directory. Here we see several directories that represent hardware we can control. Explore a bit and see what you find.&lt;br /&gt;
&lt;br /&gt;
Now try:&lt;br /&gt;
&lt;br /&gt;
 beagle$ '''cd /sys/class'''&lt;br /&gt;
 beagle$ '''ls -F'''&lt;br /&gt;
 backlight/  firmware/     lcd/       mtd/           scsi_disk/   ubi/&lt;br /&gt;
 bdi/        gpio/         leds/      net/           scsi_host/   udc/&lt;br /&gt;
 block/      graphics/     mbox/      power_supply/  sound/       uio/&lt;br /&gt;
 bluetooth/  hwmon/        mdio_bus/  regulator/     spi_master/  usbmon/&lt;br /&gt;
 bsg/        i2c-adapter/  mem/       rfkill/        spidev/      vc/&lt;br /&gt;
 dma/        i2c-dev/      misc/      rtc/           thermal/     vtconsole/&lt;br /&gt;
 drm/        input/        mmc_host/  scsi_device/   tty/         watchdog/&lt;br /&gt;
&lt;br /&gt;
Explore some.  &lt;br /&gt;
&lt;br /&gt;
=== Blinking a USR LED ===&lt;br /&gt;
The Beagle Black has four user LEDS, '''user0''' - '''user3''', that you can control. Try this:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/class/leds'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 beaglebone:green:usr0  beaglebone:green:usr2&lt;br /&gt;
 beaglebone:green:usr1  beaglebone:green:usr3&lt;br /&gt;
&lt;br /&gt;
Here you see the directories for controlling each of the usr LEDs. By default, usr0 flashes a heartbeat pattern and usr1 flashes when the micro SD card is accessed.  Let's control usr0.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd beagleboard\:\:usr0'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 brightness  device@  max_brightness  power/  subsystem@  trigger  uevent&lt;br /&gt;
&lt;br /&gt;
(The &amp;quot;'''@'''&amp;quot; after the name means it's a link.)  See what's in '''brightness''', '''max_brightness''' and '''trigger''' by using the &amp;lt;code&amp;gt;cat&amp;lt;/code&amp;gt; command.  For example:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cat trigger'''&lt;br /&gt;
 none nand-disk mmc0 timer oneshot [heartbeat] backlight gpio cpu0 default-on transient&lt;br /&gt;
&lt;br /&gt;
This shows trigger can have many values.  The present value is '''heartbeat'''.  Check the LED, is it beating?  You can stop the heartbeat via:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo none &amp;gt; trigger'''&lt;br /&gt;
 bone$ '''cat trigger'''&lt;br /&gt;
 [none] nand-disk mmc0 timer oneshot heartbeat backlight gpio cpu0 default-on transient &lt;br /&gt;
&lt;br /&gt;
Did it stop beating?  You can now turn it on and off with:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; brightness'''&lt;br /&gt;
 bone$ '''echo 0 &amp;gt; brightness'''&lt;br /&gt;
&lt;br /&gt;
Is it responding correctly?&lt;br /&gt;
&lt;br /&gt;
The Bone has more trigger options.  Try:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cat trigger'''&lt;br /&gt;
 [none] mmc0 timer heartbeat backlight gpio default-on &lt;br /&gt;
 bone$ '''echo timer &amp;gt; trigger'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 brightness  delay_on  max_brightness  subsystem@  uevent&lt;br /&gt;
 delay_off   device@   power/          trigger&lt;br /&gt;
 bone$ '''echo 100 &amp;gt; delay_on'''&lt;br /&gt;
 bone$ '''echo 900 &amp;gt; delay_off'''&lt;br /&gt;
&lt;br /&gt;
What does this do?&lt;br /&gt;
&lt;br /&gt;
=== Blinking an External LED via gpio ===&lt;br /&gt;
&lt;br /&gt;
In the AM lab we wired an LED to the P9_12 General Purpose IO (gpio) port and controlled it via BoneScript.  Here we'll control it via a shell command. First we need to figure out which gpio pin P9_12 is attached to.  The following figure shows it attached to gpio_60.&lt;br /&gt;
&lt;br /&gt;
[[File:P9PWMs.jpg | 600px]]&lt;br /&gt;
&lt;br /&gt;
Here's how you turn it on&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/class/gpio'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  gpiochip0@  gpiochip32@  gpiochip64@  gpiochip96@  unexport&lt;br /&gt;
&lt;br /&gt;
Presently no gpio pins are visible.  You need to tell it which pin to export&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo 60 &amp;gt; export'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  gpio60@  gpiochip0@  gpiochip32@  gpiochip64@  gpiochip96@  unexport&lt;br /&gt;
&lt;br /&gt;
Notice '''gpio60''' has appeared.  All we need to do is tell it which direction and then turn it on.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd gpio60'''&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 active_low  direction  edge  power  subsystem  uevent  value&lt;br /&gt;
 bone$ '''echo out &amp;gt; direction'''&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; value'''&lt;br /&gt;
Your LED should be on!&lt;br /&gt;
 bone$ '''echo 0 &amp;gt; value'''&lt;br /&gt;
Now it's off.&lt;br /&gt;
&lt;br /&gt;
== Reading a switch ==&lt;br /&gt;
&lt;br /&gt;
Now that you have an LED working, wiring in a switch is easy.  In the AM lab you wired a switch to P9_42, which from the table above is '''gpio_7'''. &lt;br /&gt;
&lt;br /&gt;
Based on what you saw above.&lt;br /&gt;
 bone$ '''cd /sys/class/gpio'''&lt;br /&gt;
 bone$ '''echo 7 &amp;gt; export'''&lt;br /&gt;
 bone$ '''cd gpio7'''&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 bone$ '''echo in &amp;gt; direction'''&lt;br /&gt;
 bone$ '''cat value'''&lt;br /&gt;
 0&lt;br /&gt;
Now hold the button down and try again.&lt;br /&gt;
 bone$ '''cat value'''&lt;br /&gt;
 1&lt;br /&gt;
Once you have the switch and LED working use '''nano''' and put the following in a file.&lt;br /&gt;
 bone$ '''cd'''  (Go back home)&lt;br /&gt;
 bone$ '''nano button.sh'''&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 cd /sys/class/gpio&lt;br /&gt;
 while [ 1 ]&lt;br /&gt;
 do&lt;br /&gt;
    cat gpio7/value&lt;br /&gt;
    sleep 0.25&lt;br /&gt;
 done&lt;br /&gt;
Quit nano and run&lt;br /&gt;
 bone$ '''chmod +x button.sh'''  (This makes button.sh executable)&lt;br /&gt;
 bone$ '''./button.sh'''&lt;br /&gt;
What happens when you push the button?&lt;br /&gt;
&lt;br /&gt;
Now experiment around. Can you flash the LED? How fast? Make the LED read the switch.&lt;br /&gt;
&lt;br /&gt;
== Analog In ==&lt;br /&gt;
The bone has eight Analog Inputs.  Several are exposed on P9.  They are labeled '''AIN''' in the table below.  How many do you find?&lt;br /&gt;
&lt;br /&gt;
[[File:P9PWMs.jpg|800px]]&lt;br /&gt;
&lt;br /&gt;
The AIN pins are sampled at 12 bits and 100k samples per second.  The input voltage is between 0 and 1.8V.  Fortunately, both voltages are available on P9.&lt;br /&gt;
&lt;br /&gt;
You've already wired up P9_39 for AIN0 in the AM lab. You interact with the analog in much like the gpio, but it appears in a different place. We have to run a command before the AIN interface appears.  Just run them now, later I'll explain what you did if you are interested.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''SLOTS=/sys/devices/bone_capemgr.*/slots'''&lt;br /&gt;
 bone$ '''echo cape-bone-iio &amp;gt; $SLOTS'''&lt;br /&gt;
&lt;br /&gt;
You can now access the analog interface, let's explore.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/devices/ocp.2/helper.14'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 AIN0  AIN2  AIN4  AIN6  driver@   power/      uevent&lt;br /&gt;
 AIN1  AIN3  AIN5  AIN7  modalias  subsystem@&lt;br /&gt;
 bone$ '''cat AIN0'''&lt;br /&gt;
 1185&lt;br /&gt;
&lt;br /&gt;
Change the pot and rerun '''cat'''.  What's the min and max value you get?  Is it 12 bits?&lt;br /&gt;
&lt;br /&gt;
You can use the following script to continuously read the input.&lt;br /&gt;
 while [ 1 ]&lt;br /&gt;
   do &lt;br /&gt;
   tr '\n' '\r' &amp;lt; AIN0&lt;br /&gt;
 done&lt;br /&gt;
&lt;br /&gt;
== Pulse Width Modulation ==&lt;br /&gt;
&lt;br /&gt;
(Note: The pwm interface seems to changing. Some of this may not apply in the future.)&lt;br /&gt;
&lt;br /&gt;
The Bone has a PWM interface at &amp;lt;code&amp;gt;/sys/class/pwm/&amp;lt;/code&amp;gt;. You can see what's there by:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/class/pwm'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  unexport&lt;br /&gt;
Hmmm, there isn't much there.  We have to run a command to make something appear.  Try&lt;br /&gt;
 bone$ '''SLOTS=/sys/devices/bone_capemgr.*/slots'''&lt;br /&gt;
 bone$ '''echo am33xx_pwm &amp;gt; $SLOTS'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  pwmchip0@  pwmchip2@  pwmchip3@  pwmchip5@  pwmchip7@  unexport&lt;br /&gt;
Now we need to run another command to say which pwm pin we want to use.  I'm using P9_21.&lt;br /&gt;
 bone$ '''echo bone_pwm_P9_21 &amp;gt; $SLOTS&lt;br /&gt;
Now you can export a pwm much list you export a gpio port&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; export'''&lt;br /&gt;
 bone$ '''cd pwm1'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 device@  duty_ns  period_ns  polarity  power/  run  subsystem@  uevent&lt;br /&gt;
Try a 1Hz frequency with a 25% duty cycle&lt;br /&gt;
 bone$ '''echo 1000000000 &amp;gt; period_ns'''&lt;br /&gt;
 bone$ '''echo  250000000 &amp;gt; duty_ns'''&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; run'''&lt;br /&gt;
&lt;br /&gt;
Connect the LED from and watch it flash.  Try changing the frequency and duty cycle.  You may have to set the duty cycle to 0 to change the frequency.  Can you guess why?&lt;br /&gt;
&lt;br /&gt;
=== Challenge ===&lt;br /&gt;
Combine the analog in and the PWM by having the pot control the frequency or the duty cycle of the LED.&lt;br /&gt;
 &lt;br /&gt;
{{YoderFoot}}&lt;/div&gt;</summary>
		<author><name>Yoder</name></author>	</entry>

	<entry>
		<id>http://www.elinux.org/ASEE_2013_Workshop</id>
		<title>ASEE 2013 Workshop</title>
		<link rel="alternate" type="text/html" href="http://www.elinux.org/ASEE_2013_Workshop"/>
				<updated>2013-06-14T16:45:07Z</updated>
		
		<summary type="html">&lt;p&gt;Yoder: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:ECE497 |Workshop]]&lt;br /&gt;
{{YoderHead}}&lt;br /&gt;
Here are the labs for the afternoon Linux part of the [http://www.asee.org/public/conferences/20/registration/view_session?session_id=2420 ASEE 2013 Workshop]&lt;br /&gt;
&lt;br /&gt;
== Warm Up ==&lt;br /&gt;
[[File:PuTTYconfiguration.jpg|thumbnail]]&lt;br /&gt;
Before we can interact with LEDs and switches we need to learn some simple Linux commands. &lt;br /&gt;
# On your host computer, running Windows, start up '''puTTY'''.  &lt;br /&gt;
# If you get a ''Security Warning'', click '''Run'''.&lt;br /&gt;
# Enter '''192.167.7.2''' in the '''Host Name''' field and click '''Open'''&lt;br /&gt;
# Login as '''root''' with no password.&lt;br /&gt;
# Enter '''ls'''  to list what files you have. You shouldn't see much.&lt;br /&gt;
[[File:PuTTYloging.jpg|thumbnail]]&lt;br /&gt;
&lt;br /&gt;
At this point you need to learn a few simple Linux commands for creating and displaying files. Once you know these commands it's easy to turn an LED on and off.&lt;br /&gt;
&lt;br /&gt;
First, let's edit a file using the '''nano''' editor.  Nano is a simple editor that easy to learn. This will edit (and create) the file '''play.txt'''.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''nano play.txt'''&lt;br /&gt;
&lt;br /&gt;
Add a couple of lines of text to the file, it doesn't really matter what and then Exit. You can list the files in the current directory with '''ls''' and show the contents of a file with '''cat'''.&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 Desktop  play.txt&lt;br /&gt;
 bone$ '''cat play.txt'''&lt;br /&gt;
 A couple of lines&lt;br /&gt;
 of text.&lt;br /&gt;
&lt;br /&gt;
Use '''echo''' to print a line of text.&lt;br /&gt;
 bone$ '''echo This is a line of text'''&lt;br /&gt;
 This is a line of text&lt;br /&gt;
&lt;br /&gt;
Here's a powerful operator.  You can take the output of any command and redirect it to a file with '''&amp;gt;'''.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo This is a line of text &amp;gt; here.txt'''&lt;br /&gt;
 bone$ '''cat here.txt'''&lt;br /&gt;
 This is a line of text&lt;br /&gt;
&lt;br /&gt;
We are almost there.  Use '''cd''' to change directories.  '''/''' is the top level directory.&lt;br /&gt;
 bone$ '''cd /'''&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 bin   dev  home  lost+found  mnt   run   sys  usr&lt;br /&gt;
 boot  etc  lib   media       proc  sbin  tmp  var&lt;br /&gt;
&lt;br /&gt;
If you ever get lost, '''cd''' alone takes you home.&lt;br /&gt;
 bone$ '''cd'''&lt;br /&gt;
 gone$ '''ls'''&lt;br /&gt;
 Desktop  here.txt  play.txt&lt;br /&gt;
&lt;br /&gt;
Now you are ready to flash an LED.&lt;br /&gt;
&lt;br /&gt;
== Blinking an LED ==&lt;br /&gt;
=== gpio via the Shell Command Line and sysfs ===&lt;br /&gt;
&lt;br /&gt;
Another easy way to do general purpose I/O (gpio) on the Beagle is through a terminal window and a shell prompt. In Linux, almost everything is treated as a file, even things that aren't files. Here we'll use a virtual file system called '''sysfs'''.  sysfs exposes the drivers for the hardware so you can easily use them.&lt;br /&gt;
&lt;br /&gt;
Try this:&lt;br /&gt;
 bone$ '''cd /sys'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 block/  bus/  class/  dev/  devices/  firmware/  fs/  kernel/  module/  power/&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;'''/'''&amp;quot; after the name means it's a directory. Here we see several directories that represent hardware we can control. Explore a bit and see what you find.&lt;br /&gt;
&lt;br /&gt;
Now try:&lt;br /&gt;
&lt;br /&gt;
 beagle$ '''cd /sys/class'''&lt;br /&gt;
 beagle$ '''ls -F'''&lt;br /&gt;
 backlight/  firmware/     lcd/       mtd/           scsi_disk/   ubi/&lt;br /&gt;
 bdi/        gpio/         leds/      net/           scsi_host/   udc/&lt;br /&gt;
 block/      graphics/     mbox/      power_supply/  sound/       uio/&lt;br /&gt;
 bluetooth/  hwmon/        mdio_bus/  regulator/     spi_master/  usbmon/&lt;br /&gt;
 bsg/        i2c-adapter/  mem/       rfkill/        spidev/      vc/&lt;br /&gt;
 dma/        i2c-dev/      misc/      rtc/           thermal/     vtconsole/&lt;br /&gt;
 drm/        input/        mmc_host/  scsi_device/   tty/         watchdog/&lt;br /&gt;
&lt;br /&gt;
Explore some.  &lt;br /&gt;
&lt;br /&gt;
=== Blinking a USR LED ===&lt;br /&gt;
The Beagle Black has four user LEDS, '''user0''' - '''user3''', that you can control. Try this:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/class/leds'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 beaglebone:green:usr0  beaglebone:green:usr2&lt;br /&gt;
 beaglebone:green:usr1  beaglebone:green:usr3&lt;br /&gt;
&lt;br /&gt;
Here you see the directories for controlling each of the usr LEDs. By default, usr0 flashes a heartbeat pattern and usr1 flashes when the micro SD card is accessed.  Let's control usr0.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd beagleboard\:\:usr0'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 brightness  device@  max_brightness  power/  subsystem@  trigger  uevent&lt;br /&gt;
&lt;br /&gt;
(The &amp;quot;'''@'''&amp;quot; after the name means it's a link.)  See what's in '''brightness''', '''max_brightness''' and '''trigger''' by using the &amp;lt;code&amp;gt;cat&amp;lt;/code&amp;gt; command.  For example:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cat trigger'''&lt;br /&gt;
 none nand-disk mmc0 timer oneshot [heartbeat] backlight gpio cpu0 default-on transient&lt;br /&gt;
&lt;br /&gt;
This shows trigger can have many values.  The present value is '''heartbeat'''.  Check the LED, is it beating?  You can stop the heartbeat via:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo none &amp;gt; trigger'''&lt;br /&gt;
 bone$ '''cat trigger'''&lt;br /&gt;
 [none] nand-disk mmc0 timer oneshot heartbeat backlight gpio cpu0 default-on transient &lt;br /&gt;
&lt;br /&gt;
Did it stop beating?  You can now turn it on and off with:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; brightness'''&lt;br /&gt;
 bone$ '''echo 0 &amp;gt; brightness'''&lt;br /&gt;
&lt;br /&gt;
Is it responding correctly?&lt;br /&gt;
&lt;br /&gt;
The Bone has more trigger options.  Try:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cat trigger'''&lt;br /&gt;
 [none] mmc0 timer heartbeat backlight gpio default-on &lt;br /&gt;
 bone$ '''echo timer &amp;gt; trigger'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 brightness  delay_on  max_brightness  subsystem@  uevent&lt;br /&gt;
 delay_off   device@   power/          trigger&lt;br /&gt;
 bone$ '''echo 100 &amp;gt; delay_on'''&lt;br /&gt;
 bone$ '''echo 900 &amp;gt; delay_off'''&lt;br /&gt;
&lt;br /&gt;
What does this do?&lt;br /&gt;
&lt;br /&gt;
=== Blinking an External LED via gpio ===&lt;br /&gt;
&lt;br /&gt;
In the AM lab we wired an LED to the P9_12 General Purpose IO (gpio) port and controlled it via BoneScript.  Here we'll control it via a shell command. First we need to figure out which gpio pin P9_12 is attached to.  The following figure shows it attached to gpio_60.&lt;br /&gt;
&lt;br /&gt;
[[File:P9PWMs.jpg | 600px]]&lt;br /&gt;
&lt;br /&gt;
Here's how you turn it on&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/class/gpio'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  gpiochip0@  gpiochip32@  gpiochip64@  gpiochip96@  unexport&lt;br /&gt;
&lt;br /&gt;
Presently no gpio pins are visible.  You need to tell it which pin to export&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo 60 &amp;gt; export'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  gpio60@  gpiochip0@  gpiochip32@  gpiochip64@  gpiochip96@  unexport&lt;br /&gt;
&lt;br /&gt;
Notice '''gpio60''' has appeared.  All we need to do is tell it which direction and then turn it on.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd gpio60'''&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 active_low  direction  edge  power  subsystem  uevent  value&lt;br /&gt;
 bone$ '''echo out &amp;gt; direction'''&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; value'''&lt;br /&gt;
Your LED should be on!&lt;br /&gt;
 bone$ '''echo 0 &amp;gt; value'''&lt;br /&gt;
Now it's off.&lt;br /&gt;
&lt;br /&gt;
== Reading a switch ==&lt;br /&gt;
&lt;br /&gt;
Now that you have an LED working, wiring in a switch is easy.  In the AM lab you wired a switch to P9_42, which from the table above is '''gpio_7'''. &lt;br /&gt;
&lt;br /&gt;
Based on what you saw above.&lt;br /&gt;
 bone$ '''cd /sys/class/gpio'''&lt;br /&gt;
 bone$ '''echo 7 &amp;gt; export'''&lt;br /&gt;
 bone$ '''cd gpio7'''&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 bone$ '''echo in &amp;gt; direction'''&lt;br /&gt;
 bone$ '''cat value'''&lt;br /&gt;
 0&lt;br /&gt;
Now hold the button down and try again.&lt;br /&gt;
 bone$ '''cat value'''&lt;br /&gt;
 1&lt;br /&gt;
Once you have the switch and LED working use '''nano''' and put the following in a file.&lt;br /&gt;
 bone$ '''cd'''  (Go back home)&lt;br /&gt;
 bone$ '''nano button.sh'''&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 cd /sys/class/gpio&lt;br /&gt;
 while [ 1 ]&lt;br /&gt;
 do&lt;br /&gt;
    cat gpio7/value&lt;br /&gt;
    sleep 0.25&lt;br /&gt;
 done&lt;br /&gt;
Quit nano and run&lt;br /&gt;
 bone$ '''chmod +x button.sh'''  (This makes button.sh executable)&lt;br /&gt;
 bone$ '''./button.sh'''&lt;br /&gt;
What happens when you push the button?&lt;br /&gt;
&lt;br /&gt;
Now experiment around. Can you flash the LED? How fast? Make the LED read the switch.&lt;br /&gt;
&lt;br /&gt;
== Analog In ==&lt;br /&gt;
The bone has eight Analog Inputs.  Several are exposed on P9.  They are labeled '''AIN''' in the table below.  How many do you find?&lt;br /&gt;
&lt;br /&gt;
[[File:P9PWMs.jpg|800px]]&lt;br /&gt;
&lt;br /&gt;
The AIN pins are sampled at 12 bits and 100k samples per second.  The input voltage is between 0 and 1.8V.  Fortunately, both voltages are available on P9.&lt;br /&gt;
&lt;br /&gt;
You've already wired these up for the AM lab. You interact with the analog in much like the gpio, but it appears in a different place. We have to run a command before the AIN interface appears.  Just run them now, later I'll explain what you did if you are interested.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''SLOTS=/sys/devices/bone_capemgr.*/slots'''&lt;br /&gt;
 bone$ '''echo cape-bone-iio &amp;gt; $SLOTS'''&lt;br /&gt;
&lt;br /&gt;
You can now access the analog interface, let's explore.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/devices/ocp.2/helper.14'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 AIN0  AIN2  AIN4  AIN6  driver@   power/      uevent&lt;br /&gt;
 AIN1  AIN3  AIN5  AIN7  modalias  subsystem@&lt;br /&gt;
&lt;br /&gt;
There are the various analog inputs, but watch out.  This interface starts numbering at '''1''' and Table 11 starts at '''0''', so to read AIN5 you need to look at '''AIN6'''!&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cat AIN6'''&lt;br /&gt;
 1185&lt;br /&gt;
&lt;br /&gt;
Change the pot and rerun '''cat'''.  What's the min and max value you get?  Is it 12 bits?&lt;br /&gt;
&lt;br /&gt;
You can use the following script to continuously read the input.&lt;br /&gt;
 while [ 1 ]&lt;br /&gt;
   do &lt;br /&gt;
   tr '\n' '\r' &amp;lt; AIN6&lt;br /&gt;
 done&lt;br /&gt;
&lt;br /&gt;
== Pulse Width Modulation ==&lt;br /&gt;
&lt;br /&gt;
(Note: The pwm interface seems to changing. Some of this may not apply in the future.)&lt;br /&gt;
&lt;br /&gt;
The Bone has a PWM interface at &amp;lt;code&amp;gt;/sys/class/pwm/&amp;lt;/code&amp;gt;. You can see what's there by:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/class/pwm'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  unexport&lt;br /&gt;
Hmmm, there isn't much there.  We have to run a command to make something appear.  Try&lt;br /&gt;
 bone$ '''SLOTS=/sys/devices/bone_capemgr.*/slots'''&lt;br /&gt;
 bone$ '''echo am33xx_pwm &amp;gt; $SLOTS'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  pwmchip0@  pwmchip2@  pwmchip3@  pwmchip5@  pwmchip7@  unexport&lt;br /&gt;
Now we need to run another command to say which pwm pin we want to use.  I'm using P9_21.&lt;br /&gt;
 bone$ '''echo bone_pwm_P9_21 &amp;gt; $SLOTS&lt;br /&gt;
Now you can export a pwm much list you export a gpio port&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; export'''&lt;br /&gt;
 bone$ '''cd pwm1'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 device@  duty_ns  period_ns  polarity  power/  run  subsystem@  uevent&lt;br /&gt;
Try a 1Hz frequency with a 25% duty cycle&lt;br /&gt;
 bone$ '''echo 1000000000 &amp;gt; period_ns'''&lt;br /&gt;
 bone$ '''echo  250000000 &amp;gt; duty_ns'''&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; run'''&lt;br /&gt;
&lt;br /&gt;
Connect the LED from and watch it flash.  Try changing the frequency and duty cycle.  You may have to set the duty cycle to 0 to change the frequency.  Can you guess why?&lt;br /&gt;
&lt;br /&gt;
=== Challenge ===&lt;br /&gt;
Combine the analog in and the PWM by having the pot control the frequency or the duty cycle of the LED.&lt;br /&gt;
 &lt;br /&gt;
{{YoderFoot}}&lt;/div&gt;</summary>
		<author><name>Yoder</name></author>	</entry>

	<entry>
		<id>http://www.elinux.org/ASEE_2013_Workshop</id>
		<title>ASEE 2013 Workshop</title>
		<link rel="alternate" type="text/html" href="http://www.elinux.org/ASEE_2013_Workshop"/>
				<updated>2013-06-14T16:40:16Z</updated>
		
		<summary type="html">&lt;p&gt;Yoder: /* Reading a switch */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:ECE497 |Workshop]]&lt;br /&gt;
{{YoderHead}}&lt;br /&gt;
Here are the labs for the afternoon Linux part of the [http://www.asee.org/public/conferences/20/registration/view_session?session_id=2420 ASEE 2013 Workshop]&lt;br /&gt;
&lt;br /&gt;
== Warm Up ==&lt;br /&gt;
[[File:PuTTYconfiguration.jpg|thumbnail]]&lt;br /&gt;
Before we can interact with LEDs and switches we need to learn some simple Linux commands. &lt;br /&gt;
# On your host computer, running Windows, start up '''puTTY'''.  &lt;br /&gt;
# If you get a ''Security Warning'', click '''Run'''.&lt;br /&gt;
# Enter '''192.167.7.2''' in the '''Host Name''' field and click '''Open'''&lt;br /&gt;
# Login as '''root''' with no password.&lt;br /&gt;
# Enter '''ls'''  to list what files you have. You shouldn't see much.&lt;br /&gt;
[[File:PuTTYloging.jpg|thumbnail]]&lt;br /&gt;
&lt;br /&gt;
At this point you need to learn a few simple Linux commands for creating and displaying files. Once you know these commands it's easy to turn an LED on and off.&lt;br /&gt;
&lt;br /&gt;
First, let's edit a file using the '''nano''' editor.  Nano is a simple editor that easy to learn. This will edit (and create) the file '''play.txt'''.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''nano play.txt'''&lt;br /&gt;
&lt;br /&gt;
Add a couple of lines of text to the file, it doesn't really matter what and then Exit. You can list the files in the current directory with '''ls''' and show the contents of a file with '''cat'''.&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 Desktop  play.txt&lt;br /&gt;
 bone$ '''cat play.txt'''&lt;br /&gt;
 A couple of lines&lt;br /&gt;
 of text.&lt;br /&gt;
&lt;br /&gt;
Use '''echo''' to print a line of text.&lt;br /&gt;
 bone$ '''echo This is a line of text'''&lt;br /&gt;
 This is a line of text&lt;br /&gt;
&lt;br /&gt;
Here's a powerful operator.  You can take the output of any command and redirect it to a file with '''&amp;gt;'''.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo This is a line of text &amp;gt; here.txt'''&lt;br /&gt;
 bone$ '''cat here.txt'''&lt;br /&gt;
 This is a line of text&lt;br /&gt;
&lt;br /&gt;
We are almost there.  Use '''cd''' to change directories.  '''/''' is the top level directory.&lt;br /&gt;
 bone$ '''cd /'''&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 bin   dev  home  lost+found  mnt   run   sys  usr&lt;br /&gt;
 boot  etc  lib   media       proc  sbin  tmp  var&lt;br /&gt;
&lt;br /&gt;
If you ever get lost, '''cd''' alone takes you home.&lt;br /&gt;
 bone$ '''cd'''&lt;br /&gt;
 gone$ '''ls'''&lt;br /&gt;
 Desktop  here.txt  play.txt&lt;br /&gt;
&lt;br /&gt;
Now you are ready to flash an LED.&lt;br /&gt;
&lt;br /&gt;
== Blinking an LED ==&lt;br /&gt;
=== gpio via the Shell Command Line and sysfs ===&lt;br /&gt;
&lt;br /&gt;
Another easy way to do general purpose I/O (gpio) on the Beagle is through a terminal window and a shell prompt. In Linux, almost everything is treated as a file, even things that aren't files. Here we'll use a virtual file system called '''sysfs'''.  sysfs exposes the drivers for the hardware so you can easily use them.&lt;br /&gt;
&lt;br /&gt;
Try this:&lt;br /&gt;
 bone$ '''cd /sys'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 block/  bus/  class/  dev/  devices/  firmware/  fs/  kernel/  module/  power/&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;'''/'''&amp;quot; after the name means it's a directory. Here we see several directories that represent hardware we can control. Explore a bit and see what you find.&lt;br /&gt;
&lt;br /&gt;
Now try:&lt;br /&gt;
&lt;br /&gt;
 beagle$ '''cd /sys/class'''&lt;br /&gt;
 beagle$ '''ls -F'''&lt;br /&gt;
 backlight/  firmware/     lcd/       mtd/           scsi_disk/   ubi/&lt;br /&gt;
 bdi/        gpio/         leds/      net/           scsi_host/   udc/&lt;br /&gt;
 block/      graphics/     mbox/      power_supply/  sound/       uio/&lt;br /&gt;
 bluetooth/  hwmon/        mdio_bus/  regulator/     spi_master/  usbmon/&lt;br /&gt;
 bsg/        i2c-adapter/  mem/       rfkill/        spidev/      vc/&lt;br /&gt;
 dma/        i2c-dev/      misc/      rtc/           thermal/     vtconsole/&lt;br /&gt;
 drm/        input/        mmc_host/  scsi_device/   tty/         watchdog/&lt;br /&gt;
&lt;br /&gt;
Explore some.  &lt;br /&gt;
&lt;br /&gt;
=== Blinking a USR LED ===&lt;br /&gt;
The Beagle Black has four user LEDS, '''user0''' - '''user3''', that you can control. Try this:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/class/leds'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 beaglebone:green:usr0  beaglebone:green:usr2&lt;br /&gt;
 beaglebone:green:usr1  beaglebone:green:usr3&lt;br /&gt;
&lt;br /&gt;
Here you see the directories for controlling each of the usr LEDs. By default, usr0 flashes a heartbeat pattern and usr1 flashes when the micro SD card is accessed.  Let's control usr0.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd beagleboard\:\:usr0'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 brightness  device@  max_brightness  power/  subsystem@  trigger  uevent&lt;br /&gt;
&lt;br /&gt;
(The &amp;quot;'''@'''&amp;quot; after the name means it's a link.)  See what's in '''brightness''', '''max_brightness''' and '''trigger''' by using the &amp;lt;code&amp;gt;cat&amp;lt;/code&amp;gt; command.  For example:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cat trigger'''&lt;br /&gt;
 none nand-disk mmc0 timer oneshot [heartbeat] backlight gpio cpu0 default-on transient&lt;br /&gt;
&lt;br /&gt;
This shows trigger can have many values.  The present value is '''heartbeat'''.  Check the LED, is it beating?  You can stop the heartbeat via:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo none &amp;gt; trigger'''&lt;br /&gt;
 bone$ '''cat trigger'''&lt;br /&gt;
 [none] nand-disk mmc0 timer oneshot heartbeat backlight gpio cpu0 default-on transient &lt;br /&gt;
&lt;br /&gt;
Did it stop beating?  You can now turn it on and off with:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; brightness'''&lt;br /&gt;
 bone$ '''echo 0 &amp;gt; brightness'''&lt;br /&gt;
&lt;br /&gt;
Is it responding correctly?&lt;br /&gt;
&lt;br /&gt;
The Bone has more trigger options.  Try:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cat trigger'''&lt;br /&gt;
 [none] mmc0 timer heartbeat backlight gpio default-on &lt;br /&gt;
 bone$ '''echo timer &amp;gt; trigger'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 brightness  delay_on  max_brightness  subsystem@  uevent&lt;br /&gt;
 delay_off   device@   power/          trigger&lt;br /&gt;
 bone$ '''echo 100 &amp;gt; delay_on'''&lt;br /&gt;
 bone$ '''echo 900 &amp;gt; delay_off'''&lt;br /&gt;
&lt;br /&gt;
What does this do?&lt;br /&gt;
&lt;br /&gt;
=== Blinking an External LED via gpio ===&lt;br /&gt;
&lt;br /&gt;
In the AM lab we wired an LED to the P9_12 General Purpose IO (gpio) port and controlled it via BoneScript.  Here we'll control it via a shell command. First we need to figure out which gpio pin P9_12 is attached to.  The following figure shows it attached to gpio_60.&lt;br /&gt;
&lt;br /&gt;
[[File:P9PWMs.jpg | 600px]]&lt;br /&gt;
&lt;br /&gt;
Here's how you turn it on&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/class/gpio'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  gpiochip0@  gpiochip32@  gpiochip64@  gpiochip96@  unexport&lt;br /&gt;
&lt;br /&gt;
Presently no gpio pins are visible.  You need to tell it which pin to export&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo 60 &amp;gt; export'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  gpio60@  gpiochip0@  gpiochip32@  gpiochip64@  gpiochip96@  unexport&lt;br /&gt;
&lt;br /&gt;
Notice '''gpio60''' has appeared.  All we need to do is tell it which direction and then turn it on.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd gpio60'''&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 active_low  direction  edge  power  subsystem  uevent  value&lt;br /&gt;
 bone$ '''echo out &amp;gt; direction'''&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; value'''&lt;br /&gt;
Your LED should be on!&lt;br /&gt;
 bone$ '''echo 0 &amp;gt; value'''&lt;br /&gt;
Now it's off.&lt;br /&gt;
&lt;br /&gt;
== Reading a switch ==&lt;br /&gt;
&lt;br /&gt;
Now that you have an LED working, wiring in a switch is easy.  In the AM lab you wired a switch to P9_42, which from the table above is '''gpio_7'''. &lt;br /&gt;
&lt;br /&gt;
Based on what you saw above.&lt;br /&gt;
 bone$ '''cd /sys/class/gpio'''&lt;br /&gt;
 bone$ '''echo 7 &amp;gt; export'''&lt;br /&gt;
 bone$ '''cd gpio7'''&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 bone$ '''echo in &amp;gt; direction'''&lt;br /&gt;
 bone$ '''cat value'''&lt;br /&gt;
 0&lt;br /&gt;
Now hold the button down and try again.&lt;br /&gt;
 bone$ '''cat value'''&lt;br /&gt;
 1&lt;br /&gt;
Once you have the switch and LED working use '''nano''' and put the following in a file.&lt;br /&gt;
 bone$ '''cd'''  (Go back home)&lt;br /&gt;
 bone$ '''nano button.sh'''&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 cd /sys/class/gpio&lt;br /&gt;
 while [ 1 ]&lt;br /&gt;
 do&lt;br /&gt;
    cat gpio7/value&lt;br /&gt;
    sleep 0.25&lt;br /&gt;
 done&lt;br /&gt;
Quit nano and run&lt;br /&gt;
 bone$ '''chmod +x button.sh'''  (This makes button.sh executable)&lt;br /&gt;
 bone$ '''./button.sh'''&lt;br /&gt;
What happens when you push the button?&lt;br /&gt;
&lt;br /&gt;
Now experiment around. Can you flash the LED? How fast? Make the LED read the switch.&lt;br /&gt;
&lt;br /&gt;
== Analog In ==&lt;br /&gt;
The bone has eight Analog Inputs.  Several are exposed on P9.  They are labeled '''AIN''' in table 11 below.  How many do you find?&lt;br /&gt;
&lt;br /&gt;
[[File:P9PWMs.jpg|800px]]&lt;br /&gt;
&lt;br /&gt;
The AIN pins are sampled at 12 bits and 100k samples per second.  The input voltage is between 0 and 1.8V.  Fortunately, both voltages are available on P9.&lt;br /&gt;
&lt;br /&gt;
You've already wired these up for the AM lab. You interact with the analog in much like the gpio, but it appears in a different. We have to run a command before the AIN interface appears.  Just run them now, later I'll explain what you did if you are interested.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''SLOTS=/sys/devices/bone_capemgr.*/slots'''&lt;br /&gt;
 bone$ '''echo cape-bone-iio &amp;gt; $SLOTS'''&lt;br /&gt;
&lt;br /&gt;
You can now access the analog interface, let's explore.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/devices/ocp.2/helper.14'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 AIN0  AIN2  AIN4  AIN6  driver@   power/      uevent&lt;br /&gt;
 AIN1  AIN3  AIN5  AIN7  modalias  subsystem@&lt;br /&gt;
&lt;br /&gt;
There are the various analog inputs, but watch out.  This interface starts numbering at '''1''' and Table 11 starts at '''0''', so to read AIN5 you need to look at '''AIN6'''!&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cat AIN6'''&lt;br /&gt;
 1185&lt;br /&gt;
&lt;br /&gt;
Change the pot and rerun '''cat'''.  What's the min and max value you get?  Is it 12 bits?&lt;br /&gt;
&lt;br /&gt;
You can use the following script to continuously read the input.&lt;br /&gt;
 while [ 1 ]&lt;br /&gt;
   do &lt;br /&gt;
   tr '\n' '\r' &amp;lt; AIN6&lt;br /&gt;
 done&lt;br /&gt;
&lt;br /&gt;
== Pulse Width Modulation ==&lt;br /&gt;
&lt;br /&gt;
(Note: The pwm interface seems to changing. Some of this may not apply in the future.)&lt;br /&gt;
&lt;br /&gt;
The Bone has a PWM interface at &amp;lt;code&amp;gt;/sys/class/pwm/&amp;lt;/code&amp;gt;. You can see what's there by:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/class/pwm'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  unexport&lt;br /&gt;
Hmmm, there isn't much there.  We have to run a command to make something appear.  Try&lt;br /&gt;
 bone$ '''SLOTS=/sys/devices/bone_capemgr.*/slots'''&lt;br /&gt;
 bone$ '''echo am33xx_pwm &amp;gt; $SLOTS'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  pwmchip0@  pwmchip2@  pwmchip3@  pwmchip5@  pwmchip7@  unexport&lt;br /&gt;
Now we need to run another command to say which pwm pin we want to use.  I'm using P9_21.&lt;br /&gt;
 bone$ '''echo bone_pwm_P9_21 &amp;gt; $SLOTS&lt;br /&gt;
Now you can export a pwm much list you export a gpio port&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; export'''&lt;br /&gt;
 bone$ '''cd pwm1'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 device@  duty_ns  period_ns  polarity  power/  run  subsystem@  uevent&lt;br /&gt;
Try a 1Hz frequency with a 25% duty cycle&lt;br /&gt;
 bone$ '''echo 1000000000 &amp;gt; period_ns'''&lt;br /&gt;
 bone$ '''echo  250000000 &amp;gt; duty_ns'''&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; run'''&lt;br /&gt;
&lt;br /&gt;
Connect the LED from and watch it flash.  Try changing the frequency and duty cycle.  You may have to set the duty cycle to 0 to change the frequency.  Can you guess why?&lt;br /&gt;
&lt;br /&gt;
=== Challenge ===&lt;br /&gt;
Combine the analog in and the PWM by having the pot control the frequency or the duty cycle of the LED.&lt;br /&gt;
 &lt;br /&gt;
{{YoderFoot}}&lt;/div&gt;</summary>
		<author><name>Yoder</name></author>	</entry>

	<entry>
		<id>http://www.elinux.org/ASEE_2013_Workshop</id>
		<title>ASEE 2013 Workshop</title>
		<link rel="alternate" type="text/html" href="http://www.elinux.org/ASEE_2013_Workshop"/>
				<updated>2013-06-14T16:28:00Z</updated>
		
		<summary type="html">&lt;p&gt;Yoder: /* Blinking an External LED via gpio */ Removed unexport&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:ECE497 |Workshop]]&lt;br /&gt;
{{YoderHead}}&lt;br /&gt;
Here are the labs for the afternoon Linux part of the [http://www.asee.org/public/conferences/20/registration/view_session?session_id=2420 ASEE 2013 Workshop]&lt;br /&gt;
&lt;br /&gt;
== Warm Up ==&lt;br /&gt;
[[File:PuTTYconfiguration.jpg|thumbnail]]&lt;br /&gt;
Before we can interact with LEDs and switches we need to learn some simple Linux commands. &lt;br /&gt;
# On your host computer, running Windows, start up '''puTTY'''.  &lt;br /&gt;
# If you get a ''Security Warning'', click '''Run'''.&lt;br /&gt;
# Enter '''192.167.7.2''' in the '''Host Name''' field and click '''Open'''&lt;br /&gt;
# Login as '''root''' with no password.&lt;br /&gt;
# Enter '''ls'''  to list what files you have. You shouldn't see much.&lt;br /&gt;
[[File:PuTTYloging.jpg|thumbnail]]&lt;br /&gt;
&lt;br /&gt;
At this point you need to learn a few simple Linux commands for creating and displaying files. Once you know these commands it's easy to turn an LED on and off.&lt;br /&gt;
&lt;br /&gt;
First, let's edit a file using the '''nano''' editor.  Nano is a simple editor that easy to learn. This will edit (and create) the file '''play.txt'''.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''nano play.txt'''&lt;br /&gt;
&lt;br /&gt;
Add a couple of lines of text to the file, it doesn't really matter what and then Exit. You can list the files in the current directory with '''ls''' and show the contents of a file with '''cat'''.&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 Desktop  play.txt&lt;br /&gt;
 bone$ '''cat play.txt'''&lt;br /&gt;
 A couple of lines&lt;br /&gt;
 of text.&lt;br /&gt;
&lt;br /&gt;
Use '''echo''' to print a line of text.&lt;br /&gt;
 bone$ '''echo This is a line of text'''&lt;br /&gt;
 This is a line of text&lt;br /&gt;
&lt;br /&gt;
Here's a powerful operator.  You can take the output of any command and redirect it to a file with '''&amp;gt;'''.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo This is a line of text &amp;gt; here.txt'''&lt;br /&gt;
 bone$ '''cat here.txt'''&lt;br /&gt;
 This is a line of text&lt;br /&gt;
&lt;br /&gt;
We are almost there.  Use '''cd''' to change directories.  '''/''' is the top level directory.&lt;br /&gt;
 bone$ '''cd /'''&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 bin   dev  home  lost+found  mnt   run   sys  usr&lt;br /&gt;
 boot  etc  lib   media       proc  sbin  tmp  var&lt;br /&gt;
&lt;br /&gt;
If you ever get lost, '''cd''' alone takes you home.&lt;br /&gt;
 bone$ '''cd'''&lt;br /&gt;
 gone$ '''ls'''&lt;br /&gt;
 Desktop  here.txt  play.txt&lt;br /&gt;
&lt;br /&gt;
Now you are ready to flash an LED.&lt;br /&gt;
&lt;br /&gt;
== Blinking an LED ==&lt;br /&gt;
=== gpio via the Shell Command Line and sysfs ===&lt;br /&gt;
&lt;br /&gt;
Another easy way to do general purpose I/O (gpio) on the Beagle is through a terminal window and a shell prompt. In Linux, almost everything is treated as a file, even things that aren't files. Here we'll use a virtual file system called '''sysfs'''.  sysfs exposes the drivers for the hardware so you can easily use them.&lt;br /&gt;
&lt;br /&gt;
Try this:&lt;br /&gt;
 bone$ '''cd /sys'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 block/  bus/  class/  dev/  devices/  firmware/  fs/  kernel/  module/  power/&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;'''/'''&amp;quot; after the name means it's a directory. Here we see several directories that represent hardware we can control. Explore a bit and see what you find.&lt;br /&gt;
&lt;br /&gt;
Now try:&lt;br /&gt;
&lt;br /&gt;
 beagle$ '''cd /sys/class'''&lt;br /&gt;
 beagle$ '''ls -F'''&lt;br /&gt;
 backlight/  firmware/     lcd/       mtd/           scsi_disk/   ubi/&lt;br /&gt;
 bdi/        gpio/         leds/      net/           scsi_host/   udc/&lt;br /&gt;
 block/      graphics/     mbox/      power_supply/  sound/       uio/&lt;br /&gt;
 bluetooth/  hwmon/        mdio_bus/  regulator/     spi_master/  usbmon/&lt;br /&gt;
 bsg/        i2c-adapter/  mem/       rfkill/        spidev/      vc/&lt;br /&gt;
 dma/        i2c-dev/      misc/      rtc/           thermal/     vtconsole/&lt;br /&gt;
 drm/        input/        mmc_host/  scsi_device/   tty/         watchdog/&lt;br /&gt;
&lt;br /&gt;
Explore some.  &lt;br /&gt;
&lt;br /&gt;
=== Blinking a USR LED ===&lt;br /&gt;
The Beagle Black has four user LEDS, '''user0''' - '''user3''', that you can control. Try this:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/class/leds'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 beaglebone:green:usr0  beaglebone:green:usr2&lt;br /&gt;
 beaglebone:green:usr1  beaglebone:green:usr3&lt;br /&gt;
&lt;br /&gt;
Here you see the directories for controlling each of the usr LEDs. By default, usr0 flashes a heartbeat pattern and usr1 flashes when the micro SD card is accessed.  Let's control usr0.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd beagleboard\:\:usr0'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 brightness  device@  max_brightness  power/  subsystem@  trigger  uevent&lt;br /&gt;
&lt;br /&gt;
(The &amp;quot;'''@'''&amp;quot; after the name means it's a link.)  See what's in '''brightness''', '''max_brightness''' and '''trigger''' by using the &amp;lt;code&amp;gt;cat&amp;lt;/code&amp;gt; command.  For example:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cat trigger'''&lt;br /&gt;
 none nand-disk mmc0 timer oneshot [heartbeat] backlight gpio cpu0 default-on transient&lt;br /&gt;
&lt;br /&gt;
This shows trigger can have many values.  The present value is '''heartbeat'''.  Check the LED, is it beating?  You can stop the heartbeat via:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo none &amp;gt; trigger'''&lt;br /&gt;
 bone$ '''cat trigger'''&lt;br /&gt;
 [none] nand-disk mmc0 timer oneshot heartbeat backlight gpio cpu0 default-on transient &lt;br /&gt;
&lt;br /&gt;
Did it stop beating?  You can now turn it on and off with:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; brightness'''&lt;br /&gt;
 bone$ '''echo 0 &amp;gt; brightness'''&lt;br /&gt;
&lt;br /&gt;
Is it responding correctly?&lt;br /&gt;
&lt;br /&gt;
The Bone has more trigger options.  Try:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cat trigger'''&lt;br /&gt;
 [none] mmc0 timer heartbeat backlight gpio default-on &lt;br /&gt;
 bone$ '''echo timer &amp;gt; trigger'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 brightness  delay_on  max_brightness  subsystem@  uevent&lt;br /&gt;
 delay_off   device@   power/          trigger&lt;br /&gt;
 bone$ '''echo 100 &amp;gt; delay_on'''&lt;br /&gt;
 bone$ '''echo 900 &amp;gt; delay_off'''&lt;br /&gt;
&lt;br /&gt;
What does this do?&lt;br /&gt;
&lt;br /&gt;
=== Blinking an External LED via gpio ===&lt;br /&gt;
&lt;br /&gt;
In the AM lab we wired an LED to the P9_12 General Purpose IO (gpio) port and controlled it via BoneScript.  Here we'll control it via a shell command. First we need to figure out which gpio pin P9_12 is attached to.  The following figure shows it attached to gpio_60.&lt;br /&gt;
&lt;br /&gt;
[[File:P9PWMs.jpg | 600px]]&lt;br /&gt;
&lt;br /&gt;
Here's how you turn it on&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/class/gpio'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  gpiochip0@  gpiochip32@  gpiochip64@  gpiochip96@  unexport&lt;br /&gt;
&lt;br /&gt;
Presently no gpio pins are visible.  You need to tell it which pin to export&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo 60 &amp;gt; export'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  gpio60@  gpiochip0@  gpiochip32@  gpiochip64@  gpiochip96@  unexport&lt;br /&gt;
&lt;br /&gt;
Notice '''gpio60''' has appeared.  All we need to do is tell it which direction and then turn it on.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd gpio60'''&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 active_low  direction  edge  power  subsystem  uevent  value&lt;br /&gt;
 bone$ '''echo out &amp;gt; direction'''&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; value'''&lt;br /&gt;
Your LED should be on!&lt;br /&gt;
 bone$ '''echo 0 &amp;gt; value'''&lt;br /&gt;
Now it's off.&lt;br /&gt;
&lt;br /&gt;
== Reading a switch ==&lt;br /&gt;
&lt;br /&gt;
Now that you have an LED working, wiring in a switch is easy.  In the AM lab you wired a switch to P9_42, which from the table above is '''gpio_7'''. &lt;br /&gt;
&lt;br /&gt;
Based on what you saw above.&lt;br /&gt;
 bone$ '''cd /sys/class/gpio'''&lt;br /&gt;
 bone$ '''echo 7 &amp;gt; export'''&lt;br /&gt;
 bone$ '''cd gpio7'''&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 bone$ '''echo in &amp;gt; direction'''&lt;br /&gt;
 bone$ '''cat value'''&lt;br /&gt;
 0&lt;br /&gt;
Now hold the button down and try again.&lt;br /&gt;
 bone$ '''cat value'''&lt;br /&gt;
 1&lt;br /&gt;
Once you have the switch and LED working use '''nano''' and put the following in a file.&lt;br /&gt;
 bone$ '''nano button.sh'''&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 cd /sys/class/gpio&lt;br /&gt;
 while [ 1 ]&lt;br /&gt;
 do&lt;br /&gt;
    cat gpio7/value&lt;br /&gt;
    sleep 0.25&lt;br /&gt;
 done&lt;br /&gt;
Quit nano and run&lt;br /&gt;
 bone$ '''chmod +x button.sh'''  (This makes button.sh executable)&lt;br /&gt;
 bone$ '''./button.sh'''&lt;br /&gt;
What happens when you push the button?&lt;br /&gt;
&lt;br /&gt;
Now experiment around. Can you flash the LED? How fast? Make the LED read the switch.&lt;br /&gt;
&lt;br /&gt;
== Analog In ==&lt;br /&gt;
The bone has eight Analog Inputs.  Several are exposed on P9.  They are labeled '''AIN''' in table 11 below.  How many do you find?&lt;br /&gt;
&lt;br /&gt;
[[File:P9PWMs.jpg|800px]]&lt;br /&gt;
&lt;br /&gt;
The AIN pins are sampled at 12 bits and 100k samples per second.  The input voltage is between 0 and 1.8V.  Fortunately, both voltages are available on P9.&lt;br /&gt;
&lt;br /&gt;
You've already wired these up for the AM lab. You interact with the analog in much like the gpio, but it appears in a different. We have to run a command before the AIN interface appears.  Just run them now, later I'll explain what you did if you are interested.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''SLOTS=/sys/devices/bone_capemgr.*/slots'''&lt;br /&gt;
 bone$ '''echo cape-bone-iio &amp;gt; $SLOTS'''&lt;br /&gt;
&lt;br /&gt;
You can now access the analog interface, let's explore.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/devices/ocp.2/helper.14'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 AIN0  AIN2  AIN4  AIN6  driver@   power/      uevent&lt;br /&gt;
 AIN1  AIN3  AIN5  AIN7  modalias  subsystem@&lt;br /&gt;
&lt;br /&gt;
There are the various analog inputs, but watch out.  This interface starts numbering at '''1''' and Table 11 starts at '''0''', so to read AIN5 you need to look at '''AIN6'''!&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cat AIN6'''&lt;br /&gt;
 1185&lt;br /&gt;
&lt;br /&gt;
Change the pot and rerun '''cat'''.  What's the min and max value you get?  Is it 12 bits?&lt;br /&gt;
&lt;br /&gt;
You can use the following script to continuously read the input.&lt;br /&gt;
 while [ 1 ]&lt;br /&gt;
   do &lt;br /&gt;
   tr '\n' '\r' &amp;lt; AIN6&lt;br /&gt;
 done&lt;br /&gt;
&lt;br /&gt;
== Pulse Width Modulation ==&lt;br /&gt;
&lt;br /&gt;
(Note: The pwm interface seems to changing. Some of this may not apply in the future.)&lt;br /&gt;
&lt;br /&gt;
The Bone has a PWM interface at &amp;lt;code&amp;gt;/sys/class/pwm/&amp;lt;/code&amp;gt;. You can see what's there by:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/class/pwm'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  unexport&lt;br /&gt;
Hmmm, there isn't much there.  We have to run a command to make something appear.  Try&lt;br /&gt;
 bone$ '''SLOTS=/sys/devices/bone_capemgr.*/slots'''&lt;br /&gt;
 bone$ '''echo am33xx_pwm &amp;gt; $SLOTS'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  pwmchip0@  pwmchip2@  pwmchip3@  pwmchip5@  pwmchip7@  unexport&lt;br /&gt;
Now we need to run another command to say which pwm pin we want to use.  I'm using P9_21.&lt;br /&gt;
 bone$ '''echo bone_pwm_P9_21 &amp;gt; $SLOTS&lt;br /&gt;
Now you can export a pwm much list you export a gpio port&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; export'''&lt;br /&gt;
 bone$ '''cd pwm1'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 device@  duty_ns  period_ns  polarity  power/  run  subsystem@  uevent&lt;br /&gt;
Try a 1Hz frequency with a 25% duty cycle&lt;br /&gt;
 bone$ '''echo 1000000000 &amp;gt; period_ns'''&lt;br /&gt;
 bone$ '''echo  250000000 &amp;gt; duty_ns'''&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; run'''&lt;br /&gt;
&lt;br /&gt;
Connect the LED from and watch it flash.  Try changing the frequency and duty cycle.  You may have to set the duty cycle to 0 to change the frequency.  Can you guess why?&lt;br /&gt;
&lt;br /&gt;
=== Challenge ===&lt;br /&gt;
Combine the analog in and the PWM by having the pot control the frequency or the duty cycle of the LED.&lt;br /&gt;
 &lt;br /&gt;
{{YoderFoot}}&lt;/div&gt;</summary>
		<author><name>Yoder</name></author>	</entry>

	<entry>
		<id>http://www.elinux.org/ASEE_2013_Workshop</id>
		<title>ASEE 2013 Workshop</title>
		<link rel="alternate" type="text/html" href="http://www.elinux.org/ASEE_2013_Workshop"/>
				<updated>2013-06-14T16:26:35Z</updated>
		
		<summary type="html">&lt;p&gt;Yoder: /* Blinking an External LED via gpio */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:ECE497 |Workshop]]&lt;br /&gt;
{{YoderHead}}&lt;br /&gt;
Here are the labs for the afternoon Linux part of the [http://www.asee.org/public/conferences/20/registration/view_session?session_id=2420 ASEE 2013 Workshop]&lt;br /&gt;
&lt;br /&gt;
== Warm Up ==&lt;br /&gt;
[[File:PuTTYconfiguration.jpg|thumbnail]]&lt;br /&gt;
Before we can interact with LEDs and switches we need to learn some simple Linux commands. &lt;br /&gt;
# On your host computer, running Windows, start up '''puTTY'''.  &lt;br /&gt;
# If you get a ''Security Warning'', click '''Run'''.&lt;br /&gt;
# Enter '''192.167.7.2''' in the '''Host Name''' field and click '''Open'''&lt;br /&gt;
# Login as '''root''' with no password.&lt;br /&gt;
# Enter '''ls'''  to list what files you have. You shouldn't see much.&lt;br /&gt;
[[File:PuTTYloging.jpg|thumbnail]]&lt;br /&gt;
&lt;br /&gt;
At this point you need to learn a few simple Linux commands for creating and displaying files. Once you know these commands it's easy to turn an LED on and off.&lt;br /&gt;
&lt;br /&gt;
First, let's edit a file using the '''nano''' editor.  Nano is a simple editor that easy to learn. This will edit (and create) the file '''play.txt'''.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''nano play.txt'''&lt;br /&gt;
&lt;br /&gt;
Add a couple of lines of text to the file, it doesn't really matter what and then Exit. You can list the files in the current directory with '''ls''' and show the contents of a file with '''cat'''.&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 Desktop  play.txt&lt;br /&gt;
 bone$ '''cat play.txt'''&lt;br /&gt;
 A couple of lines&lt;br /&gt;
 of text.&lt;br /&gt;
&lt;br /&gt;
Use '''echo''' to print a line of text.&lt;br /&gt;
 bone$ '''echo This is a line of text'''&lt;br /&gt;
 This is a line of text&lt;br /&gt;
&lt;br /&gt;
Here's a powerful operator.  You can take the output of any command and redirect it to a file with '''&amp;gt;'''.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo This is a line of text &amp;gt; here.txt'''&lt;br /&gt;
 bone$ '''cat here.txt'''&lt;br /&gt;
 This is a line of text&lt;br /&gt;
&lt;br /&gt;
We are almost there.  Use '''cd''' to change directories.  '''/''' is the top level directory.&lt;br /&gt;
 bone$ '''cd /'''&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 bin   dev  home  lost+found  mnt   run   sys  usr&lt;br /&gt;
 boot  etc  lib   media       proc  sbin  tmp  var&lt;br /&gt;
&lt;br /&gt;
If you ever get lost, '''cd''' alone takes you home.&lt;br /&gt;
 bone$ '''cd'''&lt;br /&gt;
 gone$ '''ls'''&lt;br /&gt;
 Desktop  here.txt  play.txt&lt;br /&gt;
&lt;br /&gt;
Now you are ready to flash an LED.&lt;br /&gt;
&lt;br /&gt;
== Blinking an LED ==&lt;br /&gt;
=== gpio via the Shell Command Line and sysfs ===&lt;br /&gt;
&lt;br /&gt;
Another easy way to do general purpose I/O (gpio) on the Beagle is through a terminal window and a shell prompt. In Linux, almost everything is treated as a file, even things that aren't files. Here we'll use a virtual file system called '''sysfs'''.  sysfs exposes the drivers for the hardware so you can easily use them.&lt;br /&gt;
&lt;br /&gt;
Try this:&lt;br /&gt;
 bone$ '''cd /sys'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 block/  bus/  class/  dev/  devices/  firmware/  fs/  kernel/  module/  power/&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;'''/'''&amp;quot; after the name means it's a directory. Here we see several directories that represent hardware we can control. Explore a bit and see what you find.&lt;br /&gt;
&lt;br /&gt;
Now try:&lt;br /&gt;
&lt;br /&gt;
 beagle$ '''cd /sys/class'''&lt;br /&gt;
 beagle$ '''ls -F'''&lt;br /&gt;
 backlight/  firmware/     lcd/       mtd/           scsi_disk/   ubi/&lt;br /&gt;
 bdi/        gpio/         leds/      net/           scsi_host/   udc/&lt;br /&gt;
 block/      graphics/     mbox/      power_supply/  sound/       uio/&lt;br /&gt;
 bluetooth/  hwmon/        mdio_bus/  regulator/     spi_master/  usbmon/&lt;br /&gt;
 bsg/        i2c-adapter/  mem/       rfkill/        spidev/      vc/&lt;br /&gt;
 dma/        i2c-dev/      misc/      rtc/           thermal/     vtconsole/&lt;br /&gt;
 drm/        input/        mmc_host/  scsi_device/   tty/         watchdog/&lt;br /&gt;
&lt;br /&gt;
Explore some.  &lt;br /&gt;
&lt;br /&gt;
=== Blinking a USR LED ===&lt;br /&gt;
The Beagle Black has four user LEDS, '''user0''' - '''user3''', that you can control. Try this:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/class/leds'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 beaglebone:green:usr0  beaglebone:green:usr2&lt;br /&gt;
 beaglebone:green:usr1  beaglebone:green:usr3&lt;br /&gt;
&lt;br /&gt;
Here you see the directories for controlling each of the usr LEDs. By default, usr0 flashes a heartbeat pattern and usr1 flashes when the micro SD card is accessed.  Let's control usr0.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd beagleboard\:\:usr0'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 brightness  device@  max_brightness  power/  subsystem@  trigger  uevent&lt;br /&gt;
&lt;br /&gt;
(The &amp;quot;'''@'''&amp;quot; after the name means it's a link.)  See what's in '''brightness''', '''max_brightness''' and '''trigger''' by using the &amp;lt;code&amp;gt;cat&amp;lt;/code&amp;gt; command.  For example:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cat trigger'''&lt;br /&gt;
 none nand-disk mmc0 timer oneshot [heartbeat] backlight gpio cpu0 default-on transient&lt;br /&gt;
&lt;br /&gt;
This shows trigger can have many values.  The present value is '''heartbeat'''.  Check the LED, is it beating?  You can stop the heartbeat via:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo none &amp;gt; trigger'''&lt;br /&gt;
 bone$ '''cat trigger'''&lt;br /&gt;
 [none] nand-disk mmc0 timer oneshot heartbeat backlight gpio cpu0 default-on transient &lt;br /&gt;
&lt;br /&gt;
Did it stop beating?  You can now turn it on and off with:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; brightness'''&lt;br /&gt;
 bone$ '''echo 0 &amp;gt; brightness'''&lt;br /&gt;
&lt;br /&gt;
Is it responding correctly?&lt;br /&gt;
&lt;br /&gt;
The Bone has more trigger options.  Try:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cat trigger'''&lt;br /&gt;
 [none] mmc0 timer heartbeat backlight gpio default-on &lt;br /&gt;
 bone$ '''echo timer &amp;gt; trigger'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 brightness  delay_on  max_brightness  subsystem@  uevent&lt;br /&gt;
 delay_off   device@   power/          trigger&lt;br /&gt;
 bone$ '''echo 100 &amp;gt; delay_on'''&lt;br /&gt;
 bone$ '''echo 900 &amp;gt; delay_off'''&lt;br /&gt;
&lt;br /&gt;
What does this do?&lt;br /&gt;
&lt;br /&gt;
=== Blinking an External LED via gpio ===&lt;br /&gt;
&lt;br /&gt;
In the AM lab we wired an LED to the P9_12 General Purpose IO (gpio) port and controlled it via BoneScript.  Here we'll control it via a shell command. First we need to figure out which gpio pin P9_12 is attached to.  The following figure shows it attached to gpio_60.&lt;br /&gt;
&lt;br /&gt;
[[File:P9PWMs.jpg | 600px]]&lt;br /&gt;
&lt;br /&gt;
Here's how you turn it on&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/class/gpio'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  gpiochip0@  gpiochip32@  gpiochip64@  gpiochip96@  unexport&lt;br /&gt;
&lt;br /&gt;
Presently no gpio pins are visible.  You need to tell it which pin to export&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo 60 &amp;gt; export'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  gpio60@  gpiochip0@  gpiochip32@  gpiochip64@  gpiochip96@  unexport&lt;br /&gt;
&lt;br /&gt;
Notice '''gpio60''' has appeared.  All we need to do is tell it which direction and then turn it on.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd gpio60'''&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 active_low  direction  edge  power  subsystem  uevent  value&lt;br /&gt;
 bone$ '''echo out &amp;gt; direction'''&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; value'''&lt;br /&gt;
Your LED should be on!&lt;br /&gt;
 bone$ '''echo 0 &amp;gt; value'''&lt;br /&gt;
Now it's off.  When you are done you can unexport the pin and it will disappear.&lt;br /&gt;
 bone$ '''cd ..'''&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 export  gpio60  gpiochip0  gpiochip32  gpiochip64  gpiochip96  unexport&lt;br /&gt;
 bone$ '''echo 60 &amp;gt; unexport'''&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 export  gpiochip0  gpiochip32  gpiochip64  gpiochip96  unexport&lt;br /&gt;
&lt;br /&gt;
== Reading a switch ==&lt;br /&gt;
&lt;br /&gt;
Now that you have an LED working, wiring in a switch is easy.  In the AM lab you wired a switch to P9_42, which from the table above is '''gpio_7'''. &lt;br /&gt;
&lt;br /&gt;
Based on what you saw above.&lt;br /&gt;
 bone$ '''cd /sys/class/gpio'''&lt;br /&gt;
 bone$ '''echo 7 &amp;gt; export'''&lt;br /&gt;
 bone$ '''cd gpio7'''&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 bone$ '''echo in &amp;gt; direction'''&lt;br /&gt;
 bone$ '''cat value'''&lt;br /&gt;
 0&lt;br /&gt;
Now hold the button down and try again.&lt;br /&gt;
 bone$ '''cat value'''&lt;br /&gt;
 1&lt;br /&gt;
Once you have the switch and LED working use '''nano''' and put the following in a file.&lt;br /&gt;
 bone$ '''nano button.sh'''&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 cd /sys/class/gpio&lt;br /&gt;
 while [ 1 ]&lt;br /&gt;
 do&lt;br /&gt;
    cat gpio7/value&lt;br /&gt;
    sleep 0.25&lt;br /&gt;
 done&lt;br /&gt;
Quit nano and run&lt;br /&gt;
 bone$ '''chmod +x button.sh'''  (This makes button.sh executable)&lt;br /&gt;
 bone$ '''./button.sh'''&lt;br /&gt;
What happens when you push the button?&lt;br /&gt;
&lt;br /&gt;
Now experiment around. Can you flash the LED? How fast? Make the LED read the switch.&lt;br /&gt;
&lt;br /&gt;
== Analog In ==&lt;br /&gt;
The bone has eight Analog Inputs.  Several are exposed on P9.  They are labeled '''AIN''' in table 11 below.  How many do you find?&lt;br /&gt;
&lt;br /&gt;
[[File:P9PWMs.jpg|800px]]&lt;br /&gt;
&lt;br /&gt;
The AIN pins are sampled at 12 bits and 100k samples per second.  The input voltage is between 0 and 1.8V.  Fortunately, both voltages are available on P9.&lt;br /&gt;
&lt;br /&gt;
You've already wired these up for the AM lab. You interact with the analog in much like the gpio, but it appears in a different. We have to run a command before the AIN interface appears.  Just run them now, later I'll explain what you did if you are interested.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''SLOTS=/sys/devices/bone_capemgr.*/slots'''&lt;br /&gt;
 bone$ '''echo cape-bone-iio &amp;gt; $SLOTS'''&lt;br /&gt;
&lt;br /&gt;
You can now access the analog interface, let's explore.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/devices/ocp.2/helper.14'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 AIN0  AIN2  AIN4  AIN6  driver@   power/      uevent&lt;br /&gt;
 AIN1  AIN3  AIN5  AIN7  modalias  subsystem@&lt;br /&gt;
&lt;br /&gt;
There are the various analog inputs, but watch out.  This interface starts numbering at '''1''' and Table 11 starts at '''0''', so to read AIN5 you need to look at '''AIN6'''!&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cat AIN6'''&lt;br /&gt;
 1185&lt;br /&gt;
&lt;br /&gt;
Change the pot and rerun '''cat'''.  What's the min and max value you get?  Is it 12 bits?&lt;br /&gt;
&lt;br /&gt;
You can use the following script to continuously read the input.&lt;br /&gt;
 while [ 1 ]&lt;br /&gt;
   do &lt;br /&gt;
   tr '\n' '\r' &amp;lt; AIN6&lt;br /&gt;
 done&lt;br /&gt;
&lt;br /&gt;
== Pulse Width Modulation ==&lt;br /&gt;
&lt;br /&gt;
(Note: The pwm interface seems to changing. Some of this may not apply in the future.)&lt;br /&gt;
&lt;br /&gt;
The Bone has a PWM interface at &amp;lt;code&amp;gt;/sys/class/pwm/&amp;lt;/code&amp;gt;. You can see what's there by:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/class/pwm'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  unexport&lt;br /&gt;
Hmmm, there isn't much there.  We have to run a command to make something appear.  Try&lt;br /&gt;
 bone$ '''SLOTS=/sys/devices/bone_capemgr.*/slots'''&lt;br /&gt;
 bone$ '''echo am33xx_pwm &amp;gt; $SLOTS'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  pwmchip0@  pwmchip2@  pwmchip3@  pwmchip5@  pwmchip7@  unexport&lt;br /&gt;
Now we need to run another command to say which pwm pin we want to use.  I'm using P9_21.&lt;br /&gt;
 bone$ '''echo bone_pwm_P9_21 &amp;gt; $SLOTS&lt;br /&gt;
Now you can export a pwm much list you export a gpio port&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; export'''&lt;br /&gt;
 bone$ '''cd pwm1'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 device@  duty_ns  period_ns  polarity  power/  run  subsystem@  uevent&lt;br /&gt;
Try a 1Hz frequency with a 25% duty cycle&lt;br /&gt;
 bone$ '''echo 1000000000 &amp;gt; period_ns'''&lt;br /&gt;
 bone$ '''echo  250000000 &amp;gt; duty_ns'''&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; run'''&lt;br /&gt;
&lt;br /&gt;
Connect the LED from and watch it flash.  Try changing the frequency and duty cycle.  You may have to set the duty cycle to 0 to change the frequency.  Can you guess why?&lt;br /&gt;
&lt;br /&gt;
=== Challenge ===&lt;br /&gt;
Combine the analog in and the PWM by having the pot control the frequency or the duty cycle of the LED.&lt;br /&gt;
 &lt;br /&gt;
{{YoderFoot}}&lt;/div&gt;</summary>
		<author><name>Yoder</name></author>	</entry>

	<entry>
		<id>http://www.elinux.org/ASEE_2013_Workshop</id>
		<title>ASEE 2013 Workshop</title>
		<link rel="alternate" type="text/html" href="http://www.elinux.org/ASEE_2013_Workshop"/>
				<updated>2013-06-14T16:25:47Z</updated>
		
		<summary type="html">&lt;p&gt;Yoder: /* Blinking an External LED via gpio */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:ECE497 |Workshop]]&lt;br /&gt;
{{YoderHead}}&lt;br /&gt;
Here are the labs for the afternoon Linux part of the [http://www.asee.org/public/conferences/20/registration/view_session?session_id=2420 ASEE 2013 Workshop]&lt;br /&gt;
&lt;br /&gt;
== Warm Up ==&lt;br /&gt;
[[File:PuTTYconfiguration.jpg|thumbnail]]&lt;br /&gt;
Before we can interact with LEDs and switches we need to learn some simple Linux commands. &lt;br /&gt;
# On your host computer, running Windows, start up '''puTTY'''.  &lt;br /&gt;
# If you get a ''Security Warning'', click '''Run'''.&lt;br /&gt;
# Enter '''192.167.7.2''' in the '''Host Name''' field and click '''Open'''&lt;br /&gt;
# Login as '''root''' with no password.&lt;br /&gt;
# Enter '''ls'''  to list what files you have. You shouldn't see much.&lt;br /&gt;
[[File:PuTTYloging.jpg|thumbnail]]&lt;br /&gt;
&lt;br /&gt;
At this point you need to learn a few simple Linux commands for creating and displaying files. Once you know these commands it's easy to turn an LED on and off.&lt;br /&gt;
&lt;br /&gt;
First, let's edit a file using the '''nano''' editor.  Nano is a simple editor that easy to learn. This will edit (and create) the file '''play.txt'''.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''nano play.txt'''&lt;br /&gt;
&lt;br /&gt;
Add a couple of lines of text to the file, it doesn't really matter what and then Exit. You can list the files in the current directory with '''ls''' and show the contents of a file with '''cat'''.&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 Desktop  play.txt&lt;br /&gt;
 bone$ '''cat play.txt'''&lt;br /&gt;
 A couple of lines&lt;br /&gt;
 of text.&lt;br /&gt;
&lt;br /&gt;
Use '''echo''' to print a line of text.&lt;br /&gt;
 bone$ '''echo This is a line of text'''&lt;br /&gt;
 This is a line of text&lt;br /&gt;
&lt;br /&gt;
Here's a powerful operator.  You can take the output of any command and redirect it to a file with '''&amp;gt;'''.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo This is a line of text &amp;gt; here.txt'''&lt;br /&gt;
 bone$ '''cat here.txt'''&lt;br /&gt;
 This is a line of text&lt;br /&gt;
&lt;br /&gt;
We are almost there.  Use '''cd''' to change directories.  '''/''' is the top level directory.&lt;br /&gt;
 bone$ '''cd /'''&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 bin   dev  home  lost+found  mnt   run   sys  usr&lt;br /&gt;
 boot  etc  lib   media       proc  sbin  tmp  var&lt;br /&gt;
&lt;br /&gt;
If you ever get lost, '''cd''' alone takes you home.&lt;br /&gt;
 bone$ '''cd'''&lt;br /&gt;
 gone$ '''ls'''&lt;br /&gt;
 Desktop  here.txt  play.txt&lt;br /&gt;
&lt;br /&gt;
Now you are ready to flash an LED.&lt;br /&gt;
&lt;br /&gt;
== Blinking an LED ==&lt;br /&gt;
=== gpio via the Shell Command Line and sysfs ===&lt;br /&gt;
&lt;br /&gt;
Another easy way to do general purpose I/O (gpio) on the Beagle is through a terminal window and a shell prompt. In Linux, almost everything is treated as a file, even things that aren't files. Here we'll use a virtual file system called '''sysfs'''.  sysfs exposes the drivers for the hardware so you can easily use them.&lt;br /&gt;
&lt;br /&gt;
Try this:&lt;br /&gt;
 bone$ '''cd /sys'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 block/  bus/  class/  dev/  devices/  firmware/  fs/  kernel/  module/  power/&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;'''/'''&amp;quot; after the name means it's a directory. Here we see several directories that represent hardware we can control. Explore a bit and see what you find.&lt;br /&gt;
&lt;br /&gt;
Now try:&lt;br /&gt;
&lt;br /&gt;
 beagle$ '''cd /sys/class'''&lt;br /&gt;
 beagle$ '''ls -F'''&lt;br /&gt;
 backlight/  firmware/     lcd/       mtd/           scsi_disk/   ubi/&lt;br /&gt;
 bdi/        gpio/         leds/      net/           scsi_host/   udc/&lt;br /&gt;
 block/      graphics/     mbox/      power_supply/  sound/       uio/&lt;br /&gt;
 bluetooth/  hwmon/        mdio_bus/  regulator/     spi_master/  usbmon/&lt;br /&gt;
 bsg/        i2c-adapter/  mem/       rfkill/        spidev/      vc/&lt;br /&gt;
 dma/        i2c-dev/      misc/      rtc/           thermal/     vtconsole/&lt;br /&gt;
 drm/        input/        mmc_host/  scsi_device/   tty/         watchdog/&lt;br /&gt;
&lt;br /&gt;
Explore some.  &lt;br /&gt;
&lt;br /&gt;
=== Blinking a USR LED ===&lt;br /&gt;
The Beagle Black has four user LEDS, '''user0''' - '''user3''', that you can control. Try this:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/class/leds'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 beaglebone:green:usr0  beaglebone:green:usr2&lt;br /&gt;
 beaglebone:green:usr1  beaglebone:green:usr3&lt;br /&gt;
&lt;br /&gt;
Here you see the directories for controlling each of the usr LEDs. By default, usr0 flashes a heartbeat pattern and usr1 flashes when the micro SD card is accessed.  Let's control usr0.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd beagleboard\:\:usr0'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 brightness  device@  max_brightness  power/  subsystem@  trigger  uevent&lt;br /&gt;
&lt;br /&gt;
(The &amp;quot;'''@'''&amp;quot; after the name means it's a link.)  See what's in '''brightness''', '''max_brightness''' and '''trigger''' by using the &amp;lt;code&amp;gt;cat&amp;lt;/code&amp;gt; command.  For example:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cat trigger'''&lt;br /&gt;
 none nand-disk mmc0 timer oneshot [heartbeat] backlight gpio cpu0 default-on transient&lt;br /&gt;
&lt;br /&gt;
This shows trigger can have many values.  The present value is '''heartbeat'''.  Check the LED, is it beating?  You can stop the heartbeat via:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo none &amp;gt; trigger'''&lt;br /&gt;
 bone$ '''cat trigger'''&lt;br /&gt;
 [none] nand-disk mmc0 timer oneshot heartbeat backlight gpio cpu0 default-on transient &lt;br /&gt;
&lt;br /&gt;
Did it stop beating?  You can now turn it on and off with:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; brightness'''&lt;br /&gt;
 bone$ '''echo 0 &amp;gt; brightness'''&lt;br /&gt;
&lt;br /&gt;
Is it responding correctly?&lt;br /&gt;
&lt;br /&gt;
The Bone has more trigger options.  Try:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cat trigger'''&lt;br /&gt;
 [none] mmc0 timer heartbeat backlight gpio default-on &lt;br /&gt;
 bone$ '''echo timer &amp;gt; trigger'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 brightness  delay_on  max_brightness  subsystem@  uevent&lt;br /&gt;
 delay_off   device@   power/          trigger&lt;br /&gt;
 bone$ '''echo 100 &amp;gt; delay_on'''&lt;br /&gt;
 bone$ '''echo 900 &amp;gt; delay_off'''&lt;br /&gt;
&lt;br /&gt;
What does this do?&lt;br /&gt;
&lt;br /&gt;
=== Blinking an External LED via gpio ===&lt;br /&gt;
&lt;br /&gt;
In the AM lab we wired an LED to the P9_12 General Purpose IO (gpio) port and controlled it via BoneScript.  Here we'll control it via a shell command. First we need to figure out which gpio pin P9_12 is attached to.  The following figure shows it attached to gpio_60.&lt;br /&gt;
&lt;br /&gt;
[[File:P9PWMs.jpg | 600px]]&lt;br /&gt;
&lt;br /&gt;
Here's how you turn it on&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/class/gpio'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  gpiochip0@  gpiochip32@  gpiochip64@  gpiochip96@  unexport&lt;br /&gt;
&lt;br /&gt;
Presently no gpio pins are visible.  You need to tell it which pin to export&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo 60 &amp;gt; export'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  gpio60@  gpiochip0@  gpiochip32@  gpiochip64@  gpiochip96@  unexport&lt;br /&gt;
&lt;br /&gt;
Notice '''gpio60''' has appeared.  All we need to do is tell it which direction and then turn it on.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd gpio60'''&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 active_low  direction  edge  power  subsystem  uevent  value&lt;br /&gt;
 bone$ '''echo out &amp;gt; direction'''&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; value'''&lt;br /&gt;
 bone$ '''echo 0 &amp;gt; value'''&lt;br /&gt;
&lt;br /&gt;
Your LED should be on!  When you are done you can unexport the pin and it will disappear.&lt;br /&gt;
 bone$ '''cd ..'''&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 export  gpio60  gpiochip0  gpiochip32  gpiochip64  gpiochip96  unexport&lt;br /&gt;
 bone$ '''echo 60 &amp;gt; unexport'''&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 export  gpiochip0  gpiochip32  gpiochip64  gpiochip96  unexport&lt;br /&gt;
&lt;br /&gt;
== Reading a switch ==&lt;br /&gt;
&lt;br /&gt;
Now that you have an LED working, wiring in a switch is easy.  In the AM lab you wired a switch to P9_42, which from the table above is '''gpio_7'''. &lt;br /&gt;
&lt;br /&gt;
Based on what you saw above.&lt;br /&gt;
 bone$ '''cd /sys/class/gpio'''&lt;br /&gt;
 bone$ '''echo 7 &amp;gt; export'''&lt;br /&gt;
 bone$ '''cd gpio7'''&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 bone$ '''echo in &amp;gt; direction'''&lt;br /&gt;
 bone$ '''cat value'''&lt;br /&gt;
 0&lt;br /&gt;
Now hold the button down and try again.&lt;br /&gt;
 bone$ '''cat value'''&lt;br /&gt;
 1&lt;br /&gt;
Once you have the switch and LED working use '''nano''' and put the following in a file.&lt;br /&gt;
 bone$ '''nano button.sh'''&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 cd /sys/class/gpio&lt;br /&gt;
 while [ 1 ]&lt;br /&gt;
 do&lt;br /&gt;
    cat gpio7/value&lt;br /&gt;
    sleep 0.25&lt;br /&gt;
 done&lt;br /&gt;
Quit nano and run&lt;br /&gt;
 bone$ '''chmod +x button.sh'''  (This makes button.sh executable)&lt;br /&gt;
 bone$ '''./button.sh'''&lt;br /&gt;
What happens when you push the button?&lt;br /&gt;
&lt;br /&gt;
Now experiment around. Can you flash the LED? How fast? Make the LED read the switch.&lt;br /&gt;
&lt;br /&gt;
== Analog In ==&lt;br /&gt;
The bone has eight Analog Inputs.  Several are exposed on P9.  They are labeled '''AIN''' in table 11 below.  How many do you find?&lt;br /&gt;
&lt;br /&gt;
[[File:P9PWMs.jpg|800px]]&lt;br /&gt;
&lt;br /&gt;
The AIN pins are sampled at 12 bits and 100k samples per second.  The input voltage is between 0 and 1.8V.  Fortunately, both voltages are available on P9.&lt;br /&gt;
&lt;br /&gt;
You've already wired these up for the AM lab. You interact with the analog in much like the gpio, but it appears in a different. We have to run a command before the AIN interface appears.  Just run them now, later I'll explain what you did if you are interested.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''SLOTS=/sys/devices/bone_capemgr.*/slots'''&lt;br /&gt;
 bone$ '''echo cape-bone-iio &amp;gt; $SLOTS'''&lt;br /&gt;
&lt;br /&gt;
You can now access the analog interface, let's explore.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/devices/ocp.2/helper.14'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 AIN0  AIN2  AIN4  AIN6  driver@   power/      uevent&lt;br /&gt;
 AIN1  AIN3  AIN5  AIN7  modalias  subsystem@&lt;br /&gt;
&lt;br /&gt;
There are the various analog inputs, but watch out.  This interface starts numbering at '''1''' and Table 11 starts at '''0''', so to read AIN5 you need to look at '''AIN6'''!&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cat AIN6'''&lt;br /&gt;
 1185&lt;br /&gt;
&lt;br /&gt;
Change the pot and rerun '''cat'''.  What's the min and max value you get?  Is it 12 bits?&lt;br /&gt;
&lt;br /&gt;
You can use the following script to continuously read the input.&lt;br /&gt;
 while [ 1 ]&lt;br /&gt;
   do &lt;br /&gt;
   tr '\n' '\r' &amp;lt; AIN6&lt;br /&gt;
 done&lt;br /&gt;
&lt;br /&gt;
== Pulse Width Modulation ==&lt;br /&gt;
&lt;br /&gt;
(Note: The pwm interface seems to changing. Some of this may not apply in the future.)&lt;br /&gt;
&lt;br /&gt;
The Bone has a PWM interface at &amp;lt;code&amp;gt;/sys/class/pwm/&amp;lt;/code&amp;gt;. You can see what's there by:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/class/pwm'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  unexport&lt;br /&gt;
Hmmm, there isn't much there.  We have to run a command to make something appear.  Try&lt;br /&gt;
 bone$ '''SLOTS=/sys/devices/bone_capemgr.*/slots'''&lt;br /&gt;
 bone$ '''echo am33xx_pwm &amp;gt; $SLOTS'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  pwmchip0@  pwmchip2@  pwmchip3@  pwmchip5@  pwmchip7@  unexport&lt;br /&gt;
Now we need to run another command to say which pwm pin we want to use.  I'm using P9_21.&lt;br /&gt;
 bone$ '''echo bone_pwm_P9_21 &amp;gt; $SLOTS&lt;br /&gt;
Now you can export a pwm much list you export a gpio port&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; export'''&lt;br /&gt;
 bone$ '''cd pwm1'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 device@  duty_ns  period_ns  polarity  power/  run  subsystem@  uevent&lt;br /&gt;
Try a 1Hz frequency with a 25% duty cycle&lt;br /&gt;
 bone$ '''echo 1000000000 &amp;gt; period_ns'''&lt;br /&gt;
 bone$ '''echo  250000000 &amp;gt; duty_ns'''&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; run'''&lt;br /&gt;
&lt;br /&gt;
Connect the LED from and watch it flash.  Try changing the frequency and duty cycle.  You may have to set the duty cycle to 0 to change the frequency.  Can you guess why?&lt;br /&gt;
&lt;br /&gt;
=== Challenge ===&lt;br /&gt;
Combine the analog in and the PWM by having the pot control the frequency or the duty cycle of the LED.&lt;br /&gt;
 &lt;br /&gt;
{{YoderFoot}}&lt;/div&gt;</summary>
		<author><name>Yoder</name></author>	</entry>

	<entry>
		<id>http://www.elinux.org/ASEE_2013_Workshop</id>
		<title>ASEE 2013 Workshop</title>
		<link rel="alternate" type="text/html" href="http://www.elinux.org/ASEE_2013_Workshop"/>
				<updated>2013-06-14T16:21:46Z</updated>
		
		<summary type="html">&lt;p&gt;Yoder: /* Blinking a USR LED */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:ECE497 |Workshop]]&lt;br /&gt;
{{YoderHead}}&lt;br /&gt;
Here are the labs for the afternoon Linux part of the [http://www.asee.org/public/conferences/20/registration/view_session?session_id=2420 ASEE 2013 Workshop]&lt;br /&gt;
&lt;br /&gt;
== Warm Up ==&lt;br /&gt;
[[File:PuTTYconfiguration.jpg|thumbnail]]&lt;br /&gt;
Before we can interact with LEDs and switches we need to learn some simple Linux commands. &lt;br /&gt;
# On your host computer, running Windows, start up '''puTTY'''.  &lt;br /&gt;
# If you get a ''Security Warning'', click '''Run'''.&lt;br /&gt;
# Enter '''192.167.7.2''' in the '''Host Name''' field and click '''Open'''&lt;br /&gt;
# Login as '''root''' with no password.&lt;br /&gt;
# Enter '''ls'''  to list what files you have. You shouldn't see much.&lt;br /&gt;
[[File:PuTTYloging.jpg|thumbnail]]&lt;br /&gt;
&lt;br /&gt;
At this point you need to learn a few simple Linux commands for creating and displaying files. Once you know these commands it's easy to turn an LED on and off.&lt;br /&gt;
&lt;br /&gt;
First, let's edit a file using the '''nano''' editor.  Nano is a simple editor that easy to learn. This will edit (and create) the file '''play.txt'''.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''nano play.txt'''&lt;br /&gt;
&lt;br /&gt;
Add a couple of lines of text to the file, it doesn't really matter what and then Exit. You can list the files in the current directory with '''ls''' and show the contents of a file with '''cat'''.&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 Desktop  play.txt&lt;br /&gt;
 bone$ '''cat play.txt'''&lt;br /&gt;
 A couple of lines&lt;br /&gt;
 of text.&lt;br /&gt;
&lt;br /&gt;
Use '''echo''' to print a line of text.&lt;br /&gt;
 bone$ '''echo This is a line of text'''&lt;br /&gt;
 This is a line of text&lt;br /&gt;
&lt;br /&gt;
Here's a powerful operator.  You can take the output of any command and redirect it to a file with '''&amp;gt;'''.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo This is a line of text &amp;gt; here.txt'''&lt;br /&gt;
 bone$ '''cat here.txt'''&lt;br /&gt;
 This is a line of text&lt;br /&gt;
&lt;br /&gt;
We are almost there.  Use '''cd''' to change directories.  '''/''' is the top level directory.&lt;br /&gt;
 bone$ '''cd /'''&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 bin   dev  home  lost+found  mnt   run   sys  usr&lt;br /&gt;
 boot  etc  lib   media       proc  sbin  tmp  var&lt;br /&gt;
&lt;br /&gt;
If you ever get lost, '''cd''' alone takes you home.&lt;br /&gt;
 bone$ '''cd'''&lt;br /&gt;
 gone$ '''ls'''&lt;br /&gt;
 Desktop  here.txt  play.txt&lt;br /&gt;
&lt;br /&gt;
Now you are ready to flash an LED.&lt;br /&gt;
&lt;br /&gt;
== Blinking an LED ==&lt;br /&gt;
=== gpio via the Shell Command Line and sysfs ===&lt;br /&gt;
&lt;br /&gt;
Another easy way to do general purpose I/O (gpio) on the Beagle is through a terminal window and a shell prompt. In Linux, almost everything is treated as a file, even things that aren't files. Here we'll use a virtual file system called '''sysfs'''.  sysfs exposes the drivers for the hardware so you can easily use them.&lt;br /&gt;
&lt;br /&gt;
Try this:&lt;br /&gt;
 bone$ '''cd /sys'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 block/  bus/  class/  dev/  devices/  firmware/  fs/  kernel/  module/  power/&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;'''/'''&amp;quot; after the name means it's a directory. Here we see several directories that represent hardware we can control. Explore a bit and see what you find.&lt;br /&gt;
&lt;br /&gt;
Now try:&lt;br /&gt;
&lt;br /&gt;
 beagle$ '''cd /sys/class'''&lt;br /&gt;
 beagle$ '''ls -F'''&lt;br /&gt;
 backlight/  firmware/     lcd/       mtd/           scsi_disk/   ubi/&lt;br /&gt;
 bdi/        gpio/         leds/      net/           scsi_host/   udc/&lt;br /&gt;
 block/      graphics/     mbox/      power_supply/  sound/       uio/&lt;br /&gt;
 bluetooth/  hwmon/        mdio_bus/  regulator/     spi_master/  usbmon/&lt;br /&gt;
 bsg/        i2c-adapter/  mem/       rfkill/        spidev/      vc/&lt;br /&gt;
 dma/        i2c-dev/      misc/      rtc/           thermal/     vtconsole/&lt;br /&gt;
 drm/        input/        mmc_host/  scsi_device/   tty/         watchdog/&lt;br /&gt;
&lt;br /&gt;
Explore some.  &lt;br /&gt;
&lt;br /&gt;
=== Blinking a USR LED ===&lt;br /&gt;
The Beagle Black has four user LEDS, '''user0''' - '''user3''', that you can control. Try this:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/class/leds'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 beaglebone:green:usr0  beaglebone:green:usr2&lt;br /&gt;
 beaglebone:green:usr1  beaglebone:green:usr3&lt;br /&gt;
&lt;br /&gt;
Here you see the directories for controlling each of the usr LEDs. By default, usr0 flashes a heartbeat pattern and usr1 flashes when the micro SD card is accessed.  Let's control usr0.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd beagleboard\:\:usr0'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 brightness  device@  max_brightness  power/  subsystem@  trigger  uevent&lt;br /&gt;
&lt;br /&gt;
(The &amp;quot;'''@'''&amp;quot; after the name means it's a link.)  See what's in '''brightness''', '''max_brightness''' and '''trigger''' by using the &amp;lt;code&amp;gt;cat&amp;lt;/code&amp;gt; command.  For example:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cat trigger'''&lt;br /&gt;
 none nand-disk mmc0 timer oneshot [heartbeat] backlight gpio cpu0 default-on transient&lt;br /&gt;
&lt;br /&gt;
This shows trigger can have many values.  The present value is '''heartbeat'''.  Check the LED, is it beating?  You can stop the heartbeat via:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo none &amp;gt; trigger'''&lt;br /&gt;
 bone$ '''cat trigger'''&lt;br /&gt;
 [none] nand-disk mmc0 timer oneshot heartbeat backlight gpio cpu0 default-on transient &lt;br /&gt;
&lt;br /&gt;
Did it stop beating?  You can now turn it on and off with:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; brightness'''&lt;br /&gt;
 bone$ '''echo 0 &amp;gt; brightness'''&lt;br /&gt;
&lt;br /&gt;
Is it responding correctly?&lt;br /&gt;
&lt;br /&gt;
The Bone has more trigger options.  Try:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cat trigger'''&lt;br /&gt;
 [none] mmc0 timer heartbeat backlight gpio default-on &lt;br /&gt;
 bone$ '''echo timer &amp;gt; trigger'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 brightness  delay_on  max_brightness  subsystem@  uevent&lt;br /&gt;
 delay_off   device@   power/          trigger&lt;br /&gt;
 bone$ '''echo 100 &amp;gt; delay_on'''&lt;br /&gt;
 bone$ '''echo 900 &amp;gt; delay_off'''&lt;br /&gt;
&lt;br /&gt;
What does this do?&lt;br /&gt;
&lt;br /&gt;
=== Blinking an External LED via gpio ===&lt;br /&gt;
&lt;br /&gt;
In the AM lab we wired an LED to the P9_12 General Purpose IO (gpio) port and controlled it via BoneScript.  Here we'll control it via a shell command. First we need to figure out which gpio pin P9_12 is attached to.  The following figure shows it attached to gpio_60.&lt;br /&gt;
&lt;br /&gt;
[[File:P9PWMs.jpg | 600px]]&lt;br /&gt;
&lt;br /&gt;
Here's how you turn it on&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/class/gpio'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  gpiochip0@  gpiochip32@  gpiochip64@  gpiochip96@  unexport&lt;br /&gt;
&lt;br /&gt;
Presently no gpio pins are visible.  You need to tell it which pin to export&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo 60 &amp;gt; export'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  gpio60@  gpiochip0@  gpiochip32@  gpiochip64@  gpiochip96@  unexport&lt;br /&gt;
&lt;br /&gt;
Notice '''gpio60''' has appeared.  All we need to do is tell it which direction and then turn it on.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd gpio60'''&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 active_low  direction  edge  power  subsystem  uevent  value&lt;br /&gt;
 bone$ '''echo out &amp;gt; direction'''&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; value'''&lt;br /&gt;
&lt;br /&gt;
Your LED should be on!  When you are done you can unexport the pin and it will disappear.&lt;br /&gt;
 bone$ '''cd ..'''&lt;br /&gt;
 bone$ '''echo 60 &amp;gt; unexport'''&lt;br /&gt;
&lt;br /&gt;
== Reading a switch ==&lt;br /&gt;
&lt;br /&gt;
Now that you have an LED working, wiring in a switch is easy.  In the AM lab you wired a switch to P9_42, which from the table above is '''gpio_7'''. &lt;br /&gt;
&lt;br /&gt;
Based on what you saw above.&lt;br /&gt;
 bone$ '''cd /sys/class/gpio'''&lt;br /&gt;
 bone$ '''echo 7 &amp;gt; export'''&lt;br /&gt;
 bone$ '''cd gpio7'''&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 bone$ '''echo in &amp;gt; direction'''&lt;br /&gt;
 bone$ '''cat value'''&lt;br /&gt;
 0&lt;br /&gt;
Now hold the button down and try again.&lt;br /&gt;
 bone$ '''cat value'''&lt;br /&gt;
 1&lt;br /&gt;
Once you have the switch and LED working use '''nano''' and put the following in a file.&lt;br /&gt;
 bone$ '''nano button.sh'''&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 cd /sys/class/gpio&lt;br /&gt;
 while [ 1 ]&lt;br /&gt;
 do&lt;br /&gt;
    cat gpio7/value&lt;br /&gt;
    sleep 0.25&lt;br /&gt;
 done&lt;br /&gt;
Quit nano and run&lt;br /&gt;
 bone$ '''chmod +x button.sh'''  (This makes button.sh executable)&lt;br /&gt;
 bone$ '''./button.sh'''&lt;br /&gt;
What happens when you push the button?&lt;br /&gt;
&lt;br /&gt;
Now experiment around. Can you flash the LED? How fast? Make the LED read the switch.&lt;br /&gt;
&lt;br /&gt;
== Analog In ==&lt;br /&gt;
The bone has eight Analog Inputs.  Several are exposed on P9.  They are labeled '''AIN''' in table 11 below.  How many do you find?&lt;br /&gt;
&lt;br /&gt;
[[File:P9PWMs.jpg|800px]]&lt;br /&gt;
&lt;br /&gt;
The AIN pins are sampled at 12 bits and 100k samples per second.  The input voltage is between 0 and 1.8V.  Fortunately, both voltages are available on P9.&lt;br /&gt;
&lt;br /&gt;
You've already wired these up for the AM lab. You interact with the analog in much like the gpio, but it appears in a different. We have to run a command before the AIN interface appears.  Just run them now, later I'll explain what you did if you are interested.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''SLOTS=/sys/devices/bone_capemgr.*/slots'''&lt;br /&gt;
 bone$ '''echo cape-bone-iio &amp;gt; $SLOTS'''&lt;br /&gt;
&lt;br /&gt;
You can now access the analog interface, let's explore.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/devices/ocp.2/helper.14'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 AIN0  AIN2  AIN4  AIN6  driver@   power/      uevent&lt;br /&gt;
 AIN1  AIN3  AIN5  AIN7  modalias  subsystem@&lt;br /&gt;
&lt;br /&gt;
There are the various analog inputs, but watch out.  This interface starts numbering at '''1''' and Table 11 starts at '''0''', so to read AIN5 you need to look at '''AIN6'''!&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cat AIN6'''&lt;br /&gt;
 1185&lt;br /&gt;
&lt;br /&gt;
Change the pot and rerun '''cat'''.  What's the min and max value you get?  Is it 12 bits?&lt;br /&gt;
&lt;br /&gt;
You can use the following script to continuously read the input.&lt;br /&gt;
 while [ 1 ]&lt;br /&gt;
   do &lt;br /&gt;
   tr '\n' '\r' &amp;lt; AIN6&lt;br /&gt;
 done&lt;br /&gt;
&lt;br /&gt;
== Pulse Width Modulation ==&lt;br /&gt;
&lt;br /&gt;
(Note: The pwm interface seems to changing. Some of this may not apply in the future.)&lt;br /&gt;
&lt;br /&gt;
The Bone has a PWM interface at &amp;lt;code&amp;gt;/sys/class/pwm/&amp;lt;/code&amp;gt;. You can see what's there by:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/class/pwm'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  unexport&lt;br /&gt;
Hmmm, there isn't much there.  We have to run a command to make something appear.  Try&lt;br /&gt;
 bone$ '''SLOTS=/sys/devices/bone_capemgr.*/slots'''&lt;br /&gt;
 bone$ '''echo am33xx_pwm &amp;gt; $SLOTS'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  pwmchip0@  pwmchip2@  pwmchip3@  pwmchip5@  pwmchip7@  unexport&lt;br /&gt;
Now we need to run another command to say which pwm pin we want to use.  I'm using P9_21.&lt;br /&gt;
 bone$ '''echo bone_pwm_P9_21 &amp;gt; $SLOTS&lt;br /&gt;
Now you can export a pwm much list you export a gpio port&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; export'''&lt;br /&gt;
 bone$ '''cd pwm1'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 device@  duty_ns  period_ns  polarity  power/  run  subsystem@  uevent&lt;br /&gt;
Try a 1Hz frequency with a 25% duty cycle&lt;br /&gt;
 bone$ '''echo 1000000000 &amp;gt; period_ns'''&lt;br /&gt;
 bone$ '''echo  250000000 &amp;gt; duty_ns'''&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; run'''&lt;br /&gt;
&lt;br /&gt;
Connect the LED from and watch it flash.  Try changing the frequency and duty cycle.  You may have to set the duty cycle to 0 to change the frequency.  Can you guess why?&lt;br /&gt;
&lt;br /&gt;
=== Challenge ===&lt;br /&gt;
Combine the analog in and the PWM by having the pot control the frequency or the duty cycle of the LED.&lt;br /&gt;
 &lt;br /&gt;
{{YoderFoot}}&lt;/div&gt;</summary>
		<author><name>Yoder</name></author>	</entry>

	<entry>
		<id>http://www.elinux.org/ASEE_2013_Workshop</id>
		<title>ASEE 2013 Workshop</title>
		<link rel="alternate" type="text/html" href="http://www.elinux.org/ASEE_2013_Workshop"/>
				<updated>2013-06-14T16:18:28Z</updated>
		
		<summary type="html">&lt;p&gt;Yoder: Cleaning up&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:ECE497 |Workshop]]&lt;br /&gt;
{{YoderHead}}&lt;br /&gt;
Here are the labs for the afternoon Linux part of the [http://www.asee.org/public/conferences/20/registration/view_session?session_id=2420 ASEE 2013 Workshop]&lt;br /&gt;
&lt;br /&gt;
== Warm Up ==&lt;br /&gt;
[[File:PuTTYconfiguration.jpg|thumbnail]]&lt;br /&gt;
Before we can interact with LEDs and switches we need to learn some simple Linux commands. &lt;br /&gt;
# On your host computer, running Windows, start up '''puTTY'''.  &lt;br /&gt;
# If you get a ''Security Warning'', click '''Run'''.&lt;br /&gt;
# Enter '''192.167.7.2''' in the '''Host Name''' field and click '''Open'''&lt;br /&gt;
# Login as '''root''' with no password.&lt;br /&gt;
# Enter '''ls'''  to list what files you have. You shouldn't see much.&lt;br /&gt;
[[File:PuTTYloging.jpg|thumbnail]]&lt;br /&gt;
&lt;br /&gt;
At this point you need to learn a few simple Linux commands for creating and displaying files. Once you know these commands it's easy to turn an LED on and off.&lt;br /&gt;
&lt;br /&gt;
First, let's edit a file using the '''nano''' editor.  Nano is a simple editor that easy to learn. This will edit (and create) the file '''play.txt'''.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''nano play.txt'''&lt;br /&gt;
&lt;br /&gt;
Add a couple of lines of text to the file, it doesn't really matter what and then Exit. You can list the files in the current directory with '''ls''' and show the contents of a file with '''cat'''.&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 Desktop  play.txt&lt;br /&gt;
 bone$ '''cat play.txt'''&lt;br /&gt;
 A couple of lines&lt;br /&gt;
 of text.&lt;br /&gt;
&lt;br /&gt;
Use '''echo''' to print a line of text.&lt;br /&gt;
 bone$ '''echo This is a line of text'''&lt;br /&gt;
 This is a line of text&lt;br /&gt;
&lt;br /&gt;
Here's a powerful operator.  You can take the output of any command and redirect it to a file with '''&amp;gt;'''.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo This is a line of text &amp;gt; here.txt'''&lt;br /&gt;
 bone$ '''cat here.txt'''&lt;br /&gt;
 This is a line of text&lt;br /&gt;
&lt;br /&gt;
We are almost there.  Use '''cd''' to change directories.  '''/''' is the top level directory.&lt;br /&gt;
 bone$ '''cd /'''&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 bin   dev  home  lost+found  mnt   run   sys  usr&lt;br /&gt;
 boot  etc  lib   media       proc  sbin  tmp  var&lt;br /&gt;
&lt;br /&gt;
If you ever get lost, '''cd''' alone takes you home.&lt;br /&gt;
 bone$ '''cd'''&lt;br /&gt;
 gone$ '''ls'''&lt;br /&gt;
 Desktop  here.txt  play.txt&lt;br /&gt;
&lt;br /&gt;
Now you are ready to flash an LED.&lt;br /&gt;
&lt;br /&gt;
== Blinking an LED ==&lt;br /&gt;
=== gpio via the Shell Command Line and sysfs ===&lt;br /&gt;
&lt;br /&gt;
Another easy way to do general purpose I/O (gpio) on the Beagle is through a terminal window and a shell prompt. In Linux, almost everything is treated as a file, even things that aren't files. Here we'll use a virtual file system called '''sysfs'''.  sysfs exposes the drivers for the hardware so you can easily use them.&lt;br /&gt;
&lt;br /&gt;
Try this:&lt;br /&gt;
 bone$ '''cd /sys'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 block/  bus/  class/  dev/  devices/  firmware/  fs/  kernel/  module/  power/&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;'''/'''&amp;quot; after the name means it's a directory. Here we see several directories that represent hardware we can control. Explore a bit and see what you find.&lt;br /&gt;
&lt;br /&gt;
Now try:&lt;br /&gt;
&lt;br /&gt;
 beagle$ '''cd /sys/class'''&lt;br /&gt;
 beagle$ '''ls -F'''&lt;br /&gt;
 backlight/  firmware/     lcd/       mtd/           scsi_disk/   ubi/&lt;br /&gt;
 bdi/        gpio/         leds/      net/           scsi_host/   udc/&lt;br /&gt;
 block/      graphics/     mbox/      power_supply/  sound/       uio/&lt;br /&gt;
 bluetooth/  hwmon/        mdio_bus/  regulator/     spi_master/  usbmon/&lt;br /&gt;
 bsg/        i2c-adapter/  mem/       rfkill/        spidev/      vc/&lt;br /&gt;
 dma/        i2c-dev/      misc/      rtc/           thermal/     vtconsole/&lt;br /&gt;
 drm/        input/        mmc_host/  scsi_device/   tty/         watchdog/&lt;br /&gt;
&lt;br /&gt;
Explore some.  &lt;br /&gt;
&lt;br /&gt;
=== Blinking a USR LED ===&lt;br /&gt;
The Beagle Black has four user LEDS, '''user0''' - '''user3''', that you can control. Try this:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/class/leds'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 beaglebone:green:usr0  beaglebone:green:usr2&lt;br /&gt;
 beaglebone:green:usr1  beaglebone:green:usr3&lt;br /&gt;
&lt;br /&gt;
Here you see the directories for controlling each of the usr LEDs. By default, usr0 flashes a heartbeat pattern and usr1 flashes when the micro SD card is accessed.  Let's control usr0.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd beagleboard\:\:usr0'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 brightness  device@  max_brightness  power/  subsystem@  trigger  uevent&lt;br /&gt;
&lt;br /&gt;
See what's in '''brightness''', '''max_brightness''' and '''trigger''' by using the &amp;lt;code&amp;gt;cat&amp;lt;/code&amp;gt; command.  For example:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cat trigger'''&lt;br /&gt;
 none nand-disk mmc0 timer oneshot [heartbeat] backlight gpio cpu0 default-on transient&lt;br /&gt;
&lt;br /&gt;
This shows trigger can have many values.  The present value is '''heartbeat'''.  Check the LED, is it beating?  You can stop the heartbeat via:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo none &amp;gt; trigger'''&lt;br /&gt;
 bone$ '''cat trigger'''&lt;br /&gt;
 [none] nand-disk mmc0 timer oneshot heartbeat backlight gpio cpu0 default-on transient &lt;br /&gt;
&lt;br /&gt;
Did it stop beating?  You can now turn it on and off with:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; brightness'''&lt;br /&gt;
 bone$ '''echo 0 &amp;gt; brightness'''&lt;br /&gt;
&lt;br /&gt;
Is it responding correctly?&lt;br /&gt;
&lt;br /&gt;
The Bone has more trigger options.  Try:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cat trigger'''&lt;br /&gt;
 [none] mmc0 timer heartbeat backlight gpio default-on &lt;br /&gt;
 bone$ '''echo timer &amp;gt; trigger'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 brightness  delay_on  max_brightness  subsystem@  uevent&lt;br /&gt;
 delay_off   device@   power/          trigger&lt;br /&gt;
 bone$ '''echo 100 &amp;gt; delay_on'''&lt;br /&gt;
 bone$ '''echo 900 &amp;gt; delay_off'''&lt;br /&gt;
&lt;br /&gt;
What does this do?&lt;br /&gt;
&lt;br /&gt;
=== Blinking an External LED via gpio ===&lt;br /&gt;
&lt;br /&gt;
In the AM lab we wired an LED to the P9_12 General Purpose IO (gpio) port and controlled it via BoneScript.  Here we'll control it via a shell command. First we need to figure out which gpio pin P9_12 is attached to.  The following figure shows it attached to gpio_60.&lt;br /&gt;
&lt;br /&gt;
[[File:P9PWMs.jpg | 600px]]&lt;br /&gt;
&lt;br /&gt;
Here's how you turn it on&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/class/gpio'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  gpiochip0@  gpiochip32@  gpiochip64@  gpiochip96@  unexport&lt;br /&gt;
&lt;br /&gt;
Presently no gpio pins are visible.  You need to tell it which pin to export&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo 60 &amp;gt; export'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  gpio60@  gpiochip0@  gpiochip32@  gpiochip64@  gpiochip96@  unexport&lt;br /&gt;
&lt;br /&gt;
Notice '''gpio60''' has appeared.  All we need to do is tell it which direction and then turn it on.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd gpio60'''&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 active_low  direction  edge  power  subsystem  uevent  value&lt;br /&gt;
 bone$ '''echo out &amp;gt; direction'''&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; value'''&lt;br /&gt;
&lt;br /&gt;
Your LED should be on!  When you are done you can unexport the pin and it will disappear.&lt;br /&gt;
 bone$ '''cd ..'''&lt;br /&gt;
 bone$ '''echo 60 &amp;gt; unexport'''&lt;br /&gt;
&lt;br /&gt;
== Reading a switch ==&lt;br /&gt;
&lt;br /&gt;
Now that you have an LED working, wiring in a switch is easy.  In the AM lab you wired a switch to P9_42, which from the table above is '''gpio_7'''. &lt;br /&gt;
&lt;br /&gt;
Based on what you saw above.&lt;br /&gt;
 bone$ '''cd /sys/class/gpio'''&lt;br /&gt;
 bone$ '''echo 7 &amp;gt; export'''&lt;br /&gt;
 bone$ '''cd gpio7'''&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 bone$ '''echo in &amp;gt; direction'''&lt;br /&gt;
 bone$ '''cat value'''&lt;br /&gt;
 0&lt;br /&gt;
Now hold the button down and try again.&lt;br /&gt;
 bone$ '''cat value'''&lt;br /&gt;
 1&lt;br /&gt;
Once you have the switch and LED working use '''nano''' and put the following in a file.&lt;br /&gt;
 bone$ '''nano button.sh'''&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 cd /sys/class/gpio&lt;br /&gt;
 while [ 1 ]&lt;br /&gt;
 do&lt;br /&gt;
    cat gpio7/value&lt;br /&gt;
    sleep 0.25&lt;br /&gt;
 done&lt;br /&gt;
Quit nano and run&lt;br /&gt;
 bone$ '''chmod +x button.sh'''  (This makes button.sh executable)&lt;br /&gt;
 bone$ '''./button.sh'''&lt;br /&gt;
What happens when you push the button?&lt;br /&gt;
&lt;br /&gt;
Now experiment around. Can you flash the LED? How fast? Make the LED read the switch.&lt;br /&gt;
&lt;br /&gt;
== Analog In ==&lt;br /&gt;
The bone has eight Analog Inputs.  Several are exposed on P9.  They are labeled '''AIN''' in table 11 below.  How many do you find?&lt;br /&gt;
&lt;br /&gt;
[[File:P9PWMs.jpg|800px]]&lt;br /&gt;
&lt;br /&gt;
The AIN pins are sampled at 12 bits and 100k samples per second.  The input voltage is between 0 and 1.8V.  Fortunately, both voltages are available on P9.&lt;br /&gt;
&lt;br /&gt;
You've already wired these up for the AM lab. You interact with the analog in much like the gpio, but it appears in a different. We have to run a command before the AIN interface appears.  Just run them now, later I'll explain what you did if you are interested.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''SLOTS=/sys/devices/bone_capemgr.*/slots'''&lt;br /&gt;
 bone$ '''echo cape-bone-iio &amp;gt; $SLOTS'''&lt;br /&gt;
&lt;br /&gt;
You can now access the analog interface, let's explore.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/devices/ocp.2/helper.14'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 AIN0  AIN2  AIN4  AIN6  driver@   power/      uevent&lt;br /&gt;
 AIN1  AIN3  AIN5  AIN7  modalias  subsystem@&lt;br /&gt;
&lt;br /&gt;
There are the various analog inputs, but watch out.  This interface starts numbering at '''1''' and Table 11 starts at '''0''', so to read AIN5 you need to look at '''AIN6'''!&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cat AIN6'''&lt;br /&gt;
 1185&lt;br /&gt;
&lt;br /&gt;
Change the pot and rerun '''cat'''.  What's the min and max value you get?  Is it 12 bits?&lt;br /&gt;
&lt;br /&gt;
You can use the following script to continuously read the input.&lt;br /&gt;
 while [ 1 ]&lt;br /&gt;
   do &lt;br /&gt;
   tr '\n' '\r' &amp;lt; AIN6&lt;br /&gt;
 done&lt;br /&gt;
&lt;br /&gt;
== Pulse Width Modulation ==&lt;br /&gt;
&lt;br /&gt;
(Note: The pwm interface seems to changing. Some of this may not apply in the future.)&lt;br /&gt;
&lt;br /&gt;
The Bone has a PWM interface at &amp;lt;code&amp;gt;/sys/class/pwm/&amp;lt;/code&amp;gt;. You can see what's there by:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/class/pwm'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  unexport&lt;br /&gt;
Hmmm, there isn't much there.  We have to run a command to make something appear.  Try&lt;br /&gt;
 bone$ '''SLOTS=/sys/devices/bone_capemgr.*/slots'''&lt;br /&gt;
 bone$ '''echo am33xx_pwm &amp;gt; $SLOTS'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  pwmchip0@  pwmchip2@  pwmchip3@  pwmchip5@  pwmchip7@  unexport&lt;br /&gt;
Now we need to run another command to say which pwm pin we want to use.  I'm using P9_21.&lt;br /&gt;
 bone$ '''echo bone_pwm_P9_21 &amp;gt; $SLOTS&lt;br /&gt;
Now you can export a pwm much list you export a gpio port&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; export'''&lt;br /&gt;
 bone$ '''cd pwm1'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 device@  duty_ns  period_ns  polarity  power/  run  subsystem@  uevent&lt;br /&gt;
Try a 1Hz frequency with a 25% duty cycle&lt;br /&gt;
 bone$ '''echo 1000000000 &amp;gt; period_ns'''&lt;br /&gt;
 bone$ '''echo  250000000 &amp;gt; duty_ns'''&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; run'''&lt;br /&gt;
&lt;br /&gt;
Connect the LED from and watch it flash.  Try changing the frequency and duty cycle.  You may have to set the duty cycle to 0 to change the frequency.  Can you guess why?&lt;br /&gt;
&lt;br /&gt;
=== Challenge ===&lt;br /&gt;
Combine the analog in and the PWM by having the pot control the frequency or the duty cycle of the LED.&lt;br /&gt;
 &lt;br /&gt;
{{YoderFoot}}&lt;/div&gt;</summary>
		<author><name>Yoder</name></author>	</entry>

	<entry>
		<id>http://www.elinux.org/ASEE_2013_Workshop</id>
		<title>ASEE 2013 Workshop</title>
		<link rel="alternate" type="text/html" href="http://www.elinux.org/ASEE_2013_Workshop"/>
				<updated>2013-06-14T16:14:09Z</updated>
		
		<summary type="html">&lt;p&gt;Yoder: /* Warm Up */ Moved play to play.txt&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:ECE497 |Workshop]]&lt;br /&gt;
{{YoderHead}}&lt;br /&gt;
Here are the labs for the afternoon Linux part of the [http://www.asee.org/public/conferences/20/registration/view_session?session_id=2420 ASEE 2013 Workshop]&lt;br /&gt;
&lt;br /&gt;
== Warm Up ==&lt;br /&gt;
[[File:PuTTYconfiguration.jpg|thumbnail]]&lt;br /&gt;
Before we can interact with LEDs and switches we need to learn some simple Linux commands. &lt;br /&gt;
# On your host computer, running Windows, start up '''puTTY'''.  &lt;br /&gt;
# If you get a ''Security Warning'', click '''Run'''.&lt;br /&gt;
# Enter '''192.167.7.2''' in the '''Host Name''' field and click '''Open'''&lt;br /&gt;
# Login as '''root''' with no password.&lt;br /&gt;
# Enter '''ls'''  to list what files you have. You shouldn't see much.&lt;br /&gt;
[[File:PuTTYloging.jpg|thumbnail]]&lt;br /&gt;
&lt;br /&gt;
At this point you need to learn a few simple Linux commands for creating and displaying files. Once you know these commands it's easy to turn an LED on and off.&lt;br /&gt;
&lt;br /&gt;
First, let's edit a file using the '''nano''' editor.  Nano is a simple editor that easy to learn. This will edit (and create) the file '''play.txt'''.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''nano play.txt'''&lt;br /&gt;
&lt;br /&gt;
Add a couple of lines of text to the file, it doesn't really matter what and then Exit. You can list the files in the current directory with '''ls''' and show the contents of a file with '''cat'''.&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 Desktop  play.txt&lt;br /&gt;
 bone$ '''cat play.txt'''&lt;br /&gt;
 A couple of lines&lt;br /&gt;
 of text.&lt;br /&gt;
&lt;br /&gt;
Use '''echo''' to print a line of text.&lt;br /&gt;
 bone$ '''echo This is a line of text'''&lt;br /&gt;
 This is a line of text&lt;br /&gt;
&lt;br /&gt;
Here's a powerful operator.  You can take the output of any command and redirect it to a file with '''&amp;gt;'''.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo This is a line of text &amp;gt; here.txt'''&lt;br /&gt;
 bone$ '''cat here.txt'''&lt;br /&gt;
 This is a line of text&lt;br /&gt;
&lt;br /&gt;
We are almost there.  Use '''cd''' to change directories.  '''/''' is the top level directory.&lt;br /&gt;
 bone$ '''cd /'''&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 bin   dev  home  lost+found  mnt   run   sys  usr&lt;br /&gt;
 boot  etc  lib   media       proc  sbin  tmp  var&lt;br /&gt;
&lt;br /&gt;
If you ever get lost, '''cd''' alone takes you home.&lt;br /&gt;
 bone$ '''cd'''&lt;br /&gt;
 gone$ '''ls'''&lt;br /&gt;
 Desktop  here.txt  play.txt&lt;br /&gt;
&lt;br /&gt;
Now you are ready to flash an LED.&lt;br /&gt;
&lt;br /&gt;
== Blinking an LED ==&lt;br /&gt;
=== gpio via the Shell Command Line and sysfs ===&lt;br /&gt;
&lt;br /&gt;
The easiest way to do general purpose I/O (gpio) on the Beagle is through a terminal window and a shell prompt. In Linux, almost everything is treated as a file, even things that aren't files. In our class we'll use a virtual file system called '''sysfs'''.  sysfs exposes the drivers for the hardware so you get easily use them.&lt;br /&gt;
&lt;br /&gt;
Try this:&lt;br /&gt;
 bone$ '''cd /sys'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 block/  bus/  class/  dev/  devices/  firmware/  fs/  kernel/  module/  power/&lt;br /&gt;
&lt;br /&gt;
Here we see several directories that represent hardware we can control. Explore a bit and see what you find.&lt;br /&gt;
&lt;br /&gt;
Now try:&lt;br /&gt;
&lt;br /&gt;
 beagle$ '''cd /sys/class'''&lt;br /&gt;
 beagle$ '''ls -F'''&lt;br /&gt;
 backlight/  firmware/     lcd/       mtd/           scsi_disk/   ubi/&lt;br /&gt;
 bdi/        gpio/         leds/      net/           scsi_host/   udc/&lt;br /&gt;
 block/      graphics/     mbox/      power_supply/  sound/       uio/&lt;br /&gt;
 bluetooth/  hwmon/        mdio_bus/  regulator/     spi_master/  usbmon/&lt;br /&gt;
 bsg/        i2c-adapter/  mem/       rfkill/        spidev/      vc/&lt;br /&gt;
 dma/        i2c-dev/      misc/      rtc/           thermal/     vtconsole/&lt;br /&gt;
 drm/        input/        mmc_host/  scsi_device/   tty/         watchdog/&lt;br /&gt;
&lt;br /&gt;
Explore some.  &lt;br /&gt;
&lt;br /&gt;
=== Blinking a USR LED ===&lt;br /&gt;
The Beagle Black has four user LEDS, '''user0''' - '''user3''', that you can control. Try this:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/class/leds'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 beaglebone:green:usr0  beaglebone:green:usr2&lt;br /&gt;
 beaglebone:green:usr1  beaglebone:green:usr3&lt;br /&gt;
&lt;br /&gt;
Here you see the directories for controlling each of the usr LEDs. By default, usr0 flashes a heartbeat pattern and usr1 flashes when the micro SD card is accessed.  Let's control usr0.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd beagleboard\:\:usr0'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 brightness  device@  max_brightness  power/  subsystem@  trigger  uevent&lt;br /&gt;
&lt;br /&gt;
See what's in '''brightness''', '''max_brightness''' and '''trigger''' by using the &amp;lt;code&amp;gt;cat&amp;lt;/code&amp;gt; command.  For example:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cat trigger'''&lt;br /&gt;
 none nand-disk mmc0 timer oneshot [heartbeat] backlight gpio cpu0 default-on transient&lt;br /&gt;
&lt;br /&gt;
This shows trigger can have many values.  The present value is '''heartbeat'''.  Check the LED, is it beating?  You can stop the heartbeat via:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo none &amp;gt; trigger'''&lt;br /&gt;
 bone$ '''cat trigger'''&lt;br /&gt;
 [none] nand-disk mmc0 timer oneshot heartbeat backlight gpio cpu0 default-on transient &lt;br /&gt;
&lt;br /&gt;
Did it stop beating?  You can now turn it on and off with:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; brightness'''&lt;br /&gt;
 bone$ '''echo 0 &amp;gt; brightness'''&lt;br /&gt;
&lt;br /&gt;
Is it responding correctly?&lt;br /&gt;
&lt;br /&gt;
The Bone has more trigger options.  Try:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cat trigger'''&lt;br /&gt;
 [none] mmc0 timer heartbeat backlight gpio default-on &lt;br /&gt;
 bone$ '''echo timer &amp;gt; trigger'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 brightness  delay_on  max_brightness  subsystem@  uevent&lt;br /&gt;
 delay_off   device@   power/          trigger&lt;br /&gt;
 bone$ '''echo 100 &amp;gt; delay_on'''&lt;br /&gt;
 bone$ '''echo 900 &amp;gt; delay_off'''&lt;br /&gt;
&lt;br /&gt;
What does this do?&lt;br /&gt;
&lt;br /&gt;
=== Blinking an External LED via gpio ===&lt;br /&gt;
&lt;br /&gt;
In the AM lab we wired an LED to the P9_12 General Purpose IO (gpio) port and controlled it via BoneScript.  Here we'll control it via a shell command. First we need to figure out which gpio pin P9_12 is attached to.  The following figure shows it attached to gpio_60.&lt;br /&gt;
&lt;br /&gt;
[[File:P9PWMs.jpg | 600px]]&lt;br /&gt;
&lt;br /&gt;
Here's how you turn it on&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/class/gpio'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  gpiochip0@  gpiochip32@  gpiochip64@  gpiochip96@  unexport&lt;br /&gt;
&lt;br /&gt;
Presently no gpio pins are visible.  You need to tell it which pin to export&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo 60 &amp;gt; export'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  gpio60@  gpiochip0@  gpiochip32@  gpiochip64@  gpiochip96@  unexport&lt;br /&gt;
&lt;br /&gt;
Notice '''gpio60''' has appeared.  All we need to do is tell it which direction and then turn it on.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd gpio60'''&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 active_low  direction  edge  power  subsystem  uevent  value&lt;br /&gt;
 bone$ '''echo out &amp;gt; direction'''&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; value'''&lt;br /&gt;
&lt;br /&gt;
Your LED should be on!  When you are done you can unexport the pin and it will disappear.&lt;br /&gt;
 bone$ '''cd ..'''&lt;br /&gt;
 bone$ '''echo 60 &amp;gt; unexport'''&lt;br /&gt;
&lt;br /&gt;
== Reading a switch ==&lt;br /&gt;
&lt;br /&gt;
Now that you have an LED working, wiring in a switch is easy.  In the AM lab you wired a switch to P9_42, which from the table above is '''gpio_7'''. &lt;br /&gt;
&lt;br /&gt;
Based on what you saw above.&lt;br /&gt;
 bone$ '''cd /sys/class/gpio'''&lt;br /&gt;
 bone$ '''echo 7 &amp;gt; export'''&lt;br /&gt;
 bone$ '''cd gpio7'''&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 bone$ '''echo in &amp;gt; direction'''&lt;br /&gt;
 bone$ '''cat value'''&lt;br /&gt;
 0&lt;br /&gt;
Now hold the button down and try again.&lt;br /&gt;
 bone$ '''cat value'''&lt;br /&gt;
 1&lt;br /&gt;
Once you have the switch and LED working use '''nano''' and put the following in a file.&lt;br /&gt;
 bone$ '''nano button.sh'''&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 cd /sys/class/gpio&lt;br /&gt;
 while [ 1 ]&lt;br /&gt;
 do&lt;br /&gt;
    cat gpio7/value&lt;br /&gt;
    sleep 0.25&lt;br /&gt;
 done&lt;br /&gt;
Quit nano and run&lt;br /&gt;
 bone$ '''chmod +x button.sh'''  (This makes button.sh executable)&lt;br /&gt;
 bone$ '''./button.sh'''&lt;br /&gt;
What happens when you push the button?&lt;br /&gt;
&lt;br /&gt;
Now experiment around. Can you flash the LED? How fast? Make the LED read the switch.&lt;br /&gt;
&lt;br /&gt;
== Analog In ==&lt;br /&gt;
The bone has eight Analog Inputs.  Several are exposed on P9.  They are labeled '''AIN''' in table 11 below.  How many do you find?&lt;br /&gt;
&lt;br /&gt;
[[File:P9PWMs.jpg|800px]]&lt;br /&gt;
&lt;br /&gt;
The AIN pins are sampled at 12 bits and 100k samples per second.  The input voltage is between 0 and 1.8V.  Fortunately, both voltages are available on P9.&lt;br /&gt;
&lt;br /&gt;
You've already wired these up for the AM lab. You interact with the analog in much like the gpio, but it appears in a different. We have to run a command before the AIN interface appears.  Just run them now, later I'll explain what you did if you are interested.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''SLOTS=/sys/devices/bone_capemgr.*/slots'''&lt;br /&gt;
 bone$ '''echo cape-bone-iio &amp;gt; $SLOTS'''&lt;br /&gt;
&lt;br /&gt;
You can now access the analog interface, let's explore.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/devices/ocp.2/helper.14'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 AIN0  AIN2  AIN4  AIN6  driver@   power/      uevent&lt;br /&gt;
 AIN1  AIN3  AIN5  AIN7  modalias  subsystem@&lt;br /&gt;
&lt;br /&gt;
There are the various analog inputs, but watch out.  This interface starts numbering at '''1''' and Table 11 starts at '''0''', so to read AIN5 you need to look at '''AIN6'''!&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cat AIN6'''&lt;br /&gt;
 1185&lt;br /&gt;
&lt;br /&gt;
Change the pot and rerun '''cat'''.  What's the min and max value you get?  Is it 12 bits?&lt;br /&gt;
&lt;br /&gt;
You can use the following script to continuously read the input.&lt;br /&gt;
 while [ 1 ]&lt;br /&gt;
   do &lt;br /&gt;
   tr '\n' '\r' &amp;lt; AIN6&lt;br /&gt;
 done&lt;br /&gt;
&lt;br /&gt;
== Pulse Width Modulation ==&lt;br /&gt;
&lt;br /&gt;
(Note: The pwm interface seems to changing. Some of this may not apply in the future.)&lt;br /&gt;
&lt;br /&gt;
The Bone has a PWM interface at &amp;lt;code&amp;gt;/sys/class/pwm/&amp;lt;/code&amp;gt;. You can see what's there by:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/class/pwm'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  unexport&lt;br /&gt;
Hmmm, there isn't much there.  We have to run a command to make something appear.  Try&lt;br /&gt;
 bone$ '''SLOTS=/sys/devices/bone_capemgr.*/slots'''&lt;br /&gt;
 bone$ '''echo am33xx_pwm &amp;gt; $SLOTS'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  pwmchip0@  pwmchip2@  pwmchip3@  pwmchip5@  pwmchip7@  unexport&lt;br /&gt;
Now we need to run another command to say which pwm pin we want to use.  I'm using P9_21.&lt;br /&gt;
 bone$ '''echo bone_pwm_P9_21 &amp;gt; $SLOTS&lt;br /&gt;
Now you can export a pwm much list you export a gpio port&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; export'''&lt;br /&gt;
 bone$ '''cd pwm1'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 device@  duty_ns  period_ns  polarity  power/  run  subsystem@  uevent&lt;br /&gt;
Try a 1Hz frequency with a 25% duty cycle&lt;br /&gt;
 bone$ '''echo 1000000000 &amp;gt; period_ns'''&lt;br /&gt;
 bone$ '''echo  250000000 &amp;gt; duty_ns'''&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; run'''&lt;br /&gt;
&lt;br /&gt;
Connect the LED from and watch it flash.  Try changing the frequency and duty cycle.  You may have to set the duty cycle to 0 to change the frequency.  Can you guess why?&lt;br /&gt;
&lt;br /&gt;
=== Challenge ===&lt;br /&gt;
Combine the analog in and the PWM by having the pot control the frequency or the duty cycle of the LED.&lt;br /&gt;
 &lt;br /&gt;
{{YoderFoot}}&lt;/div&gt;</summary>
		<author><name>Yoder</name></author>	</entry>

	<entry>
		<id>http://www.elinux.org/EBC_Exercise_01_Start_Here</id>
		<title>EBC Exercise 01 Start Here</title>
		<link rel="alternate" type="text/html" href="http://www.elinux.org/EBC_Exercise_01_Start_Here"/>
				<updated>2013-06-11T17:47:40Z</updated>
		
		<summary type="html">&lt;p&gt;Yoder: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:ECE497]]&lt;br /&gt;
{{YoderHead}}&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
There are four major things that need to be done to have the BeagleBoard ready to run for class:&lt;br /&gt;
# Get your Beagle Hardware together&lt;br /&gt;
# Update the OS on your Beagle&lt;br /&gt;
# Set up a host computer, running Linux for code development&lt;br /&gt;
# Clone the course git repository on both the Beagle and the host&lt;br /&gt;
&lt;br /&gt;
== The Hardware ==&lt;br /&gt;
&lt;br /&gt;
Here's the hardware you will need and where you get it.&lt;br /&gt;
&lt;br /&gt;
=== You may have, or will have to buy ===&lt;br /&gt;
&lt;br /&gt;
We are using the [http://beagleboard.org/Getting%20Started BeagleBone Black] this year.  Since it's only $45 I'll have you buy your your own. There's a few other things you will need to get before the first day of class.&lt;br /&gt;
* BeagleBone Black.  See [http://beagleboard.org/ http://beagleboard.org/] for suggestions of where to buy the Black.&lt;br /&gt;
* USB keyboard and mouse&lt;br /&gt;
* HDMI display&lt;br /&gt;
* At least three 4G micro SD cards. I suggest you have 3 or 4 cards since it's easy to mess up one and it takes some 10 minutes to reload it.&lt;br /&gt;
* micro SD card reader/writer&lt;br /&gt;
* Powered USB hub, at least 4 ports.  The Black has only one USB so this will allow you to plug in the keyboard, mouse, web cam, etc.&lt;br /&gt;
&lt;br /&gt;
==== Books ====&lt;br /&gt;
* [http://www.amazon.com/Embedded-Linux-Primer-Practical-Real-World/dp/0137017839 Embedded Linux Primer] The bookstore will have this.&lt;br /&gt;
* [http://www.morganclaypool.com/doi/abs/10.2200/S00500ED1V01Y201304DCS041 Bad to the Bone] Don't by this yet, I think I can get you a free copy.&lt;br /&gt;
&lt;br /&gt;
=== What you buy from the Instrument Room ===&lt;br /&gt;
* Proto Plate with full sized breadboard&lt;br /&gt;
* various input devices, sensors, displays, etc.&lt;br /&gt;
&lt;br /&gt;
=== What you borrow from the Instrument Room ===&lt;br /&gt;
* 5V power supply&lt;br /&gt;
* micro HDMI to HDMI adapter.  [http://www.monoprice.com/products/product.asp?c_id=104&amp;amp;cp_id=10419&amp;amp;cs_id=1041913&amp;amp;p_id=7703&amp;amp;seq=1&amp;amp;format=2 Monoprice]&lt;br /&gt;
* FTDI USB to Serial Adapter.  Must be 3.3V version. [https://www.sparkfun.com/products/9717 Sparkfun]&lt;br /&gt;
&lt;br /&gt;
== Updating the Beagle OS ==&lt;br /&gt;
&lt;br /&gt;
Once you have all your hardware together go ahead and [http://beagleboard.org/Getting%20Started explore the Bone]. It should work right out of the box. After you have explored a while, update the image on the Bone so you are running the most current image. Go to [[EBC Exercise 03 Installing a Beagle OS]] to learn how to flash your SD card with a fresh OS.&lt;br /&gt;
&lt;br /&gt;
== The Linux host computer ==&lt;br /&gt;
&lt;br /&gt;
The above will get you ready for about the first 4 weeks of class. Around week 5 we'll start looking at the kernel and will need to cross compile. Once we start moving into Kernel development we will need a host computer. Since we are doing Linux development, it's generally agree the host should be running Linux.  I suggest you run [http://www.ubuntu.com Ubuntu 12.04 (LTS)]. The Rose Linux Users Group [http://lug.rose-hulman.edu/wiki/Main_Page LUG] has instructions on where to get a local copy so you don't have to download some 700M.&lt;br /&gt;
&lt;br /&gt;
There are three options as to how to run Linux.&lt;br /&gt;
# Native install ([http://www.ubuntu.com/download])&lt;br /&gt;
# Install in a virtual machine. I've been running [[EBC Exercise 06 Notes on VirtualBox | Virtual Box]] recently and it seems to work find.  You can also try [[EBC Exercise 07 Notes on Installing Ubuntu in VMware Player | VMware Player]].&lt;br /&gt;
# Run in the cloud&lt;br /&gt;
&lt;br /&gt;
The Ubuntu site gives good instructions for a native install. I've had good success with running both VMware and Virtual Box, though my installation instructions are a bit dated.  (Feel free to update them if they need it.)&lt;br /&gt;
&lt;br /&gt;
I've been testing out the &amp;quot;Cloud&amp;quot; approach and it looks like it will work too.  If you want to try the cloud, let me known and I'll ask CSSE to set up a machine for you.&lt;br /&gt;
&lt;br /&gt;
=== Kernel Development ===&lt;br /&gt;
&lt;br /&gt;
Once you have Linux running somewhere, you need to install the kernel development tools.  Go to [[EBC Exercise 08 Installing Development Tools]] to see all the steps you need. Once set up, go back to [[EBC Exercise 05 Getting Exercise Support Materials]] to clone the class repository on your host.&lt;br /&gt;
&lt;br /&gt;
Now that you have all these pieces in place you are ready to work with a very power embedded processor.&lt;br /&gt;
&lt;br /&gt;
== The class git repository ==&lt;br /&gt;
&lt;br /&gt;
Once you have an up to date OS running on your Beagle, go to [[EBC Exercise 05 Getting Exercise Support Materials]] to learn how to clone the class git repository. Once cloned it's a single command to get the latest materials on your Beagle (or host computer for that matter).&lt;br /&gt;
&lt;br /&gt;
{{YoderHead}}&lt;/div&gt;</summary>
		<author><name>Yoder</name></author>	</entry>

	<entry>
		<id>http://www.elinux.org/EBC_Exercise_01_Start_Here</id>
		<title>EBC Exercise 01 Start Here</title>
		<link rel="alternate" type="text/html" href="http://www.elinux.org/EBC_Exercise_01_Start_Here"/>
				<updated>2013-06-11T17:46:47Z</updated>
		
		<summary type="html">&lt;p&gt;Yoder: /* What you buy from the Instrument Room */ Added borrow section&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:ECE497]]&lt;br /&gt;
{{YoderHead}}&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
There are four major things that need to be done to have the BeagleBoard ready to run for class:&lt;br /&gt;
# Get your Beagle Hardware together&lt;br /&gt;
# Update the OS on your Beagle&lt;br /&gt;
# Set up a host computer, running Linux for code development&lt;br /&gt;
# Clone the course git repository on both the Beagle and the host&lt;br /&gt;
&lt;br /&gt;
== The Hardware ==&lt;br /&gt;
&lt;br /&gt;
Here's the hardware you will need and where you get it.&lt;br /&gt;
&lt;br /&gt;
=== You may have, or will have to buy ===&lt;br /&gt;
&lt;br /&gt;
We are using the [http://beagleboard.org/Getting%20Started BeagleBone Black] this year.  Since it's only $45 I'll have you buy your your own. There's a few other things you will need to get before the first day of class.&lt;br /&gt;
* BeagleBone Black.  See [http://beagleboard.org/ http://beagleboard.org/] for suggestions of where to buy the Black.&lt;br /&gt;
* USB keyboard and mouse&lt;br /&gt;
* HDMI display&lt;br /&gt;
* At least three 4G micro SD cardz. I suggest you have 3 or 4 cards since it's easy to mess up one and it takes some 10 minutes to reload it.&lt;br /&gt;
* micro SD card reader/writer&lt;br /&gt;
* Powered USB hub, at least 4 ports.  The Black has only one USB so this will allow you to plug in the keyboard, mouse, web cam, etc.&lt;br /&gt;
&lt;br /&gt;
Books&lt;br /&gt;
* [http://www.amazon.com/Embedded-Linux-Primer-Practical-Real-World/dp/0137017839 Embedded Linux Primer] The bookstore will have this.&lt;br /&gt;
* [http://www.morganclaypool.com/doi/abs/10.2200/S00500ED1V01Y201304DCS041 Bad to the Bone] Don't by this yet, I think I can get you a free copy.&lt;br /&gt;
&lt;br /&gt;
=== What you buy from the Instrument Room ===&lt;br /&gt;
* Proto Plate with full sized breadboard&lt;br /&gt;
* various input devices, sensors, displays, etc.&lt;br /&gt;
&lt;br /&gt;
=== What you borrow from the Instrument Room ===&lt;br /&gt;
* 5V power supply&lt;br /&gt;
* micro HDMI to HDMI adapter.  [http://www.monoprice.com/products/product.asp?c_id=104&amp;amp;cp_id=10419&amp;amp;cs_id=1041913&amp;amp;p_id=7703&amp;amp;seq=1&amp;amp;format=2 Monoprice]&lt;br /&gt;
* FTDI USB to Serial Adapter.  Must be 3.3V version. [https://www.sparkfun.com/products/9717 Sparkfun]&lt;br /&gt;
&lt;br /&gt;
== Updating the Beagle OS ==&lt;br /&gt;
&lt;br /&gt;
Once you have all your hardware together go ahead and [http://beagleboard.org/Getting%20Started explore the Bone]. It should work right out of the box. After you have explored a while, update the image on the Bone so you are running the most current image. Go to [[EBC Exercise 03 Installing a Beagle OS]] to learn how to flash your SD card with a fresh OS.&lt;br /&gt;
&lt;br /&gt;
== The Linux host computer ==&lt;br /&gt;
&lt;br /&gt;
The above will get you ready for about the first 4 weeks of class. Around week 5 we'll start looking at the kernel and will need to cross compile. Once we start moving into Kernel development we will need a host computer. Since we are doing Linux development, it's generally agree the host should be running Linux.  I suggest you run [http://www.ubuntu.com Ubuntu 12.04 (LTS)]. The Rose Linux Users Group [http://lug.rose-hulman.edu/wiki/Main_Page LUG] has instructions on where to get a local copy so you don't have to download some 700M.&lt;br /&gt;
&lt;br /&gt;
There are three options as to how to run Linux.&lt;br /&gt;
# Native install ([http://www.ubuntu.com/download])&lt;br /&gt;
# Install in a virtual machine. I've been running [[EBC Exercise 06 Notes on VirtualBox | Virtual Box]] recently and it seems to work find.  You can also try [[EBC Exercise 07 Notes on Installing Ubuntu in VMware Player | VMware Player]].&lt;br /&gt;
# Run in the cloud&lt;br /&gt;
&lt;br /&gt;
The Ubuntu site gives good instructions for a native install. I've had good success with running both VMware and Virtual Box, though my installation instructions are a bit dated.  (Feel free to update them if they need it.)&lt;br /&gt;
&lt;br /&gt;
I've been testing out the &amp;quot;Cloud&amp;quot; approach and it looks like it will work too.  If you want to try the cloud, let me known and I'll ask CSSE to set up a machine for you.&lt;br /&gt;
&lt;br /&gt;
=== Kernel Development ===&lt;br /&gt;
&lt;br /&gt;
Once you have Linux running somewhere, you need to install the kernel development tools.  Go to [[EBC Exercise 08 Installing Development Tools]] to see all the steps you need. Once set up, go back to [[EBC Exercise 05 Getting Exercise Support Materials]] to clone the class repository on your host.&lt;br /&gt;
&lt;br /&gt;
Now that you have all these pieces in place you are ready to work with a very power embedded processor.&lt;br /&gt;
&lt;br /&gt;
== The class git repository ==&lt;br /&gt;
&lt;br /&gt;
Once you have an up to date OS running on your Beagle, go to [[EBC Exercise 05 Getting Exercise Support Materials]] to learn how to clone the class git repository. Once cloned it's a single command to get the latest materials on your Beagle (or host computer for that matter).&lt;br /&gt;
&lt;br /&gt;
{{YoderHead}}&lt;/div&gt;</summary>
		<author><name>Yoder</name></author>	</entry>

	<entry>
		<id>http://www.elinux.org/BeagleBoard_Education_Workshops</id>
		<title>BeagleBoard Education Workshops</title>
		<link rel="alternate" type="text/html" href="http://www.elinux.org/BeagleBoard_Education_Workshops"/>
				<updated>2013-06-11T17:44:38Z</updated>
		
		<summary type="html">&lt;p&gt;Yoder: Updated price&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:ECE497 |W]]&lt;br /&gt;
[[Category:BeagleBoard]]&lt;br /&gt;
[[Category:Workshops]]&lt;br /&gt;
[[Category:Education]]&lt;br /&gt;
{{YoderHead}}&lt;br /&gt;
&lt;br /&gt;
== 2013 ASEE Workshop ==&lt;br /&gt;
{|&lt;br /&gt;
| '''Title:''' &lt;br /&gt;
| U216·WORKSHOP: BeagleBone - A Hands-on Workshop&lt;br /&gt;
|-&lt;br /&gt;
| '''Presentors:''' &lt;br /&gt;
| Dr. Steven F Barrett P.E., Jason Kridner, Mark A. Yoder&lt;br /&gt;
|-&lt;br /&gt;
| '''Location:''' &lt;br /&gt;
| Atlanta, Omni CNN Center Hotel, Omni - Chestnut&lt;br /&gt;
|-&lt;br /&gt;
| '''Date:''' &lt;br /&gt;
| 23-June-2013&lt;br /&gt;
|-&lt;br /&gt;
| '''Link'''&lt;br /&gt;
| [http://www.asee.org/public/conferences/20/registration/view_session?session_id=2420 ASEE site]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Abstract:===&lt;br /&gt;
&lt;br /&gt;
'''Ticketed event: $25.00 advanced registration and $35.00 on site registration'''&lt;br /&gt;
&lt;br /&gt;
BeagleBone is a low cost, open hardware computer first introduced in November 2011 by BeagleBoard.org, a community of developers sponsored by Texas Instruments. BeagleBone hosts a powerful 32-bit, super-scalar ARM Cortex A8 processor operating at 720 MHz. Yet it is small enough to fit in an Altoids mint tin box. The &amp;quot;Bone'' may be used in a wide variety of projects from middle school science fair projects to senior design projects to first prototypes of very complex systems. Novice users may access the power of the Bone through the user-friendly Bonescript environment. Seasoned users may take full advantage of the Bone's power using the underlying Linux-based operating system, a host of feature extension boards (Capes) and a wide variety of open source libraries. This hands on workshop provides an introduction to this powerful computer and has been designed for a wide variety of users including the first time novice through the seasoned embedded system design professional. &lt;br /&gt;
&lt;br /&gt;
Workshop participants will receive a BeagleBone board and also a BeagleBone book courtesy of BeagleBoard.org and Morgan and Claypool Publishers. This workshop is subsidized by Texas Instruments (TI).&lt;br /&gt;
&lt;br /&gt;
=== Pre Workshop ===&lt;br /&gt;
&lt;br /&gt;
=== Labs ===&lt;br /&gt;
&lt;br /&gt;
[[ASEE 2013 Workshop | Afternoon labs]]&lt;br /&gt;
&lt;br /&gt;
=== Post Workshop ===&lt;br /&gt;
&lt;br /&gt;
== 2012 Engibous Summit Workshop ==&lt;br /&gt;
{|&lt;br /&gt;
| '''Title:''' &lt;br /&gt;
| Hands-on workshop on Embedded Linux on BeagleBone&lt;br /&gt;
|-&lt;br /&gt;
| '''Presentor:''' &lt;br /&gt;
| Mark A. Yoder&lt;br /&gt;
|-&lt;br /&gt;
| '''Location:''' &lt;br /&gt;
| Dallas&lt;br /&gt;
|-&lt;br /&gt;
| '''Date:''' &lt;br /&gt;
| 30-July-2012&lt;br /&gt;
|-&lt;br /&gt;
| '''Link'''&lt;br /&gt;
| [http://www.ti.com/corp/docs/landing/universityprogram/prize.htm Engibous Summit]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Abstract:===&lt;br /&gt;
&lt;br /&gt;
???&lt;br /&gt;
&lt;br /&gt;
=== Pre Workshop ===&lt;br /&gt;
&lt;br /&gt;
You will be mailed some information about the workshop and some things for you to do before arriving.&lt;br /&gt;
&lt;br /&gt;
--Mark&lt;br /&gt;
&lt;br /&gt;
=== Labs ===&lt;br /&gt;
&lt;br /&gt;
=== Post Workshop ===&lt;br /&gt;
&lt;br /&gt;
== 2012 Chandigarh Workshop ==&lt;br /&gt;
{|&lt;br /&gt;
| '''Title:''' &lt;br /&gt;
| Hands-on workshop on Embedded Linux on Beagleboard&lt;br /&gt;
|-&lt;br /&gt;
| '''Presentor:''' &lt;br /&gt;
| Mark A. Yoder&lt;br /&gt;
|-&lt;br /&gt;
| '''Location:''' &lt;br /&gt;
| [http://www.uniti.in/events/venueevents/73-chitkara-school-of-engineering-a-technology Chitkara School of Engineering &amp;amp; Technology] - Chandigarh, India&lt;br /&gt;
|-&lt;br /&gt;
| '''Date:''' &lt;br /&gt;
| 18-20 June-2012&lt;br /&gt;
|-&lt;br /&gt;
| '''Link'''&lt;br /&gt;
| [http://www.uniti.in/events/details/128-hands-on-workshop-on-embedded-linux-on-beagleboard http://www.uniti.in/events/details/128-hands-on-workshop-on-embedded-linux-on-beagleboard]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Abstract:===&lt;br /&gt;
&lt;br /&gt;
Beagleboard is a low-cost open-source embedded system development platform. It is based on Texas Instruments DM3730 processor, which includes an on-chip ARM Cortex-A8 processor core, a Texas Instruments C6x DSP core, and a host of peripherals. Beagleboard is a single board computer, which provides adequate performance to run Linux software, yet has a power consumption lower than 2W. A large number of embedded applications have been developed on Beagleboard ([http://www.beagleboard.org www.beagleboard.org]) Module A provides a gentle introduction to the subject of Embedded Linux, Linux Systems Programming and Linux Kernel Programming. The intention of Module B is to provide a hands-on exposure to running Embedded Linux operating system on the Beagleboard and develop system software on the Beagleboard.&lt;br /&gt;
=== Pre Workshop ===&lt;br /&gt;
&lt;br /&gt;
The purpose of this page is to give you practice editing a wiki and to start building a community of BeagleBoard Educators.  Click on the '''edit''' tab above and add your name to the list. You will have to create an eLinux account before you can edit the page.&lt;br /&gt;
&lt;br /&gt;
--Mark&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
! style=&amp;quot;width:20%&amp;quot; | Name&lt;br /&gt;
! style=&amp;quot;width:20%&amp;quot; | School/Company&lt;br /&gt;
! style=&amp;quot;width:30%&amp;quot; | Linux/DSP Background&lt;br /&gt;
! style=&amp;quot;width:30%&amp;quot; | Interests&lt;br /&gt;
|-&lt;br /&gt;
| Mark A. Yoder&lt;br /&gt;
| Rose-Hulman Institute of Technology, &lt;br /&gt;
Terre Haute, Indiana, USA&lt;br /&gt;
| I've been using various flavors of Unix/Linux since the late '70s, but there is always more to learn.&lt;br /&gt;
I've taught a 'C6713 based DSP class years ago. &lt;br /&gt;
| I teach 32-bit embedded with the Beagle [[ECE497 - 32-bit Embedded Linux, Rose-Hulman]].&lt;br /&gt;
|-&lt;br /&gt;
|Cathy Wicks&lt;br /&gt;
|Texas Instruments, University Program Manager&lt;br /&gt;
|I am a HUGE fan of Beagleboard and very interested to develop a community of teachers using it. &lt;br /&gt;
|Our Program [http://www.ti.com/university www.ti.com/university] helps academics use TI Hardware, Software and Chips in their projects and curriculum.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Labs ===&lt;br /&gt;
&lt;br /&gt;
=== Post Workshop ===&lt;br /&gt;
&lt;br /&gt;
== 2012 Hyderabad Workshop ==&lt;br /&gt;
{|&lt;br /&gt;
| '''Title:''' &lt;br /&gt;
| Three-day workshop on Embedded Linux on Beagleboard&lt;br /&gt;
|-&lt;br /&gt;
| '''Presentor:''' &lt;br /&gt;
| Mark A. Yoder&lt;br /&gt;
|-&lt;br /&gt;
| '''Location:''' &lt;br /&gt;
| [http://www.uniti.in/events/venueevents/69-c-dac-hyderabad C-DAC Hyderabad] - Hyderabad, India&lt;br /&gt;
|-&lt;br /&gt;
| '''Date:''' &lt;br /&gt;
| 14-16 June-2012&lt;br /&gt;
|-&lt;br /&gt;
| '''Link'''&lt;br /&gt;
| [http://www.uniti.in/events/details/123-three-day-workshop-on-embedded-linux-on-beagleboard http://www.uniti.in/events/details/123-three-day-workshop-on-embedded-linux-on-beagleboard]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Abstract:===&lt;br /&gt;
&lt;br /&gt;
Linux, which is an “open source” operating system and enjoys considerable popularity on general-purpose computers, is becoming popular in the embedded world also. Different versions and variants of Linux are now available on embedded platforms. In this workshop, the intention is to provide a hands-on introduction to concepts of Linux Systems/Kernel Programming and Embedded Linux&lt;br /&gt;
&lt;br /&gt;
=== Pre Workshop ===&lt;br /&gt;
&lt;br /&gt;
The purpose of this page is to give you practice editing a wiki and to start building a community of BeagleBoard Educators.  Click on the '''edit''' tab above and add your name to the list. You will have to create an eLinux account before you can edit the page.&lt;br /&gt;
&lt;br /&gt;
--Mark&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
! style=&amp;quot;width:20%&amp;quot; | Name&lt;br /&gt;
! style=&amp;quot;width:20%&amp;quot; | School/Company&lt;br /&gt;
! style=&amp;quot;width:30%&amp;quot; | Linux/DSP Background&lt;br /&gt;
! style=&amp;quot;width:30%&amp;quot; | Interests&lt;br /&gt;
|-&lt;br /&gt;
| Mark A. Yoder&lt;br /&gt;
| Rose-Hulman Institute of Technology, &lt;br /&gt;
Terre Haute, Indiana, USA&lt;br /&gt;
| I've been using various flavors of Unix/Linux since the late '70s, but there is always more to learn.&lt;br /&gt;
I've taught a 'C6713 based DSP class years ago. &lt;br /&gt;
| I teach 32-bit embedded with the Beagle [[ECE497 - 32-bit Embedded Linux, Rose-Hulman]].&lt;br /&gt;
|-&lt;br /&gt;
|Cathy Wicks&lt;br /&gt;
|Texas Instruments, University Program Manager&lt;br /&gt;
|I am a HUGE fan of Beagleboard and very interested to develop a community of teachers using it. &lt;br /&gt;
|Our Program [http://www.ti.com/university www.ti.com/university] helps academics use TI Hardware, Software and Chips in their projects and curriculum.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Labs ===&lt;br /&gt;
&lt;br /&gt;
=== Post Workshop ===&lt;br /&gt;
&lt;br /&gt;
== 2012 Bangalore Workshop ==&lt;br /&gt;
{|&lt;br /&gt;
| '''Title:''' &lt;br /&gt;
| 6-day modular workshop on Embedded Linux&lt;br /&gt;
|-&lt;br /&gt;
| '''Presentor:''' &lt;br /&gt;
| Mark A. Yoder&lt;br /&gt;
|-&lt;br /&gt;
| '''Location:''' &lt;br /&gt;
| [http://www.uniti.in/events/venueevents/68-cambridge-institute-of-technology Cambridge Institute of Technology] - Bangalore, India&lt;br /&gt;
|-&lt;br /&gt;
| '''Date:''' &lt;br /&gt;
| 11-13 June-2012&lt;br /&gt;
|-&lt;br /&gt;
| '''Link'''&lt;br /&gt;
| [http://www.uniti.in/events/details/122-6-day-modular-workshop-on-embedded-linux www.uniti.in/events/details/122-6-day-modular-workshop-on-embedded-linux]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Abstract:===&lt;br /&gt;
&lt;br /&gt;
'''Module A''' provides an overview of basic concepts of Linux, Linux Systems Programming, Linux Kernel Programming, and Embedded Systems. Module A will also include an introduction to Beagleboard, an open-source, low-cost, low-power embedded system development platform. '''Module A''' will be conducted jointly by a team of experts from industry and academia. In '''Module B''', aspects of Embedded Linux on Beagleboard will be explored in greater depth. Module B will be conducted by Prof. Mark A. Yoder of Rose-Hulman Institute of Technology, USA.&lt;br /&gt;
&lt;br /&gt;
=== Pre Workshop ===&lt;br /&gt;
&lt;br /&gt;
The purpose of this page is to give you practice editing a wiki and to start building a community of BeagleBoard Educators.  Click on the '''edit''' tab above and add your name to the list. You will have to create an eLinux account before you can edit the page.&lt;br /&gt;
&lt;br /&gt;
--Mark&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
! style=&amp;quot;width:20%&amp;quot; | Name&lt;br /&gt;
! style=&amp;quot;width:20%&amp;quot; | School/Company&lt;br /&gt;
! style=&amp;quot;width:30%&amp;quot; | Linux/DSP Background&lt;br /&gt;
! style=&amp;quot;width:30%&amp;quot; | Interests&lt;br /&gt;
|-&lt;br /&gt;
| Mark A. Yoder&lt;br /&gt;
| Rose-Hulman Institute of Technology, &lt;br /&gt;
Terre Haute, Indiana, USA&lt;br /&gt;
| I've been using various flavors of Unix/Linux since the late '70s, but there is always more to learn.&lt;br /&gt;
I've taught a 'C6713 based DSP class years ago. &lt;br /&gt;
| I teach 32-bit embedded with the Beagle [[ECE497 - 32-bit Embedded Linux, Rose-Hulman]].&lt;br /&gt;
|-&lt;br /&gt;
|Cathy Wicks&lt;br /&gt;
|Texas Instruments, University Program Manager&lt;br /&gt;
|I am a HUGE fan of Beagleboard and very interested to develop a community of teachers using it. &lt;br /&gt;
|Our Program [http://www.ti.com/university www.ti.com/university] helps academics use TI Hardware, Software and Chips in their projects and curriculum.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Labs ===&lt;br /&gt;
&lt;br /&gt;
=== Post Workshop ===&lt;br /&gt;
&lt;br /&gt;
== 2011 FIE Workshop - Cancelled ==&lt;br /&gt;
{|&lt;br /&gt;
| '''Title:''' &lt;br /&gt;
| From DSP Chips to Embedded Processors for Teaching Digital Signal Processing&lt;br /&gt;
|-&lt;br /&gt;
| '''Presentor:''' &lt;br /&gt;
| Mark A. Yoder&lt;br /&gt;
|-&lt;br /&gt;
| '''Location:''' &lt;br /&gt;
| Holiday Inn Salon F, Rapid City, South Dakota&lt;br /&gt;
|-&lt;br /&gt;
| '''Date:''' &lt;br /&gt;
| Wednesday, October 12, 2011, 2:30 p.m. - 5:30 p.m&lt;br /&gt;
|-&lt;br /&gt;
| '''Link'''&lt;br /&gt;
| [http://fie-conference.org/fie2011/] [http://fie-conference.org/fie2011/Pages/workshops.htm#SCRL6]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Abstract:===&lt;br /&gt;
&lt;br /&gt;
The goal of this hands-on tutorial is to present ideas on how to use Texas Instrument’s DM 3730-based BeagleBoard xM ([www.BeagleBoard.org www.BeagleBoard.org]) for teaching embedded processing using Open Source resources. The DM 3730 is a dual core processor with an ARM Cortex-a8 core and a TI ‘c64x DSP core. The BeagleBoard is Open Source hardware that has sold over 30,000 units since its introduction less than 2 years ago and has a thriving Open Source Software community.&lt;br /&gt;
&lt;br /&gt;
The BeagleBoard has many uses in the classroom. This workshop will show some of those uses and present some of the challenges in teaching with Open Source.&lt;br /&gt;
&lt;br /&gt;
The workshop activities will include:&lt;br /&gt;
&lt;br /&gt;
* several hands-on exercises to get participants familiar with using the Beagle, and how it differs from a traditional 8- or 16-bit microcomputer.&lt;br /&gt;
* several demonstrations of what the Beagle can do, such as streaming video and programming its DSP and discussions of what topics to include in an embedded/DSP class including dealing with open source comminutes.&lt;br /&gt;
* This workshop is targeted to those who are teaching embedded processors or DSP hardware. Some Linux background would be helpful, but not required. Those with little or no Linux experience will be paired with those with more experience.&lt;br /&gt;
&lt;br /&gt;
=== Post Workshop ===&lt;br /&gt;
&lt;br /&gt;
Even though the workshop has been cancelled, you can still do the exercises.  Here ([[Getting a Workshop SD Image]]) are instructions on how to put the tutorial image on your SD card.&lt;br /&gt;
&lt;br /&gt;
Here ([[EBC Embedded Beagle Class Topics]]) is a list of topics I cover in my class.  If you have questions, please email me.&lt;br /&gt;
&lt;br /&gt;
== 2011 IEEE ICASSP Workshop ==&lt;br /&gt;
{|&lt;br /&gt;
| '''Title:''' &lt;br /&gt;
| How 32-bit Embedded Processors Change the Focus in Teaching DSP Hardware&lt;br /&gt;
|-&lt;br /&gt;
| '''Presentor:''' &lt;br /&gt;
| Mark A. Yoder&lt;br /&gt;
|-&lt;br /&gt;
| '''Location:''' &lt;br /&gt;
| Prague, Czech Republic&lt;br /&gt;
|-&lt;br /&gt;
| '''Date:''' &lt;br /&gt;
| Monday May 23rd, 2011, Afternoon&lt;br /&gt;
|-&lt;br /&gt;
| '''Link'''&lt;br /&gt;
| [http://www.icassp2011.com/en/registration]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Abstract:===&lt;br /&gt;
This hands-on tutorial presents ideas on how to use TI’s OMAP 3530-based BeagleBoard (www.BeagleBoard.org) for teaching embedded media processing using Open Source resources. The BeagleBoard is Open Source hardware that has sold over 20,000 units since its introduction less than 2 years ago and has a thriving Open Source Software community.&lt;br /&gt;
After the introduction, this workshop will complement the Sunday afternoon tutorial “From DSP Chips to Embedded Processors for Teaching Digital Signal Processing”.  The Sunday workshop examples focus on programming the ‘C64 DSP on the OMAP3530.  This workshop will focus on using Open Source software for media processing  (such as GStreamer, OpenCV, etc.) and using the OMAP display subsystem for handling video. &lt;br /&gt;
The workshop activities will include:&lt;br /&gt;
# Several hands-on exercises to get participants familiar with using the Beagle, (same as tutorial)&lt;br /&gt;
# Several demonstrations of what the Beagle can do using Open Source software, including using the display subsystem, recognizing speech, computer vision&lt;br /&gt;
# Discussions of what topics to include in an embedded Linux class.&lt;br /&gt;
No BeagleBoards will given out.&lt;br /&gt;
&lt;br /&gt;
=== Pre Workshop ===&lt;br /&gt;
&lt;br /&gt;
The purpose of this page is to give you practice editing a wiki and to start building a community of BeagleBoard Educators.  Click on the '''edit''' tab above and add your name to the list. You will have to create an eLinux account before you can edit the page.&lt;br /&gt;
&lt;br /&gt;
--Mark&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
! style=&amp;quot;width:20%&amp;quot; | Name&lt;br /&gt;
! style=&amp;quot;width:20%&amp;quot; | School/Company&lt;br /&gt;
! style=&amp;quot;width:30%&amp;quot; | Linux/DSP Background&lt;br /&gt;
! style=&amp;quot;width:30%&amp;quot; | Interests&lt;br /&gt;
|-&lt;br /&gt;
| Mark A. Yoder&lt;br /&gt;
| Rose-Hulman Institute of Technology, &lt;br /&gt;
Terre Haute, Indiana, USA&lt;br /&gt;
| I've been using various flavors of Unix/Linux since the late '70s, but there is always more to learn.&lt;br /&gt;
I've taught a 'C6713 based DSP class years ago. &lt;br /&gt;
| I teach 32-bit embedded with the Beagle [[ECE497 - 32-bit Embedded Linux, Rose-Hulman]].  DSP is appearing everywhere now.  The BeagleBoard is a great environment to teach DSP.&lt;br /&gt;
|-&lt;br /&gt;
|Cathy Wicks&lt;br /&gt;
|Texas Instruments, University Program Manager&lt;br /&gt;
|I am a HUGE fan of Beagleboard and very interested to develop a community of teachers using it. &lt;br /&gt;
|Our Program [http://www.ti.com/university www.ti.com/university] helps academics use TI Hardware, Software and Chips in their projects and curriculum.  &lt;br /&gt;
|-&lt;br /&gt;
|Melani Plett&lt;br /&gt;
|Seattle Pacific University,&lt;br /&gt;
Seattle, Washington, USA&lt;br /&gt;
|I teach an undergraduate signals and systems course.  I have no Linux experience, though I did use Unix years ago.&lt;br /&gt;
|I am thinking of generating a technical elective follow-on class to illustrate the signals and systems concepts on the Beagleboard.&lt;br /&gt;
|-&lt;br /&gt;
|Monty Hayes&lt;br /&gt;
|Georgia Tech, Professor, Atlanta, GA and&lt;br /&gt;
Chung-Ang University Distinguished Foreign Professor, Seoul, Korea&lt;br /&gt;
|I have no linux experience, have taught courses on DSP chips before&lt;br /&gt;
|I would like to develop an undergraduate course using the Beagleboard to teach DSP.&lt;br /&gt;
|-&lt;br /&gt;
|Oleg Muratov&lt;br /&gt;
|University of Trento, Itay&lt;br /&gt;
|I am a PhD student and I have limited Linux experience.&lt;br /&gt;
|I am planning to give a course to undergraduate students on DSP probably using some hardware.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Labs ===&lt;br /&gt;
&lt;br /&gt;
Here's an additional handout that didn't make it in time for the printers.&lt;br /&gt;
&lt;br /&gt;
[[VideoThru Lab]]&lt;br /&gt;
&lt;br /&gt;
=== Post Workshop ===&lt;br /&gt;
&lt;br /&gt;
Here ([[Getting_a_Workshop_SD_Image]]) are instructions on how to put the tutorial image on your SD card.&lt;br /&gt;
&lt;br /&gt;
== 2011 IEEE ICASSP Tutorial ==&lt;br /&gt;
{|&lt;br /&gt;
| '''Title:''' &lt;br /&gt;
| From DSP Chips to Embedded Processors for Teaching Digital Signal Processing&lt;br /&gt;
|-&lt;br /&gt;
| '''Presentor:''' &lt;br /&gt;
| Mark A. Yoder&lt;br /&gt;
|-&lt;br /&gt;
| '''Location:''' &lt;br /&gt;
| Prague, Czech Republic&lt;br /&gt;
|-&lt;br /&gt;
| '''Date:''' &lt;br /&gt;
| Sunday May 22nd, 2011, Afternoon&lt;br /&gt;
|-&lt;br /&gt;
| '''Link'''&lt;br /&gt;
| [http://www.icassp2011.com/en/tutorials/tutorial-5]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Abstract:===&lt;br /&gt;
This hands-on tutorial presents ideas on how to use TI’s OMAP 3530-based BeagleBoard (www.BeagleBoard.org) for teaching embedded media processing using Open Source resources. The BeagleBoard is Open Source hardware that has sold over 16,000 units since its introduction less than 2 years ago and has a thriving Open Source Software community.&lt;br /&gt;
Today’s media handling embedded processors have come a long way from the limited performance of 8- or 16-bit embedded processors or the limited functionality of a dedicated DSP chip. Our students need to see that the days of the single DSP chip are almost over and they need to be prepared for working with DSPs embedded with other processors.&lt;br /&gt;
The OMAP3530 processor contains both an ARM Cortex-A9 processor and a ‘C6400 DSP and it and chips like it are being used in products today. &lt;br /&gt;
The workshop activities include:&lt;br /&gt;
#      hands-on exercises to get participants familiar with using the Beagle,&lt;br /&gt;
#      demonstrations of what the Beagle can do, including streaming video and synthesizing speech and&lt;br /&gt;
#      discussions of what topics to include in an embedded Linux class.&lt;br /&gt;
Participants will receive a BeagleBoard and course materials.&lt;br /&gt;
&lt;br /&gt;
=== Pre Tutorial ===&lt;br /&gt;
&lt;br /&gt;
The purpose of this page is to give you practice editing a wiki and to start building a community of BeagleBoard Educators.  Click on the '''edit''' tab above and add your name to the list. You will have to create an eLinux account before you can edit the page.&lt;br /&gt;
&lt;br /&gt;
--Mark&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
! style=&amp;quot;width:20%&amp;quot; | Name&lt;br /&gt;
! style=&amp;quot;width:20%&amp;quot; | School/Company&lt;br /&gt;
! style=&amp;quot;width:30%&amp;quot; | Linux/DSP Background&lt;br /&gt;
! style=&amp;quot;width:30%&amp;quot; | Interests&lt;br /&gt;
|-&lt;br /&gt;
| Mark A. Yoder&lt;br /&gt;
| Rose-Hulman Institute of Technology, &lt;br /&gt;
Terre Haute, Indiana, USA&lt;br /&gt;
| I've been using various flavors of Unix/Linux since the late '70s, but there is always more to learn.&lt;br /&gt;
I've taught a 'C6713 based DSP class years ago. &lt;br /&gt;
| I teach 32-bit embedded with the Beagle [[ECE497 - 32-bit Embedded Linux, Rose-Hulman]].  DSP is appearing everywhere now.  The BeagleBoard is a great environment to teach DSP.&lt;br /&gt;
|-&lt;br /&gt;
|Cathy Wicks&lt;br /&gt;
|Texas Instruments, University Program Manager&lt;br /&gt;
|I am a HUGE fan of Beagleboard and very interested to develop a community of teachers using it. &lt;br /&gt;
|Our Program [http://www.ti.com/university www.ti.com/university] helps academics use TI Hardware, Software and Chips in their projects and curriculum.  &lt;br /&gt;
|-&lt;br /&gt;
|Melani Plett&lt;br /&gt;
|Seattle Pacific University,&lt;br /&gt;
Seattle, Washington, USA&lt;br /&gt;
|I teach an undergraduate signals and systems course.  I have no Linux experience, though I did use Unix years ago.&lt;br /&gt;
|I am thinking of generating a technical elective follow-on class to illustrate the signals and systems concepts on the Beagleboard.&lt;br /&gt;
|-&lt;br /&gt;
|Matt Gately&lt;br /&gt;
|University of Oklahoma, Norman, OK, USA&lt;br /&gt;
|I am a PhD student and I use Linux in my research. &lt;br /&gt;
|I would love to someday teach a DSP course using embedded systems such as FPGA or microcontroller boards. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Labs ===&lt;br /&gt;
&lt;br /&gt;
Here's an additional handout that didn't make it in time for the printers.&lt;br /&gt;
&lt;br /&gt;
[[AudioThru Lab]]&lt;br /&gt;
&lt;br /&gt;
=== Post Tutorial ===&lt;br /&gt;
&lt;br /&gt;
Here ([[Getting_a_Workshop_SD_Image]]) are instructions on how to put the tutorial image on your SD card.&lt;br /&gt;
&lt;br /&gt;
== 2011 IEEE SPEd (Signal Processing Society 14th DSP Workshop &amp;amp; 6th SPEd Workshop) ==&lt;br /&gt;
{|&lt;br /&gt;
| '''Title:''' &lt;br /&gt;
| Moving Beyond the DSP and Teaching 32-bit Embedded Processors Using the BeagleBoard&lt;br /&gt;
|-&lt;br /&gt;
| '''Presentor:''' &lt;br /&gt;
| Mark A. Yoder&lt;br /&gt;
|-&lt;br /&gt;
| '''Location:''' &lt;br /&gt;
| Enchantment Resort, Sedona, Arizona&lt;br /&gt;
|-&lt;br /&gt;
| '''Date:''' &lt;br /&gt;
| Thursday 6 January, 2011  Time: 14:00 - 17:30&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Post Workshop ===&lt;br /&gt;
Here are some things you might want to do now that the workshop is over.  &lt;br /&gt;
&lt;br /&gt;
Here are instructions on how to create the SD card that was used in the workshop.&lt;br /&gt;
* Go here ([[ECE597_Getting_your_Beagle_running_(precompiled)#From_beagleboard-validation.s3.amazonaws.com]]) to download and install the base image for the Beagle.  This will install the kernel and all the files needed to run many of the demos.&lt;br /&gt;
* Download [http://www.rose-hulman.edu/~yoder/Beagle/SPEd2011WorkshopFiles.zip this zip file] to get the extra files used in the workshop. Copy it to your BeagleBoard and unzip it there.  This file contains the '''VideoThru''', '''c6run_target''', '''hello.c''' and '''helloBeagle.c''' files.&lt;br /&gt;
* Download the workshop pptx [http://www.rose-hulman.edu/~yoder/Beagle/SPEd2011WorkshopPPTX.zip here].&lt;br /&gt;
&lt;br /&gt;
=== Pre Workshop === &lt;br /&gt;
If you are an overachiever (not required) go here ([[ECE497 Lab13 Using the DSP via c6run]]) to learn how to install the ARM and DSP development tools on your Linux system (Ubuntu 10.4 LTS is required).  If you don't have Ubuntu installed, go [http://processors.wiki.ti.com/index.php/How_to_Build_a_Ubuntu_Linux_host_under_VirtualBox here] to learn how to install it in a virtual machine under windows.&lt;br /&gt;
&lt;br /&gt;
These installs are not required for the workshop; however editing the the table below ''is''.&lt;br /&gt;
&lt;br /&gt;
The purpose of this page is to give you practice editing a wiki and to start building a community of BeagleBoard Educators.  Click on the '''edit''' tab above and add your name to the list. You will have to create an eLinux account before you can edit the page.&lt;br /&gt;
&lt;br /&gt;
--Mark&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
! style=&amp;quot;width:20%&amp;quot; | Name&lt;br /&gt;
! style=&amp;quot;width:20%&amp;quot; | School/Company&lt;br /&gt;
! style=&amp;quot;width:30%&amp;quot; | Linux/DSP Background&lt;br /&gt;
! style=&amp;quot;width:30%&amp;quot; | Interests&lt;br /&gt;
|-&lt;br /&gt;
| Mark A. Yoder&lt;br /&gt;
| Rose-Hulman Institute of Technology, &lt;br /&gt;
Terre Haute, Indiana, USA&lt;br /&gt;
| I've been using various flavors of Unix/Linux since the late '70s, but there is always more to learn.&lt;br /&gt;
I've taught a 'C6713 based DSP class years ago. &lt;br /&gt;
| I teach 32-bit embedded with the Beagle.  DSP is appearing everywhere now.  The BeagleBoard is a great environment to teach DSP.&lt;br /&gt;
|-&lt;br /&gt;
|Cathy Wicks&lt;br /&gt;
|Texas Instruments, University Program Manager&lt;br /&gt;
|I am a HUGE fan of Beagleboard and very interested to develop a community of teachers using it. &lt;br /&gt;
|Our Program www.ti.com/university helps academics use TI Hardware, Software and Chips in their projects and curriculum.  &lt;br /&gt;
|-&lt;br /&gt;
| Steve Chadwick&lt;br /&gt;
| Embry-Riddle Aeronautical University, Prescott, AZ &lt;br /&gt;
| Very new to DSP and hoping develop sufficient depth to teach it next academic year. &lt;br /&gt;
| Interests: Pretty much everything in science. &lt;br /&gt;
|-&lt;br /&gt;
| Mark Wickert&lt;br /&gt;
| University of Colorado, Colorado Springs, CO, USA&lt;br /&gt;
| I have played on and off with Linux for about 10 years, never done any real-time DSP under this OS however.&lt;br /&gt;
| I regularly teach DSP and related courses. I am using the C6713 today, but ready to move forward. I recently started playing with ARM processors (not the BeagleBoard until now).&lt;br /&gt;
|-&lt;br /&gt;
| Shane Cotter&lt;br /&gt;
| Union College, Schenectady, NY&lt;br /&gt;
| I have taught DSP courses. I have used Unix/Linux in the past but not for real-time DSP.&lt;br /&gt;
| The Beagleboard seems like a great platform and I'm interested in learning about it and its potential uses in courses.&lt;br /&gt;
|-&lt;br /&gt;
| Jake Gunther&lt;br /&gt;
| Utah State University&lt;br /&gt;
| I have taught DSP and communication systems for over ten years.&lt;br /&gt;
| I want to move from a simulation-based teaching approach to a real-time approach.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== 2010 ICASSP Workshop ==&lt;br /&gt;
{|&lt;br /&gt;
| '''Title:''' &lt;br /&gt;
| 32-bit Embedded Linux-based Signal Processing – Hands on Workshop&lt;br /&gt;
|-&lt;br /&gt;
| '''Presentor:''' &lt;br /&gt;
| Mark A. Yoder&lt;br /&gt;
|-&lt;br /&gt;
| '''Location:''' &lt;br /&gt;
| ICASSP 2010, Dallas, Texas&lt;br /&gt;
|-&lt;br /&gt;
| '''Date:''' &lt;br /&gt;
| Monday, March 15 2010, 13:30 - 17:00&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The purpose of this page is to give you practice editing a wiki and to start building a community of BeagleBoard Educators.  Click on the '''edit''' tab above and add your name to the list.&lt;br /&gt;
&lt;br /&gt;
--Mark&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
! style=&amp;quot;width:20%&amp;quot; | Name&lt;br /&gt;
! style=&amp;quot;width:20%&amp;quot; | School/Company&lt;br /&gt;
! style=&amp;quot;width:20%&amp;quot; | email&lt;br /&gt;
! style=&amp;quot;width:40%&amp;quot; | Interests&lt;br /&gt;
|-&lt;br /&gt;
| Mark A. Yoder&lt;br /&gt;
| Rose-Hulman Institute of Technology, &lt;br /&gt;
Terre Haute, Indiana, USA&lt;br /&gt;
| [http://www.rose-hulman.edu/~yoder]&lt;br /&gt;
| I teach 32-bit embedded with the Beagle.  DSP is appearing everywhere now.  The BeagleBoard is a great environment to teach DSP.&lt;br /&gt;
|-&lt;br /&gt;
|David V. Anderson&lt;br /&gt;
|Georgia Institute of Technology&lt;br /&gt;
|&lt;br /&gt;
|Teaching DSP using BeagleBoard as a real-time platform.&lt;br /&gt;
|-&lt;br /&gt;
|Andres Kwasinski&lt;br /&gt;
|Rochester Institute of Technology&lt;br /&gt;
|[http://people.rit.edu/axkeec/]&lt;br /&gt;
|Teaching DSP to Computer Engineers using real-world platforms.&lt;br /&gt;
|-&lt;br /&gt;
|Roger West&lt;br /&gt;
|Utah State University&lt;br /&gt;
|&lt;br /&gt;
|Teaching DSP to ECE students using real-time platforms.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Labs ===&lt;br /&gt;
Here is a list of the hands on exercises we will be doing in the 2010 workshop.  Many have suggestions for additional homework that you can do once you are back home and have a network connection.&lt;br /&gt;
&lt;br /&gt;
# [[2010 ICASSP Lab 1 Wiring_and_Running the Beagle]]&lt;br /&gt;
# [[2010 ICASSP Lab 2 The Boot Sequence]]&lt;br /&gt;
&lt;br /&gt;
{{YoderFoot}}&lt;/div&gt;</summary>
		<author><name>Yoder</name></author>	</entry>

	<entry>
		<id>http://www.elinux.org/BeagleBoard_Education_Workshops</id>
		<title>BeagleBoard Education Workshops</title>
		<link rel="alternate" type="text/html" href="http://www.elinux.org/BeagleBoard_Education_Workshops"/>
				<updated>2013-06-11T17:43:33Z</updated>
		
		<summary type="html">&lt;p&gt;Yoder: /* Labs */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:ECE497 |W]]&lt;br /&gt;
[[Category:BeagleBoard]]&lt;br /&gt;
[[Category:Workshops]]&lt;br /&gt;
[[Category:Education]]&lt;br /&gt;
{{YoderHead}}&lt;br /&gt;
&lt;br /&gt;
== 2013 ASEE Workshop ==&lt;br /&gt;
{|&lt;br /&gt;
| '''Title:''' &lt;br /&gt;
| U216·WORKSHOP: BeagleBone - A Hands-on Workshop&lt;br /&gt;
|-&lt;br /&gt;
| '''Presentors:''' &lt;br /&gt;
| Dr. Steven F Barrett P.E., Jason Kridner, Mark A. Yoder&lt;br /&gt;
|-&lt;br /&gt;
| '''Location:''' &lt;br /&gt;
| Atlanta, Omni CNN Center Hotel, Omni - Chestnut&lt;br /&gt;
|-&lt;br /&gt;
| '''Date:''' &lt;br /&gt;
| 23-June-2013&lt;br /&gt;
|-&lt;br /&gt;
| '''Link'''&lt;br /&gt;
| [http://www.asee.org/public/conferences/20/registration/view_session?session_id=2420 ASEE site]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Abstract:===&lt;br /&gt;
&lt;br /&gt;
'''Ticketed event: $100.00 advanced registration and $110.00 on site registration'''&lt;br /&gt;
&lt;br /&gt;
BeagleBone is a low cost, open hardware computer first introduced in November 2011 by BeagleBoard.org, a community of developers sponsored by Texas Instruments. BeagleBone hosts a powerful 32-bit, super-scalar ARM Cortex A8 processor operating at 720 MHz. Yet it is small enough to fit in an Altoids mint tin box. The &amp;quot;Bone'' may be used in a wide variety of projects from middle school science fair projects to senior design projects to first prototypes of very complex systems. Novice users may access the power of the Bone through the user-friendly Bonescript environment. Seasoned users may take full advantage of the Bone's power using the underlying Linux-based operating system, a host of feature extension boards (Capes) and a wide variety of open source libraries. This hands on workshop provides an introduction to this powerful computer and has been designed for a wide variety of users including the first time novice through the seasoned embedded system design professional. &lt;br /&gt;
&lt;br /&gt;
Workshop participants will receive a BeagleBone board and also a BeagleBone book courtesy of BeagleBoard.org and Morgan and Claypool Publishers. This workshop is subsidized by Texas Instruments (TI). &lt;br /&gt;
&lt;br /&gt;
=== Pre Workshop ===&lt;br /&gt;
&lt;br /&gt;
=== Labs ===&lt;br /&gt;
&lt;br /&gt;
[[ASEE 2013 Workshop | Afternoon labs]]&lt;br /&gt;
&lt;br /&gt;
=== Post Workshop ===&lt;br /&gt;
&lt;br /&gt;
== 2012 Engibous Summit Workshop ==&lt;br /&gt;
{|&lt;br /&gt;
| '''Title:''' &lt;br /&gt;
| Hands-on workshop on Embedded Linux on BeagleBone&lt;br /&gt;
|-&lt;br /&gt;
| '''Presentor:''' &lt;br /&gt;
| Mark A. Yoder&lt;br /&gt;
|-&lt;br /&gt;
| '''Location:''' &lt;br /&gt;
| Dallas&lt;br /&gt;
|-&lt;br /&gt;
| '''Date:''' &lt;br /&gt;
| 30-July-2012&lt;br /&gt;
|-&lt;br /&gt;
| '''Link'''&lt;br /&gt;
| [http://www.ti.com/corp/docs/landing/universityprogram/prize.htm Engibous Summit]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Abstract:===&lt;br /&gt;
&lt;br /&gt;
???&lt;br /&gt;
&lt;br /&gt;
=== Pre Workshop ===&lt;br /&gt;
&lt;br /&gt;
You will be mailed some information about the workshop and some things for you to do before arriving.&lt;br /&gt;
&lt;br /&gt;
--Mark&lt;br /&gt;
&lt;br /&gt;
=== Labs ===&lt;br /&gt;
&lt;br /&gt;
=== Post Workshop ===&lt;br /&gt;
&lt;br /&gt;
== 2012 Chandigarh Workshop ==&lt;br /&gt;
{|&lt;br /&gt;
| '''Title:''' &lt;br /&gt;
| Hands-on workshop on Embedded Linux on Beagleboard&lt;br /&gt;
|-&lt;br /&gt;
| '''Presentor:''' &lt;br /&gt;
| Mark A. Yoder&lt;br /&gt;
|-&lt;br /&gt;
| '''Location:''' &lt;br /&gt;
| [http://www.uniti.in/events/venueevents/73-chitkara-school-of-engineering-a-technology Chitkara School of Engineering &amp;amp; Technology] - Chandigarh, India&lt;br /&gt;
|-&lt;br /&gt;
| '''Date:''' &lt;br /&gt;
| 18-20 June-2012&lt;br /&gt;
|-&lt;br /&gt;
| '''Link'''&lt;br /&gt;
| [http://www.uniti.in/events/details/128-hands-on-workshop-on-embedded-linux-on-beagleboard http://www.uniti.in/events/details/128-hands-on-workshop-on-embedded-linux-on-beagleboard]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Abstract:===&lt;br /&gt;
&lt;br /&gt;
Beagleboard is a low-cost open-source embedded system development platform. It is based on Texas Instruments DM3730 processor, which includes an on-chip ARM Cortex-A8 processor core, a Texas Instruments C6x DSP core, and a host of peripherals. Beagleboard is a single board computer, which provides adequate performance to run Linux software, yet has a power consumption lower than 2W. A large number of embedded applications have been developed on Beagleboard ([http://www.beagleboard.org www.beagleboard.org]) Module A provides a gentle introduction to the subject of Embedded Linux, Linux Systems Programming and Linux Kernel Programming. The intention of Module B is to provide a hands-on exposure to running Embedded Linux operating system on the Beagleboard and develop system software on the Beagleboard.&lt;br /&gt;
=== Pre Workshop ===&lt;br /&gt;
&lt;br /&gt;
The purpose of this page is to give you practice editing a wiki and to start building a community of BeagleBoard Educators.  Click on the '''edit''' tab above and add your name to the list. You will have to create an eLinux account before you can edit the page.&lt;br /&gt;
&lt;br /&gt;
--Mark&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
! style=&amp;quot;width:20%&amp;quot; | Name&lt;br /&gt;
! style=&amp;quot;width:20%&amp;quot; | School/Company&lt;br /&gt;
! style=&amp;quot;width:30%&amp;quot; | Linux/DSP Background&lt;br /&gt;
! style=&amp;quot;width:30%&amp;quot; | Interests&lt;br /&gt;
|-&lt;br /&gt;
| Mark A. Yoder&lt;br /&gt;
| Rose-Hulman Institute of Technology, &lt;br /&gt;
Terre Haute, Indiana, USA&lt;br /&gt;
| I've been using various flavors of Unix/Linux since the late '70s, but there is always more to learn.&lt;br /&gt;
I've taught a 'C6713 based DSP class years ago. &lt;br /&gt;
| I teach 32-bit embedded with the Beagle [[ECE497 - 32-bit Embedded Linux, Rose-Hulman]].&lt;br /&gt;
|-&lt;br /&gt;
|Cathy Wicks&lt;br /&gt;
|Texas Instruments, University Program Manager&lt;br /&gt;
|I am a HUGE fan of Beagleboard and very interested to develop a community of teachers using it. &lt;br /&gt;
|Our Program [http://www.ti.com/university www.ti.com/university] helps academics use TI Hardware, Software and Chips in their projects and curriculum.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Labs ===&lt;br /&gt;
&lt;br /&gt;
=== Post Workshop ===&lt;br /&gt;
&lt;br /&gt;
== 2012 Hyderabad Workshop ==&lt;br /&gt;
{|&lt;br /&gt;
| '''Title:''' &lt;br /&gt;
| Three-day workshop on Embedded Linux on Beagleboard&lt;br /&gt;
|-&lt;br /&gt;
| '''Presentor:''' &lt;br /&gt;
| Mark A. Yoder&lt;br /&gt;
|-&lt;br /&gt;
| '''Location:''' &lt;br /&gt;
| [http://www.uniti.in/events/venueevents/69-c-dac-hyderabad C-DAC Hyderabad] - Hyderabad, India&lt;br /&gt;
|-&lt;br /&gt;
| '''Date:''' &lt;br /&gt;
| 14-16 June-2012&lt;br /&gt;
|-&lt;br /&gt;
| '''Link'''&lt;br /&gt;
| [http://www.uniti.in/events/details/123-three-day-workshop-on-embedded-linux-on-beagleboard http://www.uniti.in/events/details/123-three-day-workshop-on-embedded-linux-on-beagleboard]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Abstract:===&lt;br /&gt;
&lt;br /&gt;
Linux, which is an “open source” operating system and enjoys considerable popularity on general-purpose computers, is becoming popular in the embedded world also. Different versions and variants of Linux are now available on embedded platforms. In this workshop, the intention is to provide a hands-on introduction to concepts of Linux Systems/Kernel Programming and Embedded Linux&lt;br /&gt;
&lt;br /&gt;
=== Pre Workshop ===&lt;br /&gt;
&lt;br /&gt;
The purpose of this page is to give you practice editing a wiki and to start building a community of BeagleBoard Educators.  Click on the '''edit''' tab above and add your name to the list. You will have to create an eLinux account before you can edit the page.&lt;br /&gt;
&lt;br /&gt;
--Mark&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
! style=&amp;quot;width:20%&amp;quot; | Name&lt;br /&gt;
! style=&amp;quot;width:20%&amp;quot; | School/Company&lt;br /&gt;
! style=&amp;quot;width:30%&amp;quot; | Linux/DSP Background&lt;br /&gt;
! style=&amp;quot;width:30%&amp;quot; | Interests&lt;br /&gt;
|-&lt;br /&gt;
| Mark A. Yoder&lt;br /&gt;
| Rose-Hulman Institute of Technology, &lt;br /&gt;
Terre Haute, Indiana, USA&lt;br /&gt;
| I've been using various flavors of Unix/Linux since the late '70s, but there is always more to learn.&lt;br /&gt;
I've taught a 'C6713 based DSP class years ago. &lt;br /&gt;
| I teach 32-bit embedded with the Beagle [[ECE497 - 32-bit Embedded Linux, Rose-Hulman]].&lt;br /&gt;
|-&lt;br /&gt;
|Cathy Wicks&lt;br /&gt;
|Texas Instruments, University Program Manager&lt;br /&gt;
|I am a HUGE fan of Beagleboard and very interested to develop a community of teachers using it. &lt;br /&gt;
|Our Program [http://www.ti.com/university www.ti.com/university] helps academics use TI Hardware, Software and Chips in their projects and curriculum.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Labs ===&lt;br /&gt;
&lt;br /&gt;
=== Post Workshop ===&lt;br /&gt;
&lt;br /&gt;
== 2012 Bangalore Workshop ==&lt;br /&gt;
{|&lt;br /&gt;
| '''Title:''' &lt;br /&gt;
| 6-day modular workshop on Embedded Linux&lt;br /&gt;
|-&lt;br /&gt;
| '''Presentor:''' &lt;br /&gt;
| Mark A. Yoder&lt;br /&gt;
|-&lt;br /&gt;
| '''Location:''' &lt;br /&gt;
| [http://www.uniti.in/events/venueevents/68-cambridge-institute-of-technology Cambridge Institute of Technology] - Bangalore, India&lt;br /&gt;
|-&lt;br /&gt;
| '''Date:''' &lt;br /&gt;
| 11-13 June-2012&lt;br /&gt;
|-&lt;br /&gt;
| '''Link'''&lt;br /&gt;
| [http://www.uniti.in/events/details/122-6-day-modular-workshop-on-embedded-linux www.uniti.in/events/details/122-6-day-modular-workshop-on-embedded-linux]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Abstract:===&lt;br /&gt;
&lt;br /&gt;
'''Module A''' provides an overview of basic concepts of Linux, Linux Systems Programming, Linux Kernel Programming, and Embedded Systems. Module A will also include an introduction to Beagleboard, an open-source, low-cost, low-power embedded system development platform. '''Module A''' will be conducted jointly by a team of experts from industry and academia. In '''Module B''', aspects of Embedded Linux on Beagleboard will be explored in greater depth. Module B will be conducted by Prof. Mark A. Yoder of Rose-Hulman Institute of Technology, USA.&lt;br /&gt;
&lt;br /&gt;
=== Pre Workshop ===&lt;br /&gt;
&lt;br /&gt;
The purpose of this page is to give you practice editing a wiki and to start building a community of BeagleBoard Educators.  Click on the '''edit''' tab above and add your name to the list. You will have to create an eLinux account before you can edit the page.&lt;br /&gt;
&lt;br /&gt;
--Mark&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
! style=&amp;quot;width:20%&amp;quot; | Name&lt;br /&gt;
! style=&amp;quot;width:20%&amp;quot; | School/Company&lt;br /&gt;
! style=&amp;quot;width:30%&amp;quot; | Linux/DSP Background&lt;br /&gt;
! style=&amp;quot;width:30%&amp;quot; | Interests&lt;br /&gt;
|-&lt;br /&gt;
| Mark A. Yoder&lt;br /&gt;
| Rose-Hulman Institute of Technology, &lt;br /&gt;
Terre Haute, Indiana, USA&lt;br /&gt;
| I've been using various flavors of Unix/Linux since the late '70s, but there is always more to learn.&lt;br /&gt;
I've taught a 'C6713 based DSP class years ago. &lt;br /&gt;
| I teach 32-bit embedded with the Beagle [[ECE497 - 32-bit Embedded Linux, Rose-Hulman]].&lt;br /&gt;
|-&lt;br /&gt;
|Cathy Wicks&lt;br /&gt;
|Texas Instruments, University Program Manager&lt;br /&gt;
|I am a HUGE fan of Beagleboard and very interested to develop a community of teachers using it. &lt;br /&gt;
|Our Program [http://www.ti.com/university www.ti.com/university] helps academics use TI Hardware, Software and Chips in their projects and curriculum.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Labs ===&lt;br /&gt;
&lt;br /&gt;
=== Post Workshop ===&lt;br /&gt;
&lt;br /&gt;
== 2011 FIE Workshop - Cancelled ==&lt;br /&gt;
{|&lt;br /&gt;
| '''Title:''' &lt;br /&gt;
| From DSP Chips to Embedded Processors for Teaching Digital Signal Processing&lt;br /&gt;
|-&lt;br /&gt;
| '''Presentor:''' &lt;br /&gt;
| Mark A. Yoder&lt;br /&gt;
|-&lt;br /&gt;
| '''Location:''' &lt;br /&gt;
| Holiday Inn Salon F, Rapid City, South Dakota&lt;br /&gt;
|-&lt;br /&gt;
| '''Date:''' &lt;br /&gt;
| Wednesday, October 12, 2011, 2:30 p.m. - 5:30 p.m&lt;br /&gt;
|-&lt;br /&gt;
| '''Link'''&lt;br /&gt;
| [http://fie-conference.org/fie2011/] [http://fie-conference.org/fie2011/Pages/workshops.htm#SCRL6]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Abstract:===&lt;br /&gt;
&lt;br /&gt;
The goal of this hands-on tutorial is to present ideas on how to use Texas Instrument’s DM 3730-based BeagleBoard xM ([www.BeagleBoard.org www.BeagleBoard.org]) for teaching embedded processing using Open Source resources. The DM 3730 is a dual core processor with an ARM Cortex-a8 core and a TI ‘c64x DSP core. The BeagleBoard is Open Source hardware that has sold over 30,000 units since its introduction less than 2 years ago and has a thriving Open Source Software community.&lt;br /&gt;
&lt;br /&gt;
The BeagleBoard has many uses in the classroom. This workshop will show some of those uses and present some of the challenges in teaching with Open Source.&lt;br /&gt;
&lt;br /&gt;
The workshop activities will include:&lt;br /&gt;
&lt;br /&gt;
* several hands-on exercises to get participants familiar with using the Beagle, and how it differs from a traditional 8- or 16-bit microcomputer.&lt;br /&gt;
* several demonstrations of what the Beagle can do, such as streaming video and programming its DSP and discussions of what topics to include in an embedded/DSP class including dealing with open source comminutes.&lt;br /&gt;
* This workshop is targeted to those who are teaching embedded processors or DSP hardware. Some Linux background would be helpful, but not required. Those with little or no Linux experience will be paired with those with more experience.&lt;br /&gt;
&lt;br /&gt;
=== Post Workshop ===&lt;br /&gt;
&lt;br /&gt;
Even though the workshop has been cancelled, you can still do the exercises.  Here ([[Getting a Workshop SD Image]]) are instructions on how to put the tutorial image on your SD card.&lt;br /&gt;
&lt;br /&gt;
Here ([[EBC Embedded Beagle Class Topics]]) is a list of topics I cover in my class.  If you have questions, please email me.&lt;br /&gt;
&lt;br /&gt;
== 2011 IEEE ICASSP Workshop ==&lt;br /&gt;
{|&lt;br /&gt;
| '''Title:''' &lt;br /&gt;
| How 32-bit Embedded Processors Change the Focus in Teaching DSP Hardware&lt;br /&gt;
|-&lt;br /&gt;
| '''Presentor:''' &lt;br /&gt;
| Mark A. Yoder&lt;br /&gt;
|-&lt;br /&gt;
| '''Location:''' &lt;br /&gt;
| Prague, Czech Republic&lt;br /&gt;
|-&lt;br /&gt;
| '''Date:''' &lt;br /&gt;
| Monday May 23rd, 2011, Afternoon&lt;br /&gt;
|-&lt;br /&gt;
| '''Link'''&lt;br /&gt;
| [http://www.icassp2011.com/en/registration]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Abstract:===&lt;br /&gt;
This hands-on tutorial presents ideas on how to use TI’s OMAP 3530-based BeagleBoard (www.BeagleBoard.org) for teaching embedded media processing using Open Source resources. The BeagleBoard is Open Source hardware that has sold over 20,000 units since its introduction less than 2 years ago and has a thriving Open Source Software community.&lt;br /&gt;
After the introduction, this workshop will complement the Sunday afternoon tutorial “From DSP Chips to Embedded Processors for Teaching Digital Signal Processing”.  The Sunday workshop examples focus on programming the ‘C64 DSP on the OMAP3530.  This workshop will focus on using Open Source software for media processing  (such as GStreamer, OpenCV, etc.) and using the OMAP display subsystem for handling video. &lt;br /&gt;
The workshop activities will include:&lt;br /&gt;
# Several hands-on exercises to get participants familiar with using the Beagle, (same as tutorial)&lt;br /&gt;
# Several demonstrations of what the Beagle can do using Open Source software, including using the display subsystem, recognizing speech, computer vision&lt;br /&gt;
# Discussions of what topics to include in an embedded Linux class.&lt;br /&gt;
No BeagleBoards will given out.&lt;br /&gt;
&lt;br /&gt;
=== Pre Workshop ===&lt;br /&gt;
&lt;br /&gt;
The purpose of this page is to give you practice editing a wiki and to start building a community of BeagleBoard Educators.  Click on the '''edit''' tab above and add your name to the list. You will have to create an eLinux account before you can edit the page.&lt;br /&gt;
&lt;br /&gt;
--Mark&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
! style=&amp;quot;width:20%&amp;quot; | Name&lt;br /&gt;
! style=&amp;quot;width:20%&amp;quot; | School/Company&lt;br /&gt;
! style=&amp;quot;width:30%&amp;quot; | Linux/DSP Background&lt;br /&gt;
! style=&amp;quot;width:30%&amp;quot; | Interests&lt;br /&gt;
|-&lt;br /&gt;
| Mark A. Yoder&lt;br /&gt;
| Rose-Hulman Institute of Technology, &lt;br /&gt;
Terre Haute, Indiana, USA&lt;br /&gt;
| I've been using various flavors of Unix/Linux since the late '70s, but there is always more to learn.&lt;br /&gt;
I've taught a 'C6713 based DSP class years ago. &lt;br /&gt;
| I teach 32-bit embedded with the Beagle [[ECE497 - 32-bit Embedded Linux, Rose-Hulman]].  DSP is appearing everywhere now.  The BeagleBoard is a great environment to teach DSP.&lt;br /&gt;
|-&lt;br /&gt;
|Cathy Wicks&lt;br /&gt;
|Texas Instruments, University Program Manager&lt;br /&gt;
|I am a HUGE fan of Beagleboard and very interested to develop a community of teachers using it. &lt;br /&gt;
|Our Program [http://www.ti.com/university www.ti.com/university] helps academics use TI Hardware, Software and Chips in their projects and curriculum.  &lt;br /&gt;
|-&lt;br /&gt;
|Melani Plett&lt;br /&gt;
|Seattle Pacific University,&lt;br /&gt;
Seattle, Washington, USA&lt;br /&gt;
|I teach an undergraduate signals and systems course.  I have no Linux experience, though I did use Unix years ago.&lt;br /&gt;
|I am thinking of generating a technical elective follow-on class to illustrate the signals and systems concepts on the Beagleboard.&lt;br /&gt;
|-&lt;br /&gt;
|Monty Hayes&lt;br /&gt;
|Georgia Tech, Professor, Atlanta, GA and&lt;br /&gt;
Chung-Ang University Distinguished Foreign Professor, Seoul, Korea&lt;br /&gt;
|I have no linux experience, have taught courses on DSP chips before&lt;br /&gt;
|I would like to develop an undergraduate course using the Beagleboard to teach DSP.&lt;br /&gt;
|-&lt;br /&gt;
|Oleg Muratov&lt;br /&gt;
|University of Trento, Itay&lt;br /&gt;
|I am a PhD student and I have limited Linux experience.&lt;br /&gt;
|I am planning to give a course to undergraduate students on DSP probably using some hardware.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Labs ===&lt;br /&gt;
&lt;br /&gt;
Here's an additional handout that didn't make it in time for the printers.&lt;br /&gt;
&lt;br /&gt;
[[VideoThru Lab]]&lt;br /&gt;
&lt;br /&gt;
=== Post Workshop ===&lt;br /&gt;
&lt;br /&gt;
Here ([[Getting_a_Workshop_SD_Image]]) are instructions on how to put the tutorial image on your SD card.&lt;br /&gt;
&lt;br /&gt;
== 2011 IEEE ICASSP Tutorial ==&lt;br /&gt;
{|&lt;br /&gt;
| '''Title:''' &lt;br /&gt;
| From DSP Chips to Embedded Processors for Teaching Digital Signal Processing&lt;br /&gt;
|-&lt;br /&gt;
| '''Presentor:''' &lt;br /&gt;
| Mark A. Yoder&lt;br /&gt;
|-&lt;br /&gt;
| '''Location:''' &lt;br /&gt;
| Prague, Czech Republic&lt;br /&gt;
|-&lt;br /&gt;
| '''Date:''' &lt;br /&gt;
| Sunday May 22nd, 2011, Afternoon&lt;br /&gt;
|-&lt;br /&gt;
| '''Link'''&lt;br /&gt;
| [http://www.icassp2011.com/en/tutorials/tutorial-5]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Abstract:===&lt;br /&gt;
This hands-on tutorial presents ideas on how to use TI’s OMAP 3530-based BeagleBoard (www.BeagleBoard.org) for teaching embedded media processing using Open Source resources. The BeagleBoard is Open Source hardware that has sold over 16,000 units since its introduction less than 2 years ago and has a thriving Open Source Software community.&lt;br /&gt;
Today’s media handling embedded processors have come a long way from the limited performance of 8- or 16-bit embedded processors or the limited functionality of a dedicated DSP chip. Our students need to see that the days of the single DSP chip are almost over and they need to be prepared for working with DSPs embedded with other processors.&lt;br /&gt;
The OMAP3530 processor contains both an ARM Cortex-A9 processor and a ‘C6400 DSP and it and chips like it are being used in products today. &lt;br /&gt;
The workshop activities include:&lt;br /&gt;
#      hands-on exercises to get participants familiar with using the Beagle,&lt;br /&gt;
#      demonstrations of what the Beagle can do, including streaming video and synthesizing speech and&lt;br /&gt;
#      discussions of what topics to include in an embedded Linux class.&lt;br /&gt;
Participants will receive a BeagleBoard and course materials.&lt;br /&gt;
&lt;br /&gt;
=== Pre Tutorial ===&lt;br /&gt;
&lt;br /&gt;
The purpose of this page is to give you practice editing a wiki and to start building a community of BeagleBoard Educators.  Click on the '''edit''' tab above and add your name to the list. You will have to create an eLinux account before you can edit the page.&lt;br /&gt;
&lt;br /&gt;
--Mark&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
! style=&amp;quot;width:20%&amp;quot; | Name&lt;br /&gt;
! style=&amp;quot;width:20%&amp;quot; | School/Company&lt;br /&gt;
! style=&amp;quot;width:30%&amp;quot; | Linux/DSP Background&lt;br /&gt;
! style=&amp;quot;width:30%&amp;quot; | Interests&lt;br /&gt;
|-&lt;br /&gt;
| Mark A. Yoder&lt;br /&gt;
| Rose-Hulman Institute of Technology, &lt;br /&gt;
Terre Haute, Indiana, USA&lt;br /&gt;
| I've been using various flavors of Unix/Linux since the late '70s, but there is always more to learn.&lt;br /&gt;
I've taught a 'C6713 based DSP class years ago. &lt;br /&gt;
| I teach 32-bit embedded with the Beagle [[ECE497 - 32-bit Embedded Linux, Rose-Hulman]].  DSP is appearing everywhere now.  The BeagleBoard is a great environment to teach DSP.&lt;br /&gt;
|-&lt;br /&gt;
|Cathy Wicks&lt;br /&gt;
|Texas Instruments, University Program Manager&lt;br /&gt;
|I am a HUGE fan of Beagleboard and very interested to develop a community of teachers using it. &lt;br /&gt;
|Our Program [http://www.ti.com/university www.ti.com/university] helps academics use TI Hardware, Software and Chips in their projects and curriculum.  &lt;br /&gt;
|-&lt;br /&gt;
|Melani Plett&lt;br /&gt;
|Seattle Pacific University,&lt;br /&gt;
Seattle, Washington, USA&lt;br /&gt;
|I teach an undergraduate signals and systems course.  I have no Linux experience, though I did use Unix years ago.&lt;br /&gt;
|I am thinking of generating a technical elective follow-on class to illustrate the signals and systems concepts on the Beagleboard.&lt;br /&gt;
|-&lt;br /&gt;
|Matt Gately&lt;br /&gt;
|University of Oklahoma, Norman, OK, USA&lt;br /&gt;
|I am a PhD student and I use Linux in my research. &lt;br /&gt;
|I would love to someday teach a DSP course using embedded systems such as FPGA or microcontroller boards. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Labs ===&lt;br /&gt;
&lt;br /&gt;
Here's an additional handout that didn't make it in time for the printers.&lt;br /&gt;
&lt;br /&gt;
[[AudioThru Lab]]&lt;br /&gt;
&lt;br /&gt;
=== Post Tutorial ===&lt;br /&gt;
&lt;br /&gt;
Here ([[Getting_a_Workshop_SD_Image]]) are instructions on how to put the tutorial image on your SD card.&lt;br /&gt;
&lt;br /&gt;
== 2011 IEEE SPEd (Signal Processing Society 14th DSP Workshop &amp;amp; 6th SPEd Workshop) ==&lt;br /&gt;
{|&lt;br /&gt;
| '''Title:''' &lt;br /&gt;
| Moving Beyond the DSP and Teaching 32-bit Embedded Processors Using the BeagleBoard&lt;br /&gt;
|-&lt;br /&gt;
| '''Presentor:''' &lt;br /&gt;
| Mark A. Yoder&lt;br /&gt;
|-&lt;br /&gt;
| '''Location:''' &lt;br /&gt;
| Enchantment Resort, Sedona, Arizona&lt;br /&gt;
|-&lt;br /&gt;
| '''Date:''' &lt;br /&gt;
| Thursday 6 January, 2011  Time: 14:00 - 17:30&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Post Workshop ===&lt;br /&gt;
Here are some things you might want to do now that the workshop is over.  &lt;br /&gt;
&lt;br /&gt;
Here are instructions on how to create the SD card that was used in the workshop.&lt;br /&gt;
* Go here ([[ECE597_Getting_your_Beagle_running_(precompiled)#From_beagleboard-validation.s3.amazonaws.com]]) to download and install the base image for the Beagle.  This will install the kernel and all the files needed to run many of the demos.&lt;br /&gt;
* Download [http://www.rose-hulman.edu/~yoder/Beagle/SPEd2011WorkshopFiles.zip this zip file] to get the extra files used in the workshop. Copy it to your BeagleBoard and unzip it there.  This file contains the '''VideoThru''', '''c6run_target''', '''hello.c''' and '''helloBeagle.c''' files.&lt;br /&gt;
* Download the workshop pptx [http://www.rose-hulman.edu/~yoder/Beagle/SPEd2011WorkshopPPTX.zip here].&lt;br /&gt;
&lt;br /&gt;
=== Pre Workshop === &lt;br /&gt;
If you are an overachiever (not required) go here ([[ECE497 Lab13 Using the DSP via c6run]]) to learn how to install the ARM and DSP development tools on your Linux system (Ubuntu 10.4 LTS is required).  If you don't have Ubuntu installed, go [http://processors.wiki.ti.com/index.php/How_to_Build_a_Ubuntu_Linux_host_under_VirtualBox here] to learn how to install it in a virtual machine under windows.&lt;br /&gt;
&lt;br /&gt;
These installs are not required for the workshop; however editing the the table below ''is''.&lt;br /&gt;
&lt;br /&gt;
The purpose of this page is to give you practice editing a wiki and to start building a community of BeagleBoard Educators.  Click on the '''edit''' tab above and add your name to the list. You will have to create an eLinux account before you can edit the page.&lt;br /&gt;
&lt;br /&gt;
--Mark&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
! style=&amp;quot;width:20%&amp;quot; | Name&lt;br /&gt;
! style=&amp;quot;width:20%&amp;quot; | School/Company&lt;br /&gt;
! style=&amp;quot;width:30%&amp;quot; | Linux/DSP Background&lt;br /&gt;
! style=&amp;quot;width:30%&amp;quot; | Interests&lt;br /&gt;
|-&lt;br /&gt;
| Mark A. Yoder&lt;br /&gt;
| Rose-Hulman Institute of Technology, &lt;br /&gt;
Terre Haute, Indiana, USA&lt;br /&gt;
| I've been using various flavors of Unix/Linux since the late '70s, but there is always more to learn.&lt;br /&gt;
I've taught a 'C6713 based DSP class years ago. &lt;br /&gt;
| I teach 32-bit embedded with the Beagle.  DSP is appearing everywhere now.  The BeagleBoard is a great environment to teach DSP.&lt;br /&gt;
|-&lt;br /&gt;
|Cathy Wicks&lt;br /&gt;
|Texas Instruments, University Program Manager&lt;br /&gt;
|I am a HUGE fan of Beagleboard and very interested to develop a community of teachers using it. &lt;br /&gt;
|Our Program www.ti.com/university helps academics use TI Hardware, Software and Chips in their projects and curriculum.  &lt;br /&gt;
|-&lt;br /&gt;
| Steve Chadwick&lt;br /&gt;
| Embry-Riddle Aeronautical University, Prescott, AZ &lt;br /&gt;
| Very new to DSP and hoping develop sufficient depth to teach it next academic year. &lt;br /&gt;
| Interests: Pretty much everything in science. &lt;br /&gt;
|-&lt;br /&gt;
| Mark Wickert&lt;br /&gt;
| University of Colorado, Colorado Springs, CO, USA&lt;br /&gt;
| I have played on and off with Linux for about 10 years, never done any real-time DSP under this OS however.&lt;br /&gt;
| I regularly teach DSP and related courses. I am using the C6713 today, but ready to move forward. I recently started playing with ARM processors (not the BeagleBoard until now).&lt;br /&gt;
|-&lt;br /&gt;
| Shane Cotter&lt;br /&gt;
| Union College, Schenectady, NY&lt;br /&gt;
| I have taught DSP courses. I have used Unix/Linux in the past but not for real-time DSP.&lt;br /&gt;
| The Beagleboard seems like a great platform and I'm interested in learning about it and its potential uses in courses.&lt;br /&gt;
|-&lt;br /&gt;
| Jake Gunther&lt;br /&gt;
| Utah State University&lt;br /&gt;
| I have taught DSP and communication systems for over ten years.&lt;br /&gt;
| I want to move from a simulation-based teaching approach to a real-time approach.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== 2010 ICASSP Workshop ==&lt;br /&gt;
{|&lt;br /&gt;
| '''Title:''' &lt;br /&gt;
| 32-bit Embedded Linux-based Signal Processing – Hands on Workshop&lt;br /&gt;
|-&lt;br /&gt;
| '''Presentor:''' &lt;br /&gt;
| Mark A. Yoder&lt;br /&gt;
|-&lt;br /&gt;
| '''Location:''' &lt;br /&gt;
| ICASSP 2010, Dallas, Texas&lt;br /&gt;
|-&lt;br /&gt;
| '''Date:''' &lt;br /&gt;
| Monday, March 15 2010, 13:30 - 17:00&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The purpose of this page is to give you practice editing a wiki and to start building a community of BeagleBoard Educators.  Click on the '''edit''' tab above and add your name to the list.&lt;br /&gt;
&lt;br /&gt;
--Mark&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
! style=&amp;quot;width:20%&amp;quot; | Name&lt;br /&gt;
! style=&amp;quot;width:20%&amp;quot; | School/Company&lt;br /&gt;
! style=&amp;quot;width:20%&amp;quot; | email&lt;br /&gt;
! style=&amp;quot;width:40%&amp;quot; | Interests&lt;br /&gt;
|-&lt;br /&gt;
| Mark A. Yoder&lt;br /&gt;
| Rose-Hulman Institute of Technology, &lt;br /&gt;
Terre Haute, Indiana, USA&lt;br /&gt;
| [http://www.rose-hulman.edu/~yoder]&lt;br /&gt;
| I teach 32-bit embedded with the Beagle.  DSP is appearing everywhere now.  The BeagleBoard is a great environment to teach DSP.&lt;br /&gt;
|-&lt;br /&gt;
|David V. Anderson&lt;br /&gt;
|Georgia Institute of Technology&lt;br /&gt;
|&lt;br /&gt;
|Teaching DSP using BeagleBoard as a real-time platform.&lt;br /&gt;
|-&lt;br /&gt;
|Andres Kwasinski&lt;br /&gt;
|Rochester Institute of Technology&lt;br /&gt;
|[http://people.rit.edu/axkeec/]&lt;br /&gt;
|Teaching DSP to Computer Engineers using real-world platforms.&lt;br /&gt;
|-&lt;br /&gt;
|Roger West&lt;br /&gt;
|Utah State University&lt;br /&gt;
|&lt;br /&gt;
|Teaching DSP to ECE students using real-time platforms.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Labs ===&lt;br /&gt;
Here is a list of the hands on exercises we will be doing in the 2010 workshop.  Many have suggestions for additional homework that you can do once you are back home and have a network connection.&lt;br /&gt;
&lt;br /&gt;
# [[2010 ICASSP Lab 1 Wiring_and_Running the Beagle]]&lt;br /&gt;
# [[2010 ICASSP Lab 2 The Boot Sequence]]&lt;br /&gt;
&lt;br /&gt;
{{YoderFoot}}&lt;/div&gt;</summary>
		<author><name>Yoder</name></author>	</entry>

	<entry>
		<id>http://www.elinux.org/ASEE_2013_Workshop</id>
		<title>ASEE 2013 Workshop</title>
		<link rel="alternate" type="text/html" href="http://www.elinux.org/ASEE_2013_Workshop"/>
				<updated>2013-06-11T13:58:44Z</updated>
		
		<summary type="html">&lt;p&gt;Yoder: /* Analog In */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:ECE497 |Workshop]]&lt;br /&gt;
{{YoderHead}}&lt;br /&gt;
Here are the labs for the afternoon Linux part of the [http://www.asee.org/public/conferences/20/registration/view_session?session_id=2420 ASEE 2013 Workshop]&lt;br /&gt;
&lt;br /&gt;
== Warm Up ==&lt;br /&gt;
[[File:PuTTYconfiguration.jpg|thumbnail]]&lt;br /&gt;
Before we can interact with LEDs and switches we need to learn some simple Linux commands. &lt;br /&gt;
# On your host computer, running Windows, start up '''puTTY'''.  &lt;br /&gt;
# If you get a ''Security Warning'', click '''Run'''.&lt;br /&gt;
# Enter '''192.167.7.2''' in the '''Host Name''' field and click '''Open'''&lt;br /&gt;
# Login as '''root''' with no password.&lt;br /&gt;
# Enter '''ls'''  to list what files you have. You shouldn't see much.&lt;br /&gt;
[[File:PuTTYloging.jpg|thumbnail]]&lt;br /&gt;
&lt;br /&gt;
At this point you need to learn a few simple Linux commands for creating and displaying files. Once you know these commands it's easy to turn an LED on and off.&lt;br /&gt;
&lt;br /&gt;
First, let's edit a file using the '''nano''' editor.  Nano is a simple editor that easy to learn. This will edit (and create) the file '''play'''.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''nano play'''&lt;br /&gt;
&lt;br /&gt;
Add a couple of lines of text to the file, it doesn't really matter what and then Exit. You can list the files in the current directory with '''ls''' and show the contents of a file with '''cat'''.&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 Desktop  play&lt;br /&gt;
 bone$ '''cat play'''&lt;br /&gt;
 A couple of lines&lt;br /&gt;
 of text.&lt;br /&gt;
&lt;br /&gt;
Use '''echo''' to print a line of text.&lt;br /&gt;
 bone$ '''echo This is a line of text'''&lt;br /&gt;
 This is a line of text&lt;br /&gt;
&lt;br /&gt;
Here's a powerful operator.  You can take the output of any command and redirect it to a file with '''&amp;gt;'''.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo This is a line of text &amp;gt; here'''&lt;br /&gt;
 bone$ '''cat here'''&lt;br /&gt;
 This is a line of text&lt;br /&gt;
&lt;br /&gt;
We are almost there.  Use '''cd''' to change directories.  '''/''' is the top level directory.&lt;br /&gt;
 bone$ '''cd /'''&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 bin   dev  home  lost+found  mnt   run   sys  usr&lt;br /&gt;
 boot  etc  lib   media       proc  sbin  tmp  var&lt;br /&gt;
&lt;br /&gt;
If you ever get lost, '''cd''' alone takes you home.&lt;br /&gt;
 bone$ '''cd'''&lt;br /&gt;
 gone$ '''ls'''&lt;br /&gt;
 Desktop  here  play&lt;br /&gt;
&lt;br /&gt;
Now you are ready to flash an LED.&lt;br /&gt;
&lt;br /&gt;
== Blinking an LED ==&lt;br /&gt;
=== gpio via the Shell Command Line and sysfs ===&lt;br /&gt;
&lt;br /&gt;
The easiest way to do general purpose I/O (gpio) on the Beagle is through a terminal window and a shell prompt. In Linux, almost everything is treated as a file, even things that aren't files. In our class we'll use a virtual file system called '''sysfs'''.  sysfs exposes the drivers for the hardware so you get easily use them.&lt;br /&gt;
&lt;br /&gt;
Try this:&lt;br /&gt;
 bone$ '''cd /sys'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 block/  bus/  class/  dev/  devices/  firmware/  fs/  kernel/  module/  power/&lt;br /&gt;
&lt;br /&gt;
Here we see several directories that represent hardware we can control. Explore a bit and see what you find.&lt;br /&gt;
&lt;br /&gt;
Now try:&lt;br /&gt;
&lt;br /&gt;
 beagle$ '''cd /sys/class'''&lt;br /&gt;
 beagle$ '''ls -F'''&lt;br /&gt;
 backlight/  firmware/     lcd/       mtd/           scsi_disk/   ubi/&lt;br /&gt;
 bdi/        gpio/         leds/      net/           scsi_host/   udc/&lt;br /&gt;
 block/      graphics/     mbox/      power_supply/  sound/       uio/&lt;br /&gt;
 bluetooth/  hwmon/        mdio_bus/  regulator/     spi_master/  usbmon/&lt;br /&gt;
 bsg/        i2c-adapter/  mem/       rfkill/        spidev/      vc/&lt;br /&gt;
 dma/        i2c-dev/      misc/      rtc/           thermal/     vtconsole/&lt;br /&gt;
 drm/        input/        mmc_host/  scsi_device/   tty/         watchdog/&lt;br /&gt;
&lt;br /&gt;
Explore some.  &lt;br /&gt;
&lt;br /&gt;
=== Blinking a USR LED ===&lt;br /&gt;
The Beagle Black has four user LEDS, '''user0''' - '''user3''', that you can control. Try this:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/class/leds'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 beaglebone:green:usr0  beaglebone:green:usr2&lt;br /&gt;
 beaglebone:green:usr1  beaglebone:green:usr3&lt;br /&gt;
&lt;br /&gt;
Here you see the directories for controlling each of the usr LEDs. By default, usr0 flashes a heartbeat pattern and usr1 flashes when the micro SD card is accessed.  Let's control usr0.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd beagleboard\:\:usr0'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 brightness  device@  max_brightness  power/  subsystem@  trigger  uevent&lt;br /&gt;
&lt;br /&gt;
See what's in '''brightness''', '''max_brightness''' and '''trigger''' by using the &amp;lt;code&amp;gt;cat&amp;lt;/code&amp;gt; command.  For example:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cat trigger'''&lt;br /&gt;
 none nand-disk mmc0 timer oneshot [heartbeat] backlight gpio cpu0 default-on transient&lt;br /&gt;
&lt;br /&gt;
This shows trigger can have many values.  The present value is '''heartbeat'''.  Check the LED, is it beating?  You can stop the heartbeat via:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo none &amp;gt; trigger'''&lt;br /&gt;
 bone$ '''cat trigger'''&lt;br /&gt;
 [none] nand-disk mmc0 timer oneshot heartbeat backlight gpio cpu0 default-on transient &lt;br /&gt;
&lt;br /&gt;
Did it stop beating?  You can now turn it on and off with:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; brightness'''&lt;br /&gt;
 bone$ '''echo 0 &amp;gt; brightness'''&lt;br /&gt;
&lt;br /&gt;
Is it responding correctly?&lt;br /&gt;
&lt;br /&gt;
The Bone has more trigger options.  Try:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cat trigger'''&lt;br /&gt;
 [none] mmc0 timer heartbeat backlight gpio default-on &lt;br /&gt;
 bone$ '''echo timer &amp;gt; trigger'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 brightness  delay_on  max_brightness  subsystem@  uevent&lt;br /&gt;
 delay_off   device@   power/          trigger&lt;br /&gt;
 bone$ '''echo 100 &amp;gt; delay_on'''&lt;br /&gt;
 bone$ '''echo 900 &amp;gt; delay_off'''&lt;br /&gt;
&lt;br /&gt;
What does this do?&lt;br /&gt;
&lt;br /&gt;
=== Blinking an External LED via gpio ===&lt;br /&gt;
&lt;br /&gt;
In the AM lab we wired an LED to the P9_12 General Purpose IO (gpio) port and controlled it via BoneScript.  Here we'll control it via a shell command. First we need to figure out which gpio pin P9_12 is attached to.  The following figure shows it attached to gpio_60.&lt;br /&gt;
&lt;br /&gt;
[[File:P9PWMs.jpg | 600px]]&lt;br /&gt;
&lt;br /&gt;
Here's how you turn it on&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/class/gpio'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  gpiochip0@  gpiochip32@  gpiochip64@  gpiochip96@  unexport&lt;br /&gt;
&lt;br /&gt;
Presently no gpio pins are visible.  You need to tell it which pin to export&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo 60 &amp;gt; export'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  gpio60@  gpiochip0@  gpiochip32@  gpiochip64@  gpiochip96@  unexport&lt;br /&gt;
&lt;br /&gt;
Notice '''gpio60''' has appeared.  All we need to do is tell it which direction and then turn it on.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd gpio60'''&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 active_low  direction  edge  power  subsystem  uevent  value&lt;br /&gt;
 bone$ '''echo out &amp;gt; direction'''&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; value'''&lt;br /&gt;
&lt;br /&gt;
Your LED should be on!  When you are done you can unexport the pin and it will disappear.&lt;br /&gt;
 bone$ '''cd ..'''&lt;br /&gt;
 bone$ '''echo 60 &amp;gt; unexport'''&lt;br /&gt;
&lt;br /&gt;
== Reading a switch ==&lt;br /&gt;
&lt;br /&gt;
Now that you have an LED working, wiring in a switch is easy.  In the AM lab you wired a switch to P9_42, which from the table above is '''gpio_7'''. &lt;br /&gt;
&lt;br /&gt;
Based on what you saw above.&lt;br /&gt;
 bone$ '''cd /sys/class/gpio'''&lt;br /&gt;
 bone$ '''echo 7 &amp;gt; export'''&lt;br /&gt;
 bone$ '''cd gpio7'''&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 bone$ '''echo in &amp;gt; direction'''&lt;br /&gt;
 bone$ '''cat value'''&lt;br /&gt;
 0&lt;br /&gt;
Now hold the button down and try again.&lt;br /&gt;
 bone$ '''cat value'''&lt;br /&gt;
 1&lt;br /&gt;
Once you have the switch and LED working use '''nano''' and put the following in a file.&lt;br /&gt;
 bone$ '''nano button.sh'''&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 cd /sys/class/gpio&lt;br /&gt;
 while [ 1 ]&lt;br /&gt;
 do&lt;br /&gt;
    cat gpio7/value&lt;br /&gt;
    sleep 0.25&lt;br /&gt;
 done&lt;br /&gt;
Quit nano and run&lt;br /&gt;
 bone$ '''chmod +x button.sh'''  (This makes button.sh executable)&lt;br /&gt;
 bone$ '''./button.sh'''&lt;br /&gt;
What happens when you push the button?&lt;br /&gt;
&lt;br /&gt;
Now experiment around. Can you flash the LED? How fast? Make the LED read the switch.&lt;br /&gt;
&lt;br /&gt;
== Analog In ==&lt;br /&gt;
The bone has eight Analog Inputs.  Several are exposed on P9.  They are labeled '''AIN''' in table 11 below.  How many do you find?&lt;br /&gt;
&lt;br /&gt;
[[File:P9PWMs.jpg|800px]]&lt;br /&gt;
&lt;br /&gt;
The AIN pins are sampled at 12 bits and 100k samples per second.  The input voltage is between 0 and 1.8V.  Fortunately, both voltages are available on P9.&lt;br /&gt;
&lt;br /&gt;
You've already wired these up for the AM lab. You interact with the analog in much like the gpio, but it appears in a different. We have to run a command before the AIN interface appears.  Just run them now, later I'll explain what you did if you are interested.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''SLOTS=/sys/devices/bone_capemgr.*/slots'''&lt;br /&gt;
 bone$ '''echo cape-bone-iio &amp;gt; $SLOTS'''&lt;br /&gt;
&lt;br /&gt;
You can now access the analog interface, let's explore.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/devices/ocp.2/helper.14'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 AIN0  AIN2  AIN4  AIN6  driver@   power/      uevent&lt;br /&gt;
 AIN1  AIN3  AIN5  AIN7  modalias  subsystem@&lt;br /&gt;
&lt;br /&gt;
There are the various analog inputs, but watch out.  This interface starts numbering at '''1''' and Table 11 starts at '''0''', so to read AIN5 you need to look at '''AIN6'''!&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cat AIN6'''&lt;br /&gt;
 1185&lt;br /&gt;
&lt;br /&gt;
Change the pot and rerun '''cat'''.  What's the min and max value you get?  Is it 12 bits?&lt;br /&gt;
&lt;br /&gt;
You can use the following script to continuously read the input.&lt;br /&gt;
 while [ 1 ]&lt;br /&gt;
   do &lt;br /&gt;
   tr '\n' '\r' &amp;lt; AIN6&lt;br /&gt;
 done&lt;br /&gt;
&lt;br /&gt;
== Pulse Width Modulation ==&lt;br /&gt;
&lt;br /&gt;
(Note: The pwm interface seems to changing. Some of this may not apply in the future.)&lt;br /&gt;
&lt;br /&gt;
The Bone has a PWM interface at &amp;lt;code&amp;gt;/sys/class/pwm/&amp;lt;/code&amp;gt;. You can see what's there by:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/class/pwm'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  unexport&lt;br /&gt;
Hmmm, there isn't much there.  We have to run a command to make something appear.  Try&lt;br /&gt;
 bone$ '''SLOTS=/sys/devices/bone_capemgr.*/slots'''&lt;br /&gt;
 bone$ '''echo am33xx_pwm &amp;gt; $SLOTS'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  pwmchip0@  pwmchip2@  pwmchip3@  pwmchip5@  pwmchip7@  unexport&lt;br /&gt;
Now we need to run another command to say which pwm pin we want to use.  I'm using P9_21.&lt;br /&gt;
 bone$ '''echo bone_pwm_P9_21 &amp;gt; $SLOTS&lt;br /&gt;
Now you can export a pwm much list you export a gpio port&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; export'''&lt;br /&gt;
 bone$ '''cd pwm1'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 device@  duty_ns  period_ns  polarity  power/  run  subsystem@  uevent&lt;br /&gt;
Try a 1Hz frequency with a 25% duty cycle&lt;br /&gt;
 bone$ '''echo 1000000000 &amp;gt; period_ns'''&lt;br /&gt;
 bone$ '''echo  250000000 &amp;gt; duty_ns'''&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; run'''&lt;br /&gt;
&lt;br /&gt;
Connect the LED from and watch it flash.  Try changing the frequency and duty cycle.  You may have to set the duty cycle to 0 to change the frequency.  Can you guess why?&lt;br /&gt;
&lt;br /&gt;
=== Challenge ===&lt;br /&gt;
Combine the analog in and the PWM by having the pot control the frequency or the duty cycle of the LED.&lt;br /&gt;
 &lt;br /&gt;
{{YoderFoot}}&lt;/div&gt;</summary>
		<author><name>Yoder</name></author>	</entry>

	<entry>
		<id>http://www.elinux.org/ASEE_2013_Workshop</id>
		<title>ASEE 2013 Workshop</title>
		<link rel="alternate" type="text/html" href="http://www.elinux.org/ASEE_2013_Workshop"/>
				<updated>2013-06-11T13:45:31Z</updated>
		
		<summary type="html">&lt;p&gt;Yoder: /* Reading a switch */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:ECE497 |Workshop]]&lt;br /&gt;
{{YoderHead}}&lt;br /&gt;
Here are the labs for the afternoon Linux part of the [http://www.asee.org/public/conferences/20/registration/view_session?session_id=2420 ASEE 2013 Workshop]&lt;br /&gt;
&lt;br /&gt;
== Warm Up ==&lt;br /&gt;
[[File:PuTTYconfiguration.jpg|thumbnail]]&lt;br /&gt;
Before we can interact with LEDs and switches we need to learn some simple Linux commands. &lt;br /&gt;
# On your host computer, running Windows, start up '''puTTY'''.  &lt;br /&gt;
# If you get a ''Security Warning'', click '''Run'''.&lt;br /&gt;
# Enter '''192.167.7.2''' in the '''Host Name''' field and click '''Open'''&lt;br /&gt;
# Login as '''root''' with no password.&lt;br /&gt;
# Enter '''ls'''  to list what files you have. You shouldn't see much.&lt;br /&gt;
[[File:PuTTYloging.jpg|thumbnail]]&lt;br /&gt;
&lt;br /&gt;
At this point you need to learn a few simple Linux commands for creating and displaying files. Once you know these commands it's easy to turn an LED on and off.&lt;br /&gt;
&lt;br /&gt;
First, let's edit a file using the '''nano''' editor.  Nano is a simple editor that easy to learn. This will edit (and create) the file '''play'''.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''nano play'''&lt;br /&gt;
&lt;br /&gt;
Add a couple of lines of text to the file, it doesn't really matter what and then Exit. You can list the files in the current directory with '''ls''' and show the contents of a file with '''cat'''.&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 Desktop  play&lt;br /&gt;
 bone$ '''cat play'''&lt;br /&gt;
 A couple of lines&lt;br /&gt;
 of text.&lt;br /&gt;
&lt;br /&gt;
Use '''echo''' to print a line of text.&lt;br /&gt;
 bone$ '''echo This is a line of text'''&lt;br /&gt;
 This is a line of text&lt;br /&gt;
&lt;br /&gt;
Here's a powerful operator.  You can take the output of any command and redirect it to a file with '''&amp;gt;'''.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo This is a line of text &amp;gt; here'''&lt;br /&gt;
 bone$ '''cat here'''&lt;br /&gt;
 This is a line of text&lt;br /&gt;
&lt;br /&gt;
We are almost there.  Use '''cd''' to change directories.  '''/''' is the top level directory.&lt;br /&gt;
 bone$ '''cd /'''&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 bin   dev  home  lost+found  mnt   run   sys  usr&lt;br /&gt;
 boot  etc  lib   media       proc  sbin  tmp  var&lt;br /&gt;
&lt;br /&gt;
If you ever get lost, '''cd''' alone takes you home.&lt;br /&gt;
 bone$ '''cd'''&lt;br /&gt;
 gone$ '''ls'''&lt;br /&gt;
 Desktop  here  play&lt;br /&gt;
&lt;br /&gt;
Now you are ready to flash an LED.&lt;br /&gt;
&lt;br /&gt;
== Blinking an LED ==&lt;br /&gt;
=== gpio via the Shell Command Line and sysfs ===&lt;br /&gt;
&lt;br /&gt;
The easiest way to do general purpose I/O (gpio) on the Beagle is through a terminal window and a shell prompt. In Linux, almost everything is treated as a file, even things that aren't files. In our class we'll use a virtual file system called '''sysfs'''.  sysfs exposes the drivers for the hardware so you get easily use them.&lt;br /&gt;
&lt;br /&gt;
Try this:&lt;br /&gt;
 bone$ '''cd /sys'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 block/  bus/  class/  dev/  devices/  firmware/  fs/  kernel/  module/  power/&lt;br /&gt;
&lt;br /&gt;
Here we see several directories that represent hardware we can control. Explore a bit and see what you find.&lt;br /&gt;
&lt;br /&gt;
Now try:&lt;br /&gt;
&lt;br /&gt;
 beagle$ '''cd /sys/class'''&lt;br /&gt;
 beagle$ '''ls -F'''&lt;br /&gt;
 backlight/  firmware/     lcd/       mtd/           scsi_disk/   ubi/&lt;br /&gt;
 bdi/        gpio/         leds/      net/           scsi_host/   udc/&lt;br /&gt;
 block/      graphics/     mbox/      power_supply/  sound/       uio/&lt;br /&gt;
 bluetooth/  hwmon/        mdio_bus/  regulator/     spi_master/  usbmon/&lt;br /&gt;
 bsg/        i2c-adapter/  mem/       rfkill/        spidev/      vc/&lt;br /&gt;
 dma/        i2c-dev/      misc/      rtc/           thermal/     vtconsole/&lt;br /&gt;
 drm/        input/        mmc_host/  scsi_device/   tty/         watchdog/&lt;br /&gt;
&lt;br /&gt;
Explore some.  &lt;br /&gt;
&lt;br /&gt;
=== Blinking a USR LED ===&lt;br /&gt;
The Beagle Black has four user LEDS, '''user0''' - '''user3''', that you can control. Try this:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/class/leds'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 beaglebone:green:usr0  beaglebone:green:usr2&lt;br /&gt;
 beaglebone:green:usr1  beaglebone:green:usr3&lt;br /&gt;
&lt;br /&gt;
Here you see the directories for controlling each of the usr LEDs. By default, usr0 flashes a heartbeat pattern and usr1 flashes when the micro SD card is accessed.  Let's control usr0.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd beagleboard\:\:usr0'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 brightness  device@  max_brightness  power/  subsystem@  trigger  uevent&lt;br /&gt;
&lt;br /&gt;
See what's in '''brightness''', '''max_brightness''' and '''trigger''' by using the &amp;lt;code&amp;gt;cat&amp;lt;/code&amp;gt; command.  For example:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cat trigger'''&lt;br /&gt;
 none nand-disk mmc0 timer oneshot [heartbeat] backlight gpio cpu0 default-on transient&lt;br /&gt;
&lt;br /&gt;
This shows trigger can have many values.  The present value is '''heartbeat'''.  Check the LED, is it beating?  You can stop the heartbeat via:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo none &amp;gt; trigger'''&lt;br /&gt;
 bone$ '''cat trigger'''&lt;br /&gt;
 [none] nand-disk mmc0 timer oneshot heartbeat backlight gpio cpu0 default-on transient &lt;br /&gt;
&lt;br /&gt;
Did it stop beating?  You can now turn it on and off with:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; brightness'''&lt;br /&gt;
 bone$ '''echo 0 &amp;gt; brightness'''&lt;br /&gt;
&lt;br /&gt;
Is it responding correctly?&lt;br /&gt;
&lt;br /&gt;
The Bone has more trigger options.  Try:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cat trigger'''&lt;br /&gt;
 [none] mmc0 timer heartbeat backlight gpio default-on &lt;br /&gt;
 bone$ '''echo timer &amp;gt; trigger'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 brightness  delay_on  max_brightness  subsystem@  uevent&lt;br /&gt;
 delay_off   device@   power/          trigger&lt;br /&gt;
 bone$ '''echo 100 &amp;gt; delay_on'''&lt;br /&gt;
 bone$ '''echo 900 &amp;gt; delay_off'''&lt;br /&gt;
&lt;br /&gt;
What does this do?&lt;br /&gt;
&lt;br /&gt;
=== Blinking an External LED via gpio ===&lt;br /&gt;
&lt;br /&gt;
In the AM lab we wired an LED to the P9_12 General Purpose IO (gpio) port and controlled it via BoneScript.  Here we'll control it via a shell command. First we need to figure out which gpio pin P9_12 is attached to.  The following figure shows it attached to gpio_60.&lt;br /&gt;
&lt;br /&gt;
[[File:P9PWMs.jpg | 600px]]&lt;br /&gt;
&lt;br /&gt;
Here's how you turn it on&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/class/gpio'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  gpiochip0@  gpiochip32@  gpiochip64@  gpiochip96@  unexport&lt;br /&gt;
&lt;br /&gt;
Presently no gpio pins are visible.  You need to tell it which pin to export&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo 60 &amp;gt; export'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  gpio60@  gpiochip0@  gpiochip32@  gpiochip64@  gpiochip96@  unexport&lt;br /&gt;
&lt;br /&gt;
Notice '''gpio60''' has appeared.  All we need to do is tell it which direction and then turn it on.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd gpio60'''&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 active_low  direction  edge  power  subsystem  uevent  value&lt;br /&gt;
 bone$ '''echo out &amp;gt; direction'''&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; value'''&lt;br /&gt;
&lt;br /&gt;
Your LED should be on!  When you are done you can unexport the pin and it will disappear.&lt;br /&gt;
 bone$ '''cd ..'''&lt;br /&gt;
 bone$ '''echo 60 &amp;gt; unexport'''&lt;br /&gt;
&lt;br /&gt;
== Reading a switch ==&lt;br /&gt;
&lt;br /&gt;
Now that you have an LED working, wiring in a switch is easy.  In the AM lab you wired a switch to P9_42, which from the table above is '''gpio_7'''. &lt;br /&gt;
&lt;br /&gt;
Based on what you saw above.&lt;br /&gt;
 bone$ '''cd /sys/class/gpio'''&lt;br /&gt;
 bone$ '''echo 7 &amp;gt; export'''&lt;br /&gt;
 bone$ '''cd gpio7'''&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 bone$ '''echo in &amp;gt; direction'''&lt;br /&gt;
 bone$ '''cat value'''&lt;br /&gt;
 0&lt;br /&gt;
Now hold the button down and try again.&lt;br /&gt;
 bone$ '''cat value'''&lt;br /&gt;
 1&lt;br /&gt;
Once you have the switch and LED working use '''nano''' and put the following in a file.&lt;br /&gt;
 bone$ '''nano button.sh'''&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 cd /sys/class/gpio&lt;br /&gt;
 while [ 1 ]&lt;br /&gt;
 do&lt;br /&gt;
    cat gpio7/value&lt;br /&gt;
    sleep 0.25&lt;br /&gt;
 done&lt;br /&gt;
Quit nano and run&lt;br /&gt;
 bone$ '''chmod +x button.sh'''  (This makes button.sh executable)&lt;br /&gt;
 bone$ '''./button.sh'''&lt;br /&gt;
What happens when you push the button?&lt;br /&gt;
&lt;br /&gt;
Now experiment around. Can you flash the LED? How fast? Make the LED read the switch.&lt;br /&gt;
&lt;br /&gt;
== Analog In ==&lt;br /&gt;
The bone has eight Analog Inputs.  Several are exposed on P9.  They are labeled '''AIN''' in table 11 below.  How many do you find?&lt;br /&gt;
&lt;br /&gt;
[[File:P9PWMs.jpg|800px]]&lt;br /&gt;
&lt;br /&gt;
The AIN pins are sampled at 12 bits and 100k samples per second.  The input voltage is between 0 and 1.8V.  Fortunately, both voltages are available on P9.&lt;br /&gt;
&lt;br /&gt;
You've already wired these up for the AM lab. You interact with the analog in much like the gpio, but it appears in a different. We have to run a command before the AIN interface appears.  Just run them now, later I'll explain what you did if you are interested.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''SLOTS=/sys/devices/bone_capemgr.*/slots'''&lt;br /&gt;
 bone$ '''echo cape-bone-iio &amp;gt; $SLOTS'''&lt;br /&gt;
&lt;br /&gt;
You can now access the analog interface, let's explore.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/devices/ocp.2/helper.14'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 AIN0  AIN2  AIN4  AIN6  driver@   power/      uevent&lt;br /&gt;
 AIN1  AIN3  AIN5  AIN7  modalias  subsystem@&lt;br /&gt;
&lt;br /&gt;
There are the various analog inputs, but watch out.  This interface starts numbering at '''1''' and Table 11 starts at '''0''', so to read AIN5 you need to look at '''AIN6'''!&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cat AIN6'''&lt;br /&gt;
 1185&lt;br /&gt;
&lt;br /&gt;
Change the pot and rerun '''cat'''.  What's the min and max value you get?  Is it 12 bits?&lt;br /&gt;
&lt;br /&gt;
You can use the following script to continuously read the input.&lt;br /&gt;
 while [ 1 ]; do &lt;br /&gt;
   tr '\n' '\r' &amp;lt; AIN5&lt;br /&gt;
 done&lt;br /&gt;
&lt;br /&gt;
== Pulse Width Modulation ==&lt;br /&gt;
&lt;br /&gt;
(Note: The pwm interface seems to changing. Some of this may not apply in the future.)&lt;br /&gt;
&lt;br /&gt;
The Bone has a PWM interface at &amp;lt;code&amp;gt;/sys/class/pwm/&amp;lt;/code&amp;gt;. You can see what's there by:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/class/pwm'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  unexport&lt;br /&gt;
Hmmm, there isn't much there.  We have to run a command to make something appear.  Try&lt;br /&gt;
 bone$ '''SLOTS=/sys/devices/bone_capemgr.*/slots'''&lt;br /&gt;
 bone$ '''echo am33xx_pwm &amp;gt; $SLOTS'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  pwmchip0@  pwmchip2@  pwmchip3@  pwmchip5@  pwmchip7@  unexport&lt;br /&gt;
Now we need to run another command to say which pwm pin we want to use.  I'm using P9_21.&lt;br /&gt;
 bone$ '''echo bone_pwm_P9_21 &amp;gt; $SLOTS&lt;br /&gt;
Now you can export a pwm much list you export a gpio port&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; export'''&lt;br /&gt;
 bone$ '''cd pwm1'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 device@  duty_ns  period_ns  polarity  power/  run  subsystem@  uevent&lt;br /&gt;
Try a 1Hz frequency with a 25% duty cycle&lt;br /&gt;
 bone$ '''echo 1000000000 &amp;gt; period_ns'''&lt;br /&gt;
 bone$ '''echo  250000000 &amp;gt; duty_ns'''&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; run'''&lt;br /&gt;
&lt;br /&gt;
Connect the LED from and watch it flash.  Try changing the frequency and duty cycle.  You may have to set the duty cycle to 0 to change the frequency.  Can you guess why?&lt;br /&gt;
&lt;br /&gt;
=== Challenge ===&lt;br /&gt;
Combine the analog in and the PWM by having the pot control the frequency or the duty cycle of the LED.&lt;br /&gt;
 &lt;br /&gt;
{{YoderFoot}}&lt;/div&gt;</summary>
		<author><name>Yoder</name></author>	</entry>

	<entry>
		<id>http://www.elinux.org/ASEE_2013_Workshop</id>
		<title>ASEE 2013 Workshop</title>
		<link rel="alternate" type="text/html" href="http://www.elinux.org/ASEE_2013_Workshop"/>
				<updated>2013-06-11T13:37:17Z</updated>
		
		<summary type="html">&lt;p&gt;Yoder: /* Blinking an External LED via gpio */ Added ls in gpio60&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:ECE497 |Workshop]]&lt;br /&gt;
{{YoderHead}}&lt;br /&gt;
Here are the labs for the afternoon Linux part of the [http://www.asee.org/public/conferences/20/registration/view_session?session_id=2420 ASEE 2013 Workshop]&lt;br /&gt;
&lt;br /&gt;
== Warm Up ==&lt;br /&gt;
[[File:PuTTYconfiguration.jpg|thumbnail]]&lt;br /&gt;
Before we can interact with LEDs and switches we need to learn some simple Linux commands. &lt;br /&gt;
# On your host computer, running Windows, start up '''puTTY'''.  &lt;br /&gt;
# If you get a ''Security Warning'', click '''Run'''.&lt;br /&gt;
# Enter '''192.167.7.2''' in the '''Host Name''' field and click '''Open'''&lt;br /&gt;
# Login as '''root''' with no password.&lt;br /&gt;
# Enter '''ls'''  to list what files you have. You shouldn't see much.&lt;br /&gt;
[[File:PuTTYloging.jpg|thumbnail]]&lt;br /&gt;
&lt;br /&gt;
At this point you need to learn a few simple Linux commands for creating and displaying files. Once you know these commands it's easy to turn an LED on and off.&lt;br /&gt;
&lt;br /&gt;
First, let's edit a file using the '''nano''' editor.  Nano is a simple editor that easy to learn. This will edit (and create) the file '''play'''.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''nano play'''&lt;br /&gt;
&lt;br /&gt;
Add a couple of lines of text to the file, it doesn't really matter what and then Exit. You can list the files in the current directory with '''ls''' and show the contents of a file with '''cat'''.&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 Desktop  play&lt;br /&gt;
 bone$ '''cat play'''&lt;br /&gt;
 A couple of lines&lt;br /&gt;
 of text.&lt;br /&gt;
&lt;br /&gt;
Use '''echo''' to print a line of text.&lt;br /&gt;
 bone$ '''echo This is a line of text'''&lt;br /&gt;
 This is a line of text&lt;br /&gt;
&lt;br /&gt;
Here's a powerful operator.  You can take the output of any command and redirect it to a file with '''&amp;gt;'''.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo This is a line of text &amp;gt; here'''&lt;br /&gt;
 bone$ '''cat here'''&lt;br /&gt;
 This is a line of text&lt;br /&gt;
&lt;br /&gt;
We are almost there.  Use '''cd''' to change directories.  '''/''' is the top level directory.&lt;br /&gt;
 bone$ '''cd /'''&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 bin   dev  home  lost+found  mnt   run   sys  usr&lt;br /&gt;
 boot  etc  lib   media       proc  sbin  tmp  var&lt;br /&gt;
&lt;br /&gt;
If you ever get lost, '''cd''' alone takes you home.&lt;br /&gt;
 bone$ '''cd'''&lt;br /&gt;
 gone$ '''ls'''&lt;br /&gt;
 Desktop  here  play&lt;br /&gt;
&lt;br /&gt;
Now you are ready to flash an LED.&lt;br /&gt;
&lt;br /&gt;
== Blinking an LED ==&lt;br /&gt;
=== gpio via the Shell Command Line and sysfs ===&lt;br /&gt;
&lt;br /&gt;
The easiest way to do general purpose I/O (gpio) on the Beagle is through a terminal window and a shell prompt. In Linux, almost everything is treated as a file, even things that aren't files. In our class we'll use a virtual file system called '''sysfs'''.  sysfs exposes the drivers for the hardware so you get easily use them.&lt;br /&gt;
&lt;br /&gt;
Try this:&lt;br /&gt;
 bone$ '''cd /sys'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 block/  bus/  class/  dev/  devices/  firmware/  fs/  kernel/  module/  power/&lt;br /&gt;
&lt;br /&gt;
Here we see several directories that represent hardware we can control. Explore a bit and see what you find.&lt;br /&gt;
&lt;br /&gt;
Now try:&lt;br /&gt;
&lt;br /&gt;
 beagle$ '''cd /sys/class'''&lt;br /&gt;
 beagle$ '''ls -F'''&lt;br /&gt;
 backlight/  firmware/     lcd/       mtd/           scsi_disk/   ubi/&lt;br /&gt;
 bdi/        gpio/         leds/      net/           scsi_host/   udc/&lt;br /&gt;
 block/      graphics/     mbox/      power_supply/  sound/       uio/&lt;br /&gt;
 bluetooth/  hwmon/        mdio_bus/  regulator/     spi_master/  usbmon/&lt;br /&gt;
 bsg/        i2c-adapter/  mem/       rfkill/        spidev/      vc/&lt;br /&gt;
 dma/        i2c-dev/      misc/      rtc/           thermal/     vtconsole/&lt;br /&gt;
 drm/        input/        mmc_host/  scsi_device/   tty/         watchdog/&lt;br /&gt;
&lt;br /&gt;
Explore some.  &lt;br /&gt;
&lt;br /&gt;
=== Blinking a USR LED ===&lt;br /&gt;
The Beagle Black has four user LEDS, '''user0''' - '''user3''', that you can control. Try this:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/class/leds'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 beaglebone:green:usr0  beaglebone:green:usr2&lt;br /&gt;
 beaglebone:green:usr1  beaglebone:green:usr3&lt;br /&gt;
&lt;br /&gt;
Here you see the directories for controlling each of the usr LEDs. By default, usr0 flashes a heartbeat pattern and usr1 flashes when the micro SD card is accessed.  Let's control usr0.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd beagleboard\:\:usr0'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 brightness  device@  max_brightness  power/  subsystem@  trigger  uevent&lt;br /&gt;
&lt;br /&gt;
See what's in '''brightness''', '''max_brightness''' and '''trigger''' by using the &amp;lt;code&amp;gt;cat&amp;lt;/code&amp;gt; command.  For example:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cat trigger'''&lt;br /&gt;
 none nand-disk mmc0 timer oneshot [heartbeat] backlight gpio cpu0 default-on transient&lt;br /&gt;
&lt;br /&gt;
This shows trigger can have many values.  The present value is '''heartbeat'''.  Check the LED, is it beating?  You can stop the heartbeat via:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo none &amp;gt; trigger'''&lt;br /&gt;
 bone$ '''cat trigger'''&lt;br /&gt;
 [none] nand-disk mmc0 timer oneshot heartbeat backlight gpio cpu0 default-on transient &lt;br /&gt;
&lt;br /&gt;
Did it stop beating?  You can now turn it on and off with:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; brightness'''&lt;br /&gt;
 bone$ '''echo 0 &amp;gt; brightness'''&lt;br /&gt;
&lt;br /&gt;
Is it responding correctly?&lt;br /&gt;
&lt;br /&gt;
The Bone has more trigger options.  Try:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cat trigger'''&lt;br /&gt;
 [none] mmc0 timer heartbeat backlight gpio default-on &lt;br /&gt;
 bone$ '''echo timer &amp;gt; trigger'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 brightness  delay_on  max_brightness  subsystem@  uevent&lt;br /&gt;
 delay_off   device@   power/          trigger&lt;br /&gt;
 bone$ '''echo 100 &amp;gt; delay_on'''&lt;br /&gt;
 bone$ '''echo 900 &amp;gt; delay_off'''&lt;br /&gt;
&lt;br /&gt;
What does this do?&lt;br /&gt;
&lt;br /&gt;
=== Blinking an External LED via gpio ===&lt;br /&gt;
&lt;br /&gt;
In the AM lab we wired an LED to the P9_12 General Purpose IO (gpio) port and controlled it via BoneScript.  Here we'll control it via a shell command. First we need to figure out which gpio pin P9_12 is attached to.  The following figure shows it attached to gpio_60.&lt;br /&gt;
&lt;br /&gt;
[[File:P9PWMs.jpg | 600px]]&lt;br /&gt;
&lt;br /&gt;
Here's how you turn it on&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/class/gpio'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  gpiochip0@  gpiochip32@  gpiochip64@  gpiochip96@  unexport&lt;br /&gt;
&lt;br /&gt;
Presently no gpio pins are visible.  You need to tell it which pin to export&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo 60 &amp;gt; export'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  gpio60@  gpiochip0@  gpiochip32@  gpiochip64@  gpiochip96@  unexport&lt;br /&gt;
&lt;br /&gt;
Notice '''gpio60''' has appeared.  All we need to do is tell it which direction and then turn it on.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd gpio60'''&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 active_low  direction  edge  power  subsystem  uevent  value&lt;br /&gt;
 bone$ '''echo out &amp;gt; direction'''&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; value'''&lt;br /&gt;
&lt;br /&gt;
Your LED should be on!  When you are done you can unexport the pin and it will disappear.&lt;br /&gt;
 bone$ '''cd ..'''&lt;br /&gt;
 bone$ '''echo 60 &amp;gt; unexport'''&lt;br /&gt;
&lt;br /&gt;
== Reading a switch ==&lt;br /&gt;
&lt;br /&gt;
Now that you have an LED working, wiring in a switch is easy.  In the AM lab you wired a switch to P9_42, which from the table above is '''gpio_7'''. &lt;br /&gt;
&lt;br /&gt;
Based on what you saw above.&lt;br /&gt;
 bone$ '''cd /sys/class/gpio'''&lt;br /&gt;
 bone$ '''echo 7 &amp;gt; export'''&lt;br /&gt;
 bone$ '''cd gpio7'''&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 bone$ '''echo in &amp;gt; direction'''&lt;br /&gt;
 bone$ '''cat value'''&lt;br /&gt;
 0&lt;br /&gt;
Now hold the button down and try again.&lt;br /&gt;
 bone$ '''cat value'''&lt;br /&gt;
 1&lt;br /&gt;
Once you have the switch and LED working use '''nano''' and put the following in a file.&lt;br /&gt;
 bone$ '''nano flash.sh'''&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 cd /sys/class/gpio&lt;br /&gt;
 while [ 1 ]&lt;br /&gt;
 do&lt;br /&gt;
    cat gpio7/value &amp;gt; gpio60/value&lt;br /&gt;
    sleep 0.25&lt;br /&gt;
 done&lt;br /&gt;
Quit nano and run&lt;br /&gt;
 bone$ '''chmod +x flash.sh'''  (This makes flash.sh executable)&lt;br /&gt;
 bone$ '''./flash.sh'''&lt;br /&gt;
What happens when you push the button?&lt;br /&gt;
&lt;br /&gt;
Now experiment around. How fast can you flash the LED?&lt;br /&gt;
&lt;br /&gt;
== Analog In ==&lt;br /&gt;
The bone has eight Analog Inputs.  Several are exposed on P9.  They are labeled '''AIN''' in table 11 below.  How many do you find?&lt;br /&gt;
&lt;br /&gt;
[[File:P9PWMs.jpg|800px]]&lt;br /&gt;
&lt;br /&gt;
The AIN pins are sampled at 12 bits and 100k samples per second.  The input voltage is between 0 and 1.8V.  Fortunately, both voltages are available on P9.&lt;br /&gt;
&lt;br /&gt;
You've already wired these up for the AM lab. You interact with the analog in much like the gpio, but it appears in a different. We have to run a command before the AIN interface appears.  Just run them now, later I'll explain what you did if you are interested.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''SLOTS=/sys/devices/bone_capemgr.*/slots'''&lt;br /&gt;
 bone$ '''echo cape-bone-iio &amp;gt; $SLOTS'''&lt;br /&gt;
&lt;br /&gt;
You can now access the analog interface, let's explore.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/devices/ocp.2/helper.14'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 AIN0  AIN2  AIN4  AIN6  driver@   power/      uevent&lt;br /&gt;
 AIN1  AIN3  AIN5  AIN7  modalias  subsystem@&lt;br /&gt;
&lt;br /&gt;
There are the various analog inputs, but watch out.  This interface starts numbering at '''1''' and Table 11 starts at '''0''', so to read AIN5 you need to look at '''AIN6'''!&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cat AIN6'''&lt;br /&gt;
 1185&lt;br /&gt;
&lt;br /&gt;
Change the pot and rerun '''cat'''.  What's the min and max value you get?  Is it 12 bits?&lt;br /&gt;
&lt;br /&gt;
You can use the following script to continuously read the input.&lt;br /&gt;
 while [ 1 ]; do &lt;br /&gt;
   tr '\n' '\r' &amp;lt; AIN5&lt;br /&gt;
 done&lt;br /&gt;
&lt;br /&gt;
== Pulse Width Modulation ==&lt;br /&gt;
&lt;br /&gt;
(Note: The pwm interface seems to changing. Some of this may not apply in the future.)&lt;br /&gt;
&lt;br /&gt;
The Bone has a PWM interface at &amp;lt;code&amp;gt;/sys/class/pwm/&amp;lt;/code&amp;gt;. You can see what's there by:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/class/pwm'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  unexport&lt;br /&gt;
Hmmm, there isn't much there.  We have to run a command to make something appear.  Try&lt;br /&gt;
 bone$ '''SLOTS=/sys/devices/bone_capemgr.*/slots'''&lt;br /&gt;
 bone$ '''echo am33xx_pwm &amp;gt; $SLOTS'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  pwmchip0@  pwmchip2@  pwmchip3@  pwmchip5@  pwmchip7@  unexport&lt;br /&gt;
Now we need to run another command to say which pwm pin we want to use.  I'm using P9_21.&lt;br /&gt;
 bone$ '''echo bone_pwm_P9_21 &amp;gt; $SLOTS&lt;br /&gt;
Now you can export a pwm much list you export a gpio port&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; export'''&lt;br /&gt;
 bone$ '''cd pwm1'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 device@  duty_ns  period_ns  polarity  power/  run  subsystem@  uevent&lt;br /&gt;
Try a 1Hz frequency with a 25% duty cycle&lt;br /&gt;
 bone$ '''echo 1000000000 &amp;gt; period_ns'''&lt;br /&gt;
 bone$ '''echo  250000000 &amp;gt; duty_ns'''&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; run'''&lt;br /&gt;
&lt;br /&gt;
Connect the LED from and watch it flash.  Try changing the frequency and duty cycle.  You may have to set the duty cycle to 0 to change the frequency.  Can you guess why?&lt;br /&gt;
&lt;br /&gt;
=== Challenge ===&lt;br /&gt;
Combine the analog in and the PWM by having the pot control the frequency or the duty cycle of the LED.&lt;br /&gt;
 &lt;br /&gt;
{{YoderFoot}}&lt;/div&gt;</summary>
		<author><name>Yoder</name></author>	</entry>

	<entry>
		<id>http://www.elinux.org/ASEE_2013_Workshop</id>
		<title>ASEE 2013 Workshop</title>
		<link rel="alternate" type="text/html" href="http://www.elinux.org/ASEE_2013_Workshop"/>
				<updated>2013-06-10T20:38:22Z</updated>
		
		<summary type="html">&lt;p&gt;Yoder: /* Pulse Width Modulation */ Updated&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:ECE497 |Workshop]]&lt;br /&gt;
{{YoderHead}}&lt;br /&gt;
Here are the labs for the afternoon Linux part of the [http://www.asee.org/public/conferences/20/registration/view_session?session_id=2420 ASEE 2013 Workshop]&lt;br /&gt;
&lt;br /&gt;
== Warm Up ==&lt;br /&gt;
[[File:PuTTYconfiguration.jpg|thumbnail]]&lt;br /&gt;
Before we can interact with LEDs and switches we need to learn some simple Linux commands. &lt;br /&gt;
# On your host computer, running Windows, start up '''puTTY'''.  &lt;br /&gt;
# If you get a ''Security Warning'', click '''Run'''.&lt;br /&gt;
# Enter '''192.167.7.2''' in the '''Host Name''' field and click '''Open'''&lt;br /&gt;
# Login as '''root''' with no password.&lt;br /&gt;
# Enter '''ls'''  to list what files you have. You shouldn't see much.&lt;br /&gt;
[[File:PuTTYloging.jpg|thumbnail]]&lt;br /&gt;
&lt;br /&gt;
At this point you need to learn a few simple Linux commands for creating and displaying files. Once you know these commands it's easy to turn an LED on and off.&lt;br /&gt;
&lt;br /&gt;
First, let's edit a file using the '''nano''' editor.  Nano is a simple editor that easy to learn. This will edit (and create) the file '''play'''.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''nano play'''&lt;br /&gt;
&lt;br /&gt;
Add a couple of lines of text to the file, it doesn't really matter what and then Exit. You can list the files in the current directory with '''ls''' and show the contents of a file with '''cat'''.&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 Desktop  play&lt;br /&gt;
 bone$ '''cat play'''&lt;br /&gt;
 A couple of lines&lt;br /&gt;
 of text.&lt;br /&gt;
&lt;br /&gt;
Use '''echo''' to print a line of text.&lt;br /&gt;
 bone$ '''echo This is a line of text'''&lt;br /&gt;
 This is a line of text&lt;br /&gt;
&lt;br /&gt;
Here's a powerful operator.  You can take the output of any command and redirect it to a file with '''&amp;gt;'''.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo This is a line of text &amp;gt; here'''&lt;br /&gt;
 bone$ '''cat here'''&lt;br /&gt;
 This is a line of text&lt;br /&gt;
&lt;br /&gt;
We are almost there.  Use '''cd''' to change directories.  '''/''' is the top level directory.&lt;br /&gt;
 bone$ '''cd /'''&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 bin   dev  home  lost+found  mnt   run   sys  usr&lt;br /&gt;
 boot  etc  lib   media       proc  sbin  tmp  var&lt;br /&gt;
&lt;br /&gt;
If you ever get lost, '''cd''' alone takes you home.&lt;br /&gt;
 bone$ '''cd'''&lt;br /&gt;
 gone$ '''ls'''&lt;br /&gt;
 Desktop  here  play&lt;br /&gt;
&lt;br /&gt;
Now you are ready to flash an LED.&lt;br /&gt;
&lt;br /&gt;
== Blinking an LED ==&lt;br /&gt;
=== gpio via the Shell Command Line and sysfs ===&lt;br /&gt;
&lt;br /&gt;
The easiest way to do general purpose I/O (gpio) on the Beagle is through a terminal window and a shell prompt. In Linux, almost everything is treated as a file, even things that aren't files. In our class we'll use a virtual file system called '''sysfs'''.  sysfs exposes the drivers for the hardware so you get easily use them.&lt;br /&gt;
&lt;br /&gt;
Try this:&lt;br /&gt;
 bone$ '''cd /sys'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 block/  bus/  class/  dev/  devices/  firmware/  fs/  kernel/  module/  power/&lt;br /&gt;
&lt;br /&gt;
Here we see several directories that represent hardware we can control. Explore a bit and see what you find.&lt;br /&gt;
&lt;br /&gt;
Now try:&lt;br /&gt;
&lt;br /&gt;
 beagle$ '''cd /sys/class'''&lt;br /&gt;
 beagle$ '''ls -F'''&lt;br /&gt;
 backlight/  firmware/     lcd/       mtd/           scsi_disk/   ubi/&lt;br /&gt;
 bdi/        gpio/         leds/      net/           scsi_host/   udc/&lt;br /&gt;
 block/      graphics/     mbox/      power_supply/  sound/       uio/&lt;br /&gt;
 bluetooth/  hwmon/        mdio_bus/  regulator/     spi_master/  usbmon/&lt;br /&gt;
 bsg/        i2c-adapter/  mem/       rfkill/        spidev/      vc/&lt;br /&gt;
 dma/        i2c-dev/      misc/      rtc/           thermal/     vtconsole/&lt;br /&gt;
 drm/        input/        mmc_host/  scsi_device/   tty/         watchdog/&lt;br /&gt;
&lt;br /&gt;
Explore some.  &lt;br /&gt;
&lt;br /&gt;
=== Blinking a USR LED ===&lt;br /&gt;
The Beagle Black has four user LEDS, '''user0''' - '''user3''', that you can control. Try this:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/class/leds'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 beaglebone:green:usr0  beaglebone:green:usr2&lt;br /&gt;
 beaglebone:green:usr1  beaglebone:green:usr3&lt;br /&gt;
&lt;br /&gt;
Here you see the directories for controlling each of the usr LEDs. By default, usr0 flashes a heartbeat pattern and usr1 flashes when the micro SD card is accessed.  Let's control usr0.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd beagleboard\:\:usr0'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 brightness  device@  max_brightness  power/  subsystem@  trigger  uevent&lt;br /&gt;
&lt;br /&gt;
See what's in '''brightness''', '''max_brightness''' and '''trigger''' by using the &amp;lt;code&amp;gt;cat&amp;lt;/code&amp;gt; command.  For example:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cat trigger'''&lt;br /&gt;
 none nand-disk mmc0 timer oneshot [heartbeat] backlight gpio cpu0 default-on transient&lt;br /&gt;
&lt;br /&gt;
This shows trigger can have many values.  The present value is '''heartbeat'''.  Check the LED, is it beating?  You can stop the heartbeat via:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo none &amp;gt; trigger'''&lt;br /&gt;
 bone$ '''cat trigger'''&lt;br /&gt;
 [none] nand-disk mmc0 timer oneshot heartbeat backlight gpio cpu0 default-on transient &lt;br /&gt;
&lt;br /&gt;
Did it stop beating?  You can now turn it on and off with:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; brightness'''&lt;br /&gt;
 bone$ '''echo 0 &amp;gt; brightness'''&lt;br /&gt;
&lt;br /&gt;
Is it responding correctly?&lt;br /&gt;
&lt;br /&gt;
The Bone has more trigger options.  Try:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cat trigger'''&lt;br /&gt;
 [none] mmc0 timer heartbeat backlight gpio default-on &lt;br /&gt;
 bone$ '''echo timer &amp;gt; trigger'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 brightness  delay_on  max_brightness  subsystem@  uevent&lt;br /&gt;
 delay_off   device@   power/          trigger&lt;br /&gt;
 bone$ '''echo 100 &amp;gt; delay_on'''&lt;br /&gt;
 bone$ '''echo 900 &amp;gt; delay_off'''&lt;br /&gt;
&lt;br /&gt;
What does this do?&lt;br /&gt;
&lt;br /&gt;
=== Blinking an External LED via gpio ===&lt;br /&gt;
&lt;br /&gt;
In the AM lab we wired an LED to the P9_12 General Purpose IO (gpio) port and controlled it via BoneScript.  Here we'll control it via a shell command. First we need to figure out which gpio pin P9_12 is attached to.  The following figure shows it attached to gpio_60.&lt;br /&gt;
&lt;br /&gt;
[[File:P9PWMs.jpg | 600px]]&lt;br /&gt;
&lt;br /&gt;
Here's how you turn it on&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/class/gpio'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  gpiochip0@  gpiochip32@  gpiochip64@  gpiochip96@  unexport&lt;br /&gt;
&lt;br /&gt;
Presently no gpio pins are visible.  You need to tell it which pin to export&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo 60 &amp;gt; export'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  gpio60@  gpiochip0@  gpiochip32@  gpiochip64@  gpiochip96@  unexport&lt;br /&gt;
&lt;br /&gt;
Notice '''gpio60''' has appeared.  All we need to do is tell it which direction and then turn it on.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd gpio60'''&lt;br /&gt;
 bone$ '''echo out &amp;gt; direction'''&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; value'''&lt;br /&gt;
&lt;br /&gt;
Your LED should be on!  When you are done you can unexport the pin and it will disappear.&lt;br /&gt;
 bone$ '''cd ..'''&lt;br /&gt;
 bone$ '''echo 60 &amp;gt; unexport'''&lt;br /&gt;
&lt;br /&gt;
== Reading a switch ==&lt;br /&gt;
&lt;br /&gt;
Now that you have an LED working, wiring in a switch is easy.  In the AM lab you wired a switch to P9_42, which from the table above is '''gpio_7'''. &lt;br /&gt;
&lt;br /&gt;
Based on what you saw above.&lt;br /&gt;
 bone$ '''cd /sys/class/gpio'''&lt;br /&gt;
 bone$ '''echo 7 &amp;gt; export'''&lt;br /&gt;
 bone$ '''cd gpio7'''&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 bone$ '''echo in &amp;gt; direction'''&lt;br /&gt;
 bone$ '''cat value'''&lt;br /&gt;
 0&lt;br /&gt;
Now hold the button down and try again.&lt;br /&gt;
 bone$ '''cat value'''&lt;br /&gt;
 1&lt;br /&gt;
Once you have the switch and LED working use '''nano''' and put the following in a file.&lt;br /&gt;
 bone$ '''nano flash.sh'''&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 cd /sys/class/gpio&lt;br /&gt;
 while [ 1 ]&lt;br /&gt;
 do&lt;br /&gt;
    cat gpio7/value &amp;gt; gpio60/value&lt;br /&gt;
    sleep 0.25&lt;br /&gt;
 done&lt;br /&gt;
Quit nano and run&lt;br /&gt;
 bone$ '''chmod +x flash.sh'''  (This makes flash.sh executable)&lt;br /&gt;
 bone$ '''./flash.sh'''&lt;br /&gt;
What happens when you push the button?&lt;br /&gt;
&lt;br /&gt;
Now experiment around. How fast can you flash the LED?&lt;br /&gt;
&lt;br /&gt;
== Analog In ==&lt;br /&gt;
The bone has eight Analog Inputs.  Several are exposed on P9.  They are labeled '''AIN''' in table 11 below.  How many do you find?&lt;br /&gt;
&lt;br /&gt;
[[File:P9PWMs.jpg|800px]]&lt;br /&gt;
&lt;br /&gt;
The AIN pins are sampled at 12 bits and 100k samples per second.  The input voltage is between 0 and 1.8V.  Fortunately, both voltages are available on P9.&lt;br /&gt;
&lt;br /&gt;
You've already wired these up for the AM lab. You interact with the analog in much like the gpio, but it appears in a different. We have to run a command before the AIN interface appears.  Just run them now, later I'll explain what you did if you are interested.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''SLOTS=/sys/devices/bone_capemgr.*/slots'''&lt;br /&gt;
 bone$ '''echo cape-bone-iio &amp;gt; $SLOTS'''&lt;br /&gt;
&lt;br /&gt;
You can now access the analog interface, let's explore.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/devices/ocp.2/helper.14'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 AIN0  AIN2  AIN4  AIN6  driver@   power/      uevent&lt;br /&gt;
 AIN1  AIN3  AIN5  AIN7  modalias  subsystem@&lt;br /&gt;
&lt;br /&gt;
There are the various analog inputs, but watch out.  This interface starts numbering at '''1''' and Table 11 starts at '''0''', so to read AIN5 you need to look at '''AIN6'''!&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cat AIN6'''&lt;br /&gt;
 1185&lt;br /&gt;
&lt;br /&gt;
Change the pot and rerun '''cat'''.  What's the min and max value you get?  Is it 12 bits?&lt;br /&gt;
&lt;br /&gt;
You can use the following script to continuously read the input.&lt;br /&gt;
 while [ 1 ]; do &lt;br /&gt;
   tr '\n' '\r' &amp;lt; AIN5&lt;br /&gt;
 done&lt;br /&gt;
&lt;br /&gt;
== Pulse Width Modulation ==&lt;br /&gt;
&lt;br /&gt;
(Note: The pwm interface seems to changing. Some of this may not apply in the future.)&lt;br /&gt;
&lt;br /&gt;
The Bone has a PWM interface at &amp;lt;code&amp;gt;/sys/class/pwm/&amp;lt;/code&amp;gt;. You can see what's there by:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/class/pwm'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  unexport&lt;br /&gt;
Hmmm, there isn't much there.  We have to run a command to make something appear.  Try&lt;br /&gt;
 bone$ '''SLOTS=/sys/devices/bone_capemgr.*/slots'''&lt;br /&gt;
 bone$ '''echo am33xx_pwm &amp;gt; $SLOTS'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  pwmchip0@  pwmchip2@  pwmchip3@  pwmchip5@  pwmchip7@  unexport&lt;br /&gt;
Now we need to run another command to say which pwm pin we want to use.  I'm using P9_21.&lt;br /&gt;
 bone$ '''echo bone_pwm_P9_21 &amp;gt; $SLOTS&lt;br /&gt;
Now you can export a pwm much list you export a gpio port&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; export'''&lt;br /&gt;
 bone$ '''cd pwm1'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 device@  duty_ns  period_ns  polarity  power/  run  subsystem@  uevent&lt;br /&gt;
Try a 1Hz frequency with a 25% duty cycle&lt;br /&gt;
 bone$ '''echo 1000000000 &amp;gt; period_ns'''&lt;br /&gt;
 bone$ '''echo  250000000 &amp;gt; duty_ns'''&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; run'''&lt;br /&gt;
&lt;br /&gt;
Connect the LED from and watch it flash.  Try changing the frequency and duty cycle.  You may have to set the duty cycle to 0 to change the frequency.  Can you guess why?&lt;br /&gt;
&lt;br /&gt;
=== Challenge ===&lt;br /&gt;
Combine the analog in and the PWM by having the pot control the frequency or the duty cycle of the LED.&lt;br /&gt;
 &lt;br /&gt;
{{YoderFoot}}&lt;/div&gt;</summary>
		<author><name>Yoder</name></author>	</entry>

	<entry>
		<id>http://www.elinux.org/ASEE_2013_Workshop</id>
		<title>ASEE 2013 Workshop</title>
		<link rel="alternate" type="text/html" href="http://www.elinux.org/ASEE_2013_Workshop"/>
				<updated>2013-06-10T20:27:02Z</updated>
		
		<summary type="html">&lt;p&gt;Yoder: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:ECE497 |Workshop]]&lt;br /&gt;
{{YoderHead}}&lt;br /&gt;
Here are the labs for the afternoon Linux part of the [http://www.asee.org/public/conferences/20/registration/view_session?session_id=2420 ASEE 2013 Workshop]&lt;br /&gt;
&lt;br /&gt;
== Warm Up ==&lt;br /&gt;
[[File:PuTTYconfiguration.jpg|thumbnail]]&lt;br /&gt;
Before we can interact with LEDs and switches we need to learn some simple Linux commands. &lt;br /&gt;
# On your host computer, running Windows, start up '''puTTY'''.  &lt;br /&gt;
# If you get a ''Security Warning'', click '''Run'''.&lt;br /&gt;
# Enter '''192.167.7.2''' in the '''Host Name''' field and click '''Open'''&lt;br /&gt;
# Login as '''root''' with no password.&lt;br /&gt;
# Enter '''ls'''  to list what files you have. You shouldn't see much.&lt;br /&gt;
[[File:PuTTYloging.jpg|thumbnail]]&lt;br /&gt;
&lt;br /&gt;
At this point you need to learn a few simple Linux commands for creating and displaying files. Once you know these commands it's easy to turn an LED on and off.&lt;br /&gt;
&lt;br /&gt;
First, let's edit a file using the '''nano''' editor.  Nano is a simple editor that easy to learn. This will edit (and create) the file '''play'''.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''nano play'''&lt;br /&gt;
&lt;br /&gt;
Add a couple of lines of text to the file, it doesn't really matter what and then Exit. You can list the files in the current directory with '''ls''' and show the contents of a file with '''cat'''.&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 Desktop  play&lt;br /&gt;
 bone$ '''cat play'''&lt;br /&gt;
 A couple of lines&lt;br /&gt;
 of text.&lt;br /&gt;
&lt;br /&gt;
Use '''echo''' to print a line of text.&lt;br /&gt;
 bone$ '''echo This is a line of text'''&lt;br /&gt;
 This is a line of text&lt;br /&gt;
&lt;br /&gt;
Here's a powerful operator.  You can take the output of any command and redirect it to a file with '''&amp;gt;'''.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo This is a line of text &amp;gt; here'''&lt;br /&gt;
 bone$ '''cat here'''&lt;br /&gt;
 This is a line of text&lt;br /&gt;
&lt;br /&gt;
We are almost there.  Use '''cd''' to change directories.  '''/''' is the top level directory.&lt;br /&gt;
 bone$ '''cd /'''&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 bin   dev  home  lost+found  mnt   run   sys  usr&lt;br /&gt;
 boot  etc  lib   media       proc  sbin  tmp  var&lt;br /&gt;
&lt;br /&gt;
If you ever get lost, '''cd''' alone takes you home.&lt;br /&gt;
 bone$ '''cd'''&lt;br /&gt;
 gone$ '''ls'''&lt;br /&gt;
 Desktop  here  play&lt;br /&gt;
&lt;br /&gt;
Now you are ready to flash an LED.&lt;br /&gt;
&lt;br /&gt;
== Blinking an LED ==&lt;br /&gt;
=== gpio via the Shell Command Line and sysfs ===&lt;br /&gt;
&lt;br /&gt;
The easiest way to do general purpose I/O (gpio) on the Beagle is through a terminal window and a shell prompt. In Linux, almost everything is treated as a file, even things that aren't files. In our class we'll use a virtual file system called '''sysfs'''.  sysfs exposes the drivers for the hardware so you get easily use them.&lt;br /&gt;
&lt;br /&gt;
Try this:&lt;br /&gt;
 bone$ '''cd /sys'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 block/  bus/  class/  dev/  devices/  firmware/  fs/  kernel/  module/  power/&lt;br /&gt;
&lt;br /&gt;
Here we see several directories that represent hardware we can control. Explore a bit and see what you find.&lt;br /&gt;
&lt;br /&gt;
Now try:&lt;br /&gt;
&lt;br /&gt;
 beagle$ '''cd /sys/class'''&lt;br /&gt;
 beagle$ '''ls -F'''&lt;br /&gt;
 backlight/  firmware/     lcd/       mtd/           scsi_disk/   ubi/&lt;br /&gt;
 bdi/        gpio/         leds/      net/           scsi_host/   udc/&lt;br /&gt;
 block/      graphics/     mbox/      power_supply/  sound/       uio/&lt;br /&gt;
 bluetooth/  hwmon/        mdio_bus/  regulator/     spi_master/  usbmon/&lt;br /&gt;
 bsg/        i2c-adapter/  mem/       rfkill/        spidev/      vc/&lt;br /&gt;
 dma/        i2c-dev/      misc/      rtc/           thermal/     vtconsole/&lt;br /&gt;
 drm/        input/        mmc_host/  scsi_device/   tty/         watchdog/&lt;br /&gt;
&lt;br /&gt;
Explore some.  &lt;br /&gt;
&lt;br /&gt;
=== Blinking a USR LED ===&lt;br /&gt;
The Beagle Black has four user LEDS, '''user0''' - '''user3''', that you can control. Try this:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/class/leds'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 beaglebone:green:usr0  beaglebone:green:usr2&lt;br /&gt;
 beaglebone:green:usr1  beaglebone:green:usr3&lt;br /&gt;
&lt;br /&gt;
Here you see the directories for controlling each of the usr LEDs. By default, usr0 flashes a heartbeat pattern and usr1 flashes when the micro SD card is accessed.  Let's control usr0.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd beagleboard\:\:usr0'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 brightness  device@  max_brightness  power/  subsystem@  trigger  uevent&lt;br /&gt;
&lt;br /&gt;
See what's in '''brightness''', '''max_brightness''' and '''trigger''' by using the &amp;lt;code&amp;gt;cat&amp;lt;/code&amp;gt; command.  For example:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cat trigger'''&lt;br /&gt;
 none nand-disk mmc0 timer oneshot [heartbeat] backlight gpio cpu0 default-on transient&lt;br /&gt;
&lt;br /&gt;
This shows trigger can have many values.  The present value is '''heartbeat'''.  Check the LED, is it beating?  You can stop the heartbeat via:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo none &amp;gt; trigger'''&lt;br /&gt;
 bone$ '''cat trigger'''&lt;br /&gt;
 [none] nand-disk mmc0 timer oneshot heartbeat backlight gpio cpu0 default-on transient &lt;br /&gt;
&lt;br /&gt;
Did it stop beating?  You can now turn it on and off with:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; brightness'''&lt;br /&gt;
 bone$ '''echo 0 &amp;gt; brightness'''&lt;br /&gt;
&lt;br /&gt;
Is it responding correctly?&lt;br /&gt;
&lt;br /&gt;
The Bone has more trigger options.  Try:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cat trigger'''&lt;br /&gt;
 [none] mmc0 timer heartbeat backlight gpio default-on &lt;br /&gt;
 bone$ '''echo timer &amp;gt; trigger'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 brightness  delay_on  max_brightness  subsystem@  uevent&lt;br /&gt;
 delay_off   device@   power/          trigger&lt;br /&gt;
 bone$ '''echo 100 &amp;gt; delay_on'''&lt;br /&gt;
 bone$ '''echo 900 &amp;gt; delay_off'''&lt;br /&gt;
&lt;br /&gt;
What does this do?&lt;br /&gt;
&lt;br /&gt;
=== Blinking an External LED via gpio ===&lt;br /&gt;
&lt;br /&gt;
In the AM lab we wired an LED to the P9_12 General Purpose IO (gpio) port and controlled it via BoneScript.  Here we'll control it via a shell command. First we need to figure out which gpio pin P9_12 is attached to.  The following figure shows it attached to gpio_60.&lt;br /&gt;
&lt;br /&gt;
[[File:P9PWMs.jpg | 600px]]&lt;br /&gt;
&lt;br /&gt;
Here's how you turn it on&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/class/gpio'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  gpiochip0@  gpiochip32@  gpiochip64@  gpiochip96@  unexport&lt;br /&gt;
&lt;br /&gt;
Presently no gpio pins are visible.  You need to tell it which pin to export&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo 60 &amp;gt; export'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  gpio60@  gpiochip0@  gpiochip32@  gpiochip64@  gpiochip96@  unexport&lt;br /&gt;
&lt;br /&gt;
Notice '''gpio60''' has appeared.  All we need to do is tell it which direction and then turn it on.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd gpio60'''&lt;br /&gt;
 bone$ '''echo out &amp;gt; direction'''&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; value'''&lt;br /&gt;
&lt;br /&gt;
Your LED should be on!  When you are done you can unexport the pin and it will disappear.&lt;br /&gt;
 bone$ '''cd ..'''&lt;br /&gt;
 bone$ '''echo 60 &amp;gt; unexport'''&lt;br /&gt;
&lt;br /&gt;
== Reading a switch ==&lt;br /&gt;
&lt;br /&gt;
Now that you have an LED working, wiring in a switch is easy.  In the AM lab you wired a switch to P9_42, which from the table above is '''gpio_7'''. &lt;br /&gt;
&lt;br /&gt;
Based on what you saw above.&lt;br /&gt;
 bone$ '''cd /sys/class/gpio'''&lt;br /&gt;
 bone$ '''echo 7 &amp;gt; export'''&lt;br /&gt;
 bone$ '''cd gpio7'''&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 bone$ '''echo in &amp;gt; direction'''&lt;br /&gt;
 bone$ '''cat value'''&lt;br /&gt;
 0&lt;br /&gt;
Now hold the button down and try again.&lt;br /&gt;
 bone$ '''cat value'''&lt;br /&gt;
 1&lt;br /&gt;
Once you have the switch and LED working use '''nano''' and put the following in a file.&lt;br /&gt;
 bone$ '''nano flash.sh'''&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 cd /sys/class/gpio&lt;br /&gt;
 while [ 1 ]&lt;br /&gt;
 do&lt;br /&gt;
    cat gpio7/value &amp;gt; gpio60/value&lt;br /&gt;
    sleep 0.25&lt;br /&gt;
 done&lt;br /&gt;
Quit nano and run&lt;br /&gt;
 bone$ '''chmod +x flash.sh'''  (This makes flash.sh executable)&lt;br /&gt;
 bone$ '''./flash.sh'''&lt;br /&gt;
What happens when you push the button?&lt;br /&gt;
&lt;br /&gt;
Now experiment around. How fast can you flash the LED?&lt;br /&gt;
&lt;br /&gt;
== Analog In ==&lt;br /&gt;
The bone has eight Analog Inputs.  Several are exposed on P9.  They are labeled '''AIN''' in table 11 below.  How many do you find?&lt;br /&gt;
&lt;br /&gt;
[[File:P9PWMs.jpg|800px]]&lt;br /&gt;
&lt;br /&gt;
The AIN pins are sampled at 12 bits and 100k samples per second.  The input voltage is between 0 and 1.8V.  Fortunately, both voltages are available on P9.&lt;br /&gt;
&lt;br /&gt;
You've already wired these up for the AM lab. You interact with the analog in much like the gpio, but it appears in a different. We have to run a command before the AIN interface appears.  Just run them now, later I'll explain what you did if you are interested.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''SLOTS=/sys/devices/bone_capemgr.*/slots'''&lt;br /&gt;
 bone$ '''echo cape-bone-iio &amp;gt; $SLOTS'''&lt;br /&gt;
&lt;br /&gt;
You can now access the analog interface, let's explore.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/devices/ocp.2/helper.14'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 AIN0  AIN2  AIN4  AIN6  driver@   power/      uevent&lt;br /&gt;
 AIN1  AIN3  AIN5  AIN7  modalias  subsystem@&lt;br /&gt;
&lt;br /&gt;
There are the various analog inputs, but watch out.  This interface starts numbering at '''1''' and Table 11 starts at '''0''', so to read AIN5 you need to look at '''AIN6'''!&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cat AIN6'''&lt;br /&gt;
 1185&lt;br /&gt;
&lt;br /&gt;
Change the pot and rerun '''cat'''.  What's the min and max value you get?  Is it 12 bits?&lt;br /&gt;
&lt;br /&gt;
You can use the following script to continuously read the input.&lt;br /&gt;
 while [ 1 ]; do &lt;br /&gt;
   tr '\n' '\r' &amp;lt; AIN5&lt;br /&gt;
 done&lt;br /&gt;
&lt;br /&gt;
== Pulse Width Modulation ==&lt;br /&gt;
&lt;br /&gt;
{{YoderFoot}}&lt;/div&gt;</summary>
		<author><name>Yoder</name></author>	</entry>

	<entry>
		<id>http://www.elinux.org/ASEE_2013_Workshop</id>
		<title>ASEE 2013 Workshop</title>
		<link rel="alternate" type="text/html" href="http://www.elinux.org/ASEE_2013_Workshop"/>
				<updated>2013-06-10T19:04:39Z</updated>
		
		<summary type="html">&lt;p&gt;Yoder: /* Reading a switch */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:ECE497 |Workshop]]&lt;br /&gt;
{{YoderHead}}&lt;br /&gt;
Here are the labs for the afternoon Linux part of the [http://www.asee.org/public/conferences/20/registration/view_session?session_id=2420 ASEE 2013 Workshop]&lt;br /&gt;
&lt;br /&gt;
== Warm Up ==&lt;br /&gt;
[[File:PuTTYconfiguration.jpg|thumbnail]]&lt;br /&gt;
Before we can interact with LEDs and switches we need to learn some simple Linux commands. &lt;br /&gt;
# On your host computer, running Windows, start up '''puTTY'''.  &lt;br /&gt;
# If you get a ''Security Warning'', click '''Run'''.&lt;br /&gt;
# Enter '''192.167.7.2''' in the '''Host Name''' field and click '''Open'''&lt;br /&gt;
# Login as '''root''' with no password.&lt;br /&gt;
# Enter '''ls'''  to list what files you have. You shouldn't see much.&lt;br /&gt;
[[File:PuTTYloging.jpg|thumbnail]]&lt;br /&gt;
&lt;br /&gt;
At this point you need to learn a few simple Linux commands for creating and displaying files. Once you know these commands it's easy to turn an LED on and off.&lt;br /&gt;
&lt;br /&gt;
First, let's edit a file using the '''nano''' editor.  Nano is a simple editor that easy to learn. This will edit (and create) the file '''play'''.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''nano play'''&lt;br /&gt;
&lt;br /&gt;
Add a couple of lines of text to the file, it doesn't really matter what and then Exit. You can list the files in the current directory with '''ls''' and show the contents of a file with '''cat'''.&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 Desktop  play&lt;br /&gt;
 bone$ '''cat play'''&lt;br /&gt;
 A couple of lines&lt;br /&gt;
 of text.&lt;br /&gt;
&lt;br /&gt;
Use '''echo''' to print a line of text.&lt;br /&gt;
 bone$ '''echo This is a line of text'''&lt;br /&gt;
 This is a line of text&lt;br /&gt;
&lt;br /&gt;
Here's a powerful operator.  You can take the output of any command and redirect it to a file with '''&amp;gt;'''.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo This is a line of text &amp;gt; here'''&lt;br /&gt;
 bone$ '''cat here'''&lt;br /&gt;
 This is a line of text&lt;br /&gt;
&lt;br /&gt;
We are almost there.  Use '''cd''' to change directories.  '''/''' is the top level directory.&lt;br /&gt;
 bone$ '''cd /'''&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 bin   dev  home  lost+found  mnt   run   sys  usr&lt;br /&gt;
 boot  etc  lib   media       proc  sbin  tmp  var&lt;br /&gt;
&lt;br /&gt;
If you ever get lost, '''cd''' alone takes you home.&lt;br /&gt;
 bone$ '''cd'''&lt;br /&gt;
 gone$ '''ls'''&lt;br /&gt;
 Desktop  here  play&lt;br /&gt;
&lt;br /&gt;
Now you are ready to flash an LED.&lt;br /&gt;
&lt;br /&gt;
== Blinking an LED ==&lt;br /&gt;
=== gpio via the Shell Command Line and sysfs ===&lt;br /&gt;
&lt;br /&gt;
The easiest way to do general purpose I/O (gpio) on the Beagle is through a terminal window and a shell prompt. In Linux, almost everything is treated as a file, even things that aren't files. In our class we'll use a virtual file system called '''sysfs'''.  sysfs exposes the drivers for the hardware so you get easily use them.&lt;br /&gt;
&lt;br /&gt;
Try this:&lt;br /&gt;
 bone$ '''cd /sys'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 block/  bus/  class/  dev/  devices/  firmware/  fs/  kernel/  module/  power/&lt;br /&gt;
&lt;br /&gt;
Here we see several directories that represent hardware we can control. Explore a bit and see what you find.&lt;br /&gt;
&lt;br /&gt;
Now try:&lt;br /&gt;
&lt;br /&gt;
 beagle$ '''cd /sys/class'''&lt;br /&gt;
 beagle$ '''ls -F'''&lt;br /&gt;
 backlight/  firmware/     lcd/       mtd/           scsi_disk/   ubi/&lt;br /&gt;
 bdi/        gpio/         leds/      net/           scsi_host/   udc/&lt;br /&gt;
 block/      graphics/     mbox/      power_supply/  sound/       uio/&lt;br /&gt;
 bluetooth/  hwmon/        mdio_bus/  regulator/     spi_master/  usbmon/&lt;br /&gt;
 bsg/        i2c-adapter/  mem/       rfkill/        spidev/      vc/&lt;br /&gt;
 dma/        i2c-dev/      misc/      rtc/           thermal/     vtconsole/&lt;br /&gt;
 drm/        input/        mmc_host/  scsi_device/   tty/         watchdog/&lt;br /&gt;
&lt;br /&gt;
Explore some.  &lt;br /&gt;
&lt;br /&gt;
=== Blinking a USR LED ===&lt;br /&gt;
The Beagle Black has four user LEDS, '''user0''' - '''user3''', that you can control. Try this:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/class/leds'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 beaglebone:green:usr0  beaglebone:green:usr2&lt;br /&gt;
 beaglebone:green:usr1  beaglebone:green:usr3&lt;br /&gt;
&lt;br /&gt;
Here you see the directories for controlling each of the usr LEDs. By default, usr0 flashes a heartbeat pattern and usr1 flashes when the micro SD card is accessed.  Let's control usr0.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd beagleboard\:\:usr0'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 brightness  device@  max_brightness  power/  subsystem@  trigger  uevent&lt;br /&gt;
&lt;br /&gt;
See what's in '''brightness''', '''max_brightness''' and '''trigger''' by using the &amp;lt;code&amp;gt;cat&amp;lt;/code&amp;gt; command.  For example:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cat trigger'''&lt;br /&gt;
 none nand-disk mmc0 timer oneshot [heartbeat] backlight gpio cpu0 default-on transient&lt;br /&gt;
&lt;br /&gt;
This shows trigger can have many values.  The present value is '''heartbeat'''.  Check the LED, is it beating?  You can stop the heartbeat via:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo none &amp;gt; trigger'''&lt;br /&gt;
 bone$ '''cat trigger'''&lt;br /&gt;
 [none] nand-disk mmc0 timer oneshot heartbeat backlight gpio cpu0 default-on transient &lt;br /&gt;
&lt;br /&gt;
Did it stop beating?  You can now turn it on and off with:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; brightness'''&lt;br /&gt;
 bone$ '''echo 0 &amp;gt; brightness'''&lt;br /&gt;
&lt;br /&gt;
Is it responding correctly?&lt;br /&gt;
&lt;br /&gt;
The Bone has more trigger options.  Try:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cat trigger'''&lt;br /&gt;
 [none] mmc0 timer heartbeat backlight gpio default-on &lt;br /&gt;
 bone$ '''echo timer &amp;gt; trigger'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 brightness  delay_on  max_brightness  subsystem@  uevent&lt;br /&gt;
 delay_off   device@   power/          trigger&lt;br /&gt;
 bone$ '''echo 100 &amp;gt; delay_on'''&lt;br /&gt;
 bone$ '''echo 900 &amp;gt; delay_off'''&lt;br /&gt;
&lt;br /&gt;
What does this do?&lt;br /&gt;
&lt;br /&gt;
=== Blinking an External LED via gpio ===&lt;br /&gt;
&lt;br /&gt;
In the AM lab we wired an LED to the P9_12 General Purpose IO (gpio) port and controlled it via BoneScript.  Here we'll control it via a shell command. First we need to figure out which gpio pin P9_12 is attached to.  The following figure shows it attached to gpio_60.&lt;br /&gt;
&lt;br /&gt;
[[File:P9PWMs.jpg | 600px]]&lt;br /&gt;
&lt;br /&gt;
Here's how you turn it on&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/class/gpio'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  gpiochip0@  gpiochip32@  gpiochip64@  gpiochip96@  unexport&lt;br /&gt;
&lt;br /&gt;
Presently no gpio pins are visible.  You need to tell it which pin to export&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo 60 &amp;gt; export'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  gpio60@  gpiochip0@  gpiochip32@  gpiochip64@  gpiochip96@  unexport&lt;br /&gt;
&lt;br /&gt;
Notice '''gpio60''' has appeared.  All we need to do is tell it which direction and then turn it on.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd gpio60'''&lt;br /&gt;
 bone$ '''echo out &amp;gt; direction'''&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; value'''&lt;br /&gt;
&lt;br /&gt;
Your LED should be on!  When you are done you can unexport the pin and it will disappear.&lt;br /&gt;
 bone$ '''cd ..'''&lt;br /&gt;
 bone$ '''echo 60 &amp;gt; unexport'''&lt;br /&gt;
&lt;br /&gt;
== Reading a switch ==&lt;br /&gt;
&lt;br /&gt;
Now that you have an LED working, wiring in a switch is easy.  In the AM lab you wired a switch to P9_42, which from the table above is '''gpio_7'''. &lt;br /&gt;
&lt;br /&gt;
Based on what you saw above.&lt;br /&gt;
 bone$ '''cd /sys/class/gpio'''&lt;br /&gt;
 bone$ '''echo 7 &amp;gt; export'''&lt;br /&gt;
 bone$ '''cd gpio7'''&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 bone$ '''echo in &amp;gt; direction'''&lt;br /&gt;
 bone$ '''cat value'''&lt;br /&gt;
 0&lt;br /&gt;
Now hold the button down and try again.&lt;br /&gt;
 bone$ '''cat value'''&lt;br /&gt;
 1&lt;br /&gt;
Once you have the switch and LED working use '''nano''' and put the following in a file.&lt;br /&gt;
 bone$ '''nano flash.sh'''&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 cd /sys/class/gpio&lt;br /&gt;
 while [ 1 ]&lt;br /&gt;
 do&lt;br /&gt;
    cat gpio7/value &amp;gt; gpio60/value&lt;br /&gt;
    sleep 0.25&lt;br /&gt;
 done&lt;br /&gt;
Quit nano and run&lt;br /&gt;
 bone$ '''chmod +x flash.sh'''  (This makes flash.sh executable)&lt;br /&gt;
 bone$ '''./flash.sh'''&lt;br /&gt;
What happens when you push the button?&lt;br /&gt;
&lt;br /&gt;
Now experiment around. How fast can you flash the LED?&lt;br /&gt;
&lt;br /&gt;
== Analog In ==&lt;br /&gt;
&lt;br /&gt;
== Pulse Width Modulation ==&lt;br /&gt;
&lt;br /&gt;
{{YoderFoot}}&lt;/div&gt;</summary>
		<author><name>Yoder</name></author>	</entry>

	<entry>
		<id>http://www.elinux.org/ASEE_2013_Workshop</id>
		<title>ASEE 2013 Workshop</title>
		<link rel="alternate" type="text/html" href="http://www.elinux.org/ASEE_2013_Workshop"/>
				<updated>2013-06-10T18:39:10Z</updated>
		
		<summary type="html">&lt;p&gt;Yoder: /* Reading a Switch */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:ECE497 |Workshop]]&lt;br /&gt;
{{YoderHead}}&lt;br /&gt;
Here are the labs for the afternoon Linux part of the [http://www.asee.org/public/conferences/20/registration/view_session?session_id=2420 ASEE 2013 Workshop]&lt;br /&gt;
&lt;br /&gt;
== Warm Up ==&lt;br /&gt;
[[File:PuTTYconfiguration.jpg|thumbnail]]&lt;br /&gt;
Before we can interact with LEDs and switches we need to learn some simple Linux commands. &lt;br /&gt;
# On your host computer, running Windows, start up '''puTTY'''.  &lt;br /&gt;
# If you get a ''Security Warning'', click '''Run'''.&lt;br /&gt;
# Enter '''192.167.7.2''' in the '''Host Name''' field and click '''Open'''&lt;br /&gt;
# Login as '''root''' with no password.&lt;br /&gt;
# Enter '''ls'''  to list what files you have. You shouldn't see much.&lt;br /&gt;
[[File:PuTTYloging.jpg|thumbnail]]&lt;br /&gt;
&lt;br /&gt;
At this point you need to learn a few simple Linux commands for creating and displaying files. Once you know these commands it's easy to turn an LED on and off.&lt;br /&gt;
&lt;br /&gt;
First, let's edit a file using the '''nano''' editor.  Nano is a simple editor that easy to learn. This will edit (and create) the file '''play'''.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''nano play'''&lt;br /&gt;
&lt;br /&gt;
Add a couple of lines of text to the file, it doesn't really matter what and then Exit. You can list the files in the current directory with '''ls''' and show the contents of a file with '''cat'''.&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 Desktop  play&lt;br /&gt;
 bone$ '''cat play'''&lt;br /&gt;
 A couple of lines&lt;br /&gt;
 of text.&lt;br /&gt;
&lt;br /&gt;
Use '''echo''' to print a line of text.&lt;br /&gt;
 bone$ '''echo This is a line of text'''&lt;br /&gt;
 This is a line of text&lt;br /&gt;
&lt;br /&gt;
Here's a powerful operator.  You can take the output of any command and redirect it to a file with '''&amp;gt;'''.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo This is a line of text &amp;gt; here'''&lt;br /&gt;
 bone$ '''cat here'''&lt;br /&gt;
 This is a line of text&lt;br /&gt;
&lt;br /&gt;
We are almost there.  Use '''cd''' to change directories.  '''/''' is the top level directory.&lt;br /&gt;
 bone$ '''cd /'''&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 bin   dev  home  lost+found  mnt   run   sys  usr&lt;br /&gt;
 boot  etc  lib   media       proc  sbin  tmp  var&lt;br /&gt;
&lt;br /&gt;
If you ever get lost, '''cd''' alone takes you home.&lt;br /&gt;
 bone$ '''cd'''&lt;br /&gt;
 gone$ '''ls'''&lt;br /&gt;
 Desktop  here  play&lt;br /&gt;
&lt;br /&gt;
Now you are ready to flash an LED.&lt;br /&gt;
&lt;br /&gt;
== Blinking an LED ==&lt;br /&gt;
=== gpio via the Shell Command Line and sysfs ===&lt;br /&gt;
&lt;br /&gt;
The easiest way to do general purpose I/O (gpio) on the Beagle is through a terminal window and a shell prompt. In Linux, almost everything is treated as a file, even things that aren't files. In our class we'll use a virtual file system called '''sysfs'''.  sysfs exposes the drivers for the hardware so you get easily use them.&lt;br /&gt;
&lt;br /&gt;
Try this:&lt;br /&gt;
 bone$ '''cd /sys'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 block/  bus/  class/  dev/  devices/  firmware/  fs/  kernel/  module/  power/&lt;br /&gt;
&lt;br /&gt;
Here we see several directories that represent hardware we can control. Explore a bit and see what you find.&lt;br /&gt;
&lt;br /&gt;
Now try:&lt;br /&gt;
&lt;br /&gt;
 beagle$ '''cd /sys/class'''&lt;br /&gt;
 beagle$ '''ls -F'''&lt;br /&gt;
 backlight/  firmware/     lcd/       mtd/           scsi_disk/   ubi/&lt;br /&gt;
 bdi/        gpio/         leds/      net/           scsi_host/   udc/&lt;br /&gt;
 block/      graphics/     mbox/      power_supply/  sound/       uio/&lt;br /&gt;
 bluetooth/  hwmon/        mdio_bus/  regulator/     spi_master/  usbmon/&lt;br /&gt;
 bsg/        i2c-adapter/  mem/       rfkill/        spidev/      vc/&lt;br /&gt;
 dma/        i2c-dev/      misc/      rtc/           thermal/     vtconsole/&lt;br /&gt;
 drm/        input/        mmc_host/  scsi_device/   tty/         watchdog/&lt;br /&gt;
&lt;br /&gt;
Explore some.  &lt;br /&gt;
&lt;br /&gt;
=== Blinking a USR LED ===&lt;br /&gt;
The Beagle Black has four user LEDS, '''user0''' - '''user3''', that you can control. Try this:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/class/leds'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 beaglebone:green:usr0  beaglebone:green:usr2&lt;br /&gt;
 beaglebone:green:usr1  beaglebone:green:usr3&lt;br /&gt;
&lt;br /&gt;
Here you see the directories for controlling each of the usr LEDs. By default, usr0 flashes a heartbeat pattern and usr1 flashes when the micro SD card is accessed.  Let's control usr0.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd beagleboard\:\:usr0'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 brightness  device@  max_brightness  power/  subsystem@  trigger  uevent&lt;br /&gt;
&lt;br /&gt;
See what's in '''brightness''', '''max_brightness''' and '''trigger''' by using the &amp;lt;code&amp;gt;cat&amp;lt;/code&amp;gt; command.  For example:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cat trigger'''&lt;br /&gt;
 none nand-disk mmc0 timer oneshot [heartbeat] backlight gpio cpu0 default-on transient&lt;br /&gt;
&lt;br /&gt;
This shows trigger can have many values.  The present value is '''heartbeat'''.  Check the LED, is it beating?  You can stop the heartbeat via:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo none &amp;gt; trigger'''&lt;br /&gt;
 bone$ '''cat trigger'''&lt;br /&gt;
 [none] nand-disk mmc0 timer oneshot heartbeat backlight gpio cpu0 default-on transient &lt;br /&gt;
&lt;br /&gt;
Did it stop beating?  You can now turn it on and off with:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; brightness'''&lt;br /&gt;
 bone$ '''echo 0 &amp;gt; brightness'''&lt;br /&gt;
&lt;br /&gt;
Is it responding correctly?&lt;br /&gt;
&lt;br /&gt;
The Bone has more trigger options.  Try:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cat trigger'''&lt;br /&gt;
 [none] mmc0 timer heartbeat backlight gpio default-on &lt;br /&gt;
 bone$ '''echo timer &amp;gt; trigger'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 brightness  delay_on  max_brightness  subsystem@  uevent&lt;br /&gt;
 delay_off   device@   power/          trigger&lt;br /&gt;
 bone$ '''echo 100 &amp;gt; delay_on'''&lt;br /&gt;
 bone$ '''echo 900 &amp;gt; delay_off'''&lt;br /&gt;
&lt;br /&gt;
What does this do?&lt;br /&gt;
&lt;br /&gt;
=== Blinking an External LED via gpio ===&lt;br /&gt;
&lt;br /&gt;
In the AM lab we wired an LED to the P9_12 General Purpose IO (gpio) port and controlled it via BoneScript.  Here we'll control it via a shell command. First we need to figure out which gpio pin P9_12 is attached to.  The following figure shows it attached to gpio_60.&lt;br /&gt;
&lt;br /&gt;
[[File:P9PWMs.jpg | 600px]]&lt;br /&gt;
&lt;br /&gt;
Here's how you turn it on&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/class/gpio'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  gpiochip0@  gpiochip32@  gpiochip64@  gpiochip96@  unexport&lt;br /&gt;
&lt;br /&gt;
Presently no gpio pins are visible.  You need to tell it which pin to export&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo 60 &amp;gt; export'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  gpio60@  gpiochip0@  gpiochip32@  gpiochip64@  gpiochip96@  unexport&lt;br /&gt;
&lt;br /&gt;
Notice '''gpio60''' has appeared.  All we need to do is tell it which direction and then turn it on.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd gpio60'''&lt;br /&gt;
 bone$ '''echo out &amp;gt; direction'''&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; value'''&lt;br /&gt;
&lt;br /&gt;
Your LED should be on!  When you are done you can unexport the pin and it will disappear.&lt;br /&gt;
 bone$ '''cd ..'''&lt;br /&gt;
 bone$ '''echo 60 &amp;gt; unexport'''&lt;br /&gt;
&lt;br /&gt;
== Reading a switch ==&lt;br /&gt;
&lt;br /&gt;
Now that you have an LED working, wiring in a switch is easy.  In the AM lab you wired a switch to P9_42, which from the table above is '''gpio_7'''. &lt;br /&gt;
&lt;br /&gt;
Based on what you saw above.&lt;br /&gt;
 bone$ '''cd /sys/class/gpio'''&lt;br /&gt;
 bone$ '''echo 7 &amp;gt; export'''&lt;br /&gt;
 bone$ '''cd gpio7'''&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 bone$ '''cat value'''&lt;br /&gt;
 0&lt;br /&gt;
Now hold the button down and try again.&lt;br /&gt;
 bone$ '''cat value'''&lt;br /&gt;
 1&lt;br /&gt;
Once you have the switch and LED working use '''nano''' and put the following in a file.&lt;br /&gt;
 bone$ '''nano flash.sh'''&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 cd /sys/class/gpio&lt;br /&gt;
 while [ 1 ]&lt;br /&gt;
 do&lt;br /&gt;
    cat gpio7/value &amp;gt; gpio60/value&lt;br /&gt;
    sleep 0.25&lt;br /&gt;
 done&lt;br /&gt;
Quit nano and run&lt;br /&gt;
 bone$ '''chmod +x flash.sh'''  (This makes flash.sh executable)&lt;br /&gt;
 bone$ '''./flash.sh'''&lt;br /&gt;
What happens when you push the button?&lt;br /&gt;
&lt;br /&gt;
Now experiment around. How fast can you flash the LED?&lt;br /&gt;
&lt;br /&gt;
== Analog In ==&lt;br /&gt;
&lt;br /&gt;
== Pulse Width Modulation ==&lt;br /&gt;
&lt;br /&gt;
{{YoderFoot}}&lt;/div&gt;</summary>
		<author><name>Yoder</name></author>	</entry>

	<entry>
		<id>http://www.elinux.org/ASEE_2013_Workshop</id>
		<title>ASEE 2013 Workshop</title>
		<link rel="alternate" type="text/html" href="http://www.elinux.org/ASEE_2013_Workshop"/>
				<updated>2013-06-10T18:29:55Z</updated>
		
		<summary type="html">&lt;p&gt;Yoder: /* Blinking an LED */ Initial page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:ECE497 |Workshop]]&lt;br /&gt;
{{YoderHead}}&lt;br /&gt;
Here are the labs for the afternoon Linux part of the [http://www.asee.org/public/conferences/20/registration/view_session?session_id=2420 ASEE 2013 Workshop]&lt;br /&gt;
&lt;br /&gt;
== Warm Up ==&lt;br /&gt;
[[File:PuTTYconfiguration.jpg|thumbnail]]&lt;br /&gt;
Before we can interact with LEDs and switches we need to learn some simple Linux commands. &lt;br /&gt;
# On your host computer, running Windows, start up '''puTTY'''.  &lt;br /&gt;
# If you get a ''Security Warning'', click '''Run'''.&lt;br /&gt;
# Enter '''192.167.7.2''' in the '''Host Name''' field and click '''Open'''&lt;br /&gt;
# Login as '''root''' with no password.&lt;br /&gt;
# Enter '''ls'''  to list what files you have. You shouldn't see much.&lt;br /&gt;
[[File:PuTTYloging.jpg|thumbnail]]&lt;br /&gt;
&lt;br /&gt;
At this point you need to learn a few simple Linux commands for creating and displaying files. Once you know these commands it's easy to turn an LED on and off.&lt;br /&gt;
&lt;br /&gt;
First, let's edit a file using the '''nano''' editor.  Nano is a simple editor that easy to learn. This will edit (and create) the file '''play'''.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''nano play'''&lt;br /&gt;
&lt;br /&gt;
Add a couple of lines of text to the file, it doesn't really matter what and then Exit. You can list the files in the current directory with '''ls''' and show the contents of a file with '''cat'''.&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 Desktop  play&lt;br /&gt;
 bone$ '''cat play'''&lt;br /&gt;
 A couple of lines&lt;br /&gt;
 of text.&lt;br /&gt;
&lt;br /&gt;
Use '''echo''' to print a line of text.&lt;br /&gt;
 bone$ '''echo This is a line of text'''&lt;br /&gt;
 This is a line of text&lt;br /&gt;
&lt;br /&gt;
Here's a powerful operator.  You can take the output of any command and redirect it to a file with '''&amp;gt;'''.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo This is a line of text &amp;gt; here'''&lt;br /&gt;
 bone$ '''cat here'''&lt;br /&gt;
 This is a line of text&lt;br /&gt;
&lt;br /&gt;
We are almost there.  Use '''cd''' to change directories.  '''/''' is the top level directory.&lt;br /&gt;
 bone$ '''cd /'''&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 bin   dev  home  lost+found  mnt   run   sys  usr&lt;br /&gt;
 boot  etc  lib   media       proc  sbin  tmp  var&lt;br /&gt;
&lt;br /&gt;
If you ever get lost, '''cd''' alone takes you home.&lt;br /&gt;
 bone$ '''cd'''&lt;br /&gt;
 gone$ '''ls'''&lt;br /&gt;
 Desktop  here  play&lt;br /&gt;
&lt;br /&gt;
Now you are ready to flash an LED.&lt;br /&gt;
&lt;br /&gt;
== Blinking an LED ==&lt;br /&gt;
=== gpio via the Shell Command Line and sysfs ===&lt;br /&gt;
&lt;br /&gt;
The easiest way to do general purpose I/O (gpio) on the Beagle is through a terminal window and a shell prompt. In Linux, almost everything is treated as a file, even things that aren't files. In our class we'll use a virtual file system called '''sysfs'''.  sysfs exposes the drivers for the hardware so you get easily use them.&lt;br /&gt;
&lt;br /&gt;
Try this:&lt;br /&gt;
 bone$ '''cd /sys'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 block/  bus/  class/  dev/  devices/  firmware/  fs/  kernel/  module/  power/&lt;br /&gt;
&lt;br /&gt;
Here we see several directories that represent hardware we can control. Explore a bit and see what you find.&lt;br /&gt;
&lt;br /&gt;
Now try:&lt;br /&gt;
&lt;br /&gt;
 beagle$ '''cd /sys/class'''&lt;br /&gt;
 beagle$ '''ls -F'''&lt;br /&gt;
 backlight/  firmware/     lcd/       mtd/           scsi_disk/   ubi/&lt;br /&gt;
 bdi/        gpio/         leds/      net/           scsi_host/   udc/&lt;br /&gt;
 block/      graphics/     mbox/      power_supply/  sound/       uio/&lt;br /&gt;
 bluetooth/  hwmon/        mdio_bus/  regulator/     spi_master/  usbmon/&lt;br /&gt;
 bsg/        i2c-adapter/  mem/       rfkill/        spidev/      vc/&lt;br /&gt;
 dma/        i2c-dev/      misc/      rtc/           thermal/     vtconsole/&lt;br /&gt;
 drm/        input/        mmc_host/  scsi_device/   tty/         watchdog/&lt;br /&gt;
&lt;br /&gt;
Explore some.  &lt;br /&gt;
&lt;br /&gt;
=== Blinking a USR LED ===&lt;br /&gt;
The Beagle Black has four user LEDS, '''user0''' - '''user3''', that you can control. Try this:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/class/leds'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 beaglebone:green:usr0  beaglebone:green:usr2&lt;br /&gt;
 beaglebone:green:usr1  beaglebone:green:usr3&lt;br /&gt;
&lt;br /&gt;
Here you see the directories for controlling each of the usr LEDs. By default, usr0 flashes a heartbeat pattern and usr1 flashes when the micro SD card is accessed.  Let's control usr0.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd beagleboard\:\:usr0'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 brightness  device@  max_brightness  power/  subsystem@  trigger  uevent&lt;br /&gt;
&lt;br /&gt;
See what's in '''brightness''', '''max_brightness''' and '''trigger''' by using the &amp;lt;code&amp;gt;cat&amp;lt;/code&amp;gt; command.  For example:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cat trigger'''&lt;br /&gt;
 none nand-disk mmc0 timer oneshot [heartbeat] backlight gpio cpu0 default-on transient&lt;br /&gt;
&lt;br /&gt;
This shows trigger can have many values.  The present value is '''heartbeat'''.  Check the LED, is it beating?  You can stop the heartbeat via:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo none &amp;gt; trigger'''&lt;br /&gt;
 bone$ '''cat trigger'''&lt;br /&gt;
 [none] nand-disk mmc0 timer oneshot heartbeat backlight gpio cpu0 default-on transient &lt;br /&gt;
&lt;br /&gt;
Did it stop beating?  You can now turn it on and off with:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; brightness'''&lt;br /&gt;
 bone$ '''echo 0 &amp;gt; brightness'''&lt;br /&gt;
&lt;br /&gt;
Is it responding correctly?&lt;br /&gt;
&lt;br /&gt;
The Bone has more trigger options.  Try:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cat trigger'''&lt;br /&gt;
 [none] mmc0 timer heartbeat backlight gpio default-on &lt;br /&gt;
 bone$ '''echo timer &amp;gt; trigger'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 brightness  delay_on  max_brightness  subsystem@  uevent&lt;br /&gt;
 delay_off   device@   power/          trigger&lt;br /&gt;
 bone$ '''echo 100 &amp;gt; delay_on'''&lt;br /&gt;
 bone$ '''echo 900 &amp;gt; delay_off'''&lt;br /&gt;
&lt;br /&gt;
What does this do?&lt;br /&gt;
&lt;br /&gt;
=== Blinking an External LED via gpio ===&lt;br /&gt;
&lt;br /&gt;
In the AM lab we wired an LED to the P9_12 General Purpose IO (gpio) port and controlled it via BoneScript.  Here we'll control it via a shell command. First we need to figure out which gpio pin P9_12 is attached to.  The following figure shows it attached to gpio_60.&lt;br /&gt;
&lt;br /&gt;
[[File:P9PWMs.jpg | 600px]]&lt;br /&gt;
&lt;br /&gt;
Here's how you turn it on&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/class/gpio'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  gpiochip0@  gpiochip32@  gpiochip64@  gpiochip96@  unexport&lt;br /&gt;
&lt;br /&gt;
Presently no gpio pins are visible.  You need to tell it which pin to export&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo 60 &amp;gt; export'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 export  gpio60@  gpiochip0@  gpiochip32@  gpiochip64@  gpiochip96@  unexport&lt;br /&gt;
&lt;br /&gt;
Notice '''gpio60''' has appeared.  All we need to do is tell it which direction and then turn it on.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd gpio60'''&lt;br /&gt;
 bone$ '''echo out &amp;gt; direction'''&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; value'''&lt;br /&gt;
&lt;br /&gt;
Your LED should be on!  When you are done you can unexport the pin and it will disappear.&lt;br /&gt;
 bone$ '''cd ..'''&lt;br /&gt;
 bone$ '''echo 60 &amp;gt; unexport'''&lt;br /&gt;
&lt;br /&gt;
== Reading a Switch ==&lt;br /&gt;
&lt;br /&gt;
== Analog In ==&lt;br /&gt;
&lt;br /&gt;
== Pulse Width Modulation ==&lt;br /&gt;
&lt;br /&gt;
{{YoderFoot}}&lt;/div&gt;</summary>
		<author><name>Yoder</name></author>	</entry>

	<entry>
		<id>http://www.elinux.org/File:P9PWMs.jpg</id>
		<title>File:P9PWMs.jpg</title>
		<link rel="alternate" type="text/html" href="http://www.elinux.org/File:P9PWMs.jpg"/>
				<updated>2013-06-10T18:19:49Z</updated>
		
		<summary type="html">&lt;p&gt;Yoder: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Yoder</name></author>	</entry>

	<entry>
		<id>http://www.elinux.org/ASEE_2013_Workshop</id>
		<title>ASEE 2013 Workshop</title>
		<link rel="alternate" type="text/html" href="http://www.elinux.org/ASEE_2013_Workshop"/>
				<updated>2013-06-10T18:09:37Z</updated>
		
		<summary type="html">&lt;p&gt;Yoder: /* Blinking an LED */ Initial page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:ECE497 |Workshop]]&lt;br /&gt;
{{YoderHead}}&lt;br /&gt;
Here are the labs for the afternoon Linux part of the [http://www.asee.org/public/conferences/20/registration/view_session?session_id=2420 ASEE 2013 Workshop]&lt;br /&gt;
&lt;br /&gt;
== Warm Up ==&lt;br /&gt;
[[File:PuTTYconfiguration.jpg|thumbnail]]&lt;br /&gt;
Before we can interact with LEDs and switches we need to learn some simple Linux commands. &lt;br /&gt;
# On your host computer, running Windows, start up '''puTTY'''.  &lt;br /&gt;
# If you get a ''Security Warning'', click '''Run'''.&lt;br /&gt;
# Enter '''192.167.7.2''' in the '''Host Name''' field and click '''Open'''&lt;br /&gt;
# Login as '''root''' with no password.&lt;br /&gt;
# Enter '''ls'''  to list what files you have. You shouldn't see much.&lt;br /&gt;
[[File:PuTTYloging.jpg|thumbnail]]&lt;br /&gt;
&lt;br /&gt;
At this point you need to learn a few simple Linux commands for creating and displaying files. Once you know these commands it's easy to turn an LED on and off.&lt;br /&gt;
&lt;br /&gt;
First, let's edit a file using the '''nano''' editor.  Nano is a simple editor that easy to learn. This will edit (and create) the file '''play'''.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''nano play'''&lt;br /&gt;
&lt;br /&gt;
Add a couple of lines of text to the file, it doesn't really matter what and then Exit. You can list the files in the current directory with '''ls''' and show the contents of a file with '''cat'''.&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 Desktop  play&lt;br /&gt;
 bone$ '''cat play'''&lt;br /&gt;
 A couple of lines&lt;br /&gt;
 of text.&lt;br /&gt;
&lt;br /&gt;
Use '''echo''' to print a line of text.&lt;br /&gt;
 bone$ '''echo This is a line of text'''&lt;br /&gt;
 This is a line of text&lt;br /&gt;
&lt;br /&gt;
Here's a powerful operator.  You can take the output of any command and redirect it to a file with '''&amp;gt;'''.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo This is a line of text &amp;gt; here'''&lt;br /&gt;
 bone$ '''cat here'''&lt;br /&gt;
 This is a line of text&lt;br /&gt;
&lt;br /&gt;
We are almost there.  Use '''cd''' to change directories.  '''/''' is the top level directory.&lt;br /&gt;
 bone$ '''cd /'''&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 bin   dev  home  lost+found  mnt   run   sys  usr&lt;br /&gt;
 boot  etc  lib   media       proc  sbin  tmp  var&lt;br /&gt;
&lt;br /&gt;
If you ever get lost, '''cd''' alone takes you home.&lt;br /&gt;
 bone$ '''cd'''&lt;br /&gt;
 gone$ '''ls'''&lt;br /&gt;
 Desktop  here  play&lt;br /&gt;
&lt;br /&gt;
Now you are ready to flash an LED.&lt;br /&gt;
&lt;br /&gt;
== Blinking an LED ==&lt;br /&gt;
=== gpio via the Shell Command Line and sysfs ===&lt;br /&gt;
&lt;br /&gt;
The easiest way to do general purpose I/O (gpio) on the Beagle is through a terminal window and a shell prompt. In Linux, almost everything is treated as a file, even things that aren't files. In our class we'll use a virtual file system called '''sysfs'''.  sysfs exposes the drivers for the hardware so you get easily use them.&lt;br /&gt;
&lt;br /&gt;
Try this:&lt;br /&gt;
 bone$ '''cd /sys'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 block/  bus/  class/  dev/  devices/  firmware/  fs/  kernel/  module/  power/&lt;br /&gt;
&lt;br /&gt;
Here we see several directories that represent hardware we can control. Explore a bit and see what you find.&lt;br /&gt;
&lt;br /&gt;
Now try:&lt;br /&gt;
&lt;br /&gt;
 beagle$ '''cd /sys/class'''&lt;br /&gt;
 beagle$ '''ls -F'''&lt;br /&gt;
 backlight/  firmware/     lcd/       mtd/           scsi_disk/   ubi/&lt;br /&gt;
 bdi/        gpio/         leds/      net/           scsi_host/   udc/&lt;br /&gt;
 block/      graphics/     mbox/      power_supply/  sound/       uio/&lt;br /&gt;
 bluetooth/  hwmon/        mdio_bus/  regulator/     spi_master/  usbmon/&lt;br /&gt;
 bsg/        i2c-adapter/  mem/       rfkill/        spidev/      vc/&lt;br /&gt;
 dma/        i2c-dev/      misc/      rtc/           thermal/     vtconsole/&lt;br /&gt;
 drm/        input/        mmc_host/  scsi_device/   tty/         watchdog/&lt;br /&gt;
&lt;br /&gt;
Explore some.  &lt;br /&gt;
&lt;br /&gt;
The Beagle Black has four user LEDS, '''user0''' - '''user3''', that you can control. Try this:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/class/leds'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 beaglebone:green:usr0  beaglebone:green:usr2&lt;br /&gt;
 beaglebone:green:usr1  beaglebone:green:usr3&lt;br /&gt;
&lt;br /&gt;
Here you see the directories for controlling each of the usr LEDs. By default, usr0 flashes a heartbeat pattern and usr1 flashes when the micro SD card is accessed.  Let's control usr0.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd beagleboard\:\:usr0'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 brightness  device@  max_brightness  power/  subsystem@  trigger  uevent&lt;br /&gt;
&lt;br /&gt;
See what's in '''brightness''', '''max_brightness''' and '''trigger''' by using the &amp;lt;code&amp;gt;cat&amp;lt;/code&amp;gt; command.  For example:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cat trigger'''&lt;br /&gt;
 none nand-disk mmc0 timer oneshot [heartbeat] backlight gpio cpu0 default-on transient&lt;br /&gt;
&lt;br /&gt;
This shows trigger can have many values.  The present value is '''heartbeat'''.  Check the LED, is it beating?  You can stop the heartbeat via:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo none &amp;gt; trigger'''&lt;br /&gt;
 bone$ '''cat trigger'''&lt;br /&gt;
 [none] nand-disk mmc0 timer oneshot heartbeat backlight gpio cpu0 default-on transient &lt;br /&gt;
&lt;br /&gt;
Did it stop beating?  You can now turn it on and off with:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo 1 &amp;gt; brightness'''&lt;br /&gt;
 bone$ '''echo 0 &amp;gt; brightness'''&lt;br /&gt;
&lt;br /&gt;
Is it responding correctly?&lt;br /&gt;
&lt;br /&gt;
The Bone has more trigger options.  Try:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cat trigger'''&lt;br /&gt;
 [none] mmc0 timer heartbeat backlight gpio default-on &lt;br /&gt;
 bone$ '''echo timer &amp;gt; trigger'''&lt;br /&gt;
 bone$ '''ls -F'''&lt;br /&gt;
 brightness  delay_on  max_brightness  subsystem@  uevent&lt;br /&gt;
 delay_off   device@   power/          trigger&lt;br /&gt;
 bone$ '''echo 100 &amp;gt; delay_on'''&lt;br /&gt;
 bone$ '''echo 900 &amp;gt; delay_off'''&lt;br /&gt;
&lt;br /&gt;
What does this do?&lt;br /&gt;
&lt;br /&gt;
== Reading a Switch ==&lt;br /&gt;
&lt;br /&gt;
== Analog In ==&lt;br /&gt;
&lt;br /&gt;
== Pulse Width Modulation ==&lt;br /&gt;
&lt;br /&gt;
{{YoderFoot}}&lt;/div&gt;</summary>
		<author><name>Yoder</name></author>	</entry>

	<entry>
		<id>http://www.elinux.org/ASEE_2013_Workshop</id>
		<title>ASEE 2013 Workshop</title>
		<link rel="alternate" type="text/html" href="http://www.elinux.org/ASEE_2013_Workshop"/>
				<updated>2013-06-10T18:03:33Z</updated>
		
		<summary type="html">&lt;p&gt;Yoder: /* Warm Up */ Initial page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:ECE497 |Workshop]]&lt;br /&gt;
{{YoderHead}}&lt;br /&gt;
Here are the labs for the afternoon Linux part of the [http://www.asee.org/public/conferences/20/registration/view_session?session_id=2420 ASEE 2013 Workshop]&lt;br /&gt;
&lt;br /&gt;
== Warm Up ==&lt;br /&gt;
[[File:PuTTYconfiguration.jpg|thumbnail]]&lt;br /&gt;
Before we can interact with LEDs and switches we need to learn some simple Linux commands. &lt;br /&gt;
# On your host computer, running Windows, start up '''puTTY'''.  &lt;br /&gt;
# If you get a ''Security Warning'', click '''Run'''.&lt;br /&gt;
# Enter '''192.167.7.2''' in the '''Host Name''' field and click '''Open'''&lt;br /&gt;
# Login as '''root''' with no password.&lt;br /&gt;
# Enter '''ls'''  to list what files you have. You shouldn't see much.&lt;br /&gt;
[[File:PuTTYloging.jpg|thumbnail]]&lt;br /&gt;
&lt;br /&gt;
At this point you need to learn a few simple Linux commands for creating and displaying files. Once you know these commands it's easy to turn an LED on and off.&lt;br /&gt;
&lt;br /&gt;
First, let's edit a file using the '''nano''' editor.  Nano is a simple editor that easy to learn. This will edit (and create) the file '''play'''.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''nano play'''&lt;br /&gt;
&lt;br /&gt;
Add a couple of lines of text to the file, it doesn't really matter what and then Exit. You can list the files in the current directory with '''ls''' and show the contents of a file with '''cat'''.&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 Desktop  play&lt;br /&gt;
 bone$ '''cat play'''&lt;br /&gt;
 A couple of lines&lt;br /&gt;
 of text.&lt;br /&gt;
&lt;br /&gt;
Use '''echo''' to print a line of text.&lt;br /&gt;
 bone$ '''echo This is a line of text'''&lt;br /&gt;
 This is a line of text&lt;br /&gt;
&lt;br /&gt;
Here's a powerful operator.  You can take the output of any command and redirect it to a file with '''&amp;gt;'''.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo This is a line of text &amp;gt; here'''&lt;br /&gt;
 bone$ '''cat here'''&lt;br /&gt;
 This is a line of text&lt;br /&gt;
&lt;br /&gt;
We are almost there.  Use '''cd''' to change directories.  '''/''' is the top level directory.&lt;br /&gt;
 bone$ '''cd /'''&lt;br /&gt;
 bone$ '''ls'''&lt;br /&gt;
 bin   dev  home  lost+found  mnt   run   sys  usr&lt;br /&gt;
 boot  etc  lib   media       proc  sbin  tmp  var&lt;br /&gt;
&lt;br /&gt;
If you ever get lost, '''cd''' alone takes you home.&lt;br /&gt;
 bone$ '''cd'''&lt;br /&gt;
 gone$ '''ls'''&lt;br /&gt;
 Desktop  here  play&lt;br /&gt;
&lt;br /&gt;
Now you are ready to flash an LED.&lt;br /&gt;
&lt;br /&gt;
== Blinking an LED ==&lt;br /&gt;
&lt;br /&gt;
== Reading a Switch ==&lt;br /&gt;
&lt;br /&gt;
== Analog In ==&lt;br /&gt;
&lt;br /&gt;
== Pulse Width Modulation ==&lt;br /&gt;
&lt;br /&gt;
{{YoderFoot}}&lt;/div&gt;</summary>
		<author><name>Yoder</name></author>	</entry>

	<entry>
		<id>http://www.elinux.org/ASEE_2013_Workshop</id>
		<title>ASEE 2013 Workshop</title>
		<link rel="alternate" type="text/html" href="http://www.elinux.org/ASEE_2013_Workshop"/>
				<updated>2013-06-10T17:48:32Z</updated>
		
		<summary type="html">&lt;p&gt;Yoder: Initial Page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:ECE497 |Workshop]]&lt;br /&gt;
{{YoderHead}}&lt;br /&gt;
Here are the labs for the afternoon Linux part of the [http://www.asee.org/public/conferences/20/registration/view_session?session_id=2420 ASEE 2013 Workshop]&lt;br /&gt;
&lt;br /&gt;
== Warm Up ==&lt;br /&gt;
[[File:PuTTYconfiguration.jpg|thumbnail]]&lt;br /&gt;
Before we can interact with LEDs and switches we need to learn some simple Linux commands. &lt;br /&gt;
# On your host computer, running Windows, start up '''puTTY'''.  &lt;br /&gt;
# If you get a ''Security Warning'', click '''Run'''.&lt;br /&gt;
# Enter '''192.167.7.2''' in the '''Host Name''' field and click '''Open'''&lt;br /&gt;
# Login as '''root''' with no password.&lt;br /&gt;
# Enter '''ls'''  to list what files you have. You shouldn't see much.&lt;br /&gt;
[[File:PuTTYloging.jpg|thumbnail]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Blinking an LED ==&lt;br /&gt;
&lt;br /&gt;
== Reading a Switch ==&lt;br /&gt;
&lt;br /&gt;
== Analog In ==&lt;br /&gt;
&lt;br /&gt;
== Pulse Width Modulation ==&lt;br /&gt;
&lt;br /&gt;
{{YoderFoot}}&lt;/div&gt;</summary>
		<author><name>Yoder</name></author>	</entry>

	<entry>
		<id>http://www.elinux.org/File:PuTTYloging.jpg</id>
		<title>File:PuTTYloging.jpg</title>
		<link rel="alternate" type="text/html" href="http://www.elinux.org/File:PuTTYloging.jpg"/>
				<updated>2013-06-10T17:35:29Z</updated>
		
		<summary type="html">&lt;p&gt;Yoder: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Yoder</name></author>	</entry>

	<entry>
		<id>http://www.elinux.org/File:PuTTYconfiguration.jpg</id>
		<title>File:PuTTYconfiguration.jpg</title>
		<link rel="alternate" type="text/html" href="http://www.elinux.org/File:PuTTYconfiguration.jpg"/>
				<updated>2013-06-10T17:22:14Z</updated>
		
		<summary type="html">&lt;p&gt;Yoder: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Yoder</name></author>	</entry>

	<entry>
		<id>http://www.elinux.org/ECE497_SPI_Project</id>
		<title>ECE497 SPI Project</title>
		<link rel="alternate" type="text/html" href="http://www.elinux.org/ECE497_SPI_Project"/>
				<updated>2013-06-07T18:31:22Z</updated>
		
		<summary type="html">&lt;p&gt;Yoder: /* Installation Instructions 3.8 Kernel */ Updated to use setup.sh&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:ECE497Fall2012 |Project]]&lt;br /&gt;
[[Category:ECE497 |Ada]]&lt;br /&gt;
Team members: [[user:Richarsm|Sean Richardson]], [[user:larmorgs|Greg Larmore]]&lt;br /&gt;
&lt;br /&gt;
== Executive Summary ==&lt;br /&gt;
&lt;br /&gt;
For this project we wanted to further improve documentation available for sysfs kernel drivers with the Beagle Bone. To do this we have interfaced an [http://adafruit.com/products/306 LED light strand] by Adafruit with a sysfs kernel driver utilizing SPI. In doing so we have created an easy to use interface to the light strand while also maximizing data throughput.&lt;br /&gt;
&lt;br /&gt;
== Good Websites ==&lt;br /&gt;
&lt;br /&gt;
[http://elinux.org/BeagleBoard/SPI BeagleBoard and SPI]&lt;br /&gt;
&lt;br /&gt;
[http://www.xml.com/ldd/chapter/book/ O'Reilly Book on Linux Device Drivers]&lt;br /&gt;
&lt;br /&gt;
[http://www.cs.fsu.edu/~baker/devices/lxr/http/source/linux/samples/kobject/kset-example.c Kset example for sysfs driver]&lt;br /&gt;
&lt;br /&gt;
[http://elk.informatik.fh-augsburg.de/pub/elinux/ngw100-docs/AVR32743/spi/spi_example.c Example SPI device driver]&lt;br /&gt;
&lt;br /&gt;
[http://www.jumpnowtek.com/index.php?option=com_content&amp;amp;view=article&amp;amp;id=57&amp;amp;Itemid=62 Another example SPI device driver]&lt;br /&gt;
&lt;br /&gt;
== More Good Websites ==&lt;br /&gt;
&lt;br /&gt;
[http://www.loadyourself.com/linux/sample-linux-driver/ Example Kernel Driver (ioctl, no sysfs)]&lt;br /&gt;
&lt;br /&gt;
[http://www.freesoftwaremagazine.com/articles/drivers_linux Kernel Driver Tutorial (no sysfs/ioctl)]&lt;br /&gt;
&lt;br /&gt;
== Installation Instructions 3.2 Kernel ==&lt;br /&gt;
{{EBC3.2}}&lt;br /&gt;
All of these instructions are meant for the A6A BeagleBone running version 3.2.25+ of the kernel. Scripts and Makefiles expect that the kernel be located at &amp;lt;code&amp;gt;~/BeagleBoard/kernel/kernel&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Start by cloning the [https://github.com/larmorgs/FinalProject github] repository on both the bone and the host machine by running the following:&lt;br /&gt;
&lt;br /&gt;
 both$ '''git clone git@github.com:larmorgs/FinalProject'''&lt;br /&gt;
&lt;br /&gt;
On the host machine, run the following:&lt;br /&gt;
&lt;br /&gt;
 host$ '''cd ~/FinalProject'''&lt;br /&gt;
 host$ '''./setup.sh'''&lt;br /&gt;
&lt;br /&gt;
Make sure you only do this &amp;lt;b&amp;gt;once&amp;lt;/b&amp;gt; because it is adding on our modules to the Kconfig and Makefile in &amp;lt;code&amp;gt;~/BeagleBoard/kernel/kernel/driver/char&amp;lt;/code&amp;gt;. The files are backed up in the same folder with &amp;lt;code&amp;gt;.orig&amp;lt;/code&amp;gt; appended.&lt;br /&gt;
&lt;br /&gt;
Next run the following on the host machine:&lt;br /&gt;
&lt;br /&gt;
 host$ '''make kernel'''&lt;br /&gt;
&lt;br /&gt;
This will copy the files &amp;lt;code&amp;gt;example.c&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;lpd8806.c&amp;lt;/code&amp;gt; into the &amp;lt;code&amp;gt;~/BeagleBoard/kernel/kernel/driver/char&amp;lt;/code&amp;gt; directory, make the kernel, and then scp the files to the bone.&lt;br /&gt;
&lt;br /&gt;
Moving over to the bone, run the following:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /lib/modules/3.2.25+'''&lt;br /&gt;
 bone$ '''mv modules.dep.bin modules.dep.bin.orig'''&lt;br /&gt;
&lt;br /&gt;
Next modify &amp;lt;code&amp;gt;modules.dep&amp;lt;/code&amp;gt; to include &amp;lt;code&amp;gt;kernel/drivers/char/example.ko:&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;kernel/drivers/char/lpd8806.ko:&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Upon successful completion, you should be able to run the following:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''modprobe example'''&lt;br /&gt;
 bone$ '''modprobe lpd8806'''&lt;br /&gt;
&lt;br /&gt;
== Installation Instructions 3.8 Kernel ==&lt;br /&gt;
{{EBC3.8}}&lt;br /&gt;
All of these instructions are meant for the BeagleBone running version 3.8 of the kernel with device tree. Scripts and Makefiles expect that the kernel be located at &amp;lt;code&amp;gt;~/BeagleBoard/linux-dev/KERNEL&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Start by updating the course materials. ([[EBC Exercise 05 Getting Exercise Support Materials]])&lt;br /&gt;
&lt;br /&gt;
On the host machine, run the following:&lt;br /&gt;
&lt;br /&gt;
 host$ '''cd ~/exercises/LEDstring/driver'''&lt;br /&gt;
 host$ '''git pull'''&lt;br /&gt;
 host$ '''./patch.sh'''&lt;br /&gt;
&lt;br /&gt;
Make sure you only do this &amp;lt;b&amp;gt;once&amp;lt;/b&amp;gt; because it is adding on our modules to the Kconfig and Makefile in &amp;lt;code&amp;gt;~/BeagleBoard/linux-dev/KERNEL/driver/char&amp;lt;/code&amp;gt;. The files are backed up in the same folder with &amp;lt;code&amp;gt;.orig&amp;lt;/code&amp;gt; appended.&lt;br /&gt;
&lt;br /&gt;
Next run the following on the host machine:&lt;br /&gt;
&lt;br /&gt;
 host$ '''make kernel'''&lt;br /&gt;
&lt;br /&gt;
This will copy the file &amp;lt;code&amp;gt;lpd8806.c&amp;lt;/code&amp;gt; into the &amp;lt;code&amp;gt;~/BeagleBoard/linux-dev/KERNEL/driver/char&amp;lt;/code&amp;gt; directory, make the kernel, and then scp the files to the bone. (Look in the Makefile and update the address for you Beagle.)&lt;br /&gt;
&lt;br /&gt;
Moving over to the bone, run the following:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd exercises/LEDstring'''&lt;br /&gt;
 bone$ '''git pull'''&lt;br /&gt;
 bone$ '''./setup.sh'''&lt;br /&gt;
&lt;br /&gt;
This will make the correct device tree overlay to set the pin muxxes for spi0 and insert the kernel module. You only have to do this once per booting the beagle.&lt;br /&gt;
&lt;br /&gt;
Now test it with&lt;br /&gt;
 bone$ '''make tree'''&lt;br /&gt;
 bone$ '''./tree 3 60000 20000'''&lt;br /&gt;
&lt;br /&gt;
This will display a sequence of LEDs running up and down the string.&lt;br /&gt;
&lt;br /&gt;
== User Instructions 3.2 Kernel ==&lt;br /&gt;
&lt;br /&gt;
Run &amp;lt;code&amp;gt;dmesg&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;lsmod&amp;lt;/code&amp;gt; to make sure the modules have loaded properly. You should now find two folders inside &amp;lt;code&amp;gt;/sys/firmware&amp;lt;/code&amp;gt; called &amp;lt;code&amp;gt;example&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;lpd8806&amp;lt;/code&amp;gt;. Feel free to play around in the example folder. If you go into this folder and then one folder further into device, you will find two files. The &amp;lt;code&amp;gt;test&amp;lt;/code&amp;gt; file holds an unsigned integer, while the &amp;lt;code&amp;gt;data&amp;lt;/code&amp;gt; file holds a string of length 10 (initially empty). You can read and write from these files as you would any other sysfs file.&lt;br /&gt;
&lt;br /&gt;
Next we will hook up the LED strand. &amp;lt;b&amp;gt;For this make sure the beagle is powered externally&amp;lt;/b&amp;gt;. The USB power supply does not have enough current to run the 5m strand at full brightness.&lt;br /&gt;
&lt;br /&gt;
To get started hook up pins 30 (D12/SPI1_D1) and 31 (A13/SPI1_SCLK) to SPI data and SPI clock on the strand (see the silkscreen for guidance. Hook up the ground to ground (obviously), and the 5V wire on the strand to the &amp;lt;b&amp;gt;3.3V&amp;lt;/b&amp;gt; pin on the bone. &amp;lt;b&amp;gt;Do not use the 5V pin on the bone or the suggested Adafruit 5V power supply directly connected to the strand without also adding logic level voltage shifters to the data and clock lines&amp;lt;/b&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:Bone_P9_pinout.jpg]]&lt;br /&gt;
&lt;br /&gt;
You may need to modify your muxes (if they have been changed from the default). If so, do the following:&lt;br /&gt;
 beagle$ '''echo 0 &amp;gt; /sys/kernel/debug/omap_mux/spi0_d1'''&lt;br /&gt;
 beagle$ '''echo 0 &amp;gt; /sys/kernel/debug/omap_mux/spi0_scl'''&lt;br /&gt;
&lt;br /&gt;
Now that the strand is hooked up, we can run the following:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/firmware/lpd8806/device/'''&lt;br /&gt;
 bone$ '''echo &amp;quot;127 127 127&amp;quot; &amp;gt; grb'''&lt;br /&gt;
&lt;br /&gt;
You should see the first LED (closest to the bone) light up bright white. You can also do something like the following:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo &amp;quot;127 0 0 0 127 0 0 0 127&amp;quot; &amp;gt; data'''&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;data&amp;lt;/code&amp;gt; file is written directly out to the strand while the &amp;lt;code&amp;gt;grb&amp;lt;/code&amp;gt; file treats the strand like a big shift register. &amp;lt;b&amp;gt;Be careful with using &amp;lt;code&amp;gt;data&amp;lt;/code&amp;gt;&amp;lt;/b&amp;gt;. Buffering problems can cause the kernel to seg fault or crash completely (see Future Work).&lt;br /&gt;
&lt;br /&gt;
== User Instructions 3.8 Kernel ==&lt;br /&gt;
&lt;br /&gt;
Run &amp;lt;code&amp;gt;dmesg&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;lsmod&amp;lt;/code&amp;gt; to make sure the modules have loaded properly. You should now find a folder inside &amp;lt;code&amp;gt;/sys/firmware&amp;lt;/code&amp;gt; called &amp;lt;code&amp;gt;lpd8806&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Next we will hook up the LED strand. &amp;lt;b&amp;gt;For this make sure the beagle is powered externally&amp;lt;/b&amp;gt;. The USB power supply does not have enough current to run the 5m strand at full brightness.&lt;br /&gt;
&lt;br /&gt;
To get started hook up pins 18 (D12/SPI0_D1) and 22 (A13/SPI0_SCLK) to SPI data and SPI clock on the strand (see the silkscreen for guidance. Hook up the ground to ground (obviously), and the 5V wire on the strand to the &amp;lt;b&amp;gt;3.3V&amp;lt;/b&amp;gt; pin on the bone. &amp;lt;b&amp;gt;Do not use the 5V pin on the bone or the suggested Adafruit 5V power supply directly connected to the strand without also adding logic level voltage shifters to the data and clock lines&amp;lt;/b&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:HeaderP9.jpg|800px]]&lt;br /&gt;
&lt;br /&gt;
Now that the strand is hooked up, we can run the following:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/firmware/lpd8806/device/'''&lt;br /&gt;
 bone$ '''echo &amp;quot;127 127 127 0&amp;quot; &amp;gt; rgb'''&lt;br /&gt;
&lt;br /&gt;
You should see LED '''0''' (closest to the bone) light up bright white. You can also do something like the following to turn LED ''x'' red.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo &amp;quot;127 0 0 ''x''&amp;quot; &amp;gt; rgb'''&lt;br /&gt;
&lt;br /&gt;
The driver keeps an internal state of the string and shifts it out to update the string.  (The shifting is so fast you won't see it.)  You can see the state of the string with:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cat data'''&lt;br /&gt;
&lt;br /&gt;
You can change the internal state without updating the string by suppressing the 'return' on the echo.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo -n 0 50 0 10 &amp;gt; rgb&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
* [http://hipstercircuits.com/enable-spi-with-device-tree-on-beaglebone-black-copy-paste/ Enable SPI with device tree on BeagleBone Black] shows how to set the pin muxing for SPI1.&lt;br /&gt;
* [http://blog.inbedded.net/blog/categories/device-tree/ BeagleBone Black and LCD = fun] showed how to set the pin mux for SPI0.&lt;br /&gt;
&lt;br /&gt;
== Highlights ==&lt;br /&gt;
&lt;br /&gt;
We have created a simple C example that uses this sysfs driver. You can run it by doing the following:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd ~/FinalProject'''&lt;br /&gt;
 bone$ '''make'''&lt;br /&gt;
 bone$ '''./test'''&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|8d9n5QUyH38}}&lt;br /&gt;
&lt;br /&gt;
The program shows the capabilities of the strand running in shift mode. Because of the nature of the strand's construction, it would be very simple to daisy chain many chains end to end. Also, the kset implementation means that we can have as many separate strands as there are SPI buses. Normally you could have even more, but the strand only runs 3 wire SPI (no chip select).&lt;br /&gt;
&lt;br /&gt;
The speed is increased greatly when the strand is running in direct access mode by using the &amp;lt;code&amp;gt;data&amp;lt;/code&amp;gt; file instead of the &amp;lt;code&amp;gt;grb&amp;lt;/code&amp;gt; file. However, due to time limitations we were unable to debug the buffering issues. A good place for future work would be to figure out how the buffering problem can be alleviated.&lt;br /&gt;
&lt;br /&gt;
== Theory of Operation ==&lt;br /&gt;
&lt;br /&gt;
There are many layers to the implementation, so we will break them out into subsections.&lt;br /&gt;
&lt;br /&gt;
=== Light Strand ===&lt;br /&gt;
&lt;br /&gt;
The light strand uses the LPD8806 controller chip. Each chip controls the brightness of two 3 color GRB LEDs using PWM running at 1.2 MHz. SPI is used to communicate with the controller chips. The controller has its SPI bus rated somewhere around 20 MHz, but we are only running at 10 MHz. Each LED is 21-bit color, which leaves three bits available for latch control.&lt;br /&gt;
&lt;br /&gt;
So, as you write color values out on the SPI, the first chip receives them. If the chip hasn't written a color to one of its to LEDs, it does so and thus ends the transmission. However, if it has already assigned a color to each LED then it passes the SPI along on a separate bus to the next chip. This is how the strand is able to be 5m and still run at 10 MHz.&lt;br /&gt;
&lt;br /&gt;
It is still unknown how exactly the 3 latch bits are used (because the chip manufacturer has kept the interface a secret). However, if you write 6 bytes of &amp;quot;latch&amp;quot; the strand restarts at the beginning. Perhaps less bytes of &amp;quot;latch&amp;quot; can be sent and get the same effect, but due to time limitations we were unable to debug this completely. This is a simple place to start for future work.&lt;br /&gt;
&lt;br /&gt;
=== SPI Bus ===&lt;br /&gt;
&lt;br /&gt;
We use the default SPI controller to control the SPI lines. All we had to do is find what master is controlling the bus (2 in our case) and add a device. Initially, the SPI bus we want is being used by the default configuration of spidev. So, all we do is unregister the device from spidev and reregister it for our driver. There are a few things that go into the configuration of the device like speed, number of bits, chip select, and mode. Once these are set, you can add the device and it will then be associated with your driver.&lt;br /&gt;
&lt;br /&gt;
=== Sysfs Kernel Driver ===&lt;br /&gt;
&lt;br /&gt;
The sysfs kernel driver is based on the references above. It uses a kset to store kobjects (the basic building block of the kernel). Each kobject has associated with it certain attributes. These attributes are brought out to the user as files. When the files are read from or written to, the kernel calls back into the kobject's read/write routines. Here, we are able to decide which attribute is being addressed and manipulate the buffer as we see fit.&lt;br /&gt;
&lt;br /&gt;
There are some alternative implementations to this that were looked into in addition to kset. The driver could have been implemented as a sysfs device driver instead of a kernel driver so that it shows up in &amp;lt;code&amp;gt;/sys/class&amp;lt;/code&amp;gt; with everything else. Another option is that it could be implemented as a straight up device/kernel driver making it show up in &amp;lt;code&amp;gt;/dev&amp;lt;/code&amp;gt; instead. There doesn't seem to be much of a difference though between these implementations as far as performance is concerned. However, finding where this driver fits best is another good place for future work. &lt;br /&gt;
&lt;br /&gt;
== Work Breakdown ==&lt;br /&gt;
&lt;br /&gt;
=== Sean Richardson ===&lt;br /&gt;
* Researched using SPI on the BeagleBone&lt;br /&gt;
* Debugged the LED strand (the first one we received was broken)&lt;br /&gt;
* Wrote code to interface with the strand using spidev&lt;br /&gt;
* Helped integrate the SPI interface into the sysfs driver&lt;br /&gt;
&lt;br /&gt;
=== Greg Larmore ===&lt;br /&gt;
* Researched kernel drivers and sysfs&lt;br /&gt;
* Helped debug the LED strand&lt;br /&gt;
* Wrote example sysfs driver&lt;br /&gt;
* Integrated the SPI interface into the sysfs driver&lt;br /&gt;
&lt;br /&gt;
== Future Work ==&lt;br /&gt;
&lt;br /&gt;
While the strand works well as it is, there are some things that we would like to see looked into if there is future work on this project.&lt;br /&gt;
&lt;br /&gt;
=== Latching and Controller Interface ===&lt;br /&gt;
&lt;br /&gt;
According to Adafruit, the interface to this part has been reverse engineered. The one part that really remains unknown is how exactly the 3-bit control interface works for each LED. We were able to achieve a latching effect by sending 6 empty transmissions. The code in [github.com/adafruit/lpd8806 Adafruit's github] doesn't seem to be using this many latch transmissions.&lt;br /&gt;
&lt;br /&gt;
=== Buffering Problem ===&lt;br /&gt;
&lt;br /&gt;
There is a problem with buffered output going into the &amp;lt;code&amp;gt;data&amp;lt;/code&amp;gt; file (because it is so big). When the output buffers it causes 2 sequential writes which weren't being handled well by the attribute's store function. This could be alleviated with a circular buffer and an index that can be controlled by the user, but really the driver should be able to handle this condition.&lt;br /&gt;
&lt;br /&gt;
=== Sysfs File Location ===&lt;br /&gt;
&lt;br /&gt;
The decision to have these drivers located in &amp;lt;code&amp;gt;/lib/modules/3.2.25+/kernel/drivers/char&amp;lt;/code&amp;gt; and run out of &amp;lt;code&amp;gt;/sys/firmware&amp;lt;/code&amp;gt; was pretty much arbitrary. It would be nice to do some research into how the kernel is supposed to be structured so that we can match it. This also applies to the example driver included in this project.&lt;br /&gt;
&lt;br /&gt;
== Conclusions ==&lt;br /&gt;
&lt;br /&gt;
In this project, we were able to get SPI (a lesser used interface on the bone) to work well with our LED strand. More impressively, we were able to interface with the SPI through a sysfs interface. In the process of developing this sysfs interface to the LED strand, we developed an example sysfs driver that can be used in future ECE497 classes. Lastly, we developed a sample application that uses this sysfs interface for our LED strand to show off the results.&lt;/div&gt;</summary>
		<author><name>Yoder</name></author>	</entry>

	<entry>
		<id>http://www.elinux.org/EBC_Exercise_01_Start_Here</id>
		<title>EBC Exercise 01 Start Here</title>
		<link rel="alternate" type="text/html" href="http://www.elinux.org/EBC_Exercise_01_Start_Here"/>
				<updated>2013-06-07T18:27:46Z</updated>
		
		<summary type="html">&lt;p&gt;Yoder: Added links to where to get items&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:ECE497]]&lt;br /&gt;
{{YoderHead}}&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
There are four major things that need to be done to have the BeagleBoard ready to run for class:&lt;br /&gt;
# Get your Beagle Hardware together&lt;br /&gt;
# Update the OS on your Beagle&lt;br /&gt;
# Set up a host computer, running Linux for code development&lt;br /&gt;
# Clone the course git repository on both the Beagle and the host&lt;br /&gt;
&lt;br /&gt;
== The Hardware ==&lt;br /&gt;
&lt;br /&gt;
Here's the hardware you will need and where you get it.&lt;br /&gt;
&lt;br /&gt;
=== You may have, or will have to buy ===&lt;br /&gt;
&lt;br /&gt;
We are using the [http://beagleboard.org/Getting%20Started BeagleBone Black] this year.  Since it's only $45 I'll have you buy your your own. There's a few other things you will need to get before the first day of class.&lt;br /&gt;
* BeagleBone Black.  See [http://beagleboard.org/ http://beagleboard.org/] for suggestions of where to buy the Black.&lt;br /&gt;
* USB keyboard and mouse&lt;br /&gt;
* HDMI display&lt;br /&gt;
* At least three 4G micro SD cardz. I suggest you have 3 or 4 cards since it's easy to mess up one and it takes some 10 minutes to reload it.&lt;br /&gt;
* micro SD card reader/writer&lt;br /&gt;
* Powered USB hub, at least 4 ports.  The Black has only one USB so this will allow you to plug in the keyboard, mouse, web cam, etc.&lt;br /&gt;
&lt;br /&gt;
Books&lt;br /&gt;
* [http://www.amazon.com/Embedded-Linux-Primer-Practical-Real-World/dp/0137017839 Embedded Linux Primer] The bookstore will have this.&lt;br /&gt;
* [http://www.morganclaypool.com/doi/abs/10.2200/S00500ED1V01Y201304DCS041 Bad to the Bone] Don't by this yet, I think I can get you a free copy.&lt;br /&gt;
&lt;br /&gt;
=== What you buy from the Instrument Room ===&lt;br /&gt;
&lt;br /&gt;
* 5V power supply&lt;br /&gt;
* micro HDMI to HDMI adapter.  [http://www.monoprice.com/products/product.asp?c_id=104&amp;amp;cp_id=10419&amp;amp;cs_id=1041913&amp;amp;p_id=7703&amp;amp;seq=1&amp;amp;format=2 Monoprice]&lt;br /&gt;
* FTDI USB to Serial Adapter.  Must be 3.3V version. [https://www.sparkfun.com/products/9717 Sparkfun]&lt;br /&gt;
* Proto Plate with full sized breadboard&lt;br /&gt;
* various input devices, sensors, displays, etc.&lt;br /&gt;
&lt;br /&gt;
== Updating the Beagle OS ==&lt;br /&gt;
&lt;br /&gt;
Once you have all your hardware together go ahead and [http://beagleboard.org/Getting%20Started explore the Bone]. It should work right out of the box. After you have explored a while, update the image on the Bone so you are running the most current image. Go to [[EBC Exercise 03 Installing a Beagle OS]] to learn how to flash your SD card with a fresh OS.&lt;br /&gt;
&lt;br /&gt;
== The Linux host computer ==&lt;br /&gt;
&lt;br /&gt;
The above will get you ready for about the first 4 weeks of class. Around week 5 we'll start looking at the kernel and will need to cross compile. Once we start moving into Kernel development we will need a host computer. Since we are doing Linux development, it's generally agree the host should be running Linux.  I suggest you run [http://www.ubuntu.com Ubuntu 12.04 (LTS)]. The Rose Linux Users Group [http://lug.rose-hulman.edu/wiki/Main_Page LUG] has instructions on where to get a local copy so you don't have to download some 700M.&lt;br /&gt;
&lt;br /&gt;
There are three options as to how to run Linux.&lt;br /&gt;
# Native install ([http://www.ubuntu.com/download])&lt;br /&gt;
# Install in a virtual machine. I've been running [[EBC Exercise 06 Notes on VirtualBox | Virtual Box]] recently and it seems to work find.  You can also try [[EBC Exercise 07 Notes on Installing Ubuntu in VMware Player | VMware Player]].&lt;br /&gt;
# Run in the cloud&lt;br /&gt;
&lt;br /&gt;
The Ubuntu site gives good instructions for a native install. I've had good success with running both VMware and Virtual Box, though my installation instructions are a bit dated.  (Feel free to update them if they need it.)&lt;br /&gt;
&lt;br /&gt;
I've been testing out the &amp;quot;Cloud&amp;quot; approach and it looks like it will work too.  If you want to try the cloud, let me known and I'll ask CSSE to set up a machine for you.&lt;br /&gt;
&lt;br /&gt;
=== Kernel Development ===&lt;br /&gt;
&lt;br /&gt;
Once you have Linux running somewhere, you need to install the kernel development tools.  Go to [[EBC Exercise 08 Installing Development Tools]] to see all the steps you need. Once set up, go back to [[EBC Exercise 05 Getting Exercise Support Materials]] to clone the class repository on your host.&lt;br /&gt;
&lt;br /&gt;
Now that you have all these pieces in place you are ready to work with a very power embedded processor.&lt;br /&gt;
&lt;br /&gt;
== The class git repository ==&lt;br /&gt;
&lt;br /&gt;
Once you have an up to date OS running on your Beagle, go to [[EBC Exercise 05 Getting Exercise Support Materials]] to learn how to clone the class git repository. Once cloned it's a single command to get the latest materials on your Beagle (or host computer for that matter).&lt;br /&gt;
&lt;br /&gt;
{{YoderHead}}&lt;/div&gt;</summary>
		<author><name>Yoder</name></author>	</entry>

	<entry>
		<id>http://www.elinux.org/EBC_Exercise_01_Start_Here</id>
		<title>EBC Exercise 01 Start Here</title>
		<link rel="alternate" type="text/html" href="http://www.elinux.org/EBC_Exercise_01_Start_Here"/>
				<updated>2013-06-07T18:03:25Z</updated>
		
		<summary type="html">&lt;p&gt;Yoder: Added micro HDMI adapter and FTDI USB to Serial Adaptoer&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:ECE497]]&lt;br /&gt;
{{YoderHead}}&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
There are four major things that need to be done to have the BeagleBoard ready to run for class:&lt;br /&gt;
# Get your Beagle Hardware together&lt;br /&gt;
# Update the OS on your Beagle&lt;br /&gt;
# Set up a host computer, running Linux for code development&lt;br /&gt;
# Clone the course git repository on both the Beagle and the host&lt;br /&gt;
&lt;br /&gt;
== The Hardware ==&lt;br /&gt;
&lt;br /&gt;
Here's the hardware you will need and where you get it.&lt;br /&gt;
&lt;br /&gt;
=== You may have, or will have to buy ===&lt;br /&gt;
&lt;br /&gt;
We are using the [http://beagleboard.org/Getting%20Started BeagleBone Black] this year.  Since it's only $45 I'll have you buy your your own. There's a few other things you will need to get before the first day of class.&lt;br /&gt;
* BeagleBone Black.  See [http://beagleboard.org/ http://beagleboard.org/] for suggestions of where to buy the Black.&lt;br /&gt;
* USB keyboard and mouse&lt;br /&gt;
* HDMI display&lt;br /&gt;
* At least three 4G micro SD cardz. I suggest you have 3 or 4 cards since it's easy to mess up one and it takes some 10 minutes to reload it.&lt;br /&gt;
* micro SD card reader/writer&lt;br /&gt;
* Powered USB hub, at least 4 ports.  The Black has only one USB so this will allow you to plug in the keyboard, mouse, web cam, etc.&lt;br /&gt;
&lt;br /&gt;
Books&lt;br /&gt;
* [http://www.amazon.com/Embedded-Linux-Primer-Practical-Real-World/dp/0137017839 Embedded Linux Primer] The bookstore will have this.&lt;br /&gt;
* [http://www.morganclaypool.com/doi/abs/10.2200/S00500ED1V01Y201304DCS041 Bad to the Bone] Don't by this yet, I think I can get you a free copy.&lt;br /&gt;
&lt;br /&gt;
=== What you buy from the Instrument Room ===&lt;br /&gt;
&lt;br /&gt;
* 5V power supply&lt;br /&gt;
* micro HDMI to HDMI adapter&lt;br /&gt;
* FTDI USB to Serial Adapter.  Must be 3.3V version&lt;br /&gt;
* Proto Plate with full sized breadboard&lt;br /&gt;
* various input devices, sensors, displays, etc.&lt;br /&gt;
&lt;br /&gt;
== Updating the Beagle OS ==&lt;br /&gt;
&lt;br /&gt;
Once you have all your hardware together go ahead and [http://beagleboard.org/Getting%20Started explore the Bone]. It should work right out of the box. After you have explored a while, update the image on the Bone so you are running the most current image. Go to [[EBC Exercise 03 Installing a Beagle OS]] to learn how to flash your SD card with a fresh OS.&lt;br /&gt;
&lt;br /&gt;
== The Linux host computer ==&lt;br /&gt;
&lt;br /&gt;
The above will get you ready for about the first 4 weeks of class. Around week 5 we'll start looking at the kernel and will need to cross compile. Once we start moving into Kernel development we will need a host computer. Since we are doing Linux development, it's generally agree the host should be running Linux.  I suggest you run [http://www.ubuntu.com Ubuntu 12.04 (LTS)]. The Rose Linux Users Group [http://lug.rose-hulman.edu/wiki/Main_Page LUG] has instructions on where to get a local copy so you don't have to download some 700M.&lt;br /&gt;
&lt;br /&gt;
There are three options as to how to run Linux.&lt;br /&gt;
# Native install ([http://www.ubuntu.com/download])&lt;br /&gt;
# Install in a virtual machine. I've been running [[EBC Exercise 06 Notes on VirtualBox | Virtual Box]] recently and it seems to work find.  You can also try [[EBC Exercise 07 Notes on Installing Ubuntu in VMware Player | VMware Player]].&lt;br /&gt;
# Run in the cloud&lt;br /&gt;
&lt;br /&gt;
The Ubuntu site gives good instructions for a native install. I've had good success with running both VMware and Virtual Box, though my installation instructions are a bit dated.  (Feel free to update them if they need it.)&lt;br /&gt;
&lt;br /&gt;
I've been testing out the &amp;quot;Cloud&amp;quot; approach and it looks like it will work too.  If you want to try the cloud, let me known and I'll ask CSSE to set up a machine for you.&lt;br /&gt;
&lt;br /&gt;
=== Kernel Development ===&lt;br /&gt;
&lt;br /&gt;
Once you have Linux running somewhere, you need to install the kernel development tools.  Go to [[EBC Exercise 08 Installing Development Tools]] to see all the steps you need. Once set up, go back to [[EBC Exercise 05 Getting Exercise Support Materials]] to clone the class repository on your host.&lt;br /&gt;
&lt;br /&gt;
Now that you have all these pieces in place you are ready to work with a very power embedded processor.&lt;br /&gt;
&lt;br /&gt;
== The class git repository ==&lt;br /&gt;
&lt;br /&gt;
Once you have an up to date OS running on your Beagle, go to [[EBC Exercise 05 Getting Exercise Support Materials]] to learn how to clone the class git repository. Once cloned it's a single command to get the latest materials on your Beagle (or host computer for that matter).&lt;br /&gt;
&lt;br /&gt;
{{YoderHead}}&lt;/div&gt;</summary>
		<author><name>Yoder</name></author>	</entry>

	<entry>
		<id>http://www.elinux.org/ECE497_SPI_Project</id>
		<title>ECE497 SPI Project</title>
		<link rel="alternate" type="text/html" href="http://www.elinux.org/ECE497_SPI_Project"/>
				<updated>2013-06-07T17:21:39Z</updated>
		
		<summary type="html">&lt;p&gt;Yoder: Switched setup.sh to patch.sh&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:ECE497Fall2012 |Project]]&lt;br /&gt;
[[Category:ECE497 |Ada]]&lt;br /&gt;
Team members: [[user:Richarsm|Sean Richardson]], [[user:larmorgs|Greg Larmore]]&lt;br /&gt;
&lt;br /&gt;
== Executive Summary ==&lt;br /&gt;
&lt;br /&gt;
For this project we wanted to further improve documentation available for sysfs kernel drivers with the Beagle Bone. To do this we have interfaced an [http://adafruit.com/products/306 LED light strand] by Adafruit with a sysfs kernel driver utilizing SPI. In doing so we have created an easy to use interface to the light strand while also maximizing data throughput.&lt;br /&gt;
&lt;br /&gt;
== Good Websites ==&lt;br /&gt;
&lt;br /&gt;
[http://elinux.org/BeagleBoard/SPI BeagleBoard and SPI]&lt;br /&gt;
&lt;br /&gt;
[http://www.xml.com/ldd/chapter/book/ O'Reilly Book on Linux Device Drivers]&lt;br /&gt;
&lt;br /&gt;
[http://www.cs.fsu.edu/~baker/devices/lxr/http/source/linux/samples/kobject/kset-example.c Kset example for sysfs driver]&lt;br /&gt;
&lt;br /&gt;
[http://elk.informatik.fh-augsburg.de/pub/elinux/ngw100-docs/AVR32743/spi/spi_example.c Example SPI device driver]&lt;br /&gt;
&lt;br /&gt;
[http://www.jumpnowtek.com/index.php?option=com_content&amp;amp;view=article&amp;amp;id=57&amp;amp;Itemid=62 Another example SPI device driver]&lt;br /&gt;
&lt;br /&gt;
== More Good Websites ==&lt;br /&gt;
&lt;br /&gt;
[http://www.loadyourself.com/linux/sample-linux-driver/ Example Kernel Driver (ioctl, no sysfs)]&lt;br /&gt;
&lt;br /&gt;
[http://www.freesoftwaremagazine.com/articles/drivers_linux Kernel Driver Tutorial (no sysfs/ioctl)]&lt;br /&gt;
&lt;br /&gt;
== Installation Instructions 3.2 Kernel ==&lt;br /&gt;
{{EBC3.2}}&lt;br /&gt;
All of these instructions are meant for the A6A BeagleBone running version 3.2.25+ of the kernel. Scripts and Makefiles expect that the kernel be located at &amp;lt;code&amp;gt;~/BeagleBoard/kernel/kernel&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Start by cloning the [https://github.com/larmorgs/FinalProject github] repository on both the bone and the host machine by running the following:&lt;br /&gt;
&lt;br /&gt;
 both$ '''git clone git@github.com:larmorgs/FinalProject'''&lt;br /&gt;
&lt;br /&gt;
On the host machine, run the following:&lt;br /&gt;
&lt;br /&gt;
 host$ '''cd ~/FinalProject'''&lt;br /&gt;
 host$ '''./setup.sh'''&lt;br /&gt;
&lt;br /&gt;
Make sure you only do this &amp;lt;b&amp;gt;once&amp;lt;/b&amp;gt; because it is adding on our modules to the Kconfig and Makefile in &amp;lt;code&amp;gt;~/BeagleBoard/kernel/kernel/driver/char&amp;lt;/code&amp;gt;. The files are backed up in the same folder with &amp;lt;code&amp;gt;.orig&amp;lt;/code&amp;gt; appended.&lt;br /&gt;
&lt;br /&gt;
Next run the following on the host machine:&lt;br /&gt;
&lt;br /&gt;
 host$ '''make kernel'''&lt;br /&gt;
&lt;br /&gt;
This will copy the files &amp;lt;code&amp;gt;example.c&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;lpd8806.c&amp;lt;/code&amp;gt; into the &amp;lt;code&amp;gt;~/BeagleBoard/kernel/kernel/driver/char&amp;lt;/code&amp;gt; directory, make the kernel, and then scp the files to the bone.&lt;br /&gt;
&lt;br /&gt;
Moving over to the bone, run the following:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /lib/modules/3.2.25+'''&lt;br /&gt;
 bone$ '''mv modules.dep.bin modules.dep.bin.orig'''&lt;br /&gt;
&lt;br /&gt;
Next modify &amp;lt;code&amp;gt;modules.dep&amp;lt;/code&amp;gt; to include &amp;lt;code&amp;gt;kernel/drivers/char/example.ko:&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;kernel/drivers/char/lpd8806.ko:&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Upon successful completion, you should be able to run the following:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''modprobe example'''&lt;br /&gt;
 bone$ '''modprobe lpd8806'''&lt;br /&gt;
&lt;br /&gt;
== Installation Instructions 3.8 Kernel ==&lt;br /&gt;
{{EBC3.8}}&lt;br /&gt;
All of these instructions are meant for the BeagleBone running version 3.8 of the kernel with device tree. Scripts and Makefiles expect that the kernel be located at &amp;lt;code&amp;gt;~/BeagleBoard/linux-dev/KERNEL&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Start by updating the course materials. ([[EBC Exercise 05 Getting Exercise Support Materials]])&lt;br /&gt;
&lt;br /&gt;
On the host machine, run the following:&lt;br /&gt;
&lt;br /&gt;
 host$ '''cd ~/exercises/LEDstring/driver'''&lt;br /&gt;
 host$ '''git pull'''&lt;br /&gt;
 host$ '''./patch.sh'''&lt;br /&gt;
&lt;br /&gt;
Make sure you only do this &amp;lt;b&amp;gt;once&amp;lt;/b&amp;gt; because it is adding on our modules to the Kconfig and Makefile in &amp;lt;code&amp;gt;~/BeagleBoard/linux-dev/KERNEL/driver/char&amp;lt;/code&amp;gt;. The files are backed up in the same folder with &amp;lt;code&amp;gt;.orig&amp;lt;/code&amp;gt; appended.&lt;br /&gt;
&lt;br /&gt;
Next run the following on the host machine:&lt;br /&gt;
&lt;br /&gt;
 host$ '''make kernel'''&lt;br /&gt;
&lt;br /&gt;
This will copy the file &amp;lt;code&amp;gt;lpd8806.c&amp;lt;/code&amp;gt; into the &amp;lt;code&amp;gt;~/BeagleBoard/linux-dev/KERNEL/driver/char&amp;lt;/code&amp;gt; directory, make the kernel, and then scp the files to the bone. (Look in the Makefile and update the address for you Beagle.)&lt;br /&gt;
&lt;br /&gt;
Moving over to the bone, run the following:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd exercises/LEDstring/driver'''&lt;br /&gt;
 bone$ '''git pull'''&lt;br /&gt;
 bone$ '''make dt'''&lt;br /&gt;
&lt;br /&gt;
This will make the correct device tree overlay to set the pin muxxes for spi0.  You only have to do this once per booting the beagle. Next:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /lib/modules/3.8.13''' (or whatever path is correct for you system.)&lt;br /&gt;
 bone$ '''mv modules.dep.bin modules.dep.bin.orig'''&lt;br /&gt;
&lt;br /&gt;
Next modify &amp;lt;code&amp;gt;modules.dep&amp;lt;/code&amp;gt; to include &amp;lt;code&amp;gt;kernel/drivers/char/lpd8806.ko:&amp;lt;/code&amp;gt; (This didn't work for me.)&lt;br /&gt;
&lt;br /&gt;
Upon successful completion, you should be able to run the following:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /lib/modules/3.8.13-bone19/kernel/drivers/char/'''&lt;br /&gt;
 bone$ '''insmod lpd8806'''&lt;br /&gt;
&lt;br /&gt;
Now test it with&lt;br /&gt;
 bone$ '''cd ~/exercises/LEDstring'''&lt;br /&gt;
 bone$ '''make tree'''&lt;br /&gt;
 bone$ '''./tree 3 60000 20000'''&lt;br /&gt;
&lt;br /&gt;
This will display a sequence of LEDs running up and down the string.&lt;br /&gt;
&lt;br /&gt;
== User Instructions 3.2 Kernel ==&lt;br /&gt;
&lt;br /&gt;
Run &amp;lt;code&amp;gt;dmesg&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;lsmod&amp;lt;/code&amp;gt; to make sure the modules have loaded properly. You should now find two folders inside &amp;lt;code&amp;gt;/sys/firmware&amp;lt;/code&amp;gt; called &amp;lt;code&amp;gt;example&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;lpd8806&amp;lt;/code&amp;gt;. Feel free to play around in the example folder. If you go into this folder and then one folder further into device, you will find two files. The &amp;lt;code&amp;gt;test&amp;lt;/code&amp;gt; file holds an unsigned integer, while the &amp;lt;code&amp;gt;data&amp;lt;/code&amp;gt; file holds a string of length 10 (initially empty). You can read and write from these files as you would any other sysfs file.&lt;br /&gt;
&lt;br /&gt;
Next we will hook up the LED strand. &amp;lt;b&amp;gt;For this make sure the beagle is powered externally&amp;lt;/b&amp;gt;. The USB power supply does not have enough current to run the 5m strand at full brightness.&lt;br /&gt;
&lt;br /&gt;
To get started hook up pins 30 (D12/SPI1_D1) and 31 (A13/SPI1_SCLK) to SPI data and SPI clock on the strand (see the silkscreen for guidance. Hook up the ground to ground (obviously), and the 5V wire on the strand to the &amp;lt;b&amp;gt;3.3V&amp;lt;/b&amp;gt; pin on the bone. &amp;lt;b&amp;gt;Do not use the 5V pin on the bone or the suggested Adafruit 5V power supply directly connected to the strand without also adding logic level voltage shifters to the data and clock lines&amp;lt;/b&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:Bone_P9_pinout.jpg]]&lt;br /&gt;
&lt;br /&gt;
You may need to modify your muxes (if they have been changed from the default). If so, do the following:&lt;br /&gt;
 beagle$ '''echo 0 &amp;gt; /sys/kernel/debug/omap_mux/spi0_d1'''&lt;br /&gt;
 beagle$ '''echo 0 &amp;gt; /sys/kernel/debug/omap_mux/spi0_scl'''&lt;br /&gt;
&lt;br /&gt;
Now that the strand is hooked up, we can run the following:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/firmware/lpd8806/device/'''&lt;br /&gt;
 bone$ '''echo &amp;quot;127 127 127&amp;quot; &amp;gt; grb'''&lt;br /&gt;
&lt;br /&gt;
You should see the first LED (closest to the bone) light up bright white. You can also do something like the following:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo &amp;quot;127 0 0 0 127 0 0 0 127&amp;quot; &amp;gt; data'''&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;data&amp;lt;/code&amp;gt; file is written directly out to the strand while the &amp;lt;code&amp;gt;grb&amp;lt;/code&amp;gt; file treats the strand like a big shift register. &amp;lt;b&amp;gt;Be careful with using &amp;lt;code&amp;gt;data&amp;lt;/code&amp;gt;&amp;lt;/b&amp;gt;. Buffering problems can cause the kernel to seg fault or crash completely (see Future Work).&lt;br /&gt;
&lt;br /&gt;
== User Instructions 3.8 Kernel ==&lt;br /&gt;
&lt;br /&gt;
Run &amp;lt;code&amp;gt;dmesg&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;lsmod&amp;lt;/code&amp;gt; to make sure the modules have loaded properly. You should now find a folder inside &amp;lt;code&amp;gt;/sys/firmware&amp;lt;/code&amp;gt; called &amp;lt;code&amp;gt;lpd8806&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Next we will hook up the LED strand. &amp;lt;b&amp;gt;For this make sure the beagle is powered externally&amp;lt;/b&amp;gt;. The USB power supply does not have enough current to run the 5m strand at full brightness.&lt;br /&gt;
&lt;br /&gt;
To get started hook up pins 18 (D12/SPI0_D1) and 22 (A13/SPI0_SCLK) to SPI data and SPI clock on the strand (see the silkscreen for guidance. Hook up the ground to ground (obviously), and the 5V wire on the strand to the &amp;lt;b&amp;gt;3.3V&amp;lt;/b&amp;gt; pin on the bone. &amp;lt;b&amp;gt;Do not use the 5V pin on the bone or the suggested Adafruit 5V power supply directly connected to the strand without also adding logic level voltage shifters to the data and clock lines&amp;lt;/b&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:HeaderP9.jpg|800px]]&lt;br /&gt;
&lt;br /&gt;
Now that the strand is hooked up, we can run the following:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/firmware/lpd8806/device/'''&lt;br /&gt;
 bone$ '''echo &amp;quot;127 127 127 0&amp;quot; &amp;gt; rgb'''&lt;br /&gt;
&lt;br /&gt;
You should see LED '''0''' (closest to the bone) light up bright white. You can also do something like the following to turn LED ''x'' red.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo &amp;quot;127 0 0 ''x''&amp;quot; &amp;gt; rgb'''&lt;br /&gt;
&lt;br /&gt;
The driver keeps an internal state of the string and shifts it out to update the string.  (The shifting is so fast you won't see it.)  You can see the state of the string with:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cat data'''&lt;br /&gt;
&lt;br /&gt;
You can change the internal state without updating the string by suppressing the 'return' on the echo.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo -n 0 50 0 10 &amp;gt; rgb&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
* [http://hipstercircuits.com/enable-spi-with-device-tree-on-beaglebone-black-copy-paste/ Enable SPI with device tree on BeagleBone Black] shows how to set the pin muxing for SPI1.&lt;br /&gt;
* [http://blog.inbedded.net/blog/categories/device-tree/ BeagleBone Black and LCD = fun] showed how to set the pin mux for SPI0.&lt;br /&gt;
&lt;br /&gt;
== Highlights ==&lt;br /&gt;
&lt;br /&gt;
We have created a simple C example that uses this sysfs driver. You can run it by doing the following:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd ~/FinalProject'''&lt;br /&gt;
 bone$ '''make'''&lt;br /&gt;
 bone$ '''./test'''&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|8d9n5QUyH38}}&lt;br /&gt;
&lt;br /&gt;
The program shows the capabilities of the strand running in shift mode. Because of the nature of the strand's construction, it would be very simple to daisy chain many chains end to end. Also, the kset implementation means that we can have as many separate strands as there are SPI buses. Normally you could have even more, but the strand only runs 3 wire SPI (no chip select).&lt;br /&gt;
&lt;br /&gt;
The speed is increased greatly when the strand is running in direct access mode by using the &amp;lt;code&amp;gt;data&amp;lt;/code&amp;gt; file instead of the &amp;lt;code&amp;gt;grb&amp;lt;/code&amp;gt; file. However, due to time limitations we were unable to debug the buffering issues. A good place for future work would be to figure out how the buffering problem can be alleviated.&lt;br /&gt;
&lt;br /&gt;
== Theory of Operation ==&lt;br /&gt;
&lt;br /&gt;
There are many layers to the implementation, so we will break them out into subsections.&lt;br /&gt;
&lt;br /&gt;
=== Light Strand ===&lt;br /&gt;
&lt;br /&gt;
The light strand uses the LPD8806 controller chip. Each chip controls the brightness of two 3 color GRB LEDs using PWM running at 1.2 MHz. SPI is used to communicate with the controller chips. The controller has its SPI bus rated somewhere around 20 MHz, but we are only running at 10 MHz. Each LED is 21-bit color, which leaves three bits available for latch control.&lt;br /&gt;
&lt;br /&gt;
So, as you write color values out on the SPI, the first chip receives them. If the chip hasn't written a color to one of its to LEDs, it does so and thus ends the transmission. However, if it has already assigned a color to each LED then it passes the SPI along on a separate bus to the next chip. This is how the strand is able to be 5m and still run at 10 MHz.&lt;br /&gt;
&lt;br /&gt;
It is still unknown how exactly the 3 latch bits are used (because the chip manufacturer has kept the interface a secret). However, if you write 6 bytes of &amp;quot;latch&amp;quot; the strand restarts at the beginning. Perhaps less bytes of &amp;quot;latch&amp;quot; can be sent and get the same effect, but due to time limitations we were unable to debug this completely. This is a simple place to start for future work.&lt;br /&gt;
&lt;br /&gt;
=== SPI Bus ===&lt;br /&gt;
&lt;br /&gt;
We use the default SPI controller to control the SPI lines. All we had to do is find what master is controlling the bus (2 in our case) and add a device. Initially, the SPI bus we want is being used by the default configuration of spidev. So, all we do is unregister the device from spidev and reregister it for our driver. There are a few things that go into the configuration of the device like speed, number of bits, chip select, and mode. Once these are set, you can add the device and it will then be associated with your driver.&lt;br /&gt;
&lt;br /&gt;
=== Sysfs Kernel Driver ===&lt;br /&gt;
&lt;br /&gt;
The sysfs kernel driver is based on the references above. It uses a kset to store kobjects (the basic building block of the kernel). Each kobject has associated with it certain attributes. These attributes are brought out to the user as files. When the files are read from or written to, the kernel calls back into the kobject's read/write routines. Here, we are able to decide which attribute is being addressed and manipulate the buffer as we see fit.&lt;br /&gt;
&lt;br /&gt;
There are some alternative implementations to this that were looked into in addition to kset. The driver could have been implemented as a sysfs device driver instead of a kernel driver so that it shows up in &amp;lt;code&amp;gt;/sys/class&amp;lt;/code&amp;gt; with everything else. Another option is that it could be implemented as a straight up device/kernel driver making it show up in &amp;lt;code&amp;gt;/dev&amp;lt;/code&amp;gt; instead. There doesn't seem to be much of a difference though between these implementations as far as performance is concerned. However, finding where this driver fits best is another good place for future work. &lt;br /&gt;
&lt;br /&gt;
== Work Breakdown ==&lt;br /&gt;
&lt;br /&gt;
=== Sean Richardson ===&lt;br /&gt;
* Researched using SPI on the BeagleBone&lt;br /&gt;
* Debugged the LED strand (the first one we received was broken)&lt;br /&gt;
* Wrote code to interface with the strand using spidev&lt;br /&gt;
* Helped integrate the SPI interface into the sysfs driver&lt;br /&gt;
&lt;br /&gt;
=== Greg Larmore ===&lt;br /&gt;
* Researched kernel drivers and sysfs&lt;br /&gt;
* Helped debug the LED strand&lt;br /&gt;
* Wrote example sysfs driver&lt;br /&gt;
* Integrated the SPI interface into the sysfs driver&lt;br /&gt;
&lt;br /&gt;
== Future Work ==&lt;br /&gt;
&lt;br /&gt;
While the strand works well as it is, there are some things that we would like to see looked into if there is future work on this project.&lt;br /&gt;
&lt;br /&gt;
=== Latching and Controller Interface ===&lt;br /&gt;
&lt;br /&gt;
According to Adafruit, the interface to this part has been reverse engineered. The one part that really remains unknown is how exactly the 3-bit control interface works for each LED. We were able to achieve a latching effect by sending 6 empty transmissions. The code in [github.com/adafruit/lpd8806 Adafruit's github] doesn't seem to be using this many latch transmissions.&lt;br /&gt;
&lt;br /&gt;
=== Buffering Problem ===&lt;br /&gt;
&lt;br /&gt;
There is a problem with buffered output going into the &amp;lt;code&amp;gt;data&amp;lt;/code&amp;gt; file (because it is so big). When the output buffers it causes 2 sequential writes which weren't being handled well by the attribute's store function. This could be alleviated with a circular buffer and an index that can be controlled by the user, but really the driver should be able to handle this condition.&lt;br /&gt;
&lt;br /&gt;
=== Sysfs File Location ===&lt;br /&gt;
&lt;br /&gt;
The decision to have these drivers located in &amp;lt;code&amp;gt;/lib/modules/3.2.25+/kernel/drivers/char&amp;lt;/code&amp;gt; and run out of &amp;lt;code&amp;gt;/sys/firmware&amp;lt;/code&amp;gt; was pretty much arbitrary. It would be nice to do some research into how the kernel is supposed to be structured so that we can match it. This also applies to the example driver included in this project.&lt;br /&gt;
&lt;br /&gt;
== Conclusions ==&lt;br /&gt;
&lt;br /&gt;
In this project, we were able to get SPI (a lesser used interface on the bone) to work well with our LED strand. More impressively, we were able to interface with the SPI through a sysfs interface. In the process of developing this sysfs interface to the LED strand, we developed an example sysfs driver that can be used in future ECE497 classes. Lastly, we developed a sample application that uses this sysfs interface for our LED strand to show off the results.&lt;/div&gt;</summary>
		<author><name>Yoder</name></author>	</entry>

	<entry>
		<id>http://www.elinux.org/EBC_Exercise_10a_Analog_In</id>
		<title>EBC Exercise 10a Analog In</title>
		<link rel="alternate" type="text/html" href="http://www.elinux.org/EBC_Exercise_10a_Analog_In"/>
				<updated>2013-06-06T19:14:03Z</updated>
		
		<summary type="html">&lt;p&gt;Yoder: /* Analog in */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:ECE497]]&lt;br /&gt;
{{YoderHead}}&lt;br /&gt;
== Analog in ==&lt;br /&gt;
{{EBC3.8}}This page is for the Bone (Black or White) running the 3.8 Kernel. See [[EBC_Exercise_10_Flashing_an_LED_-_xM_WhiteBone]] for the White Bone or xM running 3.2.&lt;br /&gt;
&lt;br /&gt;
(This is based on [https://groups.google.com/forum/?fromgroups#!searchin/beagleboard/AIN/beagleboard/-ClhIXxtOds/rranYdwhS88J BeagleBone Black Analog Input].)&lt;br /&gt;
&lt;br /&gt;
The bone has eight Analog Inputs.  Several are exposed on P9.  They are labeled '''AIN''' in table 11 below.  How many do you find?&lt;br /&gt;
&lt;br /&gt;
[[File:HeaderP9.jpg|800px]]&lt;br /&gt;
&lt;br /&gt;
The AIN pins are sampled at 12 bits and 100k samples per second.  The input voltage is between 0 and 1.8V.  Fortunately, both voltages are available on P9.&lt;br /&gt;
&lt;br /&gt;
The photo below shows a small potentiometer wired to the bone.  One end goes to the analog ground (pin 34), the other analog 1.8V (pin 32). The wiper is attached to '''AIN5''' which is pin 36.&lt;br /&gt;
&lt;br /&gt;
[[File:Bone gpio.JPG|300px]]&lt;br /&gt;
[[File:BoneGPIO.png|300px]]&lt;br /&gt;
&lt;br /&gt;
You interact with the analog in much like the gpio, but it appears in a different. We have to run a command before the AIN interface appears.  Just run them now, later we'll explain what you did.&lt;br /&gt;
&lt;br /&gt;
 beagle$ '''SLOTS=/sys/devices/bone_capemgr.*/slots'''&lt;br /&gt;
 beagle$ '''PINS=/sys/kernel/debug/pinctrl/44e10800.pinmux/pins'''&lt;br /&gt;
 beagle$ '''echo cape-bone-iio &amp;gt; $SLOTS'''&lt;br /&gt;
&lt;br /&gt;
You can now access the analog interface, but where do they appear.  Try using the '''find''' command.&lt;br /&gt;
&lt;br /&gt;
 beagle$ '''find /sys -name &amp;quot;*AIN&amp;quot;'''&lt;br /&gt;
 ./devices/ocp.2/helper.14/AIN0&lt;br /&gt;
 ./devices/ocp.2/helper.14/AIN1&lt;br /&gt;
 ./devices/ocp.2/helper.14/AIN2&lt;br /&gt;
 ./devices/ocp.2/helper.14/AIN3&lt;br /&gt;
 ./devices/ocp.2/helper.14/AIN4&lt;br /&gt;
 ./devices/ocp.2/helper.14/AIN5&lt;br /&gt;
 ./devices/ocp.2/helper.14/AIN6&lt;br /&gt;
 ./devices/ocp.2/helper.14/AIN7&lt;br /&gt;
&lt;br /&gt;
You paths may be slightly different. Now explore.&lt;br /&gt;
&lt;br /&gt;
 beagle$ '''cd /sys/devices/ocp.2/helper.14'''&lt;br /&gt;
 beagle$ '''ls -F'''&lt;br /&gt;
 AIN0  AIN2  AIN4  AIN6  driver@   power/      uevent&lt;br /&gt;
 AIN1  AIN3  AIN5  AIN7  modalias  subsystem@&lt;br /&gt;
&lt;br /&gt;
There are the various analog inputs, but watch out.  This interface starts numbering at '''1''' and Table 11 starts at '''0''', so to read AIN5 you need to look at '''AIN6'''!&lt;br /&gt;
&lt;br /&gt;
 beagle$ '''cat AIN6'''&lt;br /&gt;
 1185&lt;br /&gt;
&lt;br /&gt;
Change the pot and rerun '''cat'''.  What's the min and max value you get?  Is it 12 bits?&lt;br /&gt;
&lt;br /&gt;
=== Challenge ===&lt;br /&gt;
Rewrite the scripts from before to read an AIN pin and continuously display it's value.&lt;br /&gt;
&lt;br /&gt;
{{YoderFoot}}&lt;/div&gt;</summary>
		<author><name>Yoder</name></author>	</entry>

	<entry>
		<id>http://www.elinux.org/EBC_Exercise_10_Flashing_an_LED</id>
		<title>EBC Exercise 10 Flashing an LED</title>
		<link rel="alternate" type="text/html" href="http://www.elinux.org/EBC_Exercise_10_Flashing_an_LED"/>
				<updated>2013-06-06T19:09:12Z</updated>
		
		<summary type="html">&lt;p&gt;Yoder: /* Analog in */ Moved to it's own page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:EmbeddedBeagleClass]]&lt;br /&gt;
[[Category:ECE497]]&lt;br /&gt;
{{YoderHead}}&lt;br /&gt;
{{EBC3.8}}This page is for the Bone (Black or White) running the 3.8 Kernel. See [[EBC_Exercise_10_Flashing_an_LED_-_xM_WhiteBone]] for the White Bone or xM running 3.2.&lt;br /&gt;
&lt;br /&gt;
The [http://en.wikipedia.org/wiki/Hello_world_program &amp;quot;Hello World&amp;quot;] program is the traditional first program for many classes.  Flashing an LED is the embedded equivalent.  Here we will explore a few ways to flash and LED on the Beagle and explore General Purpose I/O (gpio) along the way.  These calls will be done from the command line of the Beagle, so there is no need for the host computer.&lt;br /&gt;
&lt;br /&gt;
== gpio via the Shell Command Line and sysfs ==&lt;br /&gt;
&lt;br /&gt;
('''Note''':  Draw the new diagrams with [http://engineersofthecorn.blogspot.com/2012/06/fritzing-part-for-beaglebone.html this].)&lt;br /&gt;
&lt;br /&gt;
The easiest way to do general purpose I/O (gpio) on the Beagle is through a terminal window and a shell prompt. In Linux, almost everything is treated as a file, even things that aren't files. In our class we'll use a virtual file system called '''sysfs'''.  sysfs exposes the drivers for the hardware so you get easily use them.&lt;br /&gt;
&lt;br /&gt;
Try this, open a terminal and type:&lt;br /&gt;
&lt;br /&gt;
 beagle$ '''cd /sys'''&lt;br /&gt;
 beagle$ '''ls -F'''&lt;br /&gt;
 block/  bus/  class/  dev/  devices/  firmware/  fs/  kernel/  module/  power/&lt;br /&gt;
&lt;br /&gt;
Here we see several directories that represent hardware we can control. Explore a bit and see what you find.&lt;br /&gt;
&lt;br /&gt;
Now try:&lt;br /&gt;
&lt;br /&gt;
 beagle$ '''cd /sys/class'''&lt;br /&gt;
 beagle$ '''ls -F'''&lt;br /&gt;
 backlight/  firmware/     lcd/       mtd/           scsi_disk/   ubi/&lt;br /&gt;
 bdi/        gpio/         leds/      net/           scsi_host/   udc/&lt;br /&gt;
 block/      graphics/     mbox/      power_supply/  sound/       uio/&lt;br /&gt;
 bluetooth/  hwmon/        mdio_bus/  regulator/     spi_master/  usbmon/&lt;br /&gt;
 bsg/        i2c-adapter/  mem/       rfkill/        spidev/      vc/&lt;br /&gt;
 dma/        i2c-dev/      misc/      rtc/           thermal/     vtconsole/&lt;br /&gt;
 drm/        input/        mmc_host/  scsi_device/   tty/         watchdog/&lt;br /&gt;
&lt;br /&gt;
Explore some.  What do you find?  In '''graphics''' you will see the frame buffer supported by the processor.  In '''sound''' you'll see the [http://www.alsa-project.org/main/index.php/Main_Page alsa] sound devices.&lt;br /&gt;
&lt;br /&gt;
== Flashing the user LEDs ==&lt;br /&gt;
&lt;br /&gt;
The Beagle Black has four user LEDS, '''user0''' - '''user3''', that you can control. Try this:&lt;br /&gt;
&lt;br /&gt;
 beagle$ '''cd /sys/class/leds'''&lt;br /&gt;
 beagle$ '''ls -F'''&lt;br /&gt;
 beaglebone:green:usr0  beaglebone:green:usr2&lt;br /&gt;
 beaglebone:green:usr1  beaglebone:green:usr3&lt;br /&gt;
&lt;br /&gt;
Here you see the directories for controlling each of the usr LEDs. By default, usr0 flashes a heartbeat pattern and usr1 flashes when the micro SD card is accessed.  Let's control usr0.&lt;br /&gt;
&lt;br /&gt;
 beagle$ '''cd beagleboard\:\:usr0'''&lt;br /&gt;
 beagle$ '''ls -F'''&lt;br /&gt;
 brightness  device@  max_brightness  power/  subsystem@  trigger  uevent&lt;br /&gt;
&lt;br /&gt;
See what's in '''brightness''', '''max_brightness''' and '''trigger''' by using the &amp;lt;code&amp;gt;cat&amp;lt;/code&amp;gt; command.  For example:&lt;br /&gt;
&lt;br /&gt;
 beagle$ '''cat trigger'''&lt;br /&gt;
 none nand-disk mmc0 timer oneshot [heartbeat] backlight gpio cpu0 default-on transient&lt;br /&gt;
&lt;br /&gt;
This shows trigger can have many values.  The present value is '''heartbeat'''.  Check the LED, is it beating?  You can stop the heartbeat via:&lt;br /&gt;
&lt;br /&gt;
 beagle$ '''echo none &amp;gt; trigger'''&lt;br /&gt;
 beagle$ '''cat trigger'''&lt;br /&gt;
 [none] nand-disk mmc0 timer oneshot heartbeat backlight gpio cpu0 default-on transient &lt;br /&gt;
&lt;br /&gt;
Did it stop beating?  You can now turn it on and off with:&lt;br /&gt;
&lt;br /&gt;
 beagle$ '''echo 1 &amp;gt; brightness'''&lt;br /&gt;
 beagle$ '''echo 0 &amp;gt; brightness'''&lt;br /&gt;
&lt;br /&gt;
Is it responding correctly?&lt;br /&gt;
&lt;br /&gt;
The Bone has more trigger options.  Try:&lt;br /&gt;
&lt;br /&gt;
 beagle$ '''cat trigger'''&lt;br /&gt;
 [none] mmc0 timer heartbeat backlight gpio default-on &lt;br /&gt;
 beagle$ '''echo timer &amp;gt; trigger'''&lt;br /&gt;
 beagle$ '''ls -F'''&lt;br /&gt;
 brightness  delay_on  max_brightness  subsystem@  uevent&lt;br /&gt;
 delay_off   device@   power/          trigger&lt;br /&gt;
 beagle$ '''echo 100 &amp;gt; delay_on'''&lt;br /&gt;
 beagle$ '''echo 900 &amp;gt; delay_off'''&lt;br /&gt;
&lt;br /&gt;
What does this do?&lt;br /&gt;
&lt;br /&gt;
== Adding your own LED ==&lt;br /&gt;
&lt;br /&gt;
It's not hard to use the gpio pins to control your own LED. All you need is an LED and a 220&amp;amp;Omega; resistor. Here's a picture of how it's wired. We are just doing the LED at the top of the breadboard for now.&lt;br /&gt;
&lt;br /&gt;
[[File:Bone gpio.JPG|300px]]&lt;br /&gt;
[[File:BoneGPIO.png|300px]]&lt;br /&gt;
&lt;br /&gt;
So how do you know where to connect it?  The BeagleBone [https://github.com/CircuitCo/BeagleBone-Black/blob/master/BBB_SRM.pdf?raw=true System Reference Manual] has the details.  Figure 45 on page 74 shows:&lt;br /&gt;
&lt;br /&gt;
[[File:BlackHeaders.jpg]]&lt;br /&gt;
&lt;br /&gt;
There at two expansion headers, P8 and P9.  Look at the bottom of the left header and you'll see it's labeled '''P9'''. Table 11 on page 78 shows the pinout for P9.&lt;br /&gt;
&lt;br /&gt;
[[File:HeaderP9.jpg|800px]]&lt;br /&gt;
&lt;br /&gt;
On the first photo above you can see that pin 1 (Ground) is wired to the '''-''' bus and pin 3 (3.3V) is wired to the '''+''' bus. The 220&amp;amp;Omega; resistor is wired to the '''-''' bus and the other end is attached to the negative lead of the LED.  The positive lead is attached to pin 12 which, as shown in Table 11, is attached to '''gpio1_28'''.  The gpio pins are in banks of 32 each, so to find the gpio number to use on the Beagle, use 1*32+28='''60'''.  Here's how you turn it on&lt;br /&gt;
&lt;br /&gt;
 beagle$ '''cd /sys/class/gpio'''&lt;br /&gt;
 beagle$ '''ls -F'''&lt;br /&gt;
 export  gpiochip0@  gpiochip32@  gpiochip64@  gpiochip96@  unexport&lt;br /&gt;
&lt;br /&gt;
Presently no gpio pins are visible.  You need to tell it which pin to export&lt;br /&gt;
&lt;br /&gt;
 beagle$ '''echo 60 &amp;gt; export'''&lt;br /&gt;
 beagle$ '''ls -F'''&lt;br /&gt;
 export  gpio60@  gpiochip0@  gpiochip32@  gpiochip64@  gpiochip96@  unexport&lt;br /&gt;
&lt;br /&gt;
Notice '''gpio60''' has appeared.  All we need to do is tell it which direction and then turn it on.&lt;br /&gt;
&lt;br /&gt;
 beagle$ '''cd gpio60'''&lt;br /&gt;
 beagle$ '''echo out &amp;gt; direction'''&lt;br /&gt;
 beagle$ '''echo 1 &amp;gt; value'''&lt;br /&gt;
&lt;br /&gt;
Your LED should be on!  When you are done you can unexport the pin and it will disappear.&lt;br /&gt;
 beagle$ '''cd ..'''&lt;br /&gt;
 beagle$ '''echo 60 &amp;gt; unexport'''&lt;br /&gt;
&lt;br /&gt;
== Reading a switch ==&lt;br /&gt;
&lt;br /&gt;
Now that you have an LED working, wiring in a switch is easy.  The picture above shows a push button switch wired in at the bottom of the P9 header.  Attach the '''+''' bus to one pole on the switch with a wire.  The other end of the switch is attached to pin 42 which is '''gpio0_7'''. &lt;br /&gt;
&lt;br /&gt;
Based on what you saw above, show how to read the switch.&lt;br /&gt;
&lt;br /&gt;
Once you have the switch and LED working you can use the following scripts to play with them.&lt;br /&gt;
&lt;br /&gt;
 beagle$ '''cd ~/exercises/gpio'''&lt;br /&gt;
 beagle$ '''./togglegpio.sh 60 0.1'''&lt;br /&gt;
&lt;br /&gt;
The LED should be blinking on and off.&lt;br /&gt;
&lt;br /&gt;
 beagle$ '''./readgpio.sh 7'''&lt;br /&gt;
&lt;br /&gt;
Push the pushbutton and see what happens.&lt;br /&gt;
&lt;br /&gt;
How can this work without a pulldown resistor? It turns out the Bone has an internal pulldown (and up) resistor that can be software enabled.  We'll discuss how when we cover device trees.&lt;br /&gt;
&lt;br /&gt;
=== Challenge ===&lt;br /&gt;
&lt;br /&gt;
* Can you modify the scripts above to read the switch and turn the LED on and off?&lt;br /&gt;
&lt;br /&gt;
== Assignment: gpio from the shell ==&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:green;&amp;quot;&amp;gt;Measuring a gpio pin on an Oscilloscope&amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Get an oscilloscope so you can measure the output of your gpio pins.  Run&lt;br /&gt;
 beagle$ '''./togglegpio.sh 60 0.1'''&lt;br /&gt;
&lt;br /&gt;
and answer the following questions about gpio measurements.&lt;br /&gt;
&lt;br /&gt;
# What's the min and max voltage?  &lt;br /&gt;
# What period is it?  &lt;br /&gt;
# How close is it to 100ms?  &lt;br /&gt;
# Why do they differ?&lt;br /&gt;
# Run '''htop''' and see how much processor you are using.&lt;br /&gt;
# Try different values for the sleep time (2nd argument). What's the shortest period you can get? Make a table of the values you try and the corresponding period and processor usage.&lt;br /&gt;
# How stable is the period?  &lt;br /&gt;
# Try launching something like '''mplayer'''. How stable is the period?&lt;br /&gt;
# Try cleaning up togglegpio.sh and removing unneeded lines.  Does it impact the period?&lt;br /&gt;
# togglegpio uses bash (first line in file).  Try using sh.  Is the period shorter?&lt;br /&gt;
# What's the shortest period you can get?&lt;br /&gt;
&lt;br /&gt;
=== Toggling the LEDs ===&lt;br /&gt;
&lt;br /&gt;
Modify togglegpio.sh (call it toggleLED) to toggle the on-board LEDs.  Can you get the LED to appear to dim by changing the duty cycle of the toggling?&lt;br /&gt;
&lt;br /&gt;
=== Count the User Button Presses ===&lt;br /&gt;
&lt;br /&gt;
Write a shell script that displays a count of the number of times the Button has been pressed.&lt;br /&gt;
&lt;br /&gt;
=== Copy gpio 7 to gpio 60===&lt;br /&gt;
&lt;br /&gt;
Write a shell script that copies the value of gpio pin 7 (your switch) to gpio pin 60 (Your LED).  How much CPU time does it take?  What's the delay from the time the input changes until the output changes?  How constant is the delay?&lt;br /&gt;
&lt;br /&gt;
You may need to get a function generator and set it to a square wave (0 to 3.3V) and attach it to pin 7 and attached an oscilloscope to pin 60.&lt;br /&gt;
&lt;br /&gt;
== Resources ==&lt;br /&gt;
&lt;br /&gt;
# [http://wh1t3s.com/2009/05/14/reading-beagleboard-gpio/ Here] is wh1ts article on flashing an LED.  It is referenced in the '''readgpio''' file that comes on the Beagle.&lt;br /&gt;
# [http://blog.makezine.com/archive/2009/02/blinking-leds-with-the-beagle-board.html?CMP=OTC-0D6B48984890 This] Make magazine article has a few more details.&lt;br /&gt;
# [http://www.avrfreaks.net/wiki/index.php/Documentation:Linux/GPIO#Getting_access_to_a_GPIO Here] in a gpio reference for Linux in general. It includes sample 'C' code for flashing at 1 Hz.&lt;br /&gt;
# [https://groups.google.com/forum/?hl=en#!msg/beagleboard/20rM-r8C2YY/hVZiN2ahI8YJ Here] is a posting in the Beagle Google group about gpio.&lt;br /&gt;
# [http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=Documentation/gpio.txt;h=36af58eba136bac198ea3b1f33f34236be9ce5df;hb=HEAD Here] is some information about gpio from the kernel point of view.&lt;br /&gt;
# [http://wiki.gumstix.org/index.php?title=GPIO_Event_Driver Here] is some info on a GPIO Event Driver&lt;br /&gt;
# [https://www.ridgerun.com/developer/wiki/index.php/How_to_use_GPIO_signals Here] is info on how to set '''edge''' to falling and poll() the pin.&lt;br /&gt;
# [http://www.kernel.org/doc/Documentation/gpio.txt Here] is the kernel Documentation on gpio.&lt;br /&gt;
&lt;br /&gt;
{{YoderFoot}}&lt;/div&gt;</summary>
		<author><name>Yoder</name></author>	</entry>

	<entry>
		<id>http://www.elinux.org/EBC_Exercise_10a_Analog_In</id>
		<title>EBC Exercise 10a Analog In</title>
		<link rel="alternate" type="text/html" href="http://www.elinux.org/EBC_Exercise_10a_Analog_In"/>
				<updated>2013-06-06T19:08:40Z</updated>
		
		<summary type="html">&lt;p&gt;Yoder: Initial Page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:ECE497]]&lt;br /&gt;
{{YoderHead}}&lt;br /&gt;
== Analog in ==&lt;br /&gt;
&lt;br /&gt;
(This is based on [https://groups.google.com/forum/?fromgroups#!searchin/beagleboard/AIN/beagleboard/-ClhIXxtOds/rranYdwhS88J this].)&lt;br /&gt;
&lt;br /&gt;
The bone has eight Analog Inputs.  Several are exposed on P9.  They are labeled '''AIN''' in table 11 above.  How many do you find?&lt;br /&gt;
&lt;br /&gt;
The AIN pins are sampled at 12 bits and 100k samples per second.  The input voltage is between 0 and 1.8V.  Fortunately, both voltages are available on P9.&lt;br /&gt;
&lt;br /&gt;
The photo above shows a small potentiometer wired to the bone.  One end goes to the analog ground (pin 34), the other analog 1.8V (pin 32). The wiper is attached to '''AIN5''' which is pin 36.&lt;br /&gt;
&lt;br /&gt;
You interact with the analog in much like the gpio, but it appears in a different. We have to run a command before the AIN interface appears.  Just run them now, later we'll explain what you did.&lt;br /&gt;
&lt;br /&gt;
 beagle$ '''SLOTS=/sys/devices/bone_capemgr.*/slots'''&lt;br /&gt;
 beagle$ '''PINS=/sys/kernel/debug/pinctrl/44e10800.pinmux/pins'''&lt;br /&gt;
 beagle$ '''echo cape-bone-iio &amp;gt; $SLOTS'''&lt;br /&gt;
&lt;br /&gt;
You can now access the analog interface, but where do they appear.  Try using the '''find''' command.&lt;br /&gt;
&lt;br /&gt;
 beagle$ '''find /sys -name &amp;quot;*AIN&amp;quot;'''&lt;br /&gt;
 ./devices/ocp.2/helper.14/AIN0&lt;br /&gt;
 ./devices/ocp.2/helper.14/AIN1&lt;br /&gt;
 ./devices/ocp.2/helper.14/AIN2&lt;br /&gt;
 ./devices/ocp.2/helper.14/AIN3&lt;br /&gt;
 ./devices/ocp.2/helper.14/AIN4&lt;br /&gt;
 ./devices/ocp.2/helper.14/AIN5&lt;br /&gt;
 ./devices/ocp.2/helper.14/AIN6&lt;br /&gt;
 ./devices/ocp.2/helper.14/AIN7&lt;br /&gt;
&lt;br /&gt;
You paths may be slightly different. Now explore.&lt;br /&gt;
&lt;br /&gt;
 beagle$ '''cd /sys/devices/ocp.2/helper.14'''&lt;br /&gt;
 beagle$ '''ls -F'''&lt;br /&gt;
 AIN0  AIN2  AIN4  AIN6  driver@   power/      uevent&lt;br /&gt;
 AIN1  AIN3  AIN5  AIN7  modalias  subsystem@&lt;br /&gt;
&lt;br /&gt;
There are the various analog inputs, but watch out.  This interface starts numbering at '''1''' and Table 11 starts at '''0''', so to read AIN5 you need to look at '''AIN6'''!&lt;br /&gt;
&lt;br /&gt;
 beagle$ '''cat AIN6'''&lt;br /&gt;
 1185&lt;br /&gt;
&lt;br /&gt;
Change the pot and rerun '''cat'''.  What's the min and max value you get?  Is it 12 bits?&lt;br /&gt;
&lt;br /&gt;
=== Challenge ===&lt;br /&gt;
Rewrite the scripts from before to read an AIN pin and continuously display it's value.&lt;br /&gt;
&lt;br /&gt;
{{YoderFoot}}&lt;/div&gt;</summary>
		<author><name>Yoder</name></author>	</entry>

	<entry>
		<id>http://www.elinux.org/ECE497_SPI_Project</id>
		<title>ECE497 SPI Project</title>
		<link rel="alternate" type="text/html" href="http://www.elinux.org/ECE497_SPI_Project"/>
				<updated>2013-06-06T18:56:21Z</updated>
		
		<summary type="html">&lt;p&gt;Yoder: /* User Instructions 3.8 Kernel */ Added References&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:ECE497Fall2012 |Project]]&lt;br /&gt;
[[Category:ECE497 |Ada]]&lt;br /&gt;
Team members: [[user:Richarsm|Sean Richardson]], [[user:larmorgs|Greg Larmore]]&lt;br /&gt;
&lt;br /&gt;
== Executive Summary ==&lt;br /&gt;
&lt;br /&gt;
For this project we wanted to further improve documentation available for sysfs kernel drivers with the Beagle Bone. To do this we have interfaced an [http://adafruit.com/products/306 LED light strand] by Adafruit with a sysfs kernel driver utilizing SPI. In doing so we have created an easy to use interface to the light strand while also maximizing data throughput.&lt;br /&gt;
&lt;br /&gt;
== Good Websites ==&lt;br /&gt;
&lt;br /&gt;
[http://elinux.org/BeagleBoard/SPI BeagleBoard and SPI]&lt;br /&gt;
&lt;br /&gt;
[http://www.xml.com/ldd/chapter/book/ O'Reilly Book on Linux Device Drivers]&lt;br /&gt;
&lt;br /&gt;
[http://www.cs.fsu.edu/~baker/devices/lxr/http/source/linux/samples/kobject/kset-example.c Kset example for sysfs driver]&lt;br /&gt;
&lt;br /&gt;
[http://elk.informatik.fh-augsburg.de/pub/elinux/ngw100-docs/AVR32743/spi/spi_example.c Example SPI device driver]&lt;br /&gt;
&lt;br /&gt;
[http://www.jumpnowtek.com/index.php?option=com_content&amp;amp;view=article&amp;amp;id=57&amp;amp;Itemid=62 Another example SPI device driver]&lt;br /&gt;
&lt;br /&gt;
== More Good Websites ==&lt;br /&gt;
&lt;br /&gt;
[http://www.loadyourself.com/linux/sample-linux-driver/ Example Kernel Driver (ioctl, no sysfs)]&lt;br /&gt;
&lt;br /&gt;
[http://www.freesoftwaremagazine.com/articles/drivers_linux Kernel Driver Tutorial (no sysfs/ioctl)]&lt;br /&gt;
&lt;br /&gt;
== Installation Instructions 3.2 Kernel ==&lt;br /&gt;
{{EBC3.2}}&lt;br /&gt;
All of these instructions are meant for the A6A BeagleBone running version 3.2.25+ of the kernel. Scripts and Makefiles expect that the kernel be located at &amp;lt;code&amp;gt;~/BeagleBoard/kernel/kernel&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Start by cloning the [https://github.com/larmorgs/FinalProject github] repository on both the bone and the host machine by running the following:&lt;br /&gt;
&lt;br /&gt;
 both$ '''git clone git@github.com:larmorgs/FinalProject'''&lt;br /&gt;
&lt;br /&gt;
On the host machine, run the following:&lt;br /&gt;
&lt;br /&gt;
 host$ '''cd ~/FinalProject'''&lt;br /&gt;
 host$ '''./setup.sh'''&lt;br /&gt;
&lt;br /&gt;
Make sure you only do this &amp;lt;b&amp;gt;once&amp;lt;/b&amp;gt; because it is adding on our modules to the Kconfig and Makefile in &amp;lt;code&amp;gt;~/BeagleBoard/kernel/kernel/driver/char&amp;lt;/code&amp;gt;. The files are backed up in the same folder with &amp;lt;code&amp;gt;.orig&amp;lt;/code&amp;gt; appended.&lt;br /&gt;
&lt;br /&gt;
Next run the following on the host machine:&lt;br /&gt;
&lt;br /&gt;
 host$ '''make kernel'''&lt;br /&gt;
&lt;br /&gt;
This will copy the files &amp;lt;code&amp;gt;example.c&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;lpd8806.c&amp;lt;/code&amp;gt; into the &amp;lt;code&amp;gt;~/BeagleBoard/kernel/kernel/driver/char&amp;lt;/code&amp;gt; directory, make the kernel, and then scp the files to the bone.&lt;br /&gt;
&lt;br /&gt;
Moving over to the bone, run the following:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /lib/modules/3.2.25+'''&lt;br /&gt;
 bone$ '''mv modules.dep.bin modules.dep.bin.orig'''&lt;br /&gt;
&lt;br /&gt;
Next modify &amp;lt;code&amp;gt;modules.dep&amp;lt;/code&amp;gt; to include &amp;lt;code&amp;gt;kernel/drivers/char/example.ko:&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;kernel/drivers/char/lpd8806.ko:&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Upon successful completion, you should be able to run the following:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''modprobe example'''&lt;br /&gt;
 bone$ '''modprobe lpd8806'''&lt;br /&gt;
&lt;br /&gt;
== Installation Instructions 3.8 Kernel ==&lt;br /&gt;
{{EBC3.2}}&lt;br /&gt;
All of these instructions are meant for the BeagleBone running version 3.8 of the kernel with device tree. Scripts and Makefiles expect that the kernel be located at &amp;lt;code&amp;gt;~/BeagleBoard/linux-dev/KERNEL&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Start by updating the course materials. ([[EBC Exercise 05 Getting Exercise Support Materials]])&lt;br /&gt;
&lt;br /&gt;
On the host machine, run the following:&lt;br /&gt;
&lt;br /&gt;
 host$ '''cd ~/exercises/LEDstring/driver'''&lt;br /&gt;
 host$ '''git pull'''&lt;br /&gt;
 host$ '''./setup.sh'''&lt;br /&gt;
&lt;br /&gt;
Make sure you only do this &amp;lt;b&amp;gt;once&amp;lt;/b&amp;gt; because it is adding on our modules to the Kconfig and Makefile in &amp;lt;code&amp;gt;~/BeagleBoard/linux-dev/KERNEL/driver/char&amp;lt;/code&amp;gt;. The files are backed up in the same folder with &amp;lt;code&amp;gt;.orig&amp;lt;/code&amp;gt; appended.&lt;br /&gt;
&lt;br /&gt;
Next run the following on the host machine:&lt;br /&gt;
&lt;br /&gt;
 host$ '''make kernel'''&lt;br /&gt;
&lt;br /&gt;
This will copy the file &amp;lt;code&amp;gt;lpd8806.c&amp;lt;/code&amp;gt; into the &amp;lt;code&amp;gt;~/BeagleBoard/linux-dev/KERNEL/driver/char&amp;lt;/code&amp;gt; directory, make the kernel, and then scp the files to the bone. (Look in the Makefile and update the address for you Beagle.)&lt;br /&gt;
&lt;br /&gt;
Moving over to the bone, run the following:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd exercises/LEDstring/driver'''&lt;br /&gt;
 bone$ '''git pull'''&lt;br /&gt;
 bone$ '''make dt'''&lt;br /&gt;
&lt;br /&gt;
This will make the correct device tree overlay to set the pin muxxes for spi0.  You only have to do this once per booting the beagle. Next:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /lib/modules/3.8.13''' (or whatever path is correct for you system.)&lt;br /&gt;
 bone$ '''mv modules.dep.bin modules.dep.bin.orig'''&lt;br /&gt;
&lt;br /&gt;
Next modify &amp;lt;code&amp;gt;modules.dep&amp;lt;/code&amp;gt; to include &amp;lt;code&amp;gt;kernel/drivers/char/lpd8806.ko:&amp;lt;/code&amp;gt; (This didn't work for me.)&lt;br /&gt;
&lt;br /&gt;
Upon successful completion, you should be able to run the following:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /lib/modules/3.8.13-bone19/kernel/drivers/char/'''&lt;br /&gt;
 bone$ '''insmod lpd8806'''&lt;br /&gt;
&lt;br /&gt;
Now test it with&lt;br /&gt;
 bone$ '''cd ~/exercises/LEDstring'''&lt;br /&gt;
 bone$ '''make tree'''&lt;br /&gt;
 bone$ '''./tree 3 60000 20000'''&lt;br /&gt;
&lt;br /&gt;
This will display a sequence of LEDs running up and down the string.&lt;br /&gt;
&lt;br /&gt;
== User Instructions 3.2 Kernel ==&lt;br /&gt;
&lt;br /&gt;
Run &amp;lt;code&amp;gt;dmesg&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;lsmod&amp;lt;/code&amp;gt; to make sure the modules have loaded properly. You should now find two folders inside &amp;lt;code&amp;gt;/sys/firmware&amp;lt;/code&amp;gt; called &amp;lt;code&amp;gt;example&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;lpd8806&amp;lt;/code&amp;gt;. Feel free to play around in the example folder. If you go into this folder and then one folder further into device, you will find two files. The &amp;lt;code&amp;gt;test&amp;lt;/code&amp;gt; file holds an unsigned integer, while the &amp;lt;code&amp;gt;data&amp;lt;/code&amp;gt; file holds a string of length 10 (initially empty). You can read and write from these files as you would any other sysfs file.&lt;br /&gt;
&lt;br /&gt;
Next we will hook up the LED strand. &amp;lt;b&amp;gt;For this make sure the beagle is powered externally&amp;lt;/b&amp;gt;. The USB power supply does not have enough current to run the 5m strand at full brightness.&lt;br /&gt;
&lt;br /&gt;
To get started hook up pins 30 (D12/SPI1_D1) and 31 (A13/SPI1_SCLK) to SPI data and SPI clock on the strand (see the silkscreen for guidance. Hook up the ground to ground (obviously), and the 5V wire on the strand to the &amp;lt;b&amp;gt;3.3V&amp;lt;/b&amp;gt; pin on the bone. &amp;lt;b&amp;gt;Do not use the 5V pin on the bone or the suggested Adafruit 5V power supply directly connected to the strand without also adding logic level voltage shifters to the data and clock lines&amp;lt;/b&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:Bone_P9_pinout.jpg]]&lt;br /&gt;
&lt;br /&gt;
You may need to modify your muxes (if they have been changed from the default). If so, do the following:&lt;br /&gt;
 beagle$ '''echo 0 &amp;gt; /sys/kernel/debug/omap_mux/spi0_d1'''&lt;br /&gt;
 beagle$ '''echo 0 &amp;gt; /sys/kernel/debug/omap_mux/spi0_scl'''&lt;br /&gt;
&lt;br /&gt;
Now that the strand is hooked up, we can run the following:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/firmware/lpd8806/device/'''&lt;br /&gt;
 bone$ '''echo &amp;quot;127 127 127&amp;quot; &amp;gt; grb'''&lt;br /&gt;
&lt;br /&gt;
You should see the first LED (closest to the bone) light up bright white. You can also do something like the following:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo &amp;quot;127 0 0 0 127 0 0 0 127&amp;quot; &amp;gt; data'''&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;data&amp;lt;/code&amp;gt; file is written directly out to the strand while the &amp;lt;code&amp;gt;grb&amp;lt;/code&amp;gt; file treats the strand like a big shift register. &amp;lt;b&amp;gt;Be careful with using &amp;lt;code&amp;gt;data&amp;lt;/code&amp;gt;&amp;lt;/b&amp;gt;. Buffering problems can cause the kernel to seg fault or crash completely (see Future Work).&lt;br /&gt;
&lt;br /&gt;
== User Instructions 3.8 Kernel ==&lt;br /&gt;
&lt;br /&gt;
Run &amp;lt;code&amp;gt;dmesg&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;lsmod&amp;lt;/code&amp;gt; to make sure the modules have loaded properly. You should now find a folder inside &amp;lt;code&amp;gt;/sys/firmware&amp;lt;/code&amp;gt; called &amp;lt;code&amp;gt;lpd8806&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Next we will hook up the LED strand. &amp;lt;b&amp;gt;For this make sure the beagle is powered externally&amp;lt;/b&amp;gt;. The USB power supply does not have enough current to run the 5m strand at full brightness.&lt;br /&gt;
&lt;br /&gt;
To get started hook up pins 18 (D12/SPI0_D1) and 22 (A13/SPI0_SCLK) to SPI data and SPI clock on the strand (see the silkscreen for guidance. Hook up the ground to ground (obviously), and the 5V wire on the strand to the &amp;lt;b&amp;gt;3.3V&amp;lt;/b&amp;gt; pin on the bone. &amp;lt;b&amp;gt;Do not use the 5V pin on the bone or the suggested Adafruit 5V power supply directly connected to the strand without also adding logic level voltage shifters to the data and clock lines&amp;lt;/b&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:HeaderP9.jpg|800px]]&lt;br /&gt;
&lt;br /&gt;
Now that the strand is hooked up, we can run the following:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/firmware/lpd8806/device/'''&lt;br /&gt;
 bone$ '''echo &amp;quot;127 127 127 0&amp;quot; &amp;gt; rgb'''&lt;br /&gt;
&lt;br /&gt;
You should see LED '''0''' (closest to the bone) light up bright white. You can also do something like the following to turn LED ''x'' red.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo &amp;quot;127 0 0 ''x''&amp;quot; &amp;gt; rgb'''&lt;br /&gt;
&lt;br /&gt;
The driver keeps an internal state of the string and shifts it out to update the string.  (The shifting is so fast you won't see it.)  You can see the state of the string with:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cat data'''&lt;br /&gt;
&lt;br /&gt;
You can change the internal state without updating the string by suppressing the 'return' on the echo.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo -n 0 50 0 10 &amp;gt; rgb&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
* [http://hipstercircuits.com/enable-spi-with-device-tree-on-beaglebone-black-copy-paste/ Enable SPI with device tree on BeagleBone Black] shows how to set the pin muxing for SPI1.&lt;br /&gt;
* [http://blog.inbedded.net/blog/categories/device-tree/ BeagleBone Black and LCD = fun] showed how to set the pin mux for SPI0.&lt;br /&gt;
&lt;br /&gt;
== Highlights ==&lt;br /&gt;
&lt;br /&gt;
We have created a simple C example that uses this sysfs driver. You can run it by doing the following:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd ~/FinalProject'''&lt;br /&gt;
 bone$ '''make'''&lt;br /&gt;
 bone$ '''./test'''&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|8d9n5QUyH38}}&lt;br /&gt;
&lt;br /&gt;
The program shows the capabilities of the strand running in shift mode. Because of the nature of the strand's construction, it would be very simple to daisy chain many chains end to end. Also, the kset implementation means that we can have as many separate strands as there are SPI buses. Normally you could have even more, but the strand only runs 3 wire SPI (no chip select).&lt;br /&gt;
&lt;br /&gt;
The speed is increased greatly when the strand is running in direct access mode by using the &amp;lt;code&amp;gt;data&amp;lt;/code&amp;gt; file instead of the &amp;lt;code&amp;gt;grb&amp;lt;/code&amp;gt; file. However, due to time limitations we were unable to debug the buffering issues. A good place for future work would be to figure out how the buffering problem can be alleviated.&lt;br /&gt;
&lt;br /&gt;
== Theory of Operation ==&lt;br /&gt;
&lt;br /&gt;
There are many layers to the implementation, so we will break them out into subsections.&lt;br /&gt;
&lt;br /&gt;
=== Light Strand ===&lt;br /&gt;
&lt;br /&gt;
The light strand uses the LPD8806 controller chip. Each chip controls the brightness of two 3 color GRB LEDs using PWM running at 1.2 MHz. SPI is used to communicate with the controller chips. The controller has its SPI bus rated somewhere around 20 MHz, but we are only running at 10 MHz. Each LED is 21-bit color, which leaves three bits available for latch control.&lt;br /&gt;
&lt;br /&gt;
So, as you write color values out on the SPI, the first chip receives them. If the chip hasn't written a color to one of its to LEDs, it does so and thus ends the transmission. However, if it has already assigned a color to each LED then it passes the SPI along on a separate bus to the next chip. This is how the strand is able to be 5m and still run at 10 MHz.&lt;br /&gt;
&lt;br /&gt;
It is still unknown how exactly the 3 latch bits are used (because the chip manufacturer has kept the interface a secret). However, if you write 6 bytes of &amp;quot;latch&amp;quot; the strand restarts at the beginning. Perhaps less bytes of &amp;quot;latch&amp;quot; can be sent and get the same effect, but due to time limitations we were unable to debug this completely. This is a simple place to start for future work.&lt;br /&gt;
&lt;br /&gt;
=== SPI Bus ===&lt;br /&gt;
&lt;br /&gt;
We use the default SPI controller to control the SPI lines. All we had to do is find what master is controlling the bus (2 in our case) and add a device. Initially, the SPI bus we want is being used by the default configuration of spidev. So, all we do is unregister the device from spidev and reregister it for our driver. There are a few things that go into the configuration of the device like speed, number of bits, chip select, and mode. Once these are set, you can add the device and it will then be associated with your driver.&lt;br /&gt;
&lt;br /&gt;
=== Sysfs Kernel Driver ===&lt;br /&gt;
&lt;br /&gt;
The sysfs kernel driver is based on the references above. It uses a kset to store kobjects (the basic building block of the kernel). Each kobject has associated with it certain attributes. These attributes are brought out to the user as files. When the files are read from or written to, the kernel calls back into the kobject's read/write routines. Here, we are able to decide which attribute is being addressed and manipulate the buffer as we see fit.&lt;br /&gt;
&lt;br /&gt;
There are some alternative implementations to this that were looked into in addition to kset. The driver could have been implemented as a sysfs device driver instead of a kernel driver so that it shows up in &amp;lt;code&amp;gt;/sys/class&amp;lt;/code&amp;gt; with everything else. Another option is that it could be implemented as a straight up device/kernel driver making it show up in &amp;lt;code&amp;gt;/dev&amp;lt;/code&amp;gt; instead. There doesn't seem to be much of a difference though between these implementations as far as performance is concerned. However, finding where this driver fits best is another good place for future work. &lt;br /&gt;
&lt;br /&gt;
== Work Breakdown ==&lt;br /&gt;
&lt;br /&gt;
=== Sean Richardson ===&lt;br /&gt;
* Researched using SPI on the BeagleBone&lt;br /&gt;
* Debugged the LED strand (the first one we received was broken)&lt;br /&gt;
* Wrote code to interface with the strand using spidev&lt;br /&gt;
* Helped integrate the SPI interface into the sysfs driver&lt;br /&gt;
&lt;br /&gt;
=== Greg Larmore ===&lt;br /&gt;
* Researched kernel drivers and sysfs&lt;br /&gt;
* Helped debug the LED strand&lt;br /&gt;
* Wrote example sysfs driver&lt;br /&gt;
* Integrated the SPI interface into the sysfs driver&lt;br /&gt;
&lt;br /&gt;
== Future Work ==&lt;br /&gt;
&lt;br /&gt;
While the strand works well as it is, there are some things that we would like to see looked into if there is future work on this project.&lt;br /&gt;
&lt;br /&gt;
=== Latching and Controller Interface ===&lt;br /&gt;
&lt;br /&gt;
According to Adafruit, the interface to this part has been reverse engineered. The one part that really remains unknown is how exactly the 3-bit control interface works for each LED. We were able to achieve a latching effect by sending 6 empty transmissions. The code in [github.com/adafruit/lpd8806 Adafruit's github] doesn't seem to be using this many latch transmissions.&lt;br /&gt;
&lt;br /&gt;
=== Buffering Problem ===&lt;br /&gt;
&lt;br /&gt;
There is a problem with buffered output going into the &amp;lt;code&amp;gt;data&amp;lt;/code&amp;gt; file (because it is so big). When the output buffers it causes 2 sequential writes which weren't being handled well by the attribute's store function. This could be alleviated with a circular buffer and an index that can be controlled by the user, but really the driver should be able to handle this condition.&lt;br /&gt;
&lt;br /&gt;
=== Sysfs File Location ===&lt;br /&gt;
&lt;br /&gt;
The decision to have these drivers located in &amp;lt;code&amp;gt;/lib/modules/3.2.25+/kernel/drivers/char&amp;lt;/code&amp;gt; and run out of &amp;lt;code&amp;gt;/sys/firmware&amp;lt;/code&amp;gt; was pretty much arbitrary. It would be nice to do some research into how the kernel is supposed to be structured so that we can match it. This also applies to the example driver included in this project.&lt;br /&gt;
&lt;br /&gt;
== Conclusions ==&lt;br /&gt;
&lt;br /&gt;
In this project, we were able to get SPI (a lesser used interface on the bone) to work well with our LED strand. More impressively, we were able to interface with the SPI through a sysfs interface. In the process of developing this sysfs interface to the LED strand, we developed an example sysfs driver that can be used in future ECE497 classes. Lastly, we developed a sample application that uses this sysfs interface for our LED strand to show off the results.&lt;/div&gt;</summary>
		<author><name>Yoder</name></author>	</entry>

	<entry>
		<id>http://www.elinux.org/ECE497_SPI_Project</id>
		<title>ECE497 SPI Project</title>
		<link rel="alternate" type="text/html" href="http://www.elinux.org/ECE497_SPI_Project"/>
				<updated>2013-06-06T18:52:54Z</updated>
		
		<summary type="html">&lt;p&gt;Yoder: /* User Instructions 3.8 Kernel */ Initial content&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:ECE497Fall2012 |Project]]&lt;br /&gt;
[[Category:ECE497 |Ada]]&lt;br /&gt;
Team members: [[user:Richarsm|Sean Richardson]], [[user:larmorgs|Greg Larmore]]&lt;br /&gt;
&lt;br /&gt;
== Executive Summary ==&lt;br /&gt;
&lt;br /&gt;
For this project we wanted to further improve documentation available for sysfs kernel drivers with the Beagle Bone. To do this we have interfaced an [http://adafruit.com/products/306 LED light strand] by Adafruit with a sysfs kernel driver utilizing SPI. In doing so we have created an easy to use interface to the light strand while also maximizing data throughput.&lt;br /&gt;
&lt;br /&gt;
== Good Websites ==&lt;br /&gt;
&lt;br /&gt;
[http://elinux.org/BeagleBoard/SPI BeagleBoard and SPI]&lt;br /&gt;
&lt;br /&gt;
[http://www.xml.com/ldd/chapter/book/ O'Reilly Book on Linux Device Drivers]&lt;br /&gt;
&lt;br /&gt;
[http://www.cs.fsu.edu/~baker/devices/lxr/http/source/linux/samples/kobject/kset-example.c Kset example for sysfs driver]&lt;br /&gt;
&lt;br /&gt;
[http://elk.informatik.fh-augsburg.de/pub/elinux/ngw100-docs/AVR32743/spi/spi_example.c Example SPI device driver]&lt;br /&gt;
&lt;br /&gt;
[http://www.jumpnowtek.com/index.php?option=com_content&amp;amp;view=article&amp;amp;id=57&amp;amp;Itemid=62 Another example SPI device driver]&lt;br /&gt;
&lt;br /&gt;
== More Good Websites ==&lt;br /&gt;
&lt;br /&gt;
[http://www.loadyourself.com/linux/sample-linux-driver/ Example Kernel Driver (ioctl, no sysfs)]&lt;br /&gt;
&lt;br /&gt;
[http://www.freesoftwaremagazine.com/articles/drivers_linux Kernel Driver Tutorial (no sysfs/ioctl)]&lt;br /&gt;
&lt;br /&gt;
== Installation Instructions 3.2 Kernel ==&lt;br /&gt;
{{EBC3.2}}&lt;br /&gt;
All of these instructions are meant for the A6A BeagleBone running version 3.2.25+ of the kernel. Scripts and Makefiles expect that the kernel be located at &amp;lt;code&amp;gt;~/BeagleBoard/kernel/kernel&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Start by cloning the [https://github.com/larmorgs/FinalProject github] repository on both the bone and the host machine by running the following:&lt;br /&gt;
&lt;br /&gt;
 both$ '''git clone git@github.com:larmorgs/FinalProject'''&lt;br /&gt;
&lt;br /&gt;
On the host machine, run the following:&lt;br /&gt;
&lt;br /&gt;
 host$ '''cd ~/FinalProject'''&lt;br /&gt;
 host$ '''./setup.sh'''&lt;br /&gt;
&lt;br /&gt;
Make sure you only do this &amp;lt;b&amp;gt;once&amp;lt;/b&amp;gt; because it is adding on our modules to the Kconfig and Makefile in &amp;lt;code&amp;gt;~/BeagleBoard/kernel/kernel/driver/char&amp;lt;/code&amp;gt;. The files are backed up in the same folder with &amp;lt;code&amp;gt;.orig&amp;lt;/code&amp;gt; appended.&lt;br /&gt;
&lt;br /&gt;
Next run the following on the host machine:&lt;br /&gt;
&lt;br /&gt;
 host$ '''make kernel'''&lt;br /&gt;
&lt;br /&gt;
This will copy the files &amp;lt;code&amp;gt;example.c&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;lpd8806.c&amp;lt;/code&amp;gt; into the &amp;lt;code&amp;gt;~/BeagleBoard/kernel/kernel/driver/char&amp;lt;/code&amp;gt; directory, make the kernel, and then scp the files to the bone.&lt;br /&gt;
&lt;br /&gt;
Moving over to the bone, run the following:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /lib/modules/3.2.25+'''&lt;br /&gt;
 bone$ '''mv modules.dep.bin modules.dep.bin.orig'''&lt;br /&gt;
&lt;br /&gt;
Next modify &amp;lt;code&amp;gt;modules.dep&amp;lt;/code&amp;gt; to include &amp;lt;code&amp;gt;kernel/drivers/char/example.ko:&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;kernel/drivers/char/lpd8806.ko:&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Upon successful completion, you should be able to run the following:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''modprobe example'''&lt;br /&gt;
 bone$ '''modprobe lpd8806'''&lt;br /&gt;
&lt;br /&gt;
== Installation Instructions 3.8 Kernel ==&lt;br /&gt;
{{EBC3.2}}&lt;br /&gt;
All of these instructions are meant for the BeagleBone running version 3.8 of the kernel with device tree. Scripts and Makefiles expect that the kernel be located at &amp;lt;code&amp;gt;~/BeagleBoard/linux-dev/KERNEL&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Start by updating the course materials. ([[EBC Exercise 05 Getting Exercise Support Materials]])&lt;br /&gt;
&lt;br /&gt;
On the host machine, run the following:&lt;br /&gt;
&lt;br /&gt;
 host$ '''cd ~/exercises/LEDstring/driver'''&lt;br /&gt;
 host$ '''git pull'''&lt;br /&gt;
 host$ '''./setup.sh'''&lt;br /&gt;
&lt;br /&gt;
Make sure you only do this &amp;lt;b&amp;gt;once&amp;lt;/b&amp;gt; because it is adding on our modules to the Kconfig and Makefile in &amp;lt;code&amp;gt;~/BeagleBoard/linux-dev/KERNEL/driver/char&amp;lt;/code&amp;gt;. The files are backed up in the same folder with &amp;lt;code&amp;gt;.orig&amp;lt;/code&amp;gt; appended.&lt;br /&gt;
&lt;br /&gt;
Next run the following on the host machine:&lt;br /&gt;
&lt;br /&gt;
 host$ '''make kernel'''&lt;br /&gt;
&lt;br /&gt;
This will copy the file &amp;lt;code&amp;gt;lpd8806.c&amp;lt;/code&amp;gt; into the &amp;lt;code&amp;gt;~/BeagleBoard/linux-dev/KERNEL/driver/char&amp;lt;/code&amp;gt; directory, make the kernel, and then scp the files to the bone. (Look in the Makefile and update the address for you Beagle.)&lt;br /&gt;
&lt;br /&gt;
Moving over to the bone, run the following:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd exercises/LEDstring/driver'''&lt;br /&gt;
 bone$ '''git pull'''&lt;br /&gt;
 bone$ '''make dt'''&lt;br /&gt;
&lt;br /&gt;
This will make the correct device tree overlay to set the pin muxxes for spi0.  You only have to do this once per booting the beagle. Next:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /lib/modules/3.8.13''' (or whatever path is correct for you system.)&lt;br /&gt;
 bone$ '''mv modules.dep.bin modules.dep.bin.orig'''&lt;br /&gt;
&lt;br /&gt;
Next modify &amp;lt;code&amp;gt;modules.dep&amp;lt;/code&amp;gt; to include &amp;lt;code&amp;gt;kernel/drivers/char/lpd8806.ko:&amp;lt;/code&amp;gt; (This didn't work for me.)&lt;br /&gt;
&lt;br /&gt;
Upon successful completion, you should be able to run the following:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /lib/modules/3.8.13-bone19/kernel/drivers/char/'''&lt;br /&gt;
 bone$ '''insmod lpd8806'''&lt;br /&gt;
&lt;br /&gt;
Now test it with&lt;br /&gt;
 bone$ '''cd ~/exercises/LEDstring'''&lt;br /&gt;
 bone$ '''make tree'''&lt;br /&gt;
 bone$ '''./tree 3 60000 20000'''&lt;br /&gt;
&lt;br /&gt;
This will display a sequence of LEDs running up and down the string.&lt;br /&gt;
&lt;br /&gt;
== User Instructions 3.2 Kernel ==&lt;br /&gt;
&lt;br /&gt;
Run &amp;lt;code&amp;gt;dmesg&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;lsmod&amp;lt;/code&amp;gt; to make sure the modules have loaded properly. You should now find two folders inside &amp;lt;code&amp;gt;/sys/firmware&amp;lt;/code&amp;gt; called &amp;lt;code&amp;gt;example&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;lpd8806&amp;lt;/code&amp;gt;. Feel free to play around in the example folder. If you go into this folder and then one folder further into device, you will find two files. The &amp;lt;code&amp;gt;test&amp;lt;/code&amp;gt; file holds an unsigned integer, while the &amp;lt;code&amp;gt;data&amp;lt;/code&amp;gt; file holds a string of length 10 (initially empty). You can read and write from these files as you would any other sysfs file.&lt;br /&gt;
&lt;br /&gt;
Next we will hook up the LED strand. &amp;lt;b&amp;gt;For this make sure the beagle is powered externally&amp;lt;/b&amp;gt;. The USB power supply does not have enough current to run the 5m strand at full brightness.&lt;br /&gt;
&lt;br /&gt;
To get started hook up pins 30 (D12/SPI1_D1) and 31 (A13/SPI1_SCLK) to SPI data and SPI clock on the strand (see the silkscreen for guidance. Hook up the ground to ground (obviously), and the 5V wire on the strand to the &amp;lt;b&amp;gt;3.3V&amp;lt;/b&amp;gt; pin on the bone. &amp;lt;b&amp;gt;Do not use the 5V pin on the bone or the suggested Adafruit 5V power supply directly connected to the strand without also adding logic level voltage shifters to the data and clock lines&amp;lt;/b&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:Bone_P9_pinout.jpg]]&lt;br /&gt;
&lt;br /&gt;
You may need to modify your muxes (if they have been changed from the default). If so, do the following:&lt;br /&gt;
 beagle$ '''echo 0 &amp;gt; /sys/kernel/debug/omap_mux/spi0_d1'''&lt;br /&gt;
 beagle$ '''echo 0 &amp;gt; /sys/kernel/debug/omap_mux/spi0_scl'''&lt;br /&gt;
&lt;br /&gt;
Now that the strand is hooked up, we can run the following:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/firmware/lpd8806/device/'''&lt;br /&gt;
 bone$ '''echo &amp;quot;127 127 127&amp;quot; &amp;gt; grb'''&lt;br /&gt;
&lt;br /&gt;
You should see the first LED (closest to the bone) light up bright white. You can also do something like the following:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo &amp;quot;127 0 0 0 127 0 0 0 127&amp;quot; &amp;gt; data'''&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;data&amp;lt;/code&amp;gt; file is written directly out to the strand while the &amp;lt;code&amp;gt;grb&amp;lt;/code&amp;gt; file treats the strand like a big shift register. &amp;lt;b&amp;gt;Be careful with using &amp;lt;code&amp;gt;data&amp;lt;/code&amp;gt;&amp;lt;/b&amp;gt;. Buffering problems can cause the kernel to seg fault or crash completely (see Future Work).&lt;br /&gt;
&lt;br /&gt;
== User Instructions 3.8 Kernel ==&lt;br /&gt;
&lt;br /&gt;
Run &amp;lt;code&amp;gt;dmesg&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;lsmod&amp;lt;/code&amp;gt; to make sure the modules have loaded properly. You should now find a folder inside &amp;lt;code&amp;gt;/sys/firmware&amp;lt;/code&amp;gt; called &amp;lt;code&amp;gt;lpd8806&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Next we will hook up the LED strand. &amp;lt;b&amp;gt;For this make sure the beagle is powered externally&amp;lt;/b&amp;gt;. The USB power supply does not have enough current to run the 5m strand at full brightness.&lt;br /&gt;
&lt;br /&gt;
To get started hook up pins 18 (D12/SPI0_D1) and 22 (A13/SPI0_SCLK) to SPI data and SPI clock on the strand (see the silkscreen for guidance. Hook up the ground to ground (obviously), and the 5V wire on the strand to the &amp;lt;b&amp;gt;3.3V&amp;lt;/b&amp;gt; pin on the bone. &amp;lt;b&amp;gt;Do not use the 5V pin on the bone or the suggested Adafruit 5V power supply directly connected to the strand without also adding logic level voltage shifters to the data and clock lines&amp;lt;/b&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:HeaderP9.jpg|800px]]&lt;br /&gt;
&lt;br /&gt;
Now that the strand is hooked up, we can run the following:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/firmware/lpd8806/device/'''&lt;br /&gt;
 bone$ '''echo &amp;quot;127 127 127 0&amp;quot; &amp;gt; rgb'''&lt;br /&gt;
&lt;br /&gt;
You should see LED '''0''' (closest to the bone) light up bright white. You can also do something like the following to turn LED ''x'' red.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo &amp;quot;127 0 0 ''x''&amp;quot; &amp;gt; rgb'''&lt;br /&gt;
&lt;br /&gt;
The driver keeps an internal state of the string and shifts it out to update the string.  (The shifting is so fast you won't see it.)  You can see the state of the string with:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cat data'''&lt;br /&gt;
&lt;br /&gt;
You can change the internal state without updating the string by suppressing the 'return' on the echo.&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo -n 0 50 0 10 &amp;gt; rgb&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Highlights ==&lt;br /&gt;
&lt;br /&gt;
We have created a simple C example that uses this sysfs driver. You can run it by doing the following:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd ~/FinalProject'''&lt;br /&gt;
 bone$ '''make'''&lt;br /&gt;
 bone$ '''./test'''&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|8d9n5QUyH38}}&lt;br /&gt;
&lt;br /&gt;
The program shows the capabilities of the strand running in shift mode. Because of the nature of the strand's construction, it would be very simple to daisy chain many chains end to end. Also, the kset implementation means that we can have as many separate strands as there are SPI buses. Normally you could have even more, but the strand only runs 3 wire SPI (no chip select).&lt;br /&gt;
&lt;br /&gt;
The speed is increased greatly when the strand is running in direct access mode by using the &amp;lt;code&amp;gt;data&amp;lt;/code&amp;gt; file instead of the &amp;lt;code&amp;gt;grb&amp;lt;/code&amp;gt; file. However, due to time limitations we were unable to debug the buffering issues. A good place for future work would be to figure out how the buffering problem can be alleviated.&lt;br /&gt;
&lt;br /&gt;
== Theory of Operation ==&lt;br /&gt;
&lt;br /&gt;
There are many layers to the implementation, so we will break them out into subsections.&lt;br /&gt;
&lt;br /&gt;
=== Light Strand ===&lt;br /&gt;
&lt;br /&gt;
The light strand uses the LPD8806 controller chip. Each chip controls the brightness of two 3 color GRB LEDs using PWM running at 1.2 MHz. SPI is used to communicate with the controller chips. The controller has its SPI bus rated somewhere around 20 MHz, but we are only running at 10 MHz. Each LED is 21-bit color, which leaves three bits available for latch control.&lt;br /&gt;
&lt;br /&gt;
So, as you write color values out on the SPI, the first chip receives them. If the chip hasn't written a color to one of its to LEDs, it does so and thus ends the transmission. However, if it has already assigned a color to each LED then it passes the SPI along on a separate bus to the next chip. This is how the strand is able to be 5m and still run at 10 MHz.&lt;br /&gt;
&lt;br /&gt;
It is still unknown how exactly the 3 latch bits are used (because the chip manufacturer has kept the interface a secret). However, if you write 6 bytes of &amp;quot;latch&amp;quot; the strand restarts at the beginning. Perhaps less bytes of &amp;quot;latch&amp;quot; can be sent and get the same effect, but due to time limitations we were unable to debug this completely. This is a simple place to start for future work.&lt;br /&gt;
&lt;br /&gt;
=== SPI Bus ===&lt;br /&gt;
&lt;br /&gt;
We use the default SPI controller to control the SPI lines. All we had to do is find what master is controlling the bus (2 in our case) and add a device. Initially, the SPI bus we want is being used by the default configuration of spidev. So, all we do is unregister the device from spidev and reregister it for our driver. There are a few things that go into the configuration of the device like speed, number of bits, chip select, and mode. Once these are set, you can add the device and it will then be associated with your driver.&lt;br /&gt;
&lt;br /&gt;
=== Sysfs Kernel Driver ===&lt;br /&gt;
&lt;br /&gt;
The sysfs kernel driver is based on the references above. It uses a kset to store kobjects (the basic building block of the kernel). Each kobject has associated with it certain attributes. These attributes are brought out to the user as files. When the files are read from or written to, the kernel calls back into the kobject's read/write routines. Here, we are able to decide which attribute is being addressed and manipulate the buffer as we see fit.&lt;br /&gt;
&lt;br /&gt;
There are some alternative implementations to this that were looked into in addition to kset. The driver could have been implemented as a sysfs device driver instead of a kernel driver so that it shows up in &amp;lt;code&amp;gt;/sys/class&amp;lt;/code&amp;gt; with everything else. Another option is that it could be implemented as a straight up device/kernel driver making it show up in &amp;lt;code&amp;gt;/dev&amp;lt;/code&amp;gt; instead. There doesn't seem to be much of a difference though between these implementations as far as performance is concerned. However, finding where this driver fits best is another good place for future work. &lt;br /&gt;
&lt;br /&gt;
== Work Breakdown ==&lt;br /&gt;
&lt;br /&gt;
=== Sean Richardson ===&lt;br /&gt;
* Researched using SPI on the BeagleBone&lt;br /&gt;
* Debugged the LED strand (the first one we received was broken)&lt;br /&gt;
* Wrote code to interface with the strand using spidev&lt;br /&gt;
* Helped integrate the SPI interface into the sysfs driver&lt;br /&gt;
&lt;br /&gt;
=== Greg Larmore ===&lt;br /&gt;
* Researched kernel drivers and sysfs&lt;br /&gt;
* Helped debug the LED strand&lt;br /&gt;
* Wrote example sysfs driver&lt;br /&gt;
* Integrated the SPI interface into the sysfs driver&lt;br /&gt;
&lt;br /&gt;
== Future Work ==&lt;br /&gt;
&lt;br /&gt;
While the strand works well as it is, there are some things that we would like to see looked into if there is future work on this project.&lt;br /&gt;
&lt;br /&gt;
=== Latching and Controller Interface ===&lt;br /&gt;
&lt;br /&gt;
According to Adafruit, the interface to this part has been reverse engineered. The one part that really remains unknown is how exactly the 3-bit control interface works for each LED. We were able to achieve a latching effect by sending 6 empty transmissions. The code in [github.com/adafruit/lpd8806 Adafruit's github] doesn't seem to be using this many latch transmissions.&lt;br /&gt;
&lt;br /&gt;
=== Buffering Problem ===&lt;br /&gt;
&lt;br /&gt;
There is a problem with buffered output going into the &amp;lt;code&amp;gt;data&amp;lt;/code&amp;gt; file (because it is so big). When the output buffers it causes 2 sequential writes which weren't being handled well by the attribute's store function. This could be alleviated with a circular buffer and an index that can be controlled by the user, but really the driver should be able to handle this condition.&lt;br /&gt;
&lt;br /&gt;
=== Sysfs File Location ===&lt;br /&gt;
&lt;br /&gt;
The decision to have these drivers located in &amp;lt;code&amp;gt;/lib/modules/3.2.25+/kernel/drivers/char&amp;lt;/code&amp;gt; and run out of &amp;lt;code&amp;gt;/sys/firmware&amp;lt;/code&amp;gt; was pretty much arbitrary. It would be nice to do some research into how the kernel is supposed to be structured so that we can match it. This also applies to the example driver included in this project.&lt;br /&gt;
&lt;br /&gt;
== Conclusions ==&lt;br /&gt;
&lt;br /&gt;
In this project, we were able to get SPI (a lesser used interface on the bone) to work well with our LED strand. More impressively, we were able to interface with the SPI through a sysfs interface. In the process of developing this sysfs interface to the LED strand, we developed an example sysfs driver that can be used in future ECE497 classes. Lastly, we developed a sample application that uses this sysfs interface for our LED strand to show off the results.&lt;/div&gt;</summary>
		<author><name>Yoder</name></author>	</entry>

	<entry>
		<id>http://www.elinux.org/ECE497_SPI_Project</id>
		<title>ECE497 SPI Project</title>
		<link rel="alternate" type="text/html" href="http://www.elinux.org/ECE497_SPI_Project"/>
				<updated>2013-06-06T18:38:24Z</updated>
		
		<summary type="html">&lt;p&gt;Yoder: /* User Instructions */ Added 3.8 Kernel instructions&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:ECE497Fall2012 |Project]]&lt;br /&gt;
[[Category:ECE497 |Ada]]&lt;br /&gt;
Team members: [[user:Richarsm|Sean Richardson]], [[user:larmorgs|Greg Larmore]]&lt;br /&gt;
&lt;br /&gt;
== Executive Summary ==&lt;br /&gt;
&lt;br /&gt;
For this project we wanted to further improve documentation available for sysfs kernel drivers with the Beagle Bone. To do this we have interfaced an [http://adafruit.com/products/306 LED light strand] by Adafruit with a sysfs kernel driver utilizing SPI. In doing so we have created an easy to use interface to the light strand while also maximizing data throughput.&lt;br /&gt;
&lt;br /&gt;
== Good Websites ==&lt;br /&gt;
&lt;br /&gt;
[http://elinux.org/BeagleBoard/SPI BeagleBoard and SPI]&lt;br /&gt;
&lt;br /&gt;
[http://www.xml.com/ldd/chapter/book/ O'Reilly Book on Linux Device Drivers]&lt;br /&gt;
&lt;br /&gt;
[http://www.cs.fsu.edu/~baker/devices/lxr/http/source/linux/samples/kobject/kset-example.c Kset example for sysfs driver]&lt;br /&gt;
&lt;br /&gt;
[http://elk.informatik.fh-augsburg.de/pub/elinux/ngw100-docs/AVR32743/spi/spi_example.c Example SPI device driver]&lt;br /&gt;
&lt;br /&gt;
[http://www.jumpnowtek.com/index.php?option=com_content&amp;amp;view=article&amp;amp;id=57&amp;amp;Itemid=62 Another example SPI device driver]&lt;br /&gt;
&lt;br /&gt;
== More Good Websites ==&lt;br /&gt;
&lt;br /&gt;
[http://www.loadyourself.com/linux/sample-linux-driver/ Example Kernel Driver (ioctl, no sysfs)]&lt;br /&gt;
&lt;br /&gt;
[http://www.freesoftwaremagazine.com/articles/drivers_linux Kernel Driver Tutorial (no sysfs/ioctl)]&lt;br /&gt;
&lt;br /&gt;
== Installation Instructions 3.2 Kernel ==&lt;br /&gt;
{{EBC3.2}}&lt;br /&gt;
All of these instructions are meant for the A6A BeagleBone running version 3.2.25+ of the kernel. Scripts and Makefiles expect that the kernel be located at &amp;lt;code&amp;gt;~/BeagleBoard/kernel/kernel&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Start by cloning the [https://github.com/larmorgs/FinalProject github] repository on both the bone and the host machine by running the following:&lt;br /&gt;
&lt;br /&gt;
 both$ '''git clone git@github.com:larmorgs/FinalProject'''&lt;br /&gt;
&lt;br /&gt;
On the host machine, run the following:&lt;br /&gt;
&lt;br /&gt;
 host$ '''cd ~/FinalProject'''&lt;br /&gt;
 host$ '''./setup.sh'''&lt;br /&gt;
&lt;br /&gt;
Make sure you only do this &amp;lt;b&amp;gt;once&amp;lt;/b&amp;gt; because it is adding on our modules to the Kconfig and Makefile in &amp;lt;code&amp;gt;~/BeagleBoard/kernel/kernel/driver/char&amp;lt;/code&amp;gt;. The files are backed up in the same folder with &amp;lt;code&amp;gt;.orig&amp;lt;/code&amp;gt; appended.&lt;br /&gt;
&lt;br /&gt;
Next run the following on the host machine:&lt;br /&gt;
&lt;br /&gt;
 host$ '''make kernel'''&lt;br /&gt;
&lt;br /&gt;
This will copy the files &amp;lt;code&amp;gt;example.c&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;lpd8806.c&amp;lt;/code&amp;gt; into the &amp;lt;code&amp;gt;~/BeagleBoard/kernel/kernel/driver/char&amp;lt;/code&amp;gt; directory, make the kernel, and then scp the files to the bone.&lt;br /&gt;
&lt;br /&gt;
Moving over to the bone, run the following:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /lib/modules/3.2.25+'''&lt;br /&gt;
 bone$ '''mv modules.dep.bin modules.dep.bin.orig'''&lt;br /&gt;
&lt;br /&gt;
Next modify &amp;lt;code&amp;gt;modules.dep&amp;lt;/code&amp;gt; to include &amp;lt;code&amp;gt;kernel/drivers/char/example.ko:&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;kernel/drivers/char/lpd8806.ko:&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Upon successful completion, you should be able to run the following:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''modprobe example'''&lt;br /&gt;
 bone$ '''modprobe lpd8806'''&lt;br /&gt;
&lt;br /&gt;
== Installation Instructions 3.8 Kernel ==&lt;br /&gt;
{{EBC3.2}}&lt;br /&gt;
All of these instructions are meant for the BeagleBone running version 3.8 of the kernel with device tree. Scripts and Makefiles expect that the kernel be located at &amp;lt;code&amp;gt;~/BeagleBoard/linux-dev/KERNEL&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Start by updating the course materials. ([[EBC Exercise 05 Getting Exercise Support Materials]])&lt;br /&gt;
&lt;br /&gt;
On the host machine, run the following:&lt;br /&gt;
&lt;br /&gt;
 host$ '''cd ~/exercises/LEDstring/driver'''&lt;br /&gt;
 host$ '''git pull'''&lt;br /&gt;
 host$ '''./setup.sh'''&lt;br /&gt;
&lt;br /&gt;
Make sure you only do this &amp;lt;b&amp;gt;once&amp;lt;/b&amp;gt; because it is adding on our modules to the Kconfig and Makefile in &amp;lt;code&amp;gt;~/BeagleBoard/linux-dev/KERNEL/driver/char&amp;lt;/code&amp;gt;. The files are backed up in the same folder with &amp;lt;code&amp;gt;.orig&amp;lt;/code&amp;gt; appended.&lt;br /&gt;
&lt;br /&gt;
Next run the following on the host machine:&lt;br /&gt;
&lt;br /&gt;
 host$ '''make kernel'''&lt;br /&gt;
&lt;br /&gt;
This will copy the file &amp;lt;code&amp;gt;lpd8806.c&amp;lt;/code&amp;gt; into the &amp;lt;code&amp;gt;~/BeagleBoard/linux-dev/KERNEL/driver/char&amp;lt;/code&amp;gt; directory, make the kernel, and then scp the files to the bone. (Look in the Makefile and update the address for you Beagle.)&lt;br /&gt;
&lt;br /&gt;
Moving over to the bone, run the following:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd exercises/LEDstring/driver'''&lt;br /&gt;
 bone$ '''git pull'''&lt;br /&gt;
 bone$ '''make dt'''&lt;br /&gt;
&lt;br /&gt;
This will make the correct device tree overlay to set the pin muxxes for spi0.  You only have to do this once per booting the beagle. Next:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /lib/modules/3.8.13''' (or whatever path is correct for you system.)&lt;br /&gt;
 bone$ '''mv modules.dep.bin modules.dep.bin.orig'''&lt;br /&gt;
&lt;br /&gt;
Next modify &amp;lt;code&amp;gt;modules.dep&amp;lt;/code&amp;gt; to include &amp;lt;code&amp;gt;kernel/drivers/char/lpd8806.ko:&amp;lt;/code&amp;gt; (This didn't work for me.)&lt;br /&gt;
&lt;br /&gt;
Upon successful completion, you should be able to run the following:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /lib/modules/3.8.13-bone19/kernel/drivers/char/'''&lt;br /&gt;
 bone$ '''insmod lpd8806'''&lt;br /&gt;
&lt;br /&gt;
Now test it with&lt;br /&gt;
 bone$ '''cd ~/exercises/LEDstring'''&lt;br /&gt;
 bone$ '''make tree'''&lt;br /&gt;
 bone$ '''./tree 3 60000 20000'''&lt;br /&gt;
&lt;br /&gt;
This will display a sequence of LEDs running up and down the string.&lt;br /&gt;
&lt;br /&gt;
== User Instructions 3.2 Kernel ==&lt;br /&gt;
&lt;br /&gt;
Run &amp;lt;code&amp;gt;dmesg&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;lsmod&amp;lt;/code&amp;gt; to make sure the modules have loaded properly. You should now find two folders inside &amp;lt;code&amp;gt;/sys/firmware&amp;lt;/code&amp;gt; called &amp;lt;code&amp;gt;example&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;lpd8806&amp;lt;/code&amp;gt;. Feel free to play around in the example folder. If you go into this folder and then one folder further into device, you will find two files. The &amp;lt;code&amp;gt;test&amp;lt;/code&amp;gt; file holds an unsigned integer, while the &amp;lt;code&amp;gt;data&amp;lt;/code&amp;gt; file holds a string of length 10 (initially empty). You can read and write from these files as you would any other sysfs file.&lt;br /&gt;
&lt;br /&gt;
Next we will hook up the LED strand. &amp;lt;b&amp;gt;For this make sure the beagle is powered externally&amp;lt;/b&amp;gt;. The USB power supply does not have enough current to run the 5m strand at full brightness.&lt;br /&gt;
&lt;br /&gt;
To get started hook up pins 30 (D12/SPI1_D1) and 31 (A13/SPI1_SCLK) to SPI data and SPI clock on the strand (see the silkscreen for guidance. Hook up the ground to ground (obviously), and the 5V wire on the strand to the &amp;lt;b&amp;gt;3.3V&amp;lt;/b&amp;gt; pin on the bone. &amp;lt;b&amp;gt;Do not use the 5V pin on the bone or the suggested Adafruit 5V power supply directly connected to the strand without also adding logic level voltage shifters to the data and clock lines&amp;lt;/b&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:Bone_P9_pinout.jpg]]&lt;br /&gt;
&lt;br /&gt;
You may need to modify your muxes (if they have been changed from the default). If so, do the following:&lt;br /&gt;
 beagle$ '''echo 0 &amp;gt; /sys/kernel/debug/omap_mux/spi0_d1'''&lt;br /&gt;
 beagle$ '''echo 0 &amp;gt; /sys/kernel/debug/omap_mux/spi0_scl'''&lt;br /&gt;
&lt;br /&gt;
Now that the strand is hooked up, we can run the following:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/firmware/lpd8806/device/'''&lt;br /&gt;
 bone$ '''echo &amp;quot;127 127 127&amp;quot; &amp;gt; grb'''&lt;br /&gt;
&lt;br /&gt;
You should see the first LED (closest to the bone) light up bright white. You can also do something like the following:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo &amp;quot;127 0 0 0 127 0 0 0 127&amp;quot; &amp;gt; data'''&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;data&amp;lt;/code&amp;gt; file is written directly out to the strand while the &amp;lt;code&amp;gt;grb&amp;lt;/code&amp;gt; file treats the strand like a big shift register. &amp;lt;b&amp;gt;Be careful with using &amp;lt;code&amp;gt;data&amp;lt;/code&amp;gt;&amp;lt;/b&amp;gt;. Buffering problems can cause the kernel to seg fault or crash completely (see Future Work).&lt;br /&gt;
&lt;br /&gt;
== User Instructions 3.8 Kernel ==&lt;br /&gt;
&lt;br /&gt;
Run &amp;lt;code&amp;gt;dmesg&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;lsmod&amp;lt;/code&amp;gt; to make sure the modules have loaded properly. You should now find two folders inside &amp;lt;code&amp;gt;/sys/firmware&amp;lt;/code&amp;gt; called &amp;lt;code&amp;gt;example&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;lpd8806&amp;lt;/code&amp;gt;. Feel free to play around in the example folder. If you go into this folder and then one folder further into device, you will find two files. The &amp;lt;code&amp;gt;test&amp;lt;/code&amp;gt; file holds an unsigned integer, while the &amp;lt;code&amp;gt;data&amp;lt;/code&amp;gt; file holds a string of length 10 (initially empty). You can read and write from these files as you would any other sysfs file.&lt;br /&gt;
&lt;br /&gt;
Next we will hook up the LED strand. &amp;lt;b&amp;gt;For this make sure the beagle is powered externally&amp;lt;/b&amp;gt;. The USB power supply does not have enough current to run the 5m strand at full brightness.&lt;br /&gt;
&lt;br /&gt;
To get started hook up pins 30 (D12/SPI1_D1) and 31 (A13/SPI1_SCLK) to SPI data and SPI clock on the strand (see the silkscreen for guidance. Hook up the ground to ground (obviously), and the 5V wire on the strand to the &amp;lt;b&amp;gt;3.3V&amp;lt;/b&amp;gt; pin on the bone. &amp;lt;b&amp;gt;Do not use the 5V pin on the bone or the suggested Adafruit 5V power supply directly connected to the strand without also adding logic level voltage shifters to the data and clock lines&amp;lt;/b&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:Bone_P9_pinout.jpg]]&lt;br /&gt;
&lt;br /&gt;
You may need to modify your muxes (if they have been changed from the default). If so, do the following:&lt;br /&gt;
 beagle$ '''echo 0 &amp;gt; /sys/kernel/debug/omap_mux/spi0_d1'''&lt;br /&gt;
 beagle$ '''echo 0 &amp;gt; /sys/kernel/debug/omap_mux/spi0_scl'''&lt;br /&gt;
&lt;br /&gt;
Now that the strand is hooked up, we can run the following:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/firmware/lpd8806/device/'''&lt;br /&gt;
 bone$ '''echo &amp;quot;127 127 127&amp;quot; &amp;gt; grb'''&lt;br /&gt;
&lt;br /&gt;
You should see the first LED (closest to the bone) light up bright white. You can also do something like the following:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo &amp;quot;127 0 0 0 127 0 0 0 127&amp;quot; &amp;gt; data'''&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;data&amp;lt;/code&amp;gt; file is written directly out to the strand while the &amp;lt;code&amp;gt;grb&amp;lt;/code&amp;gt; file treats the strand like a big shift register. &amp;lt;b&amp;gt;Be careful with using &amp;lt;code&amp;gt;data&amp;lt;/code&amp;gt;&amp;lt;/b&amp;gt;. Buffering problems can cause the kernel to seg fault or crash completely (see Future Work).&lt;br /&gt;
&lt;br /&gt;
== Highlights ==&lt;br /&gt;
&lt;br /&gt;
We have created a simple C example that uses this sysfs driver. You can run it by doing the following:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd ~/FinalProject'''&lt;br /&gt;
 bone$ '''make'''&lt;br /&gt;
 bone$ '''./test'''&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|8d9n5QUyH38}}&lt;br /&gt;
&lt;br /&gt;
The program shows the capabilities of the strand running in shift mode. Because of the nature of the strand's construction, it would be very simple to daisy chain many chains end to end. Also, the kset implementation means that we can have as many separate strands as there are SPI buses. Normally you could have even more, but the strand only runs 3 wire SPI (no chip select).&lt;br /&gt;
&lt;br /&gt;
The speed is increased greatly when the strand is running in direct access mode by using the &amp;lt;code&amp;gt;data&amp;lt;/code&amp;gt; file instead of the &amp;lt;code&amp;gt;grb&amp;lt;/code&amp;gt; file. However, due to time limitations we were unable to debug the buffering issues. A good place for future work would be to figure out how the buffering problem can be alleviated.&lt;br /&gt;
&lt;br /&gt;
== Theory of Operation ==&lt;br /&gt;
&lt;br /&gt;
There are many layers to the implementation, so we will break them out into subsections.&lt;br /&gt;
&lt;br /&gt;
=== Light Strand ===&lt;br /&gt;
&lt;br /&gt;
The light strand uses the LPD8806 controller chip. Each chip controls the brightness of two 3 color GRB LEDs using PWM running at 1.2 MHz. SPI is used to communicate with the controller chips. The controller has its SPI bus rated somewhere around 20 MHz, but we are only running at 10 MHz. Each LED is 21-bit color, which leaves three bits available for latch control.&lt;br /&gt;
&lt;br /&gt;
So, as you write color values out on the SPI, the first chip receives them. If the chip hasn't written a color to one of its to LEDs, it does so and thus ends the transmission. However, if it has already assigned a color to each LED then it passes the SPI along on a separate bus to the next chip. This is how the strand is able to be 5m and still run at 10 MHz.&lt;br /&gt;
&lt;br /&gt;
It is still unknown how exactly the 3 latch bits are used (because the chip manufacturer has kept the interface a secret). However, if you write 6 bytes of &amp;quot;latch&amp;quot; the strand restarts at the beginning. Perhaps less bytes of &amp;quot;latch&amp;quot; can be sent and get the same effect, but due to time limitations we were unable to debug this completely. This is a simple place to start for future work.&lt;br /&gt;
&lt;br /&gt;
=== SPI Bus ===&lt;br /&gt;
&lt;br /&gt;
We use the default SPI controller to control the SPI lines. All we had to do is find what master is controlling the bus (2 in our case) and add a device. Initially, the SPI bus we want is being used by the default configuration of spidev. So, all we do is unregister the device from spidev and reregister it for our driver. There are a few things that go into the configuration of the device like speed, number of bits, chip select, and mode. Once these are set, you can add the device and it will then be associated with your driver.&lt;br /&gt;
&lt;br /&gt;
=== Sysfs Kernel Driver ===&lt;br /&gt;
&lt;br /&gt;
The sysfs kernel driver is based on the references above. It uses a kset to store kobjects (the basic building block of the kernel). Each kobject has associated with it certain attributes. These attributes are brought out to the user as files. When the files are read from or written to, the kernel calls back into the kobject's read/write routines. Here, we are able to decide which attribute is being addressed and manipulate the buffer as we see fit.&lt;br /&gt;
&lt;br /&gt;
There are some alternative implementations to this that were looked into in addition to kset. The driver could have been implemented as a sysfs device driver instead of a kernel driver so that it shows up in &amp;lt;code&amp;gt;/sys/class&amp;lt;/code&amp;gt; with everything else. Another option is that it could be implemented as a straight up device/kernel driver making it show up in &amp;lt;code&amp;gt;/dev&amp;lt;/code&amp;gt; instead. There doesn't seem to be much of a difference though between these implementations as far as performance is concerned. However, finding where this driver fits best is another good place for future work. &lt;br /&gt;
&lt;br /&gt;
== Work Breakdown ==&lt;br /&gt;
&lt;br /&gt;
=== Sean Richardson ===&lt;br /&gt;
* Researched using SPI on the BeagleBone&lt;br /&gt;
* Debugged the LED strand (the first one we received was broken)&lt;br /&gt;
* Wrote code to interface with the strand using spidev&lt;br /&gt;
* Helped integrate the SPI interface into the sysfs driver&lt;br /&gt;
&lt;br /&gt;
=== Greg Larmore ===&lt;br /&gt;
* Researched kernel drivers and sysfs&lt;br /&gt;
* Helped debug the LED strand&lt;br /&gt;
* Wrote example sysfs driver&lt;br /&gt;
* Integrated the SPI interface into the sysfs driver&lt;br /&gt;
&lt;br /&gt;
== Future Work ==&lt;br /&gt;
&lt;br /&gt;
While the strand works well as it is, there are some things that we would like to see looked into if there is future work on this project.&lt;br /&gt;
&lt;br /&gt;
=== Latching and Controller Interface ===&lt;br /&gt;
&lt;br /&gt;
According to Adafruit, the interface to this part has been reverse engineered. The one part that really remains unknown is how exactly the 3-bit control interface works for each LED. We were able to achieve a latching effect by sending 6 empty transmissions. The code in [github.com/adafruit/lpd8806 Adafruit's github] doesn't seem to be using this many latch transmissions.&lt;br /&gt;
&lt;br /&gt;
=== Buffering Problem ===&lt;br /&gt;
&lt;br /&gt;
There is a problem with buffered output going into the &amp;lt;code&amp;gt;data&amp;lt;/code&amp;gt; file (because it is so big). When the output buffers it causes 2 sequential writes which weren't being handled well by the attribute's store function. This could be alleviated with a circular buffer and an index that can be controlled by the user, but really the driver should be able to handle this condition.&lt;br /&gt;
&lt;br /&gt;
=== Sysfs File Location ===&lt;br /&gt;
&lt;br /&gt;
The decision to have these drivers located in &amp;lt;code&amp;gt;/lib/modules/3.2.25+/kernel/drivers/char&amp;lt;/code&amp;gt; and run out of &amp;lt;code&amp;gt;/sys/firmware&amp;lt;/code&amp;gt; was pretty much arbitrary. It would be nice to do some research into how the kernel is supposed to be structured so that we can match it. This also applies to the example driver included in this project.&lt;br /&gt;
&lt;br /&gt;
== Conclusions ==&lt;br /&gt;
&lt;br /&gt;
In this project, we were able to get SPI (a lesser used interface on the bone) to work well with our LED strand. More impressively, we were able to interface with the SPI through a sysfs interface. In the process of developing this sysfs interface to the LED strand, we developed an example sysfs driver that can be used in future ECE497 classes. Lastly, we developed a sample application that uses this sysfs interface for our LED strand to show off the results.&lt;/div&gt;</summary>
		<author><name>Yoder</name></author>	</entry>

	<entry>
		<id>http://www.elinux.org/ECE497_SPI_Project</id>
		<title>ECE497 SPI Project</title>
		<link rel="alternate" type="text/html" href="http://www.elinux.org/ECE497_SPI_Project"/>
				<updated>2013-06-06T18:35:20Z</updated>
		
		<summary type="html">&lt;p&gt;Yoder: /* Installation Instructions 3.8 Kernel */ Initial version&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:ECE497Fall2012 |Project]]&lt;br /&gt;
[[Category:ECE497 |Ada]]&lt;br /&gt;
Team members: [[user:Richarsm|Sean Richardson]], [[user:larmorgs|Greg Larmore]]&lt;br /&gt;
&lt;br /&gt;
== Executive Summary ==&lt;br /&gt;
&lt;br /&gt;
For this project we wanted to further improve documentation available for sysfs kernel drivers with the Beagle Bone. To do this we have interfaced an [http://adafruit.com/products/306 LED light strand] by Adafruit with a sysfs kernel driver utilizing SPI. In doing so we have created an easy to use interface to the light strand while also maximizing data throughput.&lt;br /&gt;
&lt;br /&gt;
== Good Websites ==&lt;br /&gt;
&lt;br /&gt;
[http://elinux.org/BeagleBoard/SPI BeagleBoard and SPI]&lt;br /&gt;
&lt;br /&gt;
[http://www.xml.com/ldd/chapter/book/ O'Reilly Book on Linux Device Drivers]&lt;br /&gt;
&lt;br /&gt;
[http://www.cs.fsu.edu/~baker/devices/lxr/http/source/linux/samples/kobject/kset-example.c Kset example for sysfs driver]&lt;br /&gt;
&lt;br /&gt;
[http://elk.informatik.fh-augsburg.de/pub/elinux/ngw100-docs/AVR32743/spi/spi_example.c Example SPI device driver]&lt;br /&gt;
&lt;br /&gt;
[http://www.jumpnowtek.com/index.php?option=com_content&amp;amp;view=article&amp;amp;id=57&amp;amp;Itemid=62 Another example SPI device driver]&lt;br /&gt;
&lt;br /&gt;
== More Good Websites ==&lt;br /&gt;
&lt;br /&gt;
[http://www.loadyourself.com/linux/sample-linux-driver/ Example Kernel Driver (ioctl, no sysfs)]&lt;br /&gt;
&lt;br /&gt;
[http://www.freesoftwaremagazine.com/articles/drivers_linux Kernel Driver Tutorial (no sysfs/ioctl)]&lt;br /&gt;
&lt;br /&gt;
== Installation Instructions 3.2 Kernel ==&lt;br /&gt;
{{EBC3.2}}&lt;br /&gt;
All of these instructions are meant for the A6A BeagleBone running version 3.2.25+ of the kernel. Scripts and Makefiles expect that the kernel be located at &amp;lt;code&amp;gt;~/BeagleBoard/kernel/kernel&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Start by cloning the [https://github.com/larmorgs/FinalProject github] repository on both the bone and the host machine by running the following:&lt;br /&gt;
&lt;br /&gt;
 both$ '''git clone git@github.com:larmorgs/FinalProject'''&lt;br /&gt;
&lt;br /&gt;
On the host machine, run the following:&lt;br /&gt;
&lt;br /&gt;
 host$ '''cd ~/FinalProject'''&lt;br /&gt;
 host$ '''./setup.sh'''&lt;br /&gt;
&lt;br /&gt;
Make sure you only do this &amp;lt;b&amp;gt;once&amp;lt;/b&amp;gt; because it is adding on our modules to the Kconfig and Makefile in &amp;lt;code&amp;gt;~/BeagleBoard/kernel/kernel/driver/char&amp;lt;/code&amp;gt;. The files are backed up in the same folder with &amp;lt;code&amp;gt;.orig&amp;lt;/code&amp;gt; appended.&lt;br /&gt;
&lt;br /&gt;
Next run the following on the host machine:&lt;br /&gt;
&lt;br /&gt;
 host$ '''make kernel'''&lt;br /&gt;
&lt;br /&gt;
This will copy the files &amp;lt;code&amp;gt;example.c&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;lpd8806.c&amp;lt;/code&amp;gt; into the &amp;lt;code&amp;gt;~/BeagleBoard/kernel/kernel/driver/char&amp;lt;/code&amp;gt; directory, make the kernel, and then scp the files to the bone.&lt;br /&gt;
&lt;br /&gt;
Moving over to the bone, run the following:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /lib/modules/3.2.25+'''&lt;br /&gt;
 bone$ '''mv modules.dep.bin modules.dep.bin.orig'''&lt;br /&gt;
&lt;br /&gt;
Next modify &amp;lt;code&amp;gt;modules.dep&amp;lt;/code&amp;gt; to include &amp;lt;code&amp;gt;kernel/drivers/char/example.ko:&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;kernel/drivers/char/lpd8806.ko:&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Upon successful completion, you should be able to run the following:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''modprobe example'''&lt;br /&gt;
 bone$ '''modprobe lpd8806'''&lt;br /&gt;
&lt;br /&gt;
== Installation Instructions 3.8 Kernel ==&lt;br /&gt;
{{EBC3.2}}&lt;br /&gt;
All of these instructions are meant for the BeagleBone running version 3.8 of the kernel with device tree. Scripts and Makefiles expect that the kernel be located at &amp;lt;code&amp;gt;~/BeagleBoard/linux-dev/KERNEL&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Start by updating the course materials. ([[EBC Exercise 05 Getting Exercise Support Materials]])&lt;br /&gt;
&lt;br /&gt;
On the host machine, run the following:&lt;br /&gt;
&lt;br /&gt;
 host$ '''cd ~/exercises/LEDstring/driver'''&lt;br /&gt;
 host$ '''git pull'''&lt;br /&gt;
 host$ '''./setup.sh'''&lt;br /&gt;
&lt;br /&gt;
Make sure you only do this &amp;lt;b&amp;gt;once&amp;lt;/b&amp;gt; because it is adding on our modules to the Kconfig and Makefile in &amp;lt;code&amp;gt;~/BeagleBoard/linux-dev/KERNEL/driver/char&amp;lt;/code&amp;gt;. The files are backed up in the same folder with &amp;lt;code&amp;gt;.orig&amp;lt;/code&amp;gt; appended.&lt;br /&gt;
&lt;br /&gt;
Next run the following on the host machine:&lt;br /&gt;
&lt;br /&gt;
 host$ '''make kernel'''&lt;br /&gt;
&lt;br /&gt;
This will copy the file &amp;lt;code&amp;gt;lpd8806.c&amp;lt;/code&amp;gt; into the &amp;lt;code&amp;gt;~/BeagleBoard/linux-dev/KERNEL/driver/char&amp;lt;/code&amp;gt; directory, make the kernel, and then scp the files to the bone. (Look in the Makefile and update the address for you Beagle.)&lt;br /&gt;
&lt;br /&gt;
Moving over to the bone, run the following:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd exercises/LEDstring/driver'''&lt;br /&gt;
 bone$ '''git pull'''&lt;br /&gt;
 bone$ '''make dt'''&lt;br /&gt;
&lt;br /&gt;
This will make the correct device tree overlay to set the pin muxxes for spi0.  You only have to do this once per booting the beagle. Next:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /lib/modules/3.8.13''' (or whatever path is correct for you system.)&lt;br /&gt;
 bone$ '''mv modules.dep.bin modules.dep.bin.orig'''&lt;br /&gt;
&lt;br /&gt;
Next modify &amp;lt;code&amp;gt;modules.dep&amp;lt;/code&amp;gt; to include &amp;lt;code&amp;gt;kernel/drivers/char/lpd8806.ko:&amp;lt;/code&amp;gt; (This didn't work for me.)&lt;br /&gt;
&lt;br /&gt;
Upon successful completion, you should be able to run the following:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /lib/modules/3.8.13-bone19/kernel/drivers/char/'''&lt;br /&gt;
 bone$ '''insmod lpd8806'''&lt;br /&gt;
&lt;br /&gt;
Now test it with&lt;br /&gt;
 bone$ '''cd ~/exercises/LEDstring'''&lt;br /&gt;
 bone$ '''make tree'''&lt;br /&gt;
 bone$ '''./tree 3 60000 20000'''&lt;br /&gt;
&lt;br /&gt;
This will display a sequence of LEDs running up and down the string.&lt;br /&gt;
&lt;br /&gt;
== User Instructions ==&lt;br /&gt;
&lt;br /&gt;
Run &amp;lt;code&amp;gt;dmesg&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;lsmod&amp;lt;/code&amp;gt; to make sure the modules have loaded properly. You should now find two folders inside &amp;lt;code&amp;gt;/sys/firmware&amp;lt;/code&amp;gt; called &amp;lt;code&amp;gt;example&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;lpd8806&amp;lt;/code&amp;gt;. Feel free to play around in the example folder. If you go into this folder and then one folder further into device, you will find two files. The &amp;lt;code&amp;gt;test&amp;lt;/code&amp;gt; file holds an unsigned integer, while the &amp;lt;code&amp;gt;data&amp;lt;/code&amp;gt; file holds a string of length 10 (initially empty). You can read and write from these files as you would any other sysfs file.&lt;br /&gt;
&lt;br /&gt;
Next we will hook up the LED strand. &amp;lt;b&amp;gt;For this make sure the beagle is powered externally&amp;lt;/b&amp;gt;. The USB power supply does not have enough current to run the 5m strand at full brightness.&lt;br /&gt;
&lt;br /&gt;
To get started hook up pins 30 (D12/SPI1_D1) and 31 (A13/SPI1_SCLK) to SPI data and SPI clock on the strand (see the silkscreen for guidance. Hook up the ground to ground (obviously), and the 5V wire on the strand to the &amp;lt;b&amp;gt;3.3V&amp;lt;/b&amp;gt; pin on the bone. &amp;lt;b&amp;gt;Do not use the 5V pin on the bone or the suggested Adafruit 5V power supply directly connected to the strand without also adding logic level voltage shifters to the data and clock lines&amp;lt;/b&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:Bone_P9_pinout.jpg]]&lt;br /&gt;
&lt;br /&gt;
You may need to modify your muxes (if they have been changed from the default). If so, do the following:&lt;br /&gt;
 beagle$ '''echo 0 &amp;gt; /sys/kernel/debug/omap_mux/spi0_d1'''&lt;br /&gt;
 beagle$ '''echo 0 &amp;gt; /sys/kernel/debug/omap_mux/spi0_scl'''&lt;br /&gt;
&lt;br /&gt;
Now that the strand is hooked up, we can run the following:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/firmware/lpd8806/device/'''&lt;br /&gt;
 bone$ '''echo &amp;quot;127 127 127&amp;quot; &amp;gt; grb'''&lt;br /&gt;
&lt;br /&gt;
You should see the first LED (closest to the bone) light up bright white. You can also do something like the following:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo &amp;quot;127 0 0 0 127 0 0 0 127&amp;quot; &amp;gt; data'''&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;data&amp;lt;/code&amp;gt; file is written directly out to the strand while the &amp;lt;code&amp;gt;grb&amp;lt;/code&amp;gt; file treats the strand like a big shift register. &amp;lt;b&amp;gt;Be careful with using &amp;lt;code&amp;gt;data&amp;lt;/code&amp;gt;&amp;lt;/b&amp;gt;. Buffering problems can cause the kernel to seg fault or crash completely (see Future Work).&lt;br /&gt;
&lt;br /&gt;
== Highlights ==&lt;br /&gt;
&lt;br /&gt;
We have created a simple C example that uses this sysfs driver. You can run it by doing the following:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd ~/FinalProject'''&lt;br /&gt;
 bone$ '''make'''&lt;br /&gt;
 bone$ '''./test'''&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|8d9n5QUyH38}}&lt;br /&gt;
&lt;br /&gt;
The program shows the capabilities of the strand running in shift mode. Because of the nature of the strand's construction, it would be very simple to daisy chain many chains end to end. Also, the kset implementation means that we can have as many separate strands as there are SPI buses. Normally you could have even more, but the strand only runs 3 wire SPI (no chip select).&lt;br /&gt;
&lt;br /&gt;
The speed is increased greatly when the strand is running in direct access mode by using the &amp;lt;code&amp;gt;data&amp;lt;/code&amp;gt; file instead of the &amp;lt;code&amp;gt;grb&amp;lt;/code&amp;gt; file. However, due to time limitations we were unable to debug the buffering issues. A good place for future work would be to figure out how the buffering problem can be alleviated.&lt;br /&gt;
&lt;br /&gt;
== Theory of Operation ==&lt;br /&gt;
&lt;br /&gt;
There are many layers to the implementation, so we will break them out into subsections.&lt;br /&gt;
&lt;br /&gt;
=== Light Strand ===&lt;br /&gt;
&lt;br /&gt;
The light strand uses the LPD8806 controller chip. Each chip controls the brightness of two 3 color GRB LEDs using PWM running at 1.2 MHz. SPI is used to communicate with the controller chips. The controller has its SPI bus rated somewhere around 20 MHz, but we are only running at 10 MHz. Each LED is 21-bit color, which leaves three bits available for latch control.&lt;br /&gt;
&lt;br /&gt;
So, as you write color values out on the SPI, the first chip receives them. If the chip hasn't written a color to one of its to LEDs, it does so and thus ends the transmission. However, if it has already assigned a color to each LED then it passes the SPI along on a separate bus to the next chip. This is how the strand is able to be 5m and still run at 10 MHz.&lt;br /&gt;
&lt;br /&gt;
It is still unknown how exactly the 3 latch bits are used (because the chip manufacturer has kept the interface a secret). However, if you write 6 bytes of &amp;quot;latch&amp;quot; the strand restarts at the beginning. Perhaps less bytes of &amp;quot;latch&amp;quot; can be sent and get the same effect, but due to time limitations we were unable to debug this completely. This is a simple place to start for future work.&lt;br /&gt;
&lt;br /&gt;
=== SPI Bus ===&lt;br /&gt;
&lt;br /&gt;
We use the default SPI controller to control the SPI lines. All we had to do is find what master is controlling the bus (2 in our case) and add a device. Initially, the SPI bus we want is being used by the default configuration of spidev. So, all we do is unregister the device from spidev and reregister it for our driver. There are a few things that go into the configuration of the device like speed, number of bits, chip select, and mode. Once these are set, you can add the device and it will then be associated with your driver.&lt;br /&gt;
&lt;br /&gt;
=== Sysfs Kernel Driver ===&lt;br /&gt;
&lt;br /&gt;
The sysfs kernel driver is based on the references above. It uses a kset to store kobjects (the basic building block of the kernel). Each kobject has associated with it certain attributes. These attributes are brought out to the user as files. When the files are read from or written to, the kernel calls back into the kobject's read/write routines. Here, we are able to decide which attribute is being addressed and manipulate the buffer as we see fit.&lt;br /&gt;
&lt;br /&gt;
There are some alternative implementations to this that were looked into in addition to kset. The driver could have been implemented as a sysfs device driver instead of a kernel driver so that it shows up in &amp;lt;code&amp;gt;/sys/class&amp;lt;/code&amp;gt; with everything else. Another option is that it could be implemented as a straight up device/kernel driver making it show up in &amp;lt;code&amp;gt;/dev&amp;lt;/code&amp;gt; instead. There doesn't seem to be much of a difference though between these implementations as far as performance is concerned. However, finding where this driver fits best is another good place for future work. &lt;br /&gt;
&lt;br /&gt;
== Work Breakdown ==&lt;br /&gt;
&lt;br /&gt;
=== Sean Richardson ===&lt;br /&gt;
* Researched using SPI on the BeagleBone&lt;br /&gt;
* Debugged the LED strand (the first one we received was broken)&lt;br /&gt;
* Wrote code to interface with the strand using spidev&lt;br /&gt;
* Helped integrate the SPI interface into the sysfs driver&lt;br /&gt;
&lt;br /&gt;
=== Greg Larmore ===&lt;br /&gt;
* Researched kernel drivers and sysfs&lt;br /&gt;
* Helped debug the LED strand&lt;br /&gt;
* Wrote example sysfs driver&lt;br /&gt;
* Integrated the SPI interface into the sysfs driver&lt;br /&gt;
&lt;br /&gt;
== Future Work ==&lt;br /&gt;
&lt;br /&gt;
While the strand works well as it is, there are some things that we would like to see looked into if there is future work on this project.&lt;br /&gt;
&lt;br /&gt;
=== Latching and Controller Interface ===&lt;br /&gt;
&lt;br /&gt;
According to Adafruit, the interface to this part has been reverse engineered. The one part that really remains unknown is how exactly the 3-bit control interface works for each LED. We were able to achieve a latching effect by sending 6 empty transmissions. The code in [github.com/adafruit/lpd8806 Adafruit's github] doesn't seem to be using this many latch transmissions.&lt;br /&gt;
&lt;br /&gt;
=== Buffering Problem ===&lt;br /&gt;
&lt;br /&gt;
There is a problem with buffered output going into the &amp;lt;code&amp;gt;data&amp;lt;/code&amp;gt; file (because it is so big). When the output buffers it causes 2 sequential writes which weren't being handled well by the attribute's store function. This could be alleviated with a circular buffer and an index that can be controlled by the user, but really the driver should be able to handle this condition.&lt;br /&gt;
&lt;br /&gt;
=== Sysfs File Location ===&lt;br /&gt;
&lt;br /&gt;
The decision to have these drivers located in &amp;lt;code&amp;gt;/lib/modules/3.2.25+/kernel/drivers/char&amp;lt;/code&amp;gt; and run out of &amp;lt;code&amp;gt;/sys/firmware&amp;lt;/code&amp;gt; was pretty much arbitrary. It would be nice to do some research into how the kernel is supposed to be structured so that we can match it. This also applies to the example driver included in this project.&lt;br /&gt;
&lt;br /&gt;
== Conclusions ==&lt;br /&gt;
&lt;br /&gt;
In this project, we were able to get SPI (a lesser used interface on the bone) to work well with our LED strand. More impressively, we were able to interface with the SPI through a sysfs interface. In the process of developing this sysfs interface to the LED strand, we developed an example sysfs driver that can be used in future ECE497 classes. Lastly, we developed a sample application that uses this sysfs interface for our LED strand to show off the results.&lt;/div&gt;</summary>
		<author><name>Yoder</name></author>	</entry>

	<entry>
		<id>http://www.elinux.org/ECE497_SPI_Project</id>
		<title>ECE497 SPI Project</title>
		<link rel="alternate" type="text/html" href="http://www.elinux.org/ECE497_SPI_Project"/>
				<updated>2013-06-06T18:22:40Z</updated>
		
		<summary type="html">&lt;p&gt;Yoder: /* Installation Instructions */ Added 3.8 Kernel section&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:ECE497Fall2012 |Project]]&lt;br /&gt;
[[Category:ECE497 |Ada]]&lt;br /&gt;
Team members: [[user:Richarsm|Sean Richardson]], [[user:larmorgs|Greg Larmore]]&lt;br /&gt;
&lt;br /&gt;
== Executive Summary ==&lt;br /&gt;
&lt;br /&gt;
For this project we wanted to further improve documentation available for sysfs kernel drivers with the Beagle Bone. To do this we have interfaced an [http://adafruit.com/products/306 LED light strand] by Adafruit with a sysfs kernel driver utilizing SPI. In doing so we have created an easy to use interface to the light strand while also maximizing data throughput.&lt;br /&gt;
&lt;br /&gt;
== Good Websites ==&lt;br /&gt;
&lt;br /&gt;
[http://elinux.org/BeagleBoard/SPI BeagleBoard and SPI]&lt;br /&gt;
&lt;br /&gt;
[http://www.xml.com/ldd/chapter/book/ O'Reilly Book on Linux Device Drivers]&lt;br /&gt;
&lt;br /&gt;
[http://www.cs.fsu.edu/~baker/devices/lxr/http/source/linux/samples/kobject/kset-example.c Kset example for sysfs driver]&lt;br /&gt;
&lt;br /&gt;
[http://elk.informatik.fh-augsburg.de/pub/elinux/ngw100-docs/AVR32743/spi/spi_example.c Example SPI device driver]&lt;br /&gt;
&lt;br /&gt;
[http://www.jumpnowtek.com/index.php?option=com_content&amp;amp;view=article&amp;amp;id=57&amp;amp;Itemid=62 Another example SPI device driver]&lt;br /&gt;
&lt;br /&gt;
== More Good Websites ==&lt;br /&gt;
&lt;br /&gt;
[http://www.loadyourself.com/linux/sample-linux-driver/ Example Kernel Driver (ioctl, no sysfs)]&lt;br /&gt;
&lt;br /&gt;
[http://www.freesoftwaremagazine.com/articles/drivers_linux Kernel Driver Tutorial (no sysfs/ioctl)]&lt;br /&gt;
&lt;br /&gt;
== Installation Instructions 3.2 Kernel ==&lt;br /&gt;
{{EBC3.2}}&lt;br /&gt;
All of these instructions are meant for the A6A BeagleBone running version 3.2.25+ of the kernel. Scripts and Makefiles expect that the kernel be located at &amp;lt;code&amp;gt;~/BeagleBoard/kernel/kernel&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Start by cloning the [https://github.com/larmorgs/FinalProject github] repository on both the bone and the host machine by running the following:&lt;br /&gt;
&lt;br /&gt;
 both$ '''git clone git@github.com:larmorgs/FinalProject'''&lt;br /&gt;
&lt;br /&gt;
On the host machine, run the following:&lt;br /&gt;
&lt;br /&gt;
 host$ '''cd ~/FinalProject'''&lt;br /&gt;
 host$ '''./setup.sh'''&lt;br /&gt;
&lt;br /&gt;
Make sure you only do this &amp;lt;b&amp;gt;once&amp;lt;/b&amp;gt; because it is adding on our modules to the Kconfig and Makefile in &amp;lt;code&amp;gt;~/BeagleBoard/kernel/kernel/driver/char&amp;lt;/code&amp;gt;. The files are backed up in the same folder with &amp;lt;code&amp;gt;.orig&amp;lt;/code&amp;gt; appended.&lt;br /&gt;
&lt;br /&gt;
Next run the following on the host machine:&lt;br /&gt;
&lt;br /&gt;
 host$ '''make kernel'''&lt;br /&gt;
&lt;br /&gt;
This will copy the files &amp;lt;code&amp;gt;example.c&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;lpd8806.c&amp;lt;/code&amp;gt; into the &amp;lt;code&amp;gt;~/BeagleBoard/kernel/kernel/driver/char&amp;lt;/code&amp;gt; directory, make the kernel, and then scp the files to the bone.&lt;br /&gt;
&lt;br /&gt;
Moving over to the bone, run the following:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /lib/modules/3.2.25+'''&lt;br /&gt;
 bone$ '''mv modules.dep.bin modules.dep.bin.orig'''&lt;br /&gt;
&lt;br /&gt;
Next modify &amp;lt;code&amp;gt;modules.dep&amp;lt;/code&amp;gt; to include &amp;lt;code&amp;gt;kernel/drivers/char/example.ko:&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;kernel/drivers/char/lpd8806.ko:&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Upon successful completion, you should be able to run the following:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''modprobe example'''&lt;br /&gt;
 bone$ '''modprobe lpd8806'''&lt;br /&gt;
&lt;br /&gt;
== Installation Instructions 3.8 Kernel ==&lt;br /&gt;
{{EBC3.2}}&lt;br /&gt;
All of these instructions are meant for the A6A BeagleBone running version 3.2.25+ of the kernel. Scripts and Makefiles expect that the kernel be located at &amp;lt;code&amp;gt;~/BeagleBoard/kernel/kernel&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Start by cloning the [https://github.com/larmorgs/FinalProject github] repository on both the bone and the host machine by running the following:&lt;br /&gt;
&lt;br /&gt;
 both$ '''git clone git@github.com:larmorgs/FinalProject'''&lt;br /&gt;
&lt;br /&gt;
On the host machine, run the following:&lt;br /&gt;
&lt;br /&gt;
 host$ '''cd ~/FinalProject'''&lt;br /&gt;
 host$ '''./setup.sh'''&lt;br /&gt;
&lt;br /&gt;
Make sure you only do this &amp;lt;b&amp;gt;once&amp;lt;/b&amp;gt; because it is adding on our modules to the Kconfig and Makefile in &amp;lt;code&amp;gt;~/BeagleBoard/kernel/kernel/driver/char&amp;lt;/code&amp;gt;. The files are backed up in the same folder with &amp;lt;code&amp;gt;.orig&amp;lt;/code&amp;gt; appended.&lt;br /&gt;
&lt;br /&gt;
Next run the following on the host machine:&lt;br /&gt;
&lt;br /&gt;
 host$ '''make kernel'''&lt;br /&gt;
&lt;br /&gt;
This will copy the files &amp;lt;code&amp;gt;example.c&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;lpd8806.c&amp;lt;/code&amp;gt; into the &amp;lt;code&amp;gt;~/BeagleBoard/kernel/kernel/driver/char&amp;lt;/code&amp;gt; directory, make the kernel, and then scp the files to the bone.&lt;br /&gt;
&lt;br /&gt;
Moving over to the bone, run the following:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /lib/modules/3.2.25+'''&lt;br /&gt;
 bone$ '''mv modules.dep.bin modules.dep.bin.orig'''&lt;br /&gt;
&lt;br /&gt;
Next modify &amp;lt;code&amp;gt;modules.dep&amp;lt;/code&amp;gt; to include &amp;lt;code&amp;gt;kernel/drivers/char/example.ko:&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;kernel/drivers/char/lpd8806.ko:&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Upon successful completion, you should be able to run the following:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''modprobe example'''&lt;br /&gt;
 bone$ '''modprobe lpd8806'''&lt;br /&gt;
&lt;br /&gt;
== User Instructions ==&lt;br /&gt;
&lt;br /&gt;
Run &amp;lt;code&amp;gt;dmesg&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;lsmod&amp;lt;/code&amp;gt; to make sure the modules have loaded properly. You should now find two folders inside &amp;lt;code&amp;gt;/sys/firmware&amp;lt;/code&amp;gt; called &amp;lt;code&amp;gt;example&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;lpd8806&amp;lt;/code&amp;gt;. Feel free to play around in the example folder. If you go into this folder and then one folder further into device, you will find two files. The &amp;lt;code&amp;gt;test&amp;lt;/code&amp;gt; file holds an unsigned integer, while the &amp;lt;code&amp;gt;data&amp;lt;/code&amp;gt; file holds a string of length 10 (initially empty). You can read and write from these files as you would any other sysfs file.&lt;br /&gt;
&lt;br /&gt;
Next we will hook up the LED strand. &amp;lt;b&amp;gt;For this make sure the beagle is powered externally&amp;lt;/b&amp;gt;. The USB power supply does not have enough current to run the 5m strand at full brightness.&lt;br /&gt;
&lt;br /&gt;
To get started hook up pins 30 (D12/SPI1_D1) and 31 (A13/SPI1_SCLK) to SPI data and SPI clock on the strand (see the silkscreen for guidance. Hook up the ground to ground (obviously), and the 5V wire on the strand to the &amp;lt;b&amp;gt;3.3V&amp;lt;/b&amp;gt; pin on the bone. &amp;lt;b&amp;gt;Do not use the 5V pin on the bone or the suggested Adafruit 5V power supply directly connected to the strand without also adding logic level voltage shifters to the data and clock lines&amp;lt;/b&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:Bone_P9_pinout.jpg]]&lt;br /&gt;
&lt;br /&gt;
You may need to modify your muxes (if they have been changed from the default). If so, do the following:&lt;br /&gt;
 beagle$ '''echo 0 &amp;gt; /sys/kernel/debug/omap_mux/spi0_d1'''&lt;br /&gt;
 beagle$ '''echo 0 &amp;gt; /sys/kernel/debug/omap_mux/spi0_scl'''&lt;br /&gt;
&lt;br /&gt;
Now that the strand is hooked up, we can run the following:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/firmware/lpd8806/device/'''&lt;br /&gt;
 bone$ '''echo &amp;quot;127 127 127&amp;quot; &amp;gt; grb'''&lt;br /&gt;
&lt;br /&gt;
You should see the first LED (closest to the bone) light up bright white. You can also do something like the following:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo &amp;quot;127 0 0 0 127 0 0 0 127&amp;quot; &amp;gt; data'''&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;data&amp;lt;/code&amp;gt; file is written directly out to the strand while the &amp;lt;code&amp;gt;grb&amp;lt;/code&amp;gt; file treats the strand like a big shift register. &amp;lt;b&amp;gt;Be careful with using &amp;lt;code&amp;gt;data&amp;lt;/code&amp;gt;&amp;lt;/b&amp;gt;. Buffering problems can cause the kernel to seg fault or crash completely (see Future Work).&lt;br /&gt;
&lt;br /&gt;
== Highlights ==&lt;br /&gt;
&lt;br /&gt;
We have created a simple C example that uses this sysfs driver. You can run it by doing the following:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd ~/FinalProject'''&lt;br /&gt;
 bone$ '''make'''&lt;br /&gt;
 bone$ '''./test'''&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|8d9n5QUyH38}}&lt;br /&gt;
&lt;br /&gt;
The program shows the capabilities of the strand running in shift mode. Because of the nature of the strand's construction, it would be very simple to daisy chain many chains end to end. Also, the kset implementation means that we can have as many separate strands as there are SPI buses. Normally you could have even more, but the strand only runs 3 wire SPI (no chip select).&lt;br /&gt;
&lt;br /&gt;
The speed is increased greatly when the strand is running in direct access mode by using the &amp;lt;code&amp;gt;data&amp;lt;/code&amp;gt; file instead of the &amp;lt;code&amp;gt;grb&amp;lt;/code&amp;gt; file. However, due to time limitations we were unable to debug the buffering issues. A good place for future work would be to figure out how the buffering problem can be alleviated.&lt;br /&gt;
&lt;br /&gt;
== Theory of Operation ==&lt;br /&gt;
&lt;br /&gt;
There are many layers to the implementation, so we will break them out into subsections.&lt;br /&gt;
&lt;br /&gt;
=== Light Strand ===&lt;br /&gt;
&lt;br /&gt;
The light strand uses the LPD8806 controller chip. Each chip controls the brightness of two 3 color GRB LEDs using PWM running at 1.2 MHz. SPI is used to communicate with the controller chips. The controller has its SPI bus rated somewhere around 20 MHz, but we are only running at 10 MHz. Each LED is 21-bit color, which leaves three bits available for latch control.&lt;br /&gt;
&lt;br /&gt;
So, as you write color values out on the SPI, the first chip receives them. If the chip hasn't written a color to one of its to LEDs, it does so and thus ends the transmission. However, if it has already assigned a color to each LED then it passes the SPI along on a separate bus to the next chip. This is how the strand is able to be 5m and still run at 10 MHz.&lt;br /&gt;
&lt;br /&gt;
It is still unknown how exactly the 3 latch bits are used (because the chip manufacturer has kept the interface a secret). However, if you write 6 bytes of &amp;quot;latch&amp;quot; the strand restarts at the beginning. Perhaps less bytes of &amp;quot;latch&amp;quot; can be sent and get the same effect, but due to time limitations we were unable to debug this completely. This is a simple place to start for future work.&lt;br /&gt;
&lt;br /&gt;
=== SPI Bus ===&lt;br /&gt;
&lt;br /&gt;
We use the default SPI controller to control the SPI lines. All we had to do is find what master is controlling the bus (2 in our case) and add a device. Initially, the SPI bus we want is being used by the default configuration of spidev. So, all we do is unregister the device from spidev and reregister it for our driver. There are a few things that go into the configuration of the device like speed, number of bits, chip select, and mode. Once these are set, you can add the device and it will then be associated with your driver.&lt;br /&gt;
&lt;br /&gt;
=== Sysfs Kernel Driver ===&lt;br /&gt;
&lt;br /&gt;
The sysfs kernel driver is based on the references above. It uses a kset to store kobjects (the basic building block of the kernel). Each kobject has associated with it certain attributes. These attributes are brought out to the user as files. When the files are read from or written to, the kernel calls back into the kobject's read/write routines. Here, we are able to decide which attribute is being addressed and manipulate the buffer as we see fit.&lt;br /&gt;
&lt;br /&gt;
There are some alternative implementations to this that were looked into in addition to kset. The driver could have been implemented as a sysfs device driver instead of a kernel driver so that it shows up in &amp;lt;code&amp;gt;/sys/class&amp;lt;/code&amp;gt; with everything else. Another option is that it could be implemented as a straight up device/kernel driver making it show up in &amp;lt;code&amp;gt;/dev&amp;lt;/code&amp;gt; instead. There doesn't seem to be much of a difference though between these implementations as far as performance is concerned. However, finding where this driver fits best is another good place for future work. &lt;br /&gt;
&lt;br /&gt;
== Work Breakdown ==&lt;br /&gt;
&lt;br /&gt;
=== Sean Richardson ===&lt;br /&gt;
* Researched using SPI on the BeagleBone&lt;br /&gt;
* Debugged the LED strand (the first one we received was broken)&lt;br /&gt;
* Wrote code to interface with the strand using spidev&lt;br /&gt;
* Helped integrate the SPI interface into the sysfs driver&lt;br /&gt;
&lt;br /&gt;
=== Greg Larmore ===&lt;br /&gt;
* Researched kernel drivers and sysfs&lt;br /&gt;
* Helped debug the LED strand&lt;br /&gt;
* Wrote example sysfs driver&lt;br /&gt;
* Integrated the SPI interface into the sysfs driver&lt;br /&gt;
&lt;br /&gt;
== Future Work ==&lt;br /&gt;
&lt;br /&gt;
While the strand works well as it is, there are some things that we would like to see looked into if there is future work on this project.&lt;br /&gt;
&lt;br /&gt;
=== Latching and Controller Interface ===&lt;br /&gt;
&lt;br /&gt;
According to Adafruit, the interface to this part has been reverse engineered. The one part that really remains unknown is how exactly the 3-bit control interface works for each LED. We were able to achieve a latching effect by sending 6 empty transmissions. The code in [github.com/adafruit/lpd8806 Adafruit's github] doesn't seem to be using this many latch transmissions.&lt;br /&gt;
&lt;br /&gt;
=== Buffering Problem ===&lt;br /&gt;
&lt;br /&gt;
There is a problem with buffered output going into the &amp;lt;code&amp;gt;data&amp;lt;/code&amp;gt; file (because it is so big). When the output buffers it causes 2 sequential writes which weren't being handled well by the attribute's store function. This could be alleviated with a circular buffer and an index that can be controlled by the user, but really the driver should be able to handle this condition.&lt;br /&gt;
&lt;br /&gt;
=== Sysfs File Location ===&lt;br /&gt;
&lt;br /&gt;
The decision to have these drivers located in &amp;lt;code&amp;gt;/lib/modules/3.2.25+/kernel/drivers/char&amp;lt;/code&amp;gt; and run out of &amp;lt;code&amp;gt;/sys/firmware&amp;lt;/code&amp;gt; was pretty much arbitrary. It would be nice to do some research into how the kernel is supposed to be structured so that we can match it. This also applies to the example driver included in this project.&lt;br /&gt;
&lt;br /&gt;
== Conclusions ==&lt;br /&gt;
&lt;br /&gt;
In this project, we were able to get SPI (a lesser used interface on the bone) to work well with our LED strand. More impressively, we were able to interface with the SPI through a sysfs interface. In the process of developing this sysfs interface to the LED strand, we developed an example sysfs driver that can be used in future ECE497 classes. Lastly, we developed a sample application that uses this sysfs interface for our LED strand to show off the results.&lt;/div&gt;</summary>
		<author><name>Yoder</name></author>	</entry>

	<entry>
		<id>http://www.elinux.org/Adafruit:_Rotary_Encoder</id>
		<title>Adafruit: Rotary Encoder</title>
		<link rel="alternate" type="text/html" href="http://www.elinux.org/Adafruit:_Rotary_Encoder"/>
				<updated>2013-06-05T19:43:07Z</updated>
		
		<summary type="html">&lt;p&gt;Yoder: Removed Grading&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:ECE497]]&lt;br /&gt;
[[Category:Adafruit]]&lt;br /&gt;
&lt;br /&gt;
[[File:Adafruit_Rotary_Encoder.jpg|thumb|Adafruit's Rotary Encoder]]&lt;br /&gt;
&lt;br /&gt;
==Overview==&lt;br /&gt;
&lt;br /&gt;
[http://adafru.it/377 Adafruit's Rotary Encoder] is a device that detects rotation. As it rotates, it sends pulses on two pins. By comparing the signals, the direction of rotation can be determined. There are 24 pulses per rotation. The device also acts as a pushbutton switch.&lt;br /&gt;
&lt;br /&gt;
==Inputs and Outputs==&lt;br /&gt;
&lt;br /&gt;
The device has five pins - three on one side and two on the other. The side with three pins is for the encoder and is ordered (from left to right) signal A, ground, and signal B. The side with two pins is for the pushbutton switch. The signal pins require the use of pullup resistors, and the switch should use either a pullup or pulldown resistor. More information can be found on the [http://adafru.it/377 product page] or on the [http://www.adafruit.com/datasheets/pec11.pdf datasheet].&lt;br /&gt;
&lt;br /&gt;
==Bone Usage==&lt;br /&gt;
&lt;br /&gt;
The pins on the device can be difficult to use with a bread board, so it may be useful to solder the device to a perfboard and add connectors. [[File:Adafruit_Rotary_Encoder_With_Connectors.jpg|thumb|Rotary encoder with connectors added]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;color:red&amp;quot;&amp;gt;How do you configure the pullups?&amp;lt;/blockquote&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The two signal pins and one of the pushbutton pins can be hooked up directly to any of the GPIO ports on the BeagleBone. The pins should then be configured as pullups for the signal pins and either pullup or pulldown for the switch pin. The remaining pins can be hooked up to GND and +3,3v. The example below uses GPIO1_6 for signal A, GPIO1_15 for signal B, and GPIO1_16 for the pushbutton switch. [[File:Adafruit_Rotary_Encoder_in_BeagleBone.jpg|thumb|Rotary encoder hooked up to the BeagleBone]]&lt;br /&gt;
&lt;br /&gt;
To configure the pull-up resistor, write 0x0037 to the pin's OMAP mux file (in /sys/kernel/debug/omap_mux). For example, the code below writes 0x0037 into /sys/kernel/debug/omap_mux/gpmc_ad6 for the B signal pin. Writing a value of 0x0027 to the file will configure it to use a pull-down resistor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Show the specific command that does the right.  A beginner would have trouble with your instructions.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The C code below demonstrates how to use the encoder with the BeagleBone.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
&lt;br /&gt;
Port Congiguration:&lt;br /&gt;
-Encoder A: GPIO1_6 - Header P8, pin 3 - GPIO 38&lt;br /&gt;
-Encoder B: GPIO1_15 - Header P8, pin 15 - GPIO 47&lt;br /&gt;
-Encoder GND: Header P8, pin 1&lt;br /&gt;
&lt;br /&gt;
-Pushbutton Switch: GPIO1_16 - Header P9, pin 15 - GPIO 48&lt;br /&gt;
-Pusshbuton Switch V+: Header P9, pin 3&lt;br /&gt;
&lt;br /&gt;
This program keeps track of an encoder. CW rotation will&lt;br /&gt;
increment the ticks, and CCW will decrement it. The current&lt;br /&gt;
number of ticks is printed when the button is pressed.&lt;br /&gt;
&lt;br /&gt;
The files gpio.h and gpio.c  consist of the GPIO methods copied&lt;br /&gt;
directly from:&lt;br /&gt;
https://www.ridgerun.com/developer/wiki/index.php/Gpio-int-test.c&lt;br /&gt;
&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;gpio.h&amp;quot;&lt;br /&gt;
#include &amp;lt;signal.h&amp;gt;&lt;br /&gt;
#include &amp;lt;poll.h&amp;gt;&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include &amp;lt;string.h&amp;gt;&lt;br /&gt;
#include &amp;lt;unistd.h&amp;gt;&lt;br /&gt;
#include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#define OMAP_DIR &amp;quot;/sys/kernel/debug/omap_mux&amp;quot;&lt;br /&gt;
&lt;br /&gt;
int running = 1;&lt;br /&gt;
&lt;br /&gt;
// Quit when ^C is pressed&lt;br /&gt;
void signal_handler(int sig)&lt;br /&gt;
{&lt;br /&gt;
	printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
	running = 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
int main(int argc, char* argv[])&lt;br /&gt;
{&lt;br /&gt;
	// Polling variables&lt;br /&gt;
	int rc;&lt;br /&gt;
	struct pollfd fdset[3];&lt;br /&gt;
	int nfds = 3;&lt;br /&gt;
	int len;&lt;br /&gt;
	char* buf[MAX_BUF];&lt;br /&gt;
&lt;br /&gt;
	// Keeps track of encoder ticks.&lt;br /&gt;
	int ticks = 0;&lt;br /&gt;
&lt;br /&gt;
	// Variables used to store GPIO values&lt;br /&gt;
	unsigned int enc_a_val;&lt;br /&gt;
	unsigned int enc_b_val;&lt;br /&gt;
	unsigned int sw_val;&lt;br /&gt;
&lt;br /&gt;
	// Handle Ctrl^C&lt;br /&gt;
	signal(SIGINT, signal_handler);&lt;br /&gt;
&lt;br /&gt;
        // Configure the pins to use internal pull-down resistors&lt;br /&gt;
        FILE *mux_ptr;&lt;br /&gt;
        char pullup_str[10];&lt;br /&gt;
	char pulldown_str[10];&lt;br /&gt;
        strcpy(pullup_str, &amp;quot;0x0037&amp;quot;);&lt;br /&gt;
	strcpy(pulldown_str, &amp;quot;0x0027&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
        // Configure pull-up for the A signal&lt;br /&gt;
        if ((mux_ptr = fopen(OMAP_DIR &amp;quot;/gpmc_ad6&amp;quot;, &amp;quot;rb+&amp;quot;)) == NULL)&lt;br /&gt;
        {&lt;br /&gt;
                printf(&amp;quot;Failed to open gpmc_ad6. Quitting.\n&amp;quot;);&lt;br /&gt;
                exit(1);&lt;br /&gt;
        }&lt;br /&gt;
        else&lt;br /&gt;
	{&lt;br /&gt;
                fwrite(&amp;amp;pullup_str, sizeof(char), 6, mux_ptr);&lt;br /&gt;
                fclose(mux_ptr);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        // Configure pull-up for the B signal&lt;br /&gt;
        if ((mux_ptr = fopen(OMAP_DIR &amp;quot;/gpmc_ad15&amp;quot;, &amp;quot;rb+&amp;quot;)) == NULL)&lt;br /&gt;
        {&lt;br /&gt;
                printf(&amp;quot;Failed to open gpmc_ad15. Quitting.\n&amp;quot;);&lt;br /&gt;
                exit(1);&lt;br /&gt;
        }&lt;br /&gt;
        else&lt;br /&gt;
	{&lt;br /&gt;
                fwrite(&amp;amp;pullup_str, sizeof(char), 6, mux_ptr);&lt;br /&gt;
                fclose(mux_ptr);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        // Configure pull-down for the switch&lt;br /&gt;
        if ((mux_ptr = fopen(OMAP_DIR &amp;quot;/gpmc_a0&amp;quot;, &amp;quot;rb+&amp;quot;)) == NULL)&lt;br /&gt;
        {&lt;br /&gt;
                printf(&amp;quot;Failed to open gpmc_a0. Quitting.\n&amp;quot;);&lt;br /&gt;
                exit(1);&lt;br /&gt;
        }&lt;br /&gt;
        else&lt;br /&gt;
	{&lt;br /&gt;
                fwrite(&amp;amp;pulldown_str, sizeof(char), 6, mux_ptr);&lt;br /&gt;
                fclose(mux_ptr);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
	// Set up GPIO pins&lt;br /&gt;
	unsigned int gpio_a = 38;&lt;br /&gt;
	unsigned int gpio_b = 47;&lt;br /&gt;
	unsigned int gpio_sw = 48;&lt;br /&gt;
&lt;br /&gt;
	int enc_a_fd;&lt;br /&gt;
	int enc_b_fd;&lt;br /&gt;
	int enc_sw_fd;&lt;br /&gt;
&lt;br /&gt;
	printf(&amp;quot;Exporting a... %d\n&amp;quot;, gpio_export(gpio_a));&lt;br /&gt;
	printf(&amp;quot;Exporting b... %d\n&amp;quot;, gpio_export(gpio_b));&lt;br /&gt;
	printf(&amp;quot;Exporting sw... %d\n&amp;quot;, gpio_export(gpio_sw));&lt;br /&gt;
&lt;br /&gt;
	printf(&amp;quot;Setting a direction... %d\n&amp;quot;, gpio_set_dir(gpio_a, 0));&lt;br /&gt;
	printf(&amp;quot;Setting b direction... %d\n&amp;quot;, gpio_set_dir(gpio_b, 0));&lt;br /&gt;
	printf(&amp;quot;Setting sw direction... %d\n&amp;quot;, gpio_set_dir(gpio_sw, 0));&lt;br /&gt;
&lt;br /&gt;
	// Interrupts&lt;br /&gt;
	printf(&amp;quot;setting edge a... %d\n&amp;quot;, gpio_set_edge(gpio_a, &amp;quot;rising&amp;quot;));&lt;br /&gt;
	printf(&amp;quot;setting edge sw... %d\n&amp;quot;, gpio_set_edge(gpio_sw, &amp;quot;rising&amp;quot;));&lt;br /&gt;
&lt;br /&gt;
	// Open the file for the encoder A signal&lt;br /&gt;
	enc_a_fd = gpio_fd_open(gpio_a);&lt;br /&gt;
	enc_sw_fd = gpio_fd_open(gpio_sw);&lt;br /&gt;
&lt;br /&gt;
	// Main loop&lt;br /&gt;
	while (running == 1)&lt;br /&gt;
	{&lt;br /&gt;
		memset((void*)fdset, 0, sizeof(fdset));&lt;br /&gt;
&lt;br /&gt;
		fdset[0].fd = STDIN_FILENO;&lt;br /&gt;
		fdset[0].events = POLLIN;&lt;br /&gt;
&lt;br /&gt;
		fdset[1].fd = enc_a_fd;&lt;br /&gt;
		fdset[1].events = POLLPRI;&lt;br /&gt;
&lt;br /&gt;
		fdset[2].fd = enc_sw_fd;&lt;br /&gt;
		fdset[2].events = POLLPRI;&lt;br /&gt;
&lt;br /&gt;
		rc = poll(fdset, nfds, -1);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
		if (rc &amp;lt; 0)&lt;br /&gt;
		{&lt;br /&gt;
//			printf(&amp;quot;poll() failed.\n&amp;quot;);&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		if (rc == 0)&lt;br /&gt;
		{&lt;br /&gt;
//			printf(&amp;quot;.&amp;quot;);&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		if (fdset[0].revents &amp;amp; POLLIN)&lt;br /&gt;
		{&lt;br /&gt;
			(void) read(fdset[0].fd, buf, 1);&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Encoder click&lt;br /&gt;
		if (fdset[1].revents &amp;amp; POLLPRI)&lt;br /&gt;
		{&lt;br /&gt;
			lseek(fdset[1].fd, 0, SEEK_SET);&lt;br /&gt;
			len = read(fdset[1].fd, buf, MAX_BUF);&lt;br /&gt;
&lt;br /&gt;
			enc_a_val = atoi((const char*) buf);&lt;br /&gt;
			gpio_get_value(gpio_b, &amp;amp;enc_b_val);&lt;br /&gt;
&lt;br /&gt;
			if (enc_a_val == 1) // rising edge&lt;br /&gt;
			{&lt;br /&gt;
				if (enc_b_val == 0) ticks--;&lt;br /&gt;
				else ticks++;&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Button press - print the current number of encoder ticks&lt;br /&gt;
		if (fdset[2].revents &amp;amp; POLLPRI)&lt;br /&gt;
		{&lt;br /&gt;
			lseek(fdset[2].fd, 0, SEEK_SET);&lt;br /&gt;
			len = read(fdset[2].fd, buf, MAX_BUF);&lt;br /&gt;
&lt;br /&gt;
			// Very simple debouncing&lt;br /&gt;
			usleep(5000);&lt;br /&gt;
			gpio_get_value(gpio_sw, &amp;amp;sw_val);&lt;br /&gt;
			if (sw_val == 1)&lt;br /&gt;
			{&lt;br /&gt;
				printf(&amp;quot;Ticks: %d\n&amp;quot;, ticks);&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	gpio_fd_close(enc_a_fd);&lt;br /&gt;
&lt;br /&gt;
	return 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The full code can be found in [https://github.com/jtlobdell/Adafruit_Rotary_Encoder_BeagleBone John Lobdell's Git repository].&lt;br /&gt;
&lt;br /&gt;
==Interfacing with node.js==&lt;br /&gt;
&lt;br /&gt;
Interfacing it with node.js is relatively straight-forward. The code is shwon below, and can be found in [https://github.com/jtlobdell/Adafruit_Rotary_Encoder_BeagleBone John Lobdell's Git repository].&lt;br /&gt;
&lt;br /&gt;
rotary_encoder.js:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// From Getting Started With node.js and socket.io &lt;br /&gt;
// http://codehenge.net/blog/2011/12/getting-started-with-node-js-and-socket-io-v0-7-part-2/&lt;br /&gt;
&amp;quot;use strict&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
var http = require('http'),&lt;br /&gt;
    url = require('url'),&lt;br /&gt;
    fs = require('fs'),&lt;br /&gt;
    exec = require('child_process').exec,&lt;br /&gt;
    server,&lt;br /&gt;
    connectCount = 0;	// Number of connections to server&lt;br /&gt;
&lt;br /&gt;
server = http.createServer(function (req, res) {&lt;br /&gt;
// server code&lt;br /&gt;
    var path = url.parse(req.url).pathname;&lt;br /&gt;
    console.log(&amp;quot;path: &amp;quot; + path);&lt;br /&gt;
    switch (path) {&lt;br /&gt;
    case '/':&lt;br /&gt;
        res.writeHead(200, {'Content-Type': 'text/html'});&lt;br /&gt;
        res.write('&amp;lt;h1&amp;gt;John Lobdell - Mini Project 4&amp;lt;/h1&amp;gt;Try&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt;&amp;lt;a href=&amp;quot;/rotary_encoder.html&amp;quot;&amp;gt;Rotary Encoder&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;');&lt;br /&gt;
&lt;br /&gt;
        res.end();&lt;br /&gt;
        break;&lt;br /&gt;
&lt;br /&gt;
    default:		// This is so all the files will be sent.&lt;br /&gt;
        fs.readFile(__dirname + path, function (err, data) {&lt;br /&gt;
            if (err) {return send404(res); }&lt;br /&gt;
//            console.log(&amp;quot;path2: &amp;quot; + path);&lt;br /&gt;
            res.write(data, 'utf8');&lt;br /&gt;
            res.end();&lt;br /&gt;
        });&lt;br /&gt;
        break;&lt;br /&gt;
&lt;br /&gt;
    }&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
var send404 = function (res) {&lt;br /&gt;
    res.writeHead(404);&lt;br /&gt;
    res.write('404');&lt;br /&gt;
    res.end();&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
server.listen(8081);&lt;br /&gt;
&lt;br /&gt;
// socket.io, I choose you&lt;br /&gt;
var io = require('socket.io').listen(server);&lt;br /&gt;
io.set('log level', 2);&lt;br /&gt;
&lt;br /&gt;
// on a 'connection' event&lt;br /&gt;
io.sockets.on('connection', function (socket) {&lt;br /&gt;
    var frameCount = 0;	// Counts the frames from arecord&lt;br /&gt;
    var lastFrame = 0;	// Last frame sent to browser&lt;br /&gt;
    console.log(&amp;quot;Connection &amp;quot; + socket.id + &amp;quot; accepted.&amp;quot;);&lt;br /&gt;
//    console.log(&amp;quot;socket: &amp;quot; + socket);&lt;br /&gt;
&lt;br /&gt;
    // now that we have our connected 'socket' object, we can &lt;br /&gt;
    // define its event handlers&lt;br /&gt;
&lt;br /&gt;
    // Make sure gpio 38, 47, and 48 are available.&lt;br /&gt;
    exec(&amp;quot;echo 38 &amp;gt; /sys/class/gpio/export&amp;quot;);&lt;br /&gt;
    exec(&amp;quot;echo 47 &amp;gt; /sys/class/gpio/export&amp;quot;);&lt;br /&gt;
    exec(&amp;quot;echo 48 &amp;gt; /sys/class/gpio/export&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
    // Configure pullup/pulldown resistors&lt;br /&gt;
    exec(&amp;quot;echo 0x0037 &amp;gt; /sys/kernel/debug/omap_mux/gpmc_ad6&amp;quot;); // Pullup for encoder A&lt;br /&gt;
    exec(&amp;quot;echo 0x0037 &amp;gt; /sys/kernel/debug/omap_mux/gpmc_ad15&amp;quot;); // Pullup for encoder B&lt;br /&gt;
    exec(&amp;quot;echo 0x0027 &amp;gt; /sys/kernel/debug/omap_mux/gpmc_a0&amp;quot;); // Pulldown for the switch&lt;br /&gt;
&lt;br /&gt;
    // Handle disconnects&lt;br /&gt;
    socket.on('disconnect', function () {&lt;br /&gt;
        console.log(&amp;quot;Connection &amp;quot; + socket.id + &amp;quot; terminated.&amp;quot;);&lt;br /&gt;
        connectCount--;&lt;br /&gt;
        if(connectCount === 0) {&lt;br /&gt;
        }&lt;br /&gt;
        console.log(&amp;quot;connectCount = &amp;quot; + connectCount);&lt;br /&gt;
    });&lt;br /&gt;
&lt;br /&gt;
    // Periodically send data&lt;br /&gt;
    var push_interval = 20;&lt;br /&gt;
    function push_data() {&lt;br /&gt;
        // Send encoder A status&lt;br /&gt;
        var gpioPath = &amp;quot;/sys/class/gpio/gpio38/value&amp;quot;;&lt;br /&gt;
        fs.readFile(gpioPath, 'base64', function (err, data) {&lt;br /&gt;
            if (err) throw err;&lt;br /&gt;
            socket.emit('enc_a', data);&lt;br /&gt;
        });&lt;br /&gt;
&lt;br /&gt;
        // Send encoder B status&lt;br /&gt;
        gpioPath = &amp;quot;/sys/class/gpio/gpio47/value&amp;quot;;&lt;br /&gt;
        fs.readFile(gpioPath, 'base64', function (err, data) {&lt;br /&gt;
            if (err) throw err;&lt;br /&gt;
            socket.emit('enc_b', data);&lt;br /&gt;
        });&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        // Send encoder switch status&lt;br /&gt;
        gpioPath = &amp;quot;/sys/class/gpio/gpio48/value&amp;quot;;&lt;br /&gt;
        fs.readFile(gpioPath, 'base64', function (err, data) {&lt;br /&gt;
            if (err) throw err;&lt;br /&gt;
            socket.emit('enc_sw', data);&lt;br /&gt;
        });&lt;br /&gt;
&lt;br /&gt;
        setTimeout(push_data, push_interval);&lt;br /&gt;
    }&lt;br /&gt;
    push_data();&lt;br /&gt;
&lt;br /&gt;
    connectCount++;&lt;br /&gt;
    console.log(&amp;quot;connectCount = &amp;quot; + connectCount);&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
rotary_encoder.html:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!doctype html&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
  &amp;lt;head&amp;gt;&lt;br /&gt;
    &amp;lt;title&amp;gt;Rotary Encoder Demo&amp;lt;/title&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;script src=&amp;quot;/json.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt; &amp;lt;!-- for ie --&amp;gt;&lt;br /&gt;
    &amp;lt;script src=&amp;quot;/socket.io/socket.io.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;link href=&amp;quot;layout.css&amp;quot; rel=&amp;quot;stylesheet&amp;quot; type=&amp;quot;text/css&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;script src=&amp;quot;jquery.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
    &amp;lt;script src=&amp;quot;jquery.flot.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
    &amp;lt;script src=&amp;quot;jquery.flot.navigate.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
  &amp;lt;/head&amp;gt;&lt;br /&gt;
  &amp;lt;body&amp;gt;&lt;br /&gt;
    &amp;lt;h1&amp;gt;Rotary Encoder Demo &amp;lt;a href=&amp;quot;http://Rose-Hulman.edu&amp;quot; target=&amp;quot;_blank&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;img src=&amp;quot;RoseLogo96.png&amp;quot; width=200 style=&amp;quot;float:right&amp;quot;&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;&lt;br /&gt;
    &amp;lt;button id=&amp;quot;connect&amp;quot; onClick='connect()'/&amp;gt;Connect&amp;lt;/button&amp;gt;&lt;br /&gt;
    &amp;lt;button id=&amp;quot;disconnect&amp;quot; onClick='disconnect()'&amp;gt;Disconnect&amp;lt;/button&amp;gt;&lt;br /&gt;
&amp;lt;!--    &amp;lt;button id=&amp;quot;send&amp;quot; onClick='send()'/&amp;gt;Send Message&amp;lt;/button&amp;gt; --&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;&amp;lt;div id=&amp;quot;plotTop&amp;quot; style=&amp;quot;width:550px;height:150px;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;samples&amp;lt;/center&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;&amp;lt;div id=&amp;quot;plotBot&amp;quot; style=&amp;quot;width:550px;height:150px;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;samples&amp;lt;center&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;a href=&amp;quot;http://beagleboard.org&amp;quot; target=&amp;quot;_blank&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;img src=&amp;quot;beagle-hd-logo.gif&amp;quot; width=200 align=&amp;quot;right&amp;quot;&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;
    &amp;lt;div&amp;gt;&amp;lt;p id=&amp;quot;status&amp;quot;&amp;gt;Waiting for input&amp;lt;/p&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;div&amp;gt;&amp;lt;p id=&amp;quot;ticks&amp;quot;&amp;gt;&amp;lt;/p&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;a href=&amp;quot;http://www.ti.com/sitara&amp;quot; target=&amp;quot;_blank&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;img src=&amp;quot;hdr_ti_logo.gif&amp;quot; width=200 align=&amp;quot;right&amp;quot;&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;
By &amp;lt;i&amp;gt;John Lobdell&amp;lt;/i&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    var socket;&lt;br /&gt;
    var firstconnect = true,&lt;br /&gt;
        fs = 8000,&lt;br /&gt;
        Ts = 1/fs*1000,&lt;br /&gt;
        samples = 100,&lt;br /&gt;
        plotTop,&lt;br /&gt;
        enc_a = [], ienc_a = 0,&lt;br /&gt;
	enc_b = [], ienc_b = 0,&lt;br /&gt;
        sw_data = [], isw_data = 0,&lt;br /&gt;
        gpio_enc_a = 38,&lt;br /&gt;
	gpio_enc_b = 47,&lt;br /&gt;
	gpio_sw = 48;&lt;br /&gt;
&lt;br /&gt;
    enc_a[samples] = 0;&lt;br /&gt;
    enc_b[samples] = 0;&lt;br /&gt;
    sw_data[samples] = 0;&lt;br /&gt;
&lt;br /&gt;
    function connect() {&lt;br /&gt;
      if(firstconnect) {&lt;br /&gt;
        socket = io.connect(null);&lt;br /&gt;
&lt;br /&gt;
        socket.on('message', function(data)&lt;br /&gt;
            { status_update(&amp;quot;Received: message&amp;quot;);});&lt;br /&gt;
        socket.on('connect', function()&lt;br /&gt;
            { status_update(&amp;quot;Connected to Server&amp;quot;); });&lt;br /&gt;
        socket.on('disconnect', function()&lt;br /&gt;
            { status_update(&amp;quot;Disconnected from Server&amp;quot;); });&lt;br /&gt;
        socket.on('reconnect', function()&lt;br /&gt;
            { status_update(&amp;quot;Reconnected to Server&amp;quot;); });&lt;br /&gt;
        socket.on('reconnecting', function( nextRetry )&lt;br /&gt;
            { status_update(&amp;quot;Reconnecting in &amp;quot; + nextRetry/1000 + &amp;quot; s&amp;quot;); });&lt;br /&gt;
        socket.on('reconnect_failed', function()&lt;br /&gt;
            { message(&amp;quot;Reconnect Failed&amp;quot;); });&lt;br /&gt;
&lt;br /&gt;
        socket.on('enc_a', enca);&lt;br /&gt;
        socket.on('enc_b', encb);&lt;br /&gt;
        socket.on('enc_sw', encsw);&lt;br /&gt;
        socket.on('set_ticks', setTicks);&lt;br /&gt;
&lt;br /&gt;
        firstconnect = false;&lt;br /&gt;
&lt;br /&gt;
      }&lt;br /&gt;
      else {&lt;br /&gt;
        socket.socket.reconnect();&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    function disconnect() {&lt;br /&gt;
      socket.disconnect();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // When new data arrives, convert it and plot it.&lt;br /&gt;
    function enca(data) {&lt;br /&gt;
//	status_update(&amp;quot;enc_a &amp;quot; + data);&lt;br /&gt;
        data = atob(data);&lt;br /&gt;
        enc_a[ienc_a] = [ienc_a, data];&lt;br /&gt;
        ienc_a++;&lt;br /&gt;
        if (ienc_a &amp;gt;= samples) {&lt;br /&gt;
            ienc_a = 0;&lt;br /&gt;
            enc_a = [];&lt;br /&gt;
        }&lt;br /&gt;
        plotTop.setData([ enc_a, enc_b ]);&lt;br /&gt;
        plotTop.draw();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    function encb(data) {&lt;br /&gt;
//	status_update(&amp;quot;enc_b &amp;quot; + data);&lt;br /&gt;
        data = atob(data);&lt;br /&gt;
        enc_b[ienc_b] = [ienc_b, data];&lt;br /&gt;
        ienc_b++;&lt;br /&gt;
        if (ienc_b &amp;gt;= samples) {&lt;br /&gt;
            ienc_b = 0;&lt;br /&gt;
            enc_b = [];&lt;br /&gt;
        }&lt;br /&gt;
        plotTop.setData([ enc_a, enc_b ]);&lt;br /&gt;
        plotTop.draw();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    function encsw(data) {&lt;br /&gt;
//        status_update(&amp;quot;encsw &amp;quot; + data);&lt;br /&gt;
        data = atob(data);&lt;br /&gt;
        sw_data[isw_data] = [isw_data, data];&lt;br /&gt;
        isw_data++;&lt;br /&gt;
        if (isw_data &amp;gt;= samples) {&lt;br /&gt;
            isw_data = 0;&lt;br /&gt;
            sw_data = [];&lt;br /&gt;
        }&lt;br /&gt;
        plotBot.setData([ sw_data ]);&lt;br /&gt;
        plotBot.draw();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    function status_update(txt){&lt;br /&gt;
      document.getElementById('status').innerHTML = txt;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    function setTicks(numTicks){&lt;br /&gt;
        document.getElementById('ticks').innerHTML = &amp;quot;Ticks: &amp;quot; + numTicks;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    connect();&lt;br /&gt;
&lt;br /&gt;
$(function () {&lt;br /&gt;
&lt;br /&gt;
    function initPlotData() {&lt;br /&gt;
        // zip the generated y values with the x values&lt;br /&gt;
        var result = [];&lt;br /&gt;
        for (var i = 0; i &amp;lt;= samples; i++)&lt;br /&gt;
            result[i] = [i, 0];&lt;br /&gt;
        return result;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // setup plot&lt;br /&gt;
    var optionsTop = {&lt;br /&gt;
        series: { &lt;br /&gt;
            shadowSize: 0, // drawing is faster without shadows&lt;br /&gt;
            points: { show: false},&lt;br /&gt;
            lines:  { show: true, lineWidth: 5},&lt;br /&gt;
        }, &lt;br /&gt;
        yaxis:	{ min: 0, max: 2, &lt;br /&gt;
                  zoomRange: [10, 256], panRange: [-128, 128] },&lt;br /&gt;
        xaxis:	{ show: true, &lt;br /&gt;
                  zoomRange: [10, 100], panRange: [0, 100] },&lt;br /&gt;
        legend:	{ position: &amp;quot;sw&amp;quot; },&lt;br /&gt;
        zoom:	{ interactive: true, amount: 1.1 },&lt;br /&gt;
        pan:	{ interactive: true }&lt;br /&gt;
    };&lt;br /&gt;
    plotTop = $.plot($(&amp;quot;#plotTop&amp;quot;), &lt;br /&gt;
        [ &lt;br /&gt;
          { data:  initPlotData(), &lt;br /&gt;
            label: &amp;quot;Encoder A&amp;quot; },&lt;br /&gt;
          { data:  initPlotData(),&lt;br /&gt;
            label: &amp;quot;Encoder B&amp;quot; }&lt;br /&gt;
        ],&lt;br /&gt;
            optionsTop);&lt;br /&gt;
&lt;br /&gt;
    var optionsBot = {&lt;br /&gt;
        series: {&lt;br /&gt;
            shadowSize: 0, // drawing is faster without shadows&lt;br /&gt;
            points: { show: false},&lt;br /&gt;
            lines:  { show: true, lineWidth: 5},&lt;br /&gt;
            color: 2&lt;br /&gt;
        },&lt;br /&gt;
        yaxis:  { min: 0, max: 2,&lt;br /&gt;
                  zoomRange: [10, 256], panRange: [-128, 128] },&lt;br /&gt;
        xaxis:  { show: true,&lt;br /&gt;
                  zoomRange: [10, 100], panRange: [0, 100] },&lt;br /&gt;
        legend: { position: &amp;quot;sw&amp;quot; },&lt;br /&gt;
        zoom:   { interactive: true, amount: 1.1 },&lt;br /&gt;
        pan:    { interactive: true }&lt;br /&gt;
    };&lt;br /&gt;
    plotBot = $.plot($(&amp;quot;#plotBot&amp;quot;),&lt;br /&gt;
        [&lt;br /&gt;
            { data:  initPlotData(),&lt;br /&gt;
              label: &amp;quot;Encoder Switch&amp;quot;}&lt;br /&gt;
        ],&lt;br /&gt;
            optionsBot);&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yoder</name></author>	</entry>

	<entry>
		<id>http://www.elinux.org/ECE497_SPI_Project</id>
		<title>ECE497 SPI Project</title>
		<link rel="alternate" type="text/html" href="http://www.elinux.org/ECE497_SPI_Project"/>
				<updated>2013-06-05T18:27:10Z</updated>
		
		<summary type="html">&lt;p&gt;Yoder: Added ECE497 category&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:ECE497Fall2012 |Project]]&lt;br /&gt;
[[Category:ECE497 |Ada]]&lt;br /&gt;
Team members: [[user:Richarsm|Sean Richardson]], [[user:larmorgs|Greg Larmore]]&lt;br /&gt;
&lt;br /&gt;
== Executive Summary ==&lt;br /&gt;
&lt;br /&gt;
For this project we wanted to further improve documentation available for sysfs kernel drivers with the Beagle Bone. To do this we have interfaced an [http://adafruit.com/products/306 LED light strand] by Adafruit with a sysfs kernel driver utilizing SPI. In doing so we have created an easy to use interface to the light strand while also maximizing data throughput.&lt;br /&gt;
&lt;br /&gt;
== Good Websites ==&lt;br /&gt;
&lt;br /&gt;
[http://elinux.org/BeagleBoard/SPI BeagleBoard and SPI]&lt;br /&gt;
&lt;br /&gt;
[http://www.xml.com/ldd/chapter/book/ O'Reilly Book on Linux Device Drivers]&lt;br /&gt;
&lt;br /&gt;
[http://www.cs.fsu.edu/~baker/devices/lxr/http/source/linux/samples/kobject/kset-example.c Kset example for sysfs driver]&lt;br /&gt;
&lt;br /&gt;
[http://elk.informatik.fh-augsburg.de/pub/elinux/ngw100-docs/AVR32743/spi/spi_example.c Example SPI device driver]&lt;br /&gt;
&lt;br /&gt;
[http://www.jumpnowtek.com/index.php?option=com_content&amp;amp;view=article&amp;amp;id=57&amp;amp;Itemid=62 Another example SPI device driver]&lt;br /&gt;
&lt;br /&gt;
== More Good Websites ==&lt;br /&gt;
&lt;br /&gt;
[http://www.loadyourself.com/linux/sample-linux-driver/ Example Kernel Driver (ioctl, no sysfs)]&lt;br /&gt;
&lt;br /&gt;
[http://www.freesoftwaremagazine.com/articles/drivers_linux Kernel Driver Tutorial (no sysfs/ioctl)]&lt;br /&gt;
&lt;br /&gt;
== Installation Instructions ==&lt;br /&gt;
&lt;br /&gt;
All of these instructions are meant for the A6A BeagleBone running version 3.2.25+ of the kernel. Scripts and Makefiles expect that the kernel be located at &amp;lt;code&amp;gt;~/BeagleBoard/kernel/kernel&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Start by cloning the [https://github.com/larmorgs/FinalProject github] repository on both the bone and the host machine by running the following:&lt;br /&gt;
&lt;br /&gt;
 both$ '''git clone git@github.com:larmorgs/FinalProject'''&lt;br /&gt;
&lt;br /&gt;
On the host machine, run the following:&lt;br /&gt;
&lt;br /&gt;
 host$ '''cd ~/FinalProject'''&lt;br /&gt;
 host$ '''./setup.sh'''&lt;br /&gt;
&lt;br /&gt;
Make sure you only do this &amp;lt;b&amp;gt;once&amp;lt;/b&amp;gt; because it is adding on our modules to the Kconfig and Makefile in &amp;lt;code&amp;gt;~/BeagleBoard/kernel/kernel/driver/char&amp;lt;/code&amp;gt;. The files are backed up in the same folder with &amp;lt;code&amp;gt;.orig&amp;lt;/code&amp;gt; appended.&lt;br /&gt;
&lt;br /&gt;
Next run the following on the host machine:&lt;br /&gt;
&lt;br /&gt;
 host$ '''make kernel'''&lt;br /&gt;
&lt;br /&gt;
This will copy the files &amp;lt;code&amp;gt;example.c&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;lpd8806.c&amp;lt;/code&amp;gt; into the &amp;lt;code&amp;gt;~/BeagleBoard/kernel/kernel/driver/char&amp;lt;/code&amp;gt; directory, make the kernel, and then scp the files to the bone.&lt;br /&gt;
&lt;br /&gt;
Moving over to the bone, run the following:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /lib/modules/3.2.25+'''&lt;br /&gt;
 bone$ '''mv modules.dep.bin modules.dep.bin.orig'''&lt;br /&gt;
&lt;br /&gt;
Next modify &amp;lt;code&amp;gt;modules.dep&amp;lt;/code&amp;gt; to include &amp;lt;code&amp;gt;kernel/drivers/char/example.ko:&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;kernel/drivers/char/lpd8806.ko:&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Upon successful completion, you should be able to run the following:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''modprobe example'''&lt;br /&gt;
 bone$ '''modprobe lpd8806'''&lt;br /&gt;
&lt;br /&gt;
== User Instructions ==&lt;br /&gt;
&lt;br /&gt;
Run &amp;lt;code&amp;gt;dmesg&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;lsmod&amp;lt;/code&amp;gt; to make sure the modules have loaded properly. You should now find two folders inside &amp;lt;code&amp;gt;/sys/firmware&amp;lt;/code&amp;gt; called &amp;lt;code&amp;gt;example&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;lpd8806&amp;lt;/code&amp;gt;. Feel free to play around in the example folder. If you go into this folder and then one folder further into device, you will find two files. The &amp;lt;code&amp;gt;test&amp;lt;/code&amp;gt; file holds an unsigned integer, while the &amp;lt;code&amp;gt;data&amp;lt;/code&amp;gt; file holds a string of length 10 (initially empty). You can read and write from these files as you would any other sysfs file.&lt;br /&gt;
&lt;br /&gt;
Next we will hook up the LED strand. &amp;lt;b&amp;gt;For this make sure the beagle is powered externally&amp;lt;/b&amp;gt;. The USB power supply does not have enough current to run the 5m strand at full brightness.&lt;br /&gt;
&lt;br /&gt;
To get started hook up pins 30 (D12/SPI1_D1) and 31 (A13/SPI1_SCLK) to SPI data and SPI clock on the strand (see the silkscreen for guidance. Hook up the ground to ground (obviously), and the 5V wire on the strand to the &amp;lt;b&amp;gt;3.3V&amp;lt;/b&amp;gt; pin on the bone. &amp;lt;b&amp;gt;Do not use the 5V pin on the bone or the suggested Adafruit 5V power supply directly connected to the strand without also adding logic level voltage shifters to the data and clock lines&amp;lt;/b&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:Bone_P9_pinout.jpg]]&lt;br /&gt;
&lt;br /&gt;
You may need to modify your muxes (if they have been changed from the default). If so, do the following:&lt;br /&gt;
 beagle$ '''echo 0 &amp;gt; /sys/kernel/debug/omap_mux/spi0_d1'''&lt;br /&gt;
 beagle$ '''echo 0 &amp;gt; /sys/kernel/debug/omap_mux/spi0_scl'''&lt;br /&gt;
&lt;br /&gt;
Now that the strand is hooked up, we can run the following:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd /sys/firmware/lpd8806/device/'''&lt;br /&gt;
 bone$ '''echo &amp;quot;127 127 127&amp;quot; &amp;gt; grb'''&lt;br /&gt;
&lt;br /&gt;
You should see the first LED (closest to the bone) light up bright white. You can also do something like the following:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''echo &amp;quot;127 0 0 0 127 0 0 0 127&amp;quot; &amp;gt; data'''&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;data&amp;lt;/code&amp;gt; file is written directly out to the strand while the &amp;lt;code&amp;gt;grb&amp;lt;/code&amp;gt; file treats the strand like a big shift register. &amp;lt;b&amp;gt;Be careful with using &amp;lt;code&amp;gt;data&amp;lt;/code&amp;gt;&amp;lt;/b&amp;gt;. Buffering problems can cause the kernel to seg fault or crash completely (see Future Work).&lt;br /&gt;
&lt;br /&gt;
== Highlights ==&lt;br /&gt;
&lt;br /&gt;
We have created a simple C example that uses this sysfs driver. You can run it by doing the following:&lt;br /&gt;
&lt;br /&gt;
 bone$ '''cd ~/FinalProject'''&lt;br /&gt;
 bone$ '''make'''&lt;br /&gt;
 bone$ '''./test'''&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|8d9n5QUyH38}}&lt;br /&gt;
&lt;br /&gt;
The program shows the capabilities of the strand running in shift mode. Because of the nature of the strand's construction, it would be very simple to daisy chain many chains end to end. Also, the kset implementation means that we can have as many separate strands as there are SPI buses. Normally you could have even more, but the strand only runs 3 wire SPI (no chip select).&lt;br /&gt;
&lt;br /&gt;
The speed is increased greatly when the strand is running in direct access mode by using the &amp;lt;code&amp;gt;data&amp;lt;/code&amp;gt; file instead of the &amp;lt;code&amp;gt;grb&amp;lt;/code&amp;gt; file. However, due to time limitations we were unable to debug the buffering issues. A good place for future work would be to figure out how the buffering problem can be alleviated.&lt;br /&gt;
&lt;br /&gt;
== Theory of Operation ==&lt;br /&gt;
&lt;br /&gt;
There are many layers to the implementation, so we will break them out into subsections.&lt;br /&gt;
&lt;br /&gt;
=== Light Strand ===&lt;br /&gt;
&lt;br /&gt;
The light strand uses the LPD8806 controller chip. Each chip controls the brightness of two 3 color GRB LEDs using PWM running at 1.2 MHz. SPI is used to communicate with the controller chips. The controller has its SPI bus rated somewhere around 20 MHz, but we are only running at 10 MHz. Each LED is 21-bit color, which leaves three bits available for latch control.&lt;br /&gt;
&lt;br /&gt;
So, as you write color values out on the SPI, the first chip receives them. If the chip hasn't written a color to one of its to LEDs, it does so and thus ends the transmission. However, if it has already assigned a color to each LED then it passes the SPI along on a separate bus to the next chip. This is how the strand is able to be 5m and still run at 10 MHz.&lt;br /&gt;
&lt;br /&gt;
It is still unknown how exactly the 3 latch bits are used (because the chip manufacturer has kept the interface a secret). However, if you write 6 bytes of &amp;quot;latch&amp;quot; the strand restarts at the beginning. Perhaps less bytes of &amp;quot;latch&amp;quot; can be sent and get the same effect, but due to time limitations we were unable to debug this completely. This is a simple place to start for future work.&lt;br /&gt;
&lt;br /&gt;
=== SPI Bus ===&lt;br /&gt;
&lt;br /&gt;
We use the default SPI controller to control the SPI lines. All we had to do is find what master is controlling the bus (2 in our case) and add a device. Initially, the SPI bus we want is being used by the default configuration of spidev. So, all we do is unregister the device from spidev and reregister it for our driver. There are a few things that go into the configuration of the device like speed, number of bits, chip select, and mode. Once these are set, you can add the device and it will then be associated with your driver.&lt;br /&gt;
&lt;br /&gt;
=== Sysfs Kernel Driver ===&lt;br /&gt;
&lt;br /&gt;
The sysfs kernel driver is based on the references above. It uses a kset to store kobjects (the basic building block of the kernel). Each kobject has associated with it certain attributes. These attributes are brought out to the user as files. When the files are read from or written to, the kernel calls back into the kobject's read/write routines. Here, we are able to decide which attribute is being addressed and manipulate the buffer as we see fit.&lt;br /&gt;
&lt;br /&gt;
There are some alternative implementations to this that were looked into in addition to kset. The driver could have been implemented as a sysfs device driver instead of a kernel driver so that it shows up in &amp;lt;code&amp;gt;/sys/class&amp;lt;/code&amp;gt; with everything else. Another option is that it could be implemented as a straight up device/kernel driver making it show up in &amp;lt;code&amp;gt;/dev&amp;lt;/code&amp;gt; instead. There doesn't seem to be much of a difference though between these implementations as far as performance is concerned. However, finding where this driver fits best is another good place for future work. &lt;br /&gt;
&lt;br /&gt;
== Work Breakdown ==&lt;br /&gt;
&lt;br /&gt;
=== Sean Richardson ===&lt;br /&gt;
* Researched using SPI on the BeagleBone&lt;br /&gt;
* Debugged the LED strand (the first one we received was broken)&lt;br /&gt;
* Wrote code to interface with the strand using spidev&lt;br /&gt;
* Helped integrate the SPI interface into the sysfs driver&lt;br /&gt;
&lt;br /&gt;
=== Greg Larmore ===&lt;br /&gt;
* Researched kernel drivers and sysfs&lt;br /&gt;
* Helped debug the LED strand&lt;br /&gt;
* Wrote example sysfs driver&lt;br /&gt;
* Integrated the SPI interface into the sysfs driver&lt;br /&gt;
&lt;br /&gt;
== Future Work ==&lt;br /&gt;
&lt;br /&gt;
While the strand works well as it is, there are some things that we would like to see looked into if there is future work on this project.&lt;br /&gt;
&lt;br /&gt;
=== Latching and Controller Interface ===&lt;br /&gt;
&lt;br /&gt;
According to Adafruit, the interface to this part has been reverse engineered. The one part that really remains unknown is how exactly the 3-bit control interface works for each LED. We were able to achieve a latching effect by sending 6 empty transmissions. The code in [github.com/adafruit/lpd8806 Adafruit's github] doesn't seem to be using this many latch transmissions.&lt;br /&gt;
&lt;br /&gt;
=== Buffering Problem ===&lt;br /&gt;
&lt;br /&gt;
There is a problem with buffered output going into the &amp;lt;code&amp;gt;data&amp;lt;/code&amp;gt; file (because it is so big). When the output buffers it causes 2 sequential writes which weren't being handled well by the attribute's store function. This could be alleviated with a circular buffer and an index that can be controlled by the user, but really the driver should be able to handle this condition.&lt;br /&gt;
&lt;br /&gt;
=== Sysfs File Location ===&lt;br /&gt;
&lt;br /&gt;
The decision to have these drivers located in &amp;lt;code&amp;gt;/lib/modules/3.2.25+/kernel/drivers/char&amp;lt;/code&amp;gt; and run out of &amp;lt;code&amp;gt;/sys/firmware&amp;lt;/code&amp;gt; was pretty much arbitrary. It would be nice to do some research into how the kernel is supposed to be structured so that we can match it. This also applies to the example driver included in this project.&lt;br /&gt;
&lt;br /&gt;
== Conclusions ==&lt;br /&gt;
&lt;br /&gt;
In this project, we were able to get SPI (a lesser used interface on the bone) to work well with our LED strand. More impressively, we were able to interface with the SPI through a sysfs interface. In the process of developing this sysfs interface to the LED strand, we developed an example sysfs driver that can be used in future ECE497 classes. Lastly, we developed a sample application that uses this sysfs interface for our LED strand to show off the results.&lt;/div&gt;</summary>
		<author><name>Yoder</name></author>	</entry>

	<entry>
		<id>http://www.elinux.org/BeagleBone_PRU_Notes</id>
		<title>BeagleBone PRU Notes</title>
		<link rel="alternate" type="text/html" href="http://www.elinux.org/BeagleBone_PRU_Notes"/>
				<updated>2013-06-05T15:23:39Z</updated>
		
		<summary type="html">&lt;p&gt;Yoder: Added a link to some work PRU examples&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:ECE497Notes |PRU]]&lt;br /&gt;
&lt;br /&gt;
The goal of this page is to record information that is pertinent to getting started with the BeagleBone's AM335x Programmable Real-time Unit (PRU).&lt;br /&gt;
&lt;br /&gt;
== BeagleBone Programmable Real-time Unit ==&lt;br /&gt;
This is also called the PRU Subsystem (PRUSS) or PRU and Industrial Controller Subsystem (PRU-ICSS). It is optimized to perform embedded tasks that require real-time constraints.&lt;br /&gt;
&lt;br /&gt;
Most important is the purssdrv library to expose functions to the PRU. You can load this library by typing modprobe uio_pruss.&lt;br /&gt;
&lt;br /&gt;
=== PRU capabilities ===&lt;br /&gt;
[[File:PRUSS.png|AM335x PRUSS]]&lt;br /&gt;
&lt;br /&gt;
* The PRU has dual 32-bit RISC cores, shared data and instruction memories and an interrupt controller (INTC).&lt;br /&gt;
* 8KB data memory and 8KB instruction memory&lt;br /&gt;
* 12KB shared RAM&lt;br /&gt;
* A small, deterministic instruction set&lt;br /&gt;
&lt;br /&gt;
There is no pipelining done on the processor and there are 29 (r1-r30) registers to use.&lt;br /&gt;
&lt;br /&gt;
Data Sheet is located at http://www.ti.com/lit/pdf/spruh73&lt;br /&gt;
&lt;br /&gt;
=== Software examples ===&lt;br /&gt;
BeagleBoard/TI has provided example C programs that utilize the PRU on [https://github.com/beagleboard/am335x_pru_package github.]&lt;br /&gt;
&lt;br /&gt;
These include: PRU_memAccess_DDR_PRUsharedRAM, PRU_memAccessPRUDataRam, PRU_PRUtoPRUInterrupt, and a PRU assembler.&lt;br /&gt;
&lt;br /&gt;
Full assembly guide is located at http://processors.wiki.ti.com/index.php/PRU_Assembly_Reference_Guide&lt;br /&gt;
&lt;br /&gt;
=== Instruction Set ===&lt;br /&gt;
Nearly all instructions (with exception of accessing memory external to PRU) are single-cycle execute (5 ns when running at 200 MHz)&lt;br /&gt;
&lt;br /&gt;
==== Four instruction classes ====&lt;br /&gt;
* Arithmetic&lt;br /&gt;
* Logical&lt;br /&gt;
* Flow Control&lt;br /&gt;
* Register Load/Store&lt;br /&gt;
&lt;br /&gt;
==== Instruction Syntax ====&lt;br /&gt;
* Mnemonic, followed by comma separated parameter list&lt;br /&gt;
* Parameters can be a register, label, immediate value, or constant table entry&lt;br /&gt;
* Example&lt;br /&gt;
** SUB r3, r3, 10 &lt;br /&gt;
** Subtracts immediate value 10 (decimal) from the value in r3 and then places the result in r3&lt;br /&gt;
&lt;br /&gt;
==== Example Assembly ====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
;INTC_SIR_IRQ/INTC_SIR_FIQ register address&lt;br /&gt;
INTC_SIR_IRQ_ADDR/INTC_SIR_FIQ_ADDR .word 0x48200040/0x48200044&lt;br /&gt;
; ACTIVEIRQ bit field mask to get only the bit field&lt;br /&gt;
ACTIVEIRQ_MASK .equ 0x7F&lt;br /&gt;
_IRQ_ISR/_FIQ_ISR:&lt;br /&gt;
; Save the critical context&lt;br /&gt;
STMFD SP!, {R0-R12, LR} ; Save working registers and the Link register&lt;br /&gt;
MRS R11, SPSR ; Save the SPSR into R11&lt;br /&gt;
; Get the number of the highest priority active IRQ/FIQ&lt;br /&gt;
LDR R10, INTC_SIR_IRQ_ADDR/INTC_SIR_FIQ_ADDR&lt;br /&gt;
LDR R10, [R10] ; Get the INTC_SIR_IRQ/INTC_SIR_FIQ register&lt;br /&gt;
AND R10, R10, #ACTIVEIRQ_MASK ; Apply the mask to get the active IRQ number&lt;br /&gt;
; Jump to relevant subroutine handler&lt;br /&gt;
LDR PC, [PC, R10, lsl #2] ; PC base address points this instruction + 8&lt;br /&gt;
NOP ; To index the table by the PC&lt;br /&gt;
; Table of handler start addresses&lt;br /&gt;
.word IRQ0handler ;For IRQ0 of BANK0&lt;br /&gt;
.word IRQ1handler&lt;br /&gt;
.word IRQ2handler&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Leads ==&lt;br /&gt;
Here's some sources of information.  &lt;br /&gt;
&lt;br /&gt;
* [http://www.element14.com/community/community/knode/single-board_computers/next-gen_beaglebone/blog/2013/05/22/bbb--working-with-the-pru-icssprussv2 BBB - Working with the PRU-ICSS/PRUSSv2]  Has very detailed instructions for working with the Black.&lt;br /&gt;
* [http://git.mah.priv.at/gitweb?p=emc2-dev.git;a=shortlog;h=refs/heads/arm335x-hal-pru-tasks Working PRU examples]&lt;/div&gt;</summary>
		<author><name>Yoder</name></author>	</entry>

	</feed>