Sie sind auf Seite 1von 24

IEEE UNMC Student Branch

March 28, y

Embedded Linux Workshop


Technical Booklet

Hardware Reference
materials

Technical Booklet, Page 1

IEEE UNMC Student Branch


March 28, y

SUB-20 Multi Interface USB Adapter

SUB-20 is a versatile and efficient bridge device providing simple interconnect between PC
(USB host) and different HW devices and systems via popular interfaces such as I2C, SPI, MDIO,
RS232, RS485, SMBus, ModBus, IR and others. It is also a full "any to any" converter between all
supported interfaces and I/O features. SUB-20 is a powerful I/O controller with 32 GPIO, 8 Analog
Inputs, PWM Outputs, Edge DEtectors, LCD, Leds and push buttons.

SUB-20 system includes SW package containing driver, API Library, GUI and Command
Line based applications, C,C++,C#,VB.net, MATLAB, LabView sample code and documentation.
Working with SUB-20 does not require deep knowledge of low layers of the specific interface. All
you need to do is to call right API function at the right place. And this is really very easy as API
functions are well documented and "exampled". API set is relatively small but comprehensive.

SUB-20 is equipped with status Leds, optional LCD and buttons. All this guarantee fast and
comfortable development, field debugging and maintenance of applications including option of
standalone operation.
Reference: http://www.xdimax.com/sub20/sub20.html
User Manual: http://www.xdimax.com/sub20/doc/sub20-man.pdf

Technical Booklet, Page 2

IEEE UNMC Student Branch


March 28, y

AltIMU-10 v4 Gyro, Accelerometer, Compass, and


Altimeter (L3GD20H, LSM303D, and LPS25H Carrier)
The Pololu AltIMU-10 v4 is an inertial measurement unit (IMU) and altimeter that features
the same L3GD20H gyro and LSM303D accelerometer and magnetometer as the MinIMU-9 v3,
and adds an LPS25H digital barometer. An IC interface accesses ten independent pressure,
rotation, acceleration, and magnetic measurements that can be used to calculate the sensors
altitude and absolute orientation. The board operates from 2.5 to 5.5 V and has a 0.1 pin spacing.
Reference: https://www.pololu.com/product/2470

Software Reference Materials


Ubuntu
Ubuntu is a free Debian- based Linux Operating System. It is also an open source operating system.

Reference: http://www.ubuntu.com/desktop

Eclipse + C Development Tool


Eclipse is an amazing open source community of Tools, Projects and Collaborative Working Groups.
Eclipse is also famous for Java Integrated Development Environment (IDE), but our C/C++ IDE and
PHP IDE are pretty cool too. You can easily combine language support and other features into any of
our default packages, and the Eclipse Marketplace allows for virtually unlimited customization and
extension.

Eclipse + C Development Tool


Eclipse is an amazing open source community of Tools, Projects and Collaborative Working Groups.
Eclipse is also famous for Java Integrated Development Environment (IDE), but our C/C++ IDE and PHP
IDE are pretty cool too. You can easily combine language support and other features into any of our default
packages, and the Eclipse Marketplace allows for virtually unlimited customization and extension.

Reference: http://www.eclipse.org/

How to install Linux


For those of you who wish to install Linux, firstly give yourselves a clap! you are just going to install and use
a brand new operating system(It is a huge decision to make) and that too the worlds best technical
operating system! .
Do not worry, Linux installation is very easy, once you have the .iso file, within the next hour you will have 2
operating systems running on your PCs. Follow the steps accordingly and you will get there.

Technical Booklet, Page 3

IEEE UNMC Student Branch


March 28, y
Step 1 - Installing the .iso file
Firstly you need to go to the Ubuntu website to get the file, go to http://www.ubuntu.com/desktop, and if you
want, you can read more about the software otherwise go ahead and click, get now. And click on install and
now wait for the download to be completed.
Step 2 - getting VMware!

