Lab - Manual Arm BBB PDF
Lab - Manual Arm BBB PDF
For
By
Fizzible
PRECAUTIONS:
Each and every GPIO must be strictly used at 3.3v only and not more than that.
Supplying and sourcing voltage levels more than 3.3v will definitely damage
the BeagleBone Black.
Analog in voltages are 1.8v max. Application of >1.8v to any A/D pin will
damage the processor.
Before giving input to a GPIO it must be declared as input strictly, otherwise the
board may not respond thereafter.
BeagleBone Black can source only 6ma through a GPIO. So high current
applications need to use respective hardware circuitry.
External voltage greater than 3.3v starts damaging the BeagleBone Black slowly
and within few hours it completely damages the board.
Do not apply any voltages to any I/O pins when the board is not powered on.
Do not drive any external signals into the I/O pins until after the SYS_RESETn
signal is HI (3.3V).
If you are applying signals from other boards into the expansion headers, make
sure you power the board up after you power up the BeagleBone Black or make
the connections after power is applied on both boards.
Powering the processor via its I/O pins can cause damage to the processor.
5 Lab Experiments . . . . . . . . 17
Introduction:
The BeagleBone Black is the newest member of the BeagleBoard family. It is a lower-
cost, high-expansion focused BeagleBoard using a low cost Sitara XAM3359AZCZ100
Cortex A8 ARM processor from Texas Instruments. It is similar to the BeagleBone, but
with some features removed and some features added.
The table below gives the high points on the differences between the BeagleBone and
BeagleBone Black.
Beagle boards are tiny computers with all the capability of today’s desktop machines,
without the bulk, expense, or noise. The BeagleBone Black is a low-power open-source
hardware single-board computer produced by Texas Instruments in association with Digi-
Key and Newark element14. The BeagleBone was also designed with open source
software development in mind, and as a way of demonstrating the Texas Instrument's
OMAP3530 system-on-a-chip. The board was developed by a small team of engineers as
Sitara AM335x ARM cortex – A8 processor: The board is based on the Sitara
AM335x ARM Cortex-A8 processor from Texas Instruments Incorporated (TI), It
provides 1-GHz performance – 150 percent higher performance than ARM11 for
more advanced user interfaces and computation power.
DC power: +5V DC power can be supplied to the BeagleBone through a barrel
connector or from the mini-USB, both of which are located near the large RJ45
Ethernet connector.
2 GB on-board storage using eMMC: In addition to all the features of the
previous board (BeagleBone), the Beaglebone black now uses embedded
nonvolatile memory system using eMMC, which frees the MicroSD slot to be
used for additional storage.
512MB DDR3: The board is having 512 megabytes of low-power DDR3L RAM,
doubling the size and speed of the volatile memory and ensuring it will execute
software faster.
PMIC: The board uses a TI TPS65217B PMIC to generate stable supply voltages
regardless of input power variation.
Boot button: Boot button is used to boot the Beaglebone black directly from an
external microSD card. You can boot the Beaglebone Black from an external SD
card by holding down the BOOT button when applying the power
Micro HDMI: with this microHDMI we can connect directly to monitors and
TVs.
USB host: USB 2.0 type A host port.
10/100 Ethernet: 10/100 Ethernet RJ45 socket, IPv4 and IPv6 networking.
MicroSD slot: MicroSD slot for additional user data or operating systems.
The following table lists the key features of the BeagleBone Black.
Here are the locations of the key components on the Rev A5A.
Below is the location of the connectors and switches on the Rev A5A board. The Power Button
and Battery Connections are new additions to the Rev A5A.
Read the step-by-step getting started part below to begin developing with your
BeagleBone Black in minutes.
Getting started:
Use the provided USB cable to plug your Beagle into your computer. This will both
power the board and provide a development interface. BeagleBone Black will boot Linux
from the on-board 2GB eMMC. Either BeagleBone Black or original BeagleBone may
also boot from a microSD card.
BeagleBone Black will operate as a flash drive providing you with a local copy of the
documentation and drivers. Note that this interface may not be used to re-configure the
microSD card with a new image, but may be used to update the boot parameters using the
uEnv.txt file.
You'll see the PWR LED lit steadily. Within 10 seconds, you should see the other LEDs
blinking in their default configurations.
Windows (64- 64-bit installer If in doubt, try the 64-bit installer first.
bit)
Note #1: Windows Driver Certification
warning may pop up two or three times.
Click "Ignore", "Install" or "Run".
Windows (32- 32-bit installer Note #2: On systems without the latest
bit) service release, you may get an error
(0xc000007b). In that case, please install
the following and retry:
http://www.microsoft.com/en-
us/download/confirmation.aspx?id=13523
“http://www.ftdichip.com/Drivers/VCP.htm.”
Note: Additional USB to virtual Ethernet information and drivers are available from
“http://www.linux-usb.org/gadget/” / “http://joshuawise.com/horndis“
Using either Chrome or Firefox (Internet Explorer will NOT work), browse to the web
server running on your board. It will load a presentation showing you the capabilities of
the board. Use the arrow keys on your keyboard to navigate the presentation.
*Older software images require you to EJECT the BEAGLE_BONE drive to start
the network. With the latest software image, that step is no longer required.
If you have installed a Linux distribution on your microSD you can modify the root file
system partition. You are then able to utilize all of the space on your microSD card
regardless of the size of the default partition of your given image. Follow the instructions
found on Expanding File System Partition on a MicroSD.
Note: The instructions on that page are general and are not guaranteed to work on every
Linux distribution.
BoneScript
Bonescript is a Node.js library specifically optimized for the Beagle family, featuring
familiar Arduino function calls, exported to the browser. The BoneScript library provides
several functions useful for interacting with your hardware.
Copy commands:
Cloud9 IDE
If you want to program the board using a complete IDE, a JavaScript IDE is available
with BeagleBone by default. To start cloud9 IDE type the following in the URL bar of
your browser.
192.168.7.2:3000
A complete IDE Cloud9 as can be seen in the above image will get started within your
browser. This can be used to program on BBB using JavaScript.
SSH:
SSH (SSH client) is a program for logging into a remote machine and for executing
commands on a remote machine. SSH connects and logs into the specified host name
(with optional user name). The user must prove his/her identity to the remote machine
using one of several methods depending on the protocol version used. If command is
specified, it is executed on the remote host instead of a login shell.
Procedure:
1. Connect the BeagleBone to your computer with the USB cable provided.
2. Wait for the notification of active wire connection.
3. Press (Ctrl+Alt+T) to open a terminal, type the following terminal:
“ssh [email protected]”
As you can see in the image below, when we were typing the ssh command the shell we
were getting was of the computer. But after getting access to BeagleBone Black, we are
getting the shell of the root user on the BeagleBone. Whatever the commands we type
here now will run on the BeagleBone Black.
BeagleBone is a complete single board computer (SBC). Hence it can be used to program
with any language of your choice. For writing our first program on the BBB we'll use
python and C.
To get started we'll need a shell access to the BeagleBone, (Shell access procedure is
mentioned in chapter 3).
To write the program on terminal we will use a simple text editor for terminal
called as 'Nano'. To write a HelloWorld program using nano on terminal type the
following on terminal.
nano HelloWorld.py
The above command will start the Nano text editor and create the file HelloWorld.py file.
You can type your code for python in the editor. A simple hello world in Python will be
print “HelloWorld”
To save the code press Ctrl + X and press Y and then Enter. All the keyboard shortcuts
for nano are listed at the bottom of the nano interface.
The program's output can be seen in the following way.
root@beaglebone:~# python HelloWorld.py
OUTPUT: Hello World
Writing your first program using C:
#include<stdio.h>
int main(void)
{
puts(“\n\t Hello World”);
return 0;
}
Save the program using Ctrl + X and press Y and enter.
To compile the code type
root@beaglebone:~# gcc HelloWorld.c
To view the output of code type
root@beaglebone:~# ./a.out
OUTPUT: Hello World
Similarly the programs can also be written for other languages. You can also use other
terminal text editors like Vi of your choice as well. Happy Coding!
Problem statement:
Besides the push button switches you can see two L.E.D’s (red & green); red
indicating the lift is at halt and green indicating the lift is in motion.
After pressing any of the push button switch you can you can see the status of the
lift by the following two things:
o The arrow L.E.D’s shows the direction of the lift i.e. upwards or
downwards.
o The seven segment displays shows the current floor of the lift.
Problem statement:
Now to open the editor for writing the program code type the following command:
“Nano programname (your program name without spaces).py”
Ex: nano trafficlight.py
Now start writing your program in the editor which is opened on your screen.
You can save your program by pressing “CTRL+O”.
Now to exit out from the editor, press “CTRL+X”.
You can now again see the terminal on your screen.
To execute the program you have saved write the following command:
“Python programname.py”
Ex: python trafficlight.py.
Now connect the BeagleBone Black to your traffic light simulator card using the
FRC cable.
Connect the power adapter (5V 2A) to the traffic light simulator card.
Now you can see the red L.E.D is on, indicating the board is powered up properly.
On the traffic light simulator card you can see a four way which has 4 traffic
signals.
The time required to wait between red and yellow light is displayed on the seven
segment display. Also the time required for transition between the yellow and
green light is also displayed on the same.
The sequence bits (denoted by blue L.E.D’s) will change according to each step the
motor takes.
Objective:
By the end of this experiment you should be able to:
1) Understand what IP address is and how to change it on a Linux computer.
2) Remotely access the BeagleBone over a local network.
3) Access the GUI of the BeagleBone remotely on another computer.
4) Understand the concepts of SSH and VNC.
Concepts:
1) IP Address:
Internet Protocol Address (or IP Address) is a unique address that computing device use
to identify itself and communicate with other devices in the Internet Protocol network.
Any device connected to the IP network must have a unique IP address within its
network. An IP address is analogous to a street address or telephone number in that it is
used to uniquely identify a network device to deliver mail message, or call ("view") a
website.
3) VNC:
In computing, Virtual Network Computing (VNC) is a graphical desktop sharing system
that uses the Remote Frame Buffer protocol (RFB) to remotely control another computer.
It transmits the keyboard and mouse events from one computer to another, relaying the
graphical screen updates back in the other direction, over a network.
Software Required:
For SSH:
If you're using Windows then the software “Putty” is required. But if you're using Ubuntu
OS, no special software is required.
For VNC:
Install VNC viewer.
X11-VNC-server has to be installed on the BeagleBone.
Procedure:
Initial configuration (Before connecting the BeagleBone to the network)
1. Connect the BeagleBone to your computer with the USB cable provided.
2. Wait for the notification of active wire connection.
3. Press Ctrl+Alt+T to open a terminal, type the following terminal:
ssh [email protected]
4. If prompted, type yes and press Enter.
Laboratory Manual for Programming Lab III Visit- fizzible.com 26
Fig: Getting ssh access to the BeagleBone.
11. Enter the configurations details below the changed line for eth0 as follows:
address 10.0.1.37
netmask 255.255.255.0
network 10.0.1.0
gateway 10.0.1.1
12. Exit by pressing Ctrl+X.
13. In prompt: Press Y to save the changes and press Enter.
14. To shut down the BeagleBone:, type the following command:
shutdown -h now.
15. Unplug the BeagleBone from your computer and connect it to your network
(Ethernet cable).
16. Switch on the BeagleBone using the external 5 volt power adapter.
1. Next, we need to start the X11 VNC server on the BeagleBone Black to access its
GUI.
2. We need to start X11 VNC server, type the following command:
3. Avoid repeatedly typing this command, copy this command into a shell file and
when this command is in use, just run that shell file.
This method can be used to connect to the Beagle Bone using any device which has an
SSH client and a VNC client like Computers, Laptops, tablets & Phones.
System Requirements
To use CUDA on your system, you will need the following installed:
CUDA-capable GPU
A supported version of Linux with a gcc compiler and toolchain
NVIDIA CUDA Toolkit (available at http://developer.nvidia.com/cuda-
downloads.
If you do not see any settings, update the PCI hardware database that Linux maintains by
entering update-pciids (generally found in/ sbin) at the command line and retun the
previous lspci command.
The gcc compiler is required for development using the CUDA Toolkit. It is not required
for running CUDA applications. It is generally installed as part of the Linux installation,
and in most cases the version of gcc installed with a supported version of Linux will work
correctly.
To verify the version of gcc installed on your system, type the following on the command
line:
$gcc --version
If an error message displays, you need to install the development tools from your Linux
distribution or obtain a version of gcc and its accompanying tool chain from the Web.
If you installed the driver, verify that the correct version of it is installed.
This can be done through your System Properties (or equivalent) or by executing the
command
Note that this command will not work on an iGPU / dGPU system.
The version of the CUDA Toolkit can be checked by running nvcc-C in a terminal
window. The nvcc command runs the compiler driver that compiles CUDA programs. It
calls the gcc compiler for C code and the NVIDIA PTX compiler for the CUDA code.
The NVIDIA CUDA Toolkit includes sample programs in source form. You should
compile them by changing to ~/NVIDIA_CUDA-6.5_Samples and typing make. The
resulting binaries will be placed under ~/NVIDIA_CUDA-6.5_Samples/bin.
The exact appearance and the output lines might be different on your system. The
important outcomes are that a device was found (the first highlighted line), that the
device matches the one on your system (the second highlighted line), and that the test
passed (the final highlighted line).
If a CUDA-capable device and the CUDA Driver are installed but Valid Results from
deviceQuery CUDA Sample Reports that no CUDA-capable devices are present, this likely
means that the /dev/nvidia* files are missing or have the wrong permissions.
On systems where SELinux is enabled, you might need to temporarily disable this
security feature to run deviceQuery. To do this, type:
$setenforce 0
Laboratory Manual for Programming Lab III Visit- fizzible.com 33
From the command line as the superuser.
Running the bandwidth Test program ensures that the system and the CUDA-capable
device are able to communicate correctly. Its output is shown in the figure below.
Note that the measurements for your CUDA-capable device description will vary from
system to system. The important point is that you obtain measurements, and that the
second-to-last line (in the above figure) confirms that all necessary tests passed.
Should the tests not pass, make sure you have a CUDA-capable NVIDIA GPU on your
system and make sure it is properly installed.
If you run into difficulties with the link step (such as libraries not being found), consult
the Linux Release Notes found in the doc folder in the CUDA Samples directory.
Algorithm:
// Let 0 < i < p-1 and p denote the local thread index and thread count .
QSort (e = <e1,.....,en>)
begin
if n < M then return SmallSort(e)
if i = 0 then pick a pivot d belongs to e
Laboratory Manual for Programming Lab III Visit- fizzible.com 35
ai := bi := ci := 0
t := e
for i*n/p <= j <= (( i+1)*(n/p)) do
if t[ j ] < d then ai ++
else if t[ j ] = d then bi++
else ci++
end
scan(a0,.....,ap-1)
scan(b0,.....,bp-1)
scan(c0,......,cp-1)
for i*n/p <= j <= ((i+1)*(n/p))
if t[ j ] < d then e [ ai ] := t [ j ] ai++
else if t[ j ] = d then e[ bi ] := t[ j ] bi++
else e [ ci ] := t[ j ] ci++
end
return
Concatenate(Qsort(<e1,.....,e[ai] >), < e[ ai+1 ],........,e[ bi ]>), Qsort(<e[ bi+1],......,en>))
end
Process
Command Line Procedure
Step 1: Save your program with the extension .cu let say example.cu.
Step 2: Open Terminal and locate your program directory.
Step 3: Type in command prompt (Terminal in Linux) nvcc example.cu –o
example.
*This command will let you access the operating system of your BeagleBone black.
Now to open the editor for writing the program code type the following command:
“Nano programname (your program name without spaces).py”
Ex: nano cpufrequency.py
Now start writing your program in the editor which is opened on your screen.
You can save your program by pressing “CTRL+O”.
Now to exit out from the editor, press “CTRL+X”.
You can now again see the terminal on your screen.
To execute the program you have saved, write the following command:
“Python programname.py”
Ex: python cpufrequency.py.
Now insert a single pin to pin wire in pin no. 13 and ground pin (P9_01) of
BeagleBone Black.
Laboratory Manual for Programming Lab III Visit- fizzible.com 37
Connect pin no. P9_13 and ground pin (P9_01) to your CRO / DSO.
Now execute the code by pressing enter key.
Observe the square wave.