Sunday, September 22, 2013
Read and Write to ttyS0 serial ports in Linux
Two ways to interface to the ttyS0 serial port:
1) via terminal command line:
echo "ABCDEF" > /dev/ttyS0
cat /dev/ttyS0
To configure the port:
stty -F /dev/ttyS0 speed 9600 cs8
stty -F /dev/ttyS0 speed 9600 cs8 -cstopb -parenb
2) via C Program: minicom
sudo apt-get install minicom
when done use
sudo minicom -s
3) By writing your own app in C++ or C# or any other preferred Programming language:
I will have some sample working programs here soon.
Saturday, September 14, 2013
Installing Eclipse from the website on Ubuntu 13.04
I found these instructions on one of the websites discussions:
I found out that I need to install Java RTE or JDK from Java.com
I wanted to make sure I do not lose it again...
reference:
http://askubuntu.com/questions/26632/how-to-install-eclipse
http://www.eclipse.org/downloads/?osType=linux
If you've downloaded Eclipse from their official website, follow these steps for the installation.
- Extract the eclipse.XX.YY.tar.gz using
tar -zxvf eclipse.XX.YY.tar.gz
- Become root.
sudo -i
- Copy the extracted folder to
/opt
cp -r eclipse.XX.YY /opt
- Create a desktop file and install it:
gedit eclipse.desktop
and copy the following to theeclipse.desktop
file.[Desktop Entry] Name=Eclipse Type=Application Exec=eclipse Terminal=false Icon=eclipse Comment=Integrated Development Environment NoDisplay=false Categories=Development;IDE; Name[en]=Eclipse
then execute the following command to automatically install it in the unity:desktop-file-install eclipse.desktop
- Create a symlink in
/usr/local/bin
usingcd /usr/local/bin ln -s /opt/eclipse/eclipse
- For eclipse icon to be displayed in dash, eclipse icon can be added as
cp /opt/eclipse/icon.xpm /usr/share/pixmaps/eclipse.xpm
I found out that I need to install Java RTE or JDK from Java.com
I wanted to make sure I do not lose it again...
reference:
http://askubuntu.com/questions/26632/how-to-install-eclipse
http://www.eclipse.org/downloads/?osType=linux
Beaglebone Black angstrom
Status Update:
This is a list of working Not working items, so you do not get disappointed after reading the post. This is a work in progress...
Angstrom:
GPIO
ADC
I2C1
SPI almost, having some issues with CLK, and Data input output.
ArchLinux:
:-(
First Using angstrom distribution:
opkg is the app-get for angstrom....
Linux beaglebone 3.8.11 #1 SMP Wed May 8 07:34:27 CEST 2013 armv7l GNU/Linux
This is a list of working Not working items, so you do not get disappointed after reading the post. This is a work in progress...
Angstrom:
GPIO
ADC
I2C1
SPI almost, having some issues with CLK, and Data input output.
ArchLinux:
:-(
First Using angstrom distribution:
opkg is the app-get for angstrom....
Linux beaglebone 3.8.11 #1 SMP Wed May 8 07:34:27 CEST 2013 armv7l GNU/Linux
after opkg update, opkg upgrade
Linux beaglebone 3.8.13 #1 SMP Thu Sep 5 16:35:35 CEST 2013 armv7l GNU/Linux
Install Sudo
opkg install sudo
Network settings:
This post here is great source for setting Static IP
http://derekmolloy.ie/set-ip-address-to-be-static-on-the-beaglebone-black/
add user:
su
useradd xyz-user
passwd xyz-user
Update Time and Time Zone:
rm /etc/localtime
ln /usr/share/zoneinfo/EST /etc/localtime
Using GPIO:
#echo 44 > /sys/class/gpio/export
Reference:
http://www.phys-x.org/rbots/index.php?option=com_content&view=article&id=104:lesson-1-beaglebone-black-blink-led&catid=46:beaglebone-black&Itemid=81
http://www.auctoris.co.uk/2012/08/23/gpio-with-sysfs-on-raspberry-pi-part-2/
Using the I2C:
i2cdetect -y -r 1
root@beaglebone:~# i2cdetect -y -r 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- UU UU UU UU -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
i2cdump -y 1 0x50 w or
i2cdump -y 1 0x50 b
Link....
http://minix-i2c.blogspot.com/2013/07/using-i2c-tools-with-angstrom-linux-on.html
Using the SPI:
I found the required files in /lib/firmware/ BB-SPIDEV*
all I did finally, is echo this line
root@beaglebone:/lib/firmware# echo BB-SPIDEV0 > /sys/devices/bone_capemgr.9/slots
Now what is next? the question is what is really here that works?
Using Analog Inputs:
sh-4.2# cat /sys/devices/ocp.2/helper.14/AIN*
References:
http://www.gigamegablog.com/2012/01/29/beaglebone-linux-101-configuring-angstrom-linux/
http://beaglebone.cameon.net/home/reading-the-analog-inputs-adc
http://www.gigamegablog.com/2012/01/22/beaglebone-coding-101-using-the-serial-and-analog-pins/
BeagleBone Black Updating the Software
Getting Started with BeagleBone Black
============================================================
Now, I am trying arch Linux to see if it works better:
http://archlinuxarm.org/platforms/armv7/ti/beaglebone-black
Steps I used:
To Setup eth0 configuration Static:
systemctl disable netctl-ifplugd@eth0
cp /etc/netctl/examples/ethernet-static /etc/netctl/ethernet-static
nano /etc/netctl/ethernet-static #edit to you liking
Use /24 for 255.255.255.0
Use /16 for 255.255.0.0
netctl enable ethernet-static
reboot.
References:
http://hipstercircuits.com/enable-spi-1-0-and-1-1-with-device-tre-overlays-on-beaglebone/
References & Commands:
How to auto mount drive at boot... /etc/fstab http://www-rohan.sdsu.edu/doc/debian/ch-disks.html
Debian Tutorial http://www-rohan.sdsu.edu/doc/debian/
opkg install sudo
Network settings:
This post here is great source for setting Static IP
http://derekmolloy.ie/set-ip-address-to-be-static-on-the-beaglebone-black/
add user:
su
useradd xyz-user
passwd xyz-user
Update Time and Time Zone:
rm /etc/localtime
ln /usr/share/zoneinfo/EST /etc/localtime
/usr/bin/ntpdate-sync
nano default/ntpdate to set / enable sync server
date to check your new time
Using GPIO:
#echo 44 > /sys/class/gpio/export
Reference:
http://www.phys-x.org/rbots/index.php?option=com_content&view=article&id=104:lesson-1-beaglebone-black-blink-led&catid=46:beaglebone-black&Itemid=81
http://www.auctoris.co.uk/2012/08/23/gpio-with-sysfs-on-raspberry-pi-part-2/
Using the I2C:
i2cdetect -y -r 1
root@beaglebone:~# i2cdetect -y -r 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- UU UU UU UU -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
i2cdump -y 1 0x50 w or
i2cdump -y 1 0x50 b
Link....
http://minix-i2c.blogspot.com/2013/07/using-i2c-tools-with-angstrom-linux-on.html
Using the SPI:
I found the required files in /lib/firmware/ BB-SPIDEV*
all I did finally, is echo this line
root@beaglebone:/lib/firmware# echo BB-SPIDEV0 > /sys/devices/bone_capemgr.9/slots
Then ls /dev/spi* and here is what I got...
Now what is next? the question is what is really here that works?
Using Analog Inputs:
sh-4.2# echo cape-bone-iio > /sys/devices/bone_capemgr.*/slots
sh-4.2# find /sys/ -name '*AIN*'
/sys/devices/ocp.2/helper.14/AIN0
/sys/devices/ocp.2/helper.14/AIN1
/sys/devices/ocp.2/helper.14/AIN2
/sys/devices/ocp.2/helper.14/AIN3
/sys/devices/ocp.2/helper.14/AIN4
/sys/devices/ocp.2/helper.14/AIN5
/sys/devices/ocp.2/helper.14/AIN6
/sys/devices/ocp.2/helper.14/AIN7
sh-4.2# cat /sys/devices/ocp.2/helper.14/AIN1
OR
References:
http://www.gigamegablog.com/2012/01/29/beaglebone-linux-101-configuring-angstrom-linux/
http://beaglebone.cameon.net/home/reading-the-analog-inputs-adc
http://www.gigamegablog.com/2012/01/22/beaglebone-coding-101-using-the-serial-and-analog-pins/
BeagleBone Black Updating the Software
Getting Started with BeagleBone Black
============================================================
Now, I am trying arch Linux to see if it works better:
http://archlinuxarm.org/platforms/armv7/ti/beaglebone-black
Steps I used:
- pacman -Syu
- passwd
- pacman -S sudo adduser gcc make
- adduser username
- EDITOR=nano visudo
- copy my files
To Setup eth0 configuration Static:
systemctl disable netctl-ifplugd@eth0
cp /etc/netctl/examples/ethernet-static /etc/netctl/ethernet-static
nano /etc/netctl/ethernet-static #edit to you liking
Use /24 for 255.255.255.0
Use /16 for 255.255.0.0
netctl enable ethernet-static
reboot.
References:
http://hipstercircuits.com/enable-spi-1-0-and-1-1-with-device-tre-overlays-on-beaglebone/
References & Commands:
How to auto mount drive at boot... /etc/fstab http://www-rohan.sdsu.edu/doc/debian/ch-disks.html
Debian Tutorial http://www-rohan.sdsu.edu/doc/debian/
Thursday, September 5, 2013
Adding GPIO SPI and I2C options to your Arch Linux Kernel
Edit 12/07/2013:
Thanks to Mr. Mauro Ribeiro, I was able to get the SPI on my ODROID-X2 board and, now I will be working on the actual development of the main project, which is, Controlling the world via SPI bus...
Mr. Mauro Ribeiro modified the kernel on https://github.com/hardkernel/linux/tree/odroid-3.8.y
and now we can build kernels with SPI1 enabled.
First lets put some list of GPIOs I used on this board:
105, 102, 110, 117
To read from GPIO that is set as Input:
So, I had to build my Kernel to be able to enable the SPI "I hope that it is going to work..."
Make sure you have at least large SD drive, I used 8 GB and did not work. So, 16 GB is recommended...
Edit:
OK, my 8GB SD card was not fully used, I had to use gparted and resize the partition to use the full SD card size.
1. Get the source code from the link below, I had to get linux-odroid-3.8.y.zip as others did not have my odroidx2_ubuntu_defconfig configuration file.
https://github.com/hardkernel/linux
2. Now you will have to unzip the file, so crate a folder in your home directory and save the downloaded zip file to it then use
unzip linux-odroid-3.8.y.zip
I installed 7z by using
pacman -S p7zip
Then
7z x -y zip.file.name
You will also need to get
pacman -S base-devel
Also you will need:
pacman -S gcc make
3. make sure you work from the new created folder, linux-odroid-3.8.y
cd linux-odroid-3.8.y
zcat /proc/config.gz > .config
for Latest SPI enabled configuration, I used the following
make odroidx2_defconfig
4. Run make oldconfig
4. Now, run make menuconfig, this will allow you to go and enable other options before you build the new kernel
5. make sure you exit and save changes when you are done, now you should have a .config file in the current folder
6. To start build Run
make -j8
-j8 will allow the make to run up to 8 simultaneous jobs
This part will take a long time so do not set and wait for it to finish
7. Now, Run,
8. Rename the current zImage to zImage.prev and copy the new zImage to /boot
I used the steps from this location
http://odroid.us/mediawiki/index.php?title=Kernel_compiling
http://forum.odroid.com/viewtopic.php?f=52&t=81
Make sure your time is set to the correct time:
Time-Date set and check
sudo timedatectl set-time "2013-08-14 14:52:00"
timedatectl status
timedatectl set-timezone America/New_York
Warning: you may need to install module-init-tools
Now, Adding more notes about Device Tree overlay:
Install sudo pacman -S dtc-overlay
I need to find out where to find the correct dtc files to compile on the Odroid-x2
New Board found:
http://www.variscite.com/products/system-on-module-som/cortex-a9/dart-4460-cpu-ti-omap-4-omap4460?gclid=CJbkwpP3_roCFdF_Qgod0kMAtw
http://armbedded.eu/node/318
resources:
https://github.com/hardkernel/linux
http://archlinuxarm.org/developers/building-kernels
https://wiki.archlinux.org/index.php/Kernel_Compilation#Compilation
http://odroid.us/mediawiki/index.php?title=Kernel_compiling
This is my link to ODROID Forum question:
http://forum.odroid.com/viewtopic.php?f=17&t=1085
Good Links to building kernel:
http://docs.kali.org/development/custom-odroid-kernel-image
https://wiki.archlinux.org/index.php/Kernels/Compilation/Traditional
http://www.egr.msu.edu/classes/ece480/capstone/fall12/group02/documents/Mark-Birdsall_App-Note.pdf
Thanks to Mr. Mauro Ribeiro, I was able to get the SPI on my ODROID-X2 board and, now I will be working on the actual development of the main project, which is, Controlling the world via SPI bus...
Mr. Mauro Ribeiro modified the kernel on https://github.com/hardkernel/linux/tree/odroid-3.8.y
and now we can build kernels with SPI1 enabled.
First lets put some list of GPIOs I used on this board:
105, 102, 110, 117
GPIO are found @
/sys/class/gpio
and then need to export as root...
#echo "105" > export # echo "102" > export # echo "110" > export # echo "117" > export # echo "out" > gpio105/direction # echo "out" > gpio102/direction # echo "out" > gpio110/direction # echo "out" > gpio117/direction # echo "1" > gpio105/value # echo "0" > gpio105/value # echo "1" > gpio102/value # echo "0" > gpio102/value # echo "1" > gpio102/value # echo "1" > gpio105/value # echo "0" > gpio105/value
To read from GPIO that is set as Input:
# echo "in" > gpio105/direction
# cat /sys/class/gpio/gpio105/valueSo, I had to build my Kernel to be able to enable the SPI "I hope that it is going to work..."
Make sure you have at least large SD drive, I used 8 GB and did not work. So, 16 GB is recommended...
Edit:
OK, my 8GB SD card was not fully used, I had to use gparted and resize the partition to use the full SD card size.
1. Get the source code from the link below, I had to get linux-odroid-3.8.y.zip as others did not have my odroidx2_ubuntu_defconfig configuration file.
https://github.com/hardkernel/linux
2. Now you will have to unzip the file, so crate a folder in your home directory and save the downloaded zip file to it then use
unzip linux-odroid-3.8.y.zip
I installed 7z by using
pacman -S p7zip
Then
7z x -y zip.file.name
You will also need to get
pacman -S base-devel
Also you will need:
pacman -S gcc make
3. make sure you work from the new created folder, linux-odroid-3.8.y
cd linux-odroid-3.8.y
for Latest SPI enabled configuration, I used the following
make odroidx2_defconfig
4. Now, run make menuconfig, this will allow you to go and enable other options before you build the new kernel
5. make sure you exit and save changes when you are done, now you should have a .config file in the current folder
6. To start build Run
make -j8
-j8 will allow the make to run up to 8 simultaneous jobs
This part will take a long time so do not set and wait for it to finish
7. Now, Run,
make -j8 modules
sudo make modules_installmake zImage
8. Rename the current zImage to zImage.prev and copy the new zImage to /boot
kernelversion=`cat ./include/config/kernel.release` sudo cp /boot/zImage /boot/zImage.prevsudo cp /boot/uInitrd /boot/uInitrd.prevsudo cp arch/arm/boot/zImage /boot sudo cp .config /boot/config-$kernelversion
I used the steps from this location
http://odroid.us/mediawiki/index.php?title=Kernel_compiling
http://forum.odroid.com/viewtopic.php?f=52&t=81
Make sure your time is set to the correct time:
Time-Date set and check
sudo timedatectl set-time "2013-08-14 14:52:00"
timedatectl status
timedatectl set-timezone America/New_York
Warning: you may need to install module-init-tools
Install sudo pacman -S dtc-overlay
I need to find out where to find the correct dtc files to compile on the Odroid-x2
New Board found:
http://www.variscite.com/products/system-on-module-som/cortex-a9/dart-4460-cpu-ti-omap-4-omap4460?gclid=CJbkwpP3_roCFdF_Qgod0kMAtw
http://armbedded.eu/node/318
resources:
https://github.com/hardkernel/linux
http://archlinuxarm.org/developers/building-kernels
https://wiki.archlinux.org/index.php/Kernel_Compilation#Compilation
http://odroid.us/mediawiki/index.php?title=Kernel_compiling
This is my link to ODROID Forum question:
http://forum.odroid.com/viewtopic.php?f=17&t=1085
Good Links to building kernel:
http://docs.kali.org/development/custom-odroid-kernel-image
https://wiki.archlinux.org/index.php/Kernels/Compilation/Traditional
http://www.egr.msu.edu/classes/ece480/capstone/fall12/group02/documents/Mark-Birdsall_App-Note.pdf
Run Android Jelly Beans on ODROID-X2 Step by Step
After all the problem getting SPI working on the ODROID-X2 Board, I decided to visit the Android world and see what it takes to put it on the ODROID-X2 Board. And I was so amazed how easy it is...
Android 4.1 Beats-1.6:
http://com.odroid.com/sigong/nf_file_board/nfile_board_view.php?keyword=&tag=ODROID-X2&bid=182
Android 4.1 Beats-1.8 update:
http://com.odroid.com/sigong/nf_file_board/nfile_board_view.php?keyword=&tag=ODROID-X2&bid=192
How to install the update:
Google Apps:
http://goo.im/gapps/gapps-jb-20121011-signed.zip
Building Android Kernel:
http://forum.xda-developers.com/showthread.php?p=38144723
Open source from Samsun:
http://opensource.samsung.com/
Reference to building the Android ODROID-X2 kernel
https://github.com/leekyuhyuk/Odroid-X2-Android-OS-4.1-Kernel
check the readme , build.sh
Reference to Tool Chain download:
http://dev.odroid.com/projects/4412boot/#s-10.1
https://sourcery.mentor.com/GNUToolchain/release1294?lite=arm&cmpid=7108&downloadlite=scblite2012&signature=4-1377441150-0-1ca6798bb3b7e362eb68e47b2522d2d75e2f1f79
Install 32bit libraries on 64bit Linux:
install ia32-libs
Main Source Tree for Hard-Kernel:
http://dn.odroid.com/
Great News/Progress:
After re-building the kernel, and it was finished I found the following:
LD [M] drivers/spi/spidev.ko
OBJCOPY arch/arm/boot/zImage
Kernel: arch/arm/boot/zImage is ready
Android 4.1 Beats-1.6:
http://com.odroid.com/sigong/nf_file_board/nfile_board_view.php?keyword=&tag=ODROID-X2&bid=182
Android 4.1 Beats-1.8 update:
http://com.odroid.com/sigong/nf_file_board/nfile_board_view.php?keyword=&tag=ODROID-X2&bid=192
How to install the update:
Google Apps:
http://goo.im/gapps/gapps-jb-20121011-signed.zip
Building Android Kernel:
http://forum.xda-developers.com/showthread.php?p=38144723
Open source from Samsun:
http://opensource.samsung.com/
Reference to building the Android ODROID-X2 kernel
https://github.com/leekyuhyuk/Odroid-X2-Android-OS-4.1-Kernel
check the readme , build.sh
Reference to Tool Chain download:
http://dev.odroid.com/projects/4412boot/#s-10.1
https://sourcery.mentor.com/GNUToolchain/release1294?lite=arm&cmpid=7108&downloadlite=scblite2012&signature=4-1377441150-0-1ca6798bb3b7e362eb68e47b2522d2d75e2f1f79
Install 32bit libraries on 64bit Linux:
install ia32-libs
Main Source Tree for Hard-Kernel:
http://dn.odroid.com/
Great News/Progress:
After re-building the kernel, and it was finished I found the following:
LD [M] drivers/spi/spidev.ko
OBJCOPY arch/arm/boot/zImage
Kernel: arch/arm/boot/zImage is ready
So, I know now there are some module I need to load/copy with the kernel
I used the following line to copy my new Android Kernel to the board.
busybox dd conv=notrunc seek=1256960 bs=1 if=/tmp/zImage of=/dev/block/mmcblk0
I built it with built-in instead and now I see spidev in the /sys/class/sysdev and in the sys/modules/spidev but I am not sure yet how it can be used? or is it working
I need a different option to add spi_master
I used the following line to copy my new Android Kernel to the board.
busybox dd conv=notrunc seek=1256960 bs=1 if=/tmp/zImage of=/dev/block/mmcblk0
I built it with built-in instead and now I see spidev in the /sys/class/sysdev and in the sys/modules/spidev but I am not sure yet how it can be used? or is it working
I need a different option to add spi_master
Subscribe to:
Posts (Atom)