VM stands for virtual machine, this should give you an idea that we are going to be running Linux on a
virtual machine. VMware can be used to run several OS in your computer. This will get clear as we
proceed, so firstly we need to get VMware player, to do that click on the following link:

https://my.vmware.com/web/vmware/free#desktop_end_user_computing/vmware_player/7_0

and as the web page opens up , click on VMware for windows 64 bit operating systems .As we have
our player downloading , meanwhile we need to download something known as VMware tools , to get
that go to the following link:
http://softwareupdate.vmware.com/cds/vmw-desktop/player/7.1.0/2496824/windows/packages/

Since we want to install Linux on our system, it is obvious that we will need Linux installer tools
therefore click on: tools-linux-9.9.2.exe.tar

Alright we now have VMware player and VMware tools downloaded, it is now the time to setup these 2
softwares!

Step 3 - setting up VMware


To set up VMware player is very straight forward, just click on the setup and keep on clicking next but
do not just blindly click next, watch out for 3rd party softwares. As undergraduate student you all
probably know this by now.

When the process is done, go to your start menu and you can find your VMware over there, click on it,
and then just click on License agreement and you will have your VMware player running!
Step 4 - Installing Linux Virtual machine
Once the VMware player is running, you need to click Create new virtual machine . You will then see
3 options:
1. Installer Disc
2. Installer disc image file
3. I will install the Operating system later
Like this:

Technical Booklet, Page 4

IEEE UNMC Student Branch


March 28, y

We want to click the 3rd option i.e. I will install the operating system later. Go ahead and click next.
Now you will have to choose the guest operating system, so go ahead and choose Linux. Do not go
ahead and click next yet, you need to choose a version also, Linux has many versions! , so in the
version drop down menu, select Ubuntu 64-bit.
Like this:

The next step requires you to set a location for our virtual machine, you can put in anywhere you want.
Go ahead and click next.
In the next step you need to specify the disk space for Ubuntu 64-bit OS. This is really up to you, i.e.
how much space you wish to allocate. 20GB is recommended, but let us say if you want to use this OS
for a long time which means you will have quite a number of technical softwares, then maybe you can
allocate 40GB , however it is really up to you. I would go for 40GB. However this OS can run
sufficiently in 20GB space.
On the same page you need to choose one of the 2 options:
1. store virtual disk as a single image
2. spit virtual disk into multiple images
We want to select the 1st option i.e. store virtual disk as a single image. Go ahead and click next.
Like this:

Technical Booklet, Page 5

IEEE UNMC Student Branch


March 28, y

Now you need to click on customize hardware to see the configurations are created for our Linux
Ubuntu software. You will now be able to see 9 devices:
1.
2.
3.
4.
5.
6.
7.
8.
9.

Memory
processor
New CD/DVD
floppy
network adapter
USB controller
sound card
printer
display

Memory - choose 2 GB RAM


Processor - number of processor cores: 2 and click on 2 check boxes:
Virtualize Intel VT-x/EPT or AMD-V/RVI
Virtualize CPU performance counters
New CD/DVD - make sure it is auto detect.
Floppy - click on remove, we do not need it.
Network adapter - the network connection should be NAT, do not touch anything else.
And we are done, i.e. ignore the rest of the devices, therefore you can now go ahead and click on
close and then click on finish.
Like this:

Technical Booklet, Page 6

IEEE UNMC Student Branch


March 28, y
Now go ahead and click on edit virtual machine settings and go to CD/DVD. In there in the connection
section click on use ISO image file and click on browse, now look where you saved the .iso file which
you downloaded from the Linux website , most likely you must be having it in the Downloads directory.
Once you have found the .iso image file, then click on OK.
And now you are ready to play the virtual machine, so go ahead and click play virtual machine
Step 5 - Setting up Linux
After some time, it will time for us to start the setup.
1. Firstly you will be asked to choose your language, choose English and click install ubuntu.

2. On the next page, just click next, make sure you check the box saying to download third party
software and download updates while installing, it will be time consuming to do it later!
3. The next part will be a bit tricky for you as you will see two options:
Erase Disk and install Ubuntu
Something else
What we want to do is to click the 1st option that is erase disk and install Ubuntu, DO NOT
WORRY! , if you understand properly you will realise that this OS is created on a blank virtual disk,
and plus it on VMWARE, this is not going to erase your current operating system (remember we are in
a virtual machine, this is not connected to your host OS such as windows), so go ahead and click it!
4. Now go ahead and click install
5. after some time you will be asked to select your location.
6. Later you will be asked to choose the keyboard layout, go ahead and choose English (US)
7. You will then be asked to fill up your name, password, username etc.
8. You will now be prompted to restart your virtual machine, so go ahead and do that.
And congrats, you now have a second operating system on your PC!
However we need to do just one more thing. You will realise that upon maximizing the virtual machine
window, Ubuntu is not resizing itself (it is still small).
To solve this problem, we are going to need VMware tools. To do that, just follow the following steps:
1. On the top left hand corner, go ahead and click player, then click manage and then click install
VMware tools.
2. You will see a .txt file and a .tar.gz folder, what you need to do is copy this folder to the desktop.
3. Once you have the folder on the desktop, right click on it and click extract here

Technical Booklet, Page 7

IEEE UNMC Student Branch


March 28, y
4. open your terminal(Ctrl+Alt+T) by typing the command:
cd Desktop/vmware-tools-distrib/
and then type:
sudo ./vmware-install.pl
You will now need to type in your password.
And then just keep on hitting enter till the process begins.
After the process is done, just restart the virtual machine.
We now need to get the C compiler, it is extremely easy to get this compiler, and all you do is open up
your terminal (Ctrl + Alt+ T), and just type the following command:
sudo apt-get install build essential
You will then be required to type in your password and just wait for the download to finish.
During this process the terminal will ask you to press y or n mentioning the amount of space
that is going to be used up in your hard disk, so go ahead and click y.
When the download will be finished, we will have our C compiler.

Technical Booklet, Page 8

IEEE UNMC Student Branch


March 28, y

How to setup Eclipse


So far all of you have used C free or Code::Blocks for C or C++ programming and the installation is quite
straight forward right (just to go the internet, then find the software and just download it). However it is not
very straight forward for Eclipse that be used for C, C++, Java Programming.

ECLIPSE is the Grandfather of most of IDE's, therefore getting such an IDE is also not very simple BUT.....

This document will make the installation and setup of projects a sweet piece of cake. Just follow through
line by line and you will be more than just fine. HOWEVER DO NOT EVEN SKIP ONE LINE, IT CAN MESS
UP YOUR ENTIRE INSTALLATION PROCESS.

Please note that the inverted commas are just there to let you know which command to type , do not type
the inverted commas as well while executing any command unless you are told to.

STEP 1 - getting the Java compiler!

The very first step is to get a Java compiler, even if you download eclipse, you still will not be able to run a
java program because it is a must to have to compiler, to download the compiler, go to the following
website:
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
As you open the link, you will see many compilers, but what we want is just one single compiler, any
guesses?
Yes, you are right! , you need to download the Linux x64 compiler. Just click on it and the download will
start.

Technical Booklet, Page 9

IEEE UNMC Student Branch


March 28, y
STEP 2- extracting the folder

Now by default the folder will be automatically saved in the Downloads directory, you will notice the format
of the file as tar.gz, so what you need to do is extract this folder. There are two ways to extract this:
1. Right click and click on 'extract here'
2. open up the terminal(Ctrl+Alt+Tab) and change your directory to downloads as that is where you have
saved your file , you do that by typing : cd ~/Downloads/ and then you type:
tar xvfz jdk1.8.0_40/ , and then press enter, your folder will then be extracted.
Step 3 - setting a home for our Java compiler
Now what you need to do is, you need to create a folder (directory in Linux). So type the following
command:
cd /usr/lib/
after this you will be in the lib directory and this is where you need to make the folder called java, so come
back to your terminal and type the command:
sudo mkdir java
You will then be prompted for your password and after that, you will have your java folder, so now you need
to move the extracted jdk folder over here, to do that type the following commands:
cd ~/Downloads/
Then you type:
sudo mv -u jdk1.8.0_40/ /usr/lib/java

By right, the folder should be moved in the java directory we created earlier, so let us go to this directory by
typing the command:
cd /usr/lib/java/
And then type the command:
ls
The ls command will show up the contents in that directory, so you should see something like this(refer to
the next page):

Technical Booklet, Page 10

IEEE UNMC Student Branch


March 28, y

note the jdk written in blue colour , if you have that then quite good if you have that showing up, now do not
be worried by the numbers being shown on this screenshot, on this PC version 1.8.0_31 is installed, by the
time you will install it the version will already be jdk1.8.0_40. Now change to the jdk1.8.0_40 directory by
typing:
cd jdk1.8.0_40/
Step 4 - Configuring the Java compiler
Alright, now you need to copy 3 more commands in the terminal (DO PRESS THE 1 AT THE END OF THE
COMMAND AS SHOWN FOR ALL THE THREE COMMANDS) please note the spaces as well! , the first
one:
1. sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/java/jdk1.8.0_40/bin/java" 1
Now you type the following command:
2. sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/java/jdk1.8.0_40/bin/javac" 1
And the third command:
sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/java/jdk1.8.0_40/bin/javaws" 1

Same thing here as well, you need to replace the version number with the current one you have.
Alright friends, not much to go now, we are almost there!

Technical Booklet, Page 11

IEEE UNMC Student Branch


March 28, y
Step 5 - Final step

Come back to your home directory by typing:


cd ~
And now you need to make changes to your bashrc file, dont worry, we did not talk about the bashrc file
previously so just follow the steps. Type the command:
sudo gedit ~/.bashrc
You should have the file opened now.
Now copy this text EXACTLY:
#JAVA HOME directory setup
export JAVA_HOME=/usr/lib/java/jdk1.8.0_40
export PATH="$PATH:$JAVA_HOME/bin"

And paste it RIGHT AT THE END OF YOUR BASHRC FILE, AND REALLY RIGHT AT THE END, SCROLL
ALL THE WAY DOWN AND THEN PASTE IS THERE, look at the screenshot provided below:

So paste it right below the last 'fi'


Save it and close the file, and close the terminal AND WE ARE DONE!!!

Technical Booklet, Page 12

IEEE UNMC Student Branch


March 28, y
Step 6 - double checking our hard work!
It is always advisable to check the product we have, we do not need faulty products, so similarly we are
going to see whether we really have installed the java compiler or not. To do this open up your terminal
(Ctrl+Alt+T) and just type the following command:
javac

You will now see a huge load of information come up (we do not need to bother what it is!) and then just to
be double sure we type one more command:
java -version
This will show up you current version. If the above 2 commands work, then well done! , you have your Java
compiler!
Now we can go ahead and install eclipse!
Click on the following link to get eclipse:
https://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/luna/SR2/eclips
e-java-luna-SR2-linux-gtk-x86_64.tar.gz
After the link opens, click on the country name next to the green arrow
And your eclipse will start downloading.
Please note, you might get different countries depending on the server, for e.g. you might get Indonesia as
well
Once the download has finished, go the Downloads directory and extract the eclipse folder right there itself,
after extraction you should have a folder just called 'eclipse' go inside it and you will see this:

Technical Booklet, Page 13

IEEE UNMC Student Branch


March 28, y
Note the highlighted file called eclipse, all you need to do now is to right click and then click run. And that's
it, you have your eclipse setup.

Although this software is used to run java programs, we can also run C and C++ programs, we will

Installation of libusb in Ubuntu Linux OS.


Need to update all packages in Ubuntu. sudo apt-get install update

https://github.com/Nuand/bladeRF/wiki/Getting-Started%3A-Linux
sudo apt-get install libusb-1.0-0-dev libusb-1.0-0
ignore: build-essential cmake libncurses5-dev libtecla1 libtecla1-dev pkg-config git wget
You can check the libusb and libusb-dev versions installed on your system via:
dpkg -s libusb-1.0-0 libusb-1.0-0-dev
The libusb.h is installed in
/usr/include/libusb-1.0
And the libusb-1.0 library is in
/usr/lib

Installing libsub
http://www.xdimax.com/sub20/sub20.html
Create a new workspace directory ~/xdimax.
cd ~/xdimax
Copy the following tar file invPen.tar.gz into ~/xdimax directory.
And untar this file by double click on it and extract here.
There are 3 directories app, bin and Debug in the extracted directory invPen.
Enter Eclipse into ~/xdimax directory.
Create a new C project invPen in ~/xdimax directory.
Go into workspace project properties: C/C++ Build > Settings
Place in the GCC C Compiler Includes path /usr/include/libusb-1.0 and ../lib
Place in the GCC C Linker library path /usr/lib
Place in the usb library usb-1.0 and also the math library m

Technical Booklet, Page 14

IEEE UNMC Student Branch


March 28, y

Technical Booklet, Page 15

IEEE UNMC Student Branch


March 28, y
Go to Terminal and do the following.
Enter the Debug directory inside the project directory.
cd ~/xdimax/invPen/Debug
sudo chmod +x invPen
To understand all the available options do the following. But this is not necessary.
The more important document is the dsub20 API manual.
sudo ./invPen --help
As a first confidence, try the following:
sudo ./invPen --LCD=Hello
The LCD on the SUB20 should show Hello World. This indicates that the communication between the PC in
Linux and the SUB20 is good to go.

Understanding file structure


The working invPend_code.c and invPend_code.h file is where you will be placing ALL your codes.
There should be no other places. DO NOT CHANGE THE NAMES OF THESE 2 FILES.
Compile the code. Run in terminal as:
sudo ./invPen

Technical Booklet, Page 16

IEEE UNMC Student Branch


March 28, y

If there is a problem after compiling:


Program g++ not found in PATH
Then, need to install g++.
sudo apt-get install g++
This will install g++ into /usr/bin.
Exit Eclipse and re-enter Eclipse. The problem should disappear.

Technical Booklet, Page 17

IEEE UNMC Student Branch


March 28, y

Pololu i2c addresses


0x1d LSM303D MEMS accelerometer
SAD[6:2]
SAD[1:0]
00111
01

0x5d - LPS25H MEMS pressure sensor


SAD[6:1]
SAD[0]
101110
1

0x6b L3GD20H MEMS gyroscope


SAD[6:1]
SAD[0]
110101
1

Technical Booklet, Page 18

IEEE UNMC Student Branch


March 28, y

The digital signal should show:


D6

Technical Booklet, Page 19

IEEE UNMC Student Branch


March 28, y
BARE MINIMUM GYRO SETTINGS
Need to do some control on CTRL1. The others CTR 2-5 are at defaults.
CTRL1 =
DR[1:0]=00
BW[1:0]=00
PD=1
Zen=1
Xen=1
Yen=1
ie 0000 1111 = 0x0F

Technical Booklet, Page 20

IEEE UNMC Student Branch


March 28, y

LOW_ODR setting
DRDY_HL=0
I2C_dis=0
SW_RES=0
Low_ODR=1
ie: 0000 0001

Technical Booklet, Page 21

IEEE UNMC Student Branch


March 28, y

BARE MINIMUMM ACCELEROMETER SETTINGS

Technical Booklet, Page 22

IEEE UNMC Student Branch


March 28, y

CTRL1 settings
ADDR[3:0]=0101
BDU=0
AZEN=1
AYEN=1
AXEN=1
1010 0111 = 0x57

Technical Booklet, Page 23

IEEE UNMC Student Branch


March 28, y

With the above bare minimum settings, running in unfiltered filters, the following are the numbers.

Technical Booklet, Page 24

Das könnte Ihnen auch gefallen