Beaglebone
Basic
elinux
- Official wiki for Beaglebone and Beaglebone Black.
- FAQ
- Wifi configuration
- Rebuild software image
- Accessories
Blog, Resource
- ARM architecture from wikipedia.
- Downloading images and instruction from www.armhf.com
- Adafruit learning which includes flashing eMMC and other stuff.
- http://eewiki.net/display/linuxonarm/BeagleBone+Black covers a lot about BBB.
- http://hipstercircuits.com/category/beaglebone/
- http://www.circuidipity.com/getting-started-with-beaglebone-black.html
- www.linux.com
- Blog from beaglebone.org
- Beaglebone Google Group
The meaning of LEDs in BBB board
- USR0 is configured at boot to blink in a heartbeat pattern
- USR1 is configured at boot to light during microSD card accesses
- USR2 is configured at boot to light during CPU activity
- USR3 is configured at boot to light during eMMC accesses
Derek Molloy
A series of Youtube videos to introduce Beaglebone. The source code of Video #9 can be downloaded from original website.
- Video #1 introduction to beaglebone
- Video #2 C/C++ Programming
- Video #3 GPIO programming on ARM
- Video #4 I2C
- Video #5 USB Wifi & Build Kernel
- Video #6 Stepper motor
- Video #7 LCD touchscreen
- Video #8 Qt Creator
- Video #9 Example of Qt; shows an application using GPIO + Qt. Video at 1:55 shows how GPIO pins were used for both LCD and LEDs.
- Video #10 OpenCV
- Video #11 introduction to GPIO
- Video #12 Streaming video
- Video #13 Windows USB network
- Video #14 JRE, Eclipse
Debian
Download from http://beagleboard.org/latest-images. Username: debian. Password: temppwd. This distribution contains graphical desktop environment.
The source code is hosted in github.
The Debian version can be found by (version 7 has a codename wheezy)
debian@beaglebone:~$ cat /etc/debian_version 7.4
microSD version
It is not necessary but if we want first erase the microSD card, we can issue the following. See this page and wiki page for more dd command examples.
sudo fdisk -l # determine the device id export DISK=/dev/mmcblk0 sudo dd if=/dev/zero of=${DISK} bs=1024 count=1024
It is enough to just run the following
sudo dd bs=1M if=bone-debian-7.4-2014-03-04-2gb.img of=/dev/sdc sudo sync
Hold the button close to microSD card and apply power.
emmc version
sudo dd bs=1M if=BBB-eMMC-flasher-debian-7.4-2014-03-04-2gb.img of=/dev/sdc sudo sync
Doing more in LXDE
Ubuntu/Debian
- Hold the S2 button & power on BBB. 1st and 3rd LEDs blink.
eMMC version (info was outdated now)
- Image (~70MB) download http://www.armhf.com/index.php/download/ and how to write the image to microSD card , boot from microSD and then the internal eMMC under Ubuntu/Debian.
- wget the image
- Use sudo su instead su to have full root permission. Use xz command to write the image to microSD
- Insert microSD to BBB and holding the button (closest to microSD) while applying power on BBB
- To copy the image to eMMC, use wget again to get the image file. Use sudo su instead su to have full root permission. Then use xz command again to write the image to eMMC.
- Remove microSD and reboot BBB. If we keep microSD in BBB, it will boot from microSD. MicroSD has the advantage that we can extend the space while eMMC cannot.
- Kernel is 3.8.
- The image contains a miniminal Ubuntu system. It only takes 276 MB when I use df -h command to check. So it does not come with a full desktop.
- Defautl username=ubuntu, password=ubuntu
- http://robotic-controls.com/learn/beaglebone/beaglebone-black-ubuntu
- If I try to install xubuntu-desktop, it requires 421MB data to download and 1.2GB space to install. So it is not feasible since the /dev/mmcblk0p2 partition has only 1.8GB space. Fortunately, the solution in here works well.
- Unfortunately, I got an error when I issue 'startx'.
Fatal server error: AddScreen/ScreenInit failed for driver 0 Please check the log file at "/var/log/Xorg.0.log" for additional informaiton.
After I reboot, things looks better. I can get a login GUI. However, the system is very slow and I can not see mouse on the desktop.
- http://fleshandmachines.wordpress.com/2013/09/08/beaglebone-black-debian-and-x11/#more-1250 is another instruction teaching how to install Debian and lxde desktop (Lubuntu used starlxde and if we install xface such as xubuntu we should use sudo startxfce4). It also shows how to access debian from remote connection.
microSD version (with LXDE desktop environment)
PS. Even the emmc version contains LXDE environment. Download from http://beagleboard.org/latest-images
At the beginning, the "/" partition still has 1.4GB space (see table below). If we boot into microSD (using ssh [email protected]) and follow the instruction or this to expand the microSD file system, we can make use whole space in uSD. It involves two commands: one is fdisk and the other is resize2fs.
debian@beaglebone:~$ df -h Filesystem Size Used Avail Use% Mounted on rootfs 15G 1.3G 13G 10% / udev 10M 0 10M 0% /dev tmpfs 100M 616K 99M 1% /run /dev/mmcblk0p2 15G 1.3G 13G 10% / tmpfs 249M 0 249M 0% /dev/shm tmpfs 249M 0 249M 0% /sys/fs/cgroup tmpfs 100M 0 100M 0% /run/user tmpfs 5.0M 0 5.0M 0% /run/lock /dev/mmcblk0p1 96M 69M 27M 72% /boot/uboot /dev/mmcblk1p2 1.7G 1.3G 345M 79% /media/rootfs /dev/mmcblk1p1 96M 72M 25M 75% /media/boot
To find out the Debian version, use
cat /etc/debian_version
Console version
Following the instruction on robotic-controls.com, we can install the console version of Ubuntu on BBB. The image I download is Ubuntu 13.10 https://rcn-ee.net/deb/rootfs/saucy/ubuntu-13.10-console-armhf-2013-11-15.tar.xz.
This image has some features like 192.168.7.2 access automatically just like Angstrom distribution (I don't know how to get this to work on eMMC version of Ubuntu image). That means I can just connect to BBB without using ethernet under Ubuntu OS.
Installation script (uSD is mounted on /dev/sdc in my case)
wget https://rcn-ee.net/deb/rootfs/saucy/ubuntu-13.10-console-armhf-2013-11-15.tar.xz tar xJf ubuntu-13.10-console-armhf-2013-11-15.tar.xz cd ubuntu-13.10-console-armhf-2013-11-15 sudo ./setup_sdcard.sh --mmc /dev/sdc --uboot bone
The username/password is ubuntu/temppwd.
Below is what I get in HOST os
brb@brb-P45T-A:~/ubuntu-13.10-console-armhf-2013-11-15$ ifconfig ... eth2 Link encap:Ethernet HWaddr 90:59:af:63:df:45 inet addr:192.168.7.1 Bcast:192.168.7.3 Mask:255.255.255.252 inet6 addr: fe80::9259:afff:fe63:df45/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:9 errors:0 dropped:0 overruns:0 frame:0 TX packets:47 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:1010 (1.0 KB) TX bytes:11690 (11.6 KB) ...
and what I get inside BBB
ubuntu@arm:~$ ifconfig eth0 Link encap:Ethernet HWaddr 90:59:af:63:df:43 UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) Interrupt:56 ... usb0 Link encap:Ethernet HWaddr c6:18:a5:e4:60:71 inet addr:192.168.7.2 Bcast:192.168.7.3 Mask:255.255.255.252 inet6 addr: fe80::c418:a5ff:fee4:6071/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:178 errors:0 dropped:0 overruns:0 frame:0 TX packets:100 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:22583 (22.5 KB) TX bytes:20013 (20.0 KB) ubuntu@arm:~$ df -h Filesystem Size Used Avail Use% Mounted on /dev/mmcblk0p2 15G 493M 14G 4% / none 4.0K 0 4.0K 0% /sys/fs/cgroup udev 247M 4.0K 247M 1% /dev tmpfs 50M 236K 50M 1% /run none 5.0M 0 5.0M 0% /run/lock none 248M 0 248M 0% /run/shm none 100M 0 100M 0% /run/user /dev/mmcblk0p1 64M 17M 47M 27% /boot/uboot
We can make the Ubuntu talk to internet by using the instruction given in Angstrom section (run sudo su first).
TTL/Serial cable connection
The screenshot below shows we can use a ttl serial cable to log into beaglebone in command line mode. The beaglebone is powered by a 5v usb. The tricky part is the J4 pin (RXD) in BBB should be connected to the TXD pin in ttl cable. Similarly, the J5 (TDX) pin in BBB should be connected to the RXD pin 8n ttl cable. The 3.3v p8n in ttl cable is not used at all.
This post asks NOT to connect the 5V pin from TTL to BBB. The Serial port pin settings is given on elinux.org as linked from codechiefl.wordpress.com.
Check out the beaglebone black system manual (Section 7.5 Serial Header) about the serial debug ports from https://github.com/CircuitCo/BeagleBone-Black/blob/master/BBB_SRM.pdf.
BBB TTL ========== J1 GND GND J4 (RXD) TX J5 (TXD) RX
Find out the IP address if we use internet sharing
If we are using ethernet on BBB, we can find out the IP adress by using the following way.
Download fing deb package from overlooksoft website. Install it by double clicking the file in file manager. Issue the following command to find out the IP of beaglebone black (shared computer). The IP of my 2nd ethernet adapter (eth1) is 10.42.0.1.
sudo fing -n 10.42.0.1/24
Wifi setup command line
- https://wiki.debian.org/WiFi/HowToUse#Command_Line
- http://embeddedprogrammer.blogspot.com/2013/01/beaglebone-using-usb-wifi-dongle-to.html (it is worthy to mention the tutorial uses USB emulated serial connection ONCE all required software are installed. Similar tech was also used in Raspberry Pi). The Adafruit website also teaches us how to use the USB cable provided by BBB to do an ad-hoc SSH connection. However, the BBB differ from BB by several factors, including removal of USB-to-serial interface; see here
dmesg | grep rtl8192 ifconfig wlan0 sudo apt-get install wireless-tools iwconfig sudo nano /etc/network/interface # Made appropriate change on /etc/network/interface sudo ifup wlan0 // not needed if we have enable wlan0 at boot. // sudo ifconfig wlan0 up sudo iwlist wlan0 scanning ping www.google.com
where the file /etc/network/interface should be like
auto wlan0 iface wlan0 inet dhcp wpa-ssid mynetworkname wpa-psk mysecretpassphrase
Angstrom
- Remove uSD card before power on BBB. 4 LEDs lit up.
- Download Angstrom image from http://beagleboard.org/latest-images
- I pick 2GB eMMC version for Beaglebone Black
- https://s3.amazonaws.com/angstrom/demo/beaglebone/BBB-eMMC-flasher-2013.06.20.img.xz
- There is a version dated 2013.09.12 at http://downloads.angstrom-distribution.org/demo/beaglebone/ as the instruction from http://www.height8.com/info/devel/hardware/beagleboneblack/macupdateangstrom
# Umount the uSD card mount # find /dev/sdc1 sudo diskfutil unmount /dev/sdc1 ls *.xz # Copy img file to microSD card. Took about 15-30 minutes. # Method 1. tar -xJf BBB-eMMC-flasher-2013.06.20.img.xz sudo dd bs=1m if=~/Downloads/BBB-eMMC-flasher-2013.06.20.img of=/dev/sdc sudo sync # Method 2. xz -cd BBB-eMMC-flasher-2013.06.20.img.xz > /dev/sdc
Remove the microSD card and insert it fully into BBB uSD card slot.
To flash the BBB: Hold down the 'user boot' button (closes to uSD card slot) and power on BBB until the 4 LED's light up for a few seconds. It will take 30-45 minutes to flash the image onto the eMMC. Once it's done, the 4 LED's will all stay lit up at the same time. You can then power down your BBB, remove uSD and power up BBB.
The username is root. There is not password. We can access it by ssh [email protected].
If we type ifconfig in Angstrom, we find the connection is through usb0 adapter.
root@beaglebone:~# ifconfig eth0 Link encap:Ethernet HWaddr 90:59:AF:63:DF:43 UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) Interrupt:56 lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:12 errors:0 dropped:0 overruns:0 frame:0 TX packets:12 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:760 (760.0 B) TX bytes:760 (760.0 B) usb0 Link encap:Ethernet HWaddr 86:27:86:2D:45:5C inet addr:192.168.7.2 Bcast:192.168.7.3 Mask:255.255.255.252 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:2765 errors:0 dropped:0 overruns:0 frame:0 TX packets:5003 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:179578 (175.3 KiB) TX bytes:7067277 (6.7 MiB)
Web server
Google coder
http://www.adafruit.com/blog/2013/09/17/run-google-coder-on-your-beaglebone-black/
VNC
opkg update opkg install x11vnc x11vnc -bg -o %HOME/.x11vnc.log.%VNCDISPLAY -auth /var/run/gdm/auth-for-gdm*/database -display :0 -forever
To start VNC server at bootup and shutdown, check out
- https://lists.fedoraproject.org/pipermail/devel/2011-July/154611.html
- https://wiki.archlinux.org/index.php/Vncserver
Package download
http://www.gigamegablog.com/2012/01/29/beaglebone-linux-101-configuring-angstrom-linux/
opkg update opkg install XXXX opkg list | grep "gfortran"
However, at least for BBB case, I cannot find gfortran package so I cannot install R. See discussions below
The angstrom linux package browser is the place we can see if packages for BBB Cortex-A8. According to Wikipedia the Cortex-A8 has armv7a architecture. Cortex-A7 (eg pcDuino3) is a smaller, faster, and more power-efficient successor to the Cortex-A8.
On ubuntu, we can use ldconfig -v command to show the installed libraries and their versions. See here. If we like to manually add libraries to ubuntu/debian, we can check the tip here.
beaglebone.local and Avahi/Bonjour/Zeroconf
Instead of typing an IP address, we can use [email protected] to access BBB running on Angstrom OS. The implementation is done by Avahi Daemon/Bonjour/ZeroConf/Multicast.
We can manually install avahi-daemon in ubuntu-armhf by
sudo apt-get update sudo apt-get install avahi-daemon
After that, we should be able to ssh [email protected] instead of using IP. PS: not stable.
brb@brb-P45T-A:~$ ssh [email protected] ssh: connect to host ubuntu-armhf.local port 22: Connection refused
The real IP address can be found by ping HOSTNAME.local (Updated: use ps -ef | grep avahi to find out the exact hostname used in .local domain because at least one of my Ubuntu machines does not use its hostname exactly)
For the Angstrom OS with beaglebone, I found the IP number is in 192.168.7.2 (same as in the Getting Start page) by using ping command.
brb@brb-P45T-A:/etc/init$ ping beaglebone.local PING beaglebone.local (192.168.7.2) 56(84) bytes of data. brb@brb-P45T-A:/etc/init$ ifconfig (skip) eth2 Link encap:Ethernet HWaddr 90:59:af:63:df:45 inet addr:192.168.7.1 Bcast:192.168.7.3 Mask:255.255.255.252
The same method can be applied to Raspberry Pi or Ubuntu. In fact, avahi-daemon is installed by default. We can use ps -ef | grep avahi to check it.
Internet over Ethernet
The host has IP 10.42.0.1 and it is configured as shared instead of DHCP.
The BBB will have eth0: 10.42.0.50 and usb0: 192.168.7.2.
We can use ssh [email protected] to access it. The BBB will have internet access.
echo "nameserver 8.8.8.8" > /etc/resolv.conf
Internet over USB
- http://shallowsky.com/blog/hardware/talking-to-beaglebone.html
- http://www.circuidipity.com/getting-started-with-beaglebone-black.html
- http://robotic-controls.com/learn/beaglebone/beaglebone-internet-over-usb-only
- https://www.youtube.com/watch?v=fzRVVtGNfj8&list=PLF4A1A7E09E5E260A&noredirect=1 Host is Windows 7.
On BBB, run
sudo su /sbin/route add default gw 192.168.7.1 echo "nameserver 8.8.8.8" >> /etc/resolv.conf /sbin/route
(IP Masquerade/Share the internet connection + IP forward) On host, run
sudo iptables -A POSTROUTING -t nat -j MASQUERADE echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward > /dev/null sudo iptables -t nat -L
Done. Tested on my home ubuntu host machine running 12.04. We can use the last command to show nat table on host machine; See here.
Angstrom
http://beaglebone.cameon.net/home/internet-over-usb
ArchLinux
This post on Archlinux discusses how to get the usb network adapter that is built into the mini-usb power connector working under Arch.
Ubuntu
How to share internet over USB on BBB? http://askubuntu.com/questions/380810/internet-over-usb-on-beaglebone-black
microHDMI to VGA cable
http://circuitco.com/support/index.php?title=BeagleBone_Black_Accessories
Question: How to create EDIT? My NEC monitor supports only 1024 x 768.
Beagleboneblack HDMI page from circuitco.com.
Remote desktop connection
See Raspberry#Connection_to_Raspberry_Pi_with_tightvnc
# Server side sudo apt-get install tightvncserver tightvncserver # set up the password vncserver # this step may not be necessary vncserver –kill :1 # Client side xtightvncviewer 10.42.0.50:1 # or xtightvncviewer 192.168.7.2:1 if we use usb0
To start tightvncserver automatically at start, follow the instruction at here to create a new script file under /etc/init.d/ directory and run update-rc.d on the new script.
debian@beaglebone:~$ sudo nano /etc/init.d/vncserver [sudo] password for debian: debian@beaglebone:~$ sudo chmod +x /etc/init.d/vncserver debian@beaglebone:~$ sudo update-rc.d vncserver defaults update-rc.d: using dependency based boot sequencing update-rc.d: warning: default start runlevel arguments (2 3 4 5) do not match vncserver Default-Start values (S) update-rc.d: warning: default stop runlevel arguments (0 1 6) do not match vncserver Default-Stop values (0 6) insserv: Script vncserver is broken: incomplete LSB comment. insserv: missing `Required-Stop:' entry: please add even if empty. debian@beaglebone:~$ sudo reboot
Despite the warning, it still works. It make a copy of this vncserver file below. Something we may want to change for different scenario is the USER and GEOMETRY parameters.
#!/bin/sh -e ### BEGIN INIT INFO # Provides: vncserver # Required-Start: networking # Default-Start: S # Default-Stop: 0 6 ### END INIT INFO # PATH="$PATH:/usr/X11R6/bin/" # The Username:Group that will run VNC export USER="debian" #${RUNAS} # The display that VNC will use DISPLAY="1" # Color depth (between 8 and 32) DEPTH="16" # The Desktop geometry to use. #GEOMETRY="<WIDTH>x<HEIGHT>" #GEOMETRY="800x600" GEOMETRY="1024x768" #GEOMETRY="1280x1024" # The name that the VNC Desktop will have. NAME="my-vnc-server" OPTIONS="-name ${NAME} -depth ${DEPTH} -geometry ${GEOMETRY} :${DISPLAY}" . /lib/lsb/init-functions case "$1" in start) log_action_begin_msg "Starting vncserver for user '${USER}' on localhost:${DISPLAY}" su ${USER} -c "/usr/bin/vncserver ${OPTIONS}" ;; stop) log_action_begin_msg "Stoping vncserver for user '${USER}' on localhost:${DISPLAY}" su ${USER} -c "/usr/bin/vncserver -kill :${DISPLAY}" ;; restart) $0 stop $0 start ;; esac exit 0
My Observation about angstrom distribution
When I use the image BBB-eMMC-flasher-2013.06.20.img to put it on the microSD card with win32DiskImager, I see (from plugging SD in Ubuntu) the microSD card has 2 partitions
eMMC-Flasher -ext4 BEAGLE_BONE - vfat
where eMMC-Flasher contains an ubuntu data and BEAGLE_BONE contains only 4 files.
ID.txt - just one line MLO - 98K binary u-boot.img - 371K binary uEnv.txt - just one line
Flashing is done by pressing the 'Boot' button while connecting the power. It took 1 hour in my case when I flashed BBB-eMMC-flasher-2013.06.20.img.
However, once the microSD is flashed to eMMC, the 'eMMC-Flasher' partition will be gone and 'BEAGLE_BONE' partition is changed to include 3 new folders- App, Docs and Drivers AND some new files - START.htm, autorun.inf, README.md.
Android OS
- http://icculus.org/~hendersa/android/
- Comparison of several SoC from Udoo.org.
- http://downloads.ti.com/sitara_android/esd/TI_Android_DevKit/TI_Android_JB_4_2_2_DevKit_4_1_1/index_FDS.html
Books
- Bad to the Bone: Crafting Electronics Systems with Beaglebone and BeagleBone Black
- Getting Started with BeagleBone: Linux-Powered Electronic Projects With Python and JavaScript
BBB vs Raspberry Pi
- http://makezine.com/magazine/how-to-choose-the-right-platform-raspberry-pi-or-beaglebone-black/
- http://www.doctormonk.com/2013/07/raspberry-pi-vs-beaglebone-black.html
Beaglebone 101
Angstrom includes a web server running on BBB. The web address is http://192.168.7.2
I have created screenshots in Google drive http://goo.gl/o03iex
Fix date/time
See here. Run the following to change the country and time zone.
sudo dpkg-reconfigure tzdata
Use microSD as ext storage
It is possible. See the idea in here.
Build R on BBB
I am using Ubuntu 13.04 image since angstrom linux missing many required packages.
Since the space is limited, instead of using 'sudo apt-get build-dep r-base', I manually install the essential packages: build-essential, gfortran, libreadline6-dev, libx11-dev, libxt-dev and openjdk-7-jre.
I am using R 3.0.1.
ubuntu@ubuntu-armhf:~$ df -h Filesystem Size Used Avail Use% Mounted on /dev/mmcblk0p2 1.8G 276M 1.4G 17% / none 4.0K 0 4.0K 0% /sys/fs/cgroup devtmpfs 248M 4.0K 248M 1% /dev none 50M 220K 50M 1% /run none 5.0M 0 5.0M 0% /run/lock none 248M 0 248M 0% /run/shm none 100M 0 100M 0% /run/user /dev/mmcblk0p1 1004K 472K 532K 48% /boot/uboot sudo apt-get update sudo apt-get install build-essential sudo apt-get install gfortran sudo apt-get install libreadline6-dev sudo apt-get install libx11-dev sudo apt-get install libxt-dev sudo apt-get install openjdk-7-jre // (optional) need it if we don't want to get an error message at the end of running 'make' // This require 143MB space. // The whole process (configure + make) takes at least 2 hours on BBB ./configure --enable-R-shlib make // make > ~/Rmake.txt 2>&1 There is still warnings with library/datasets http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=695411 It seems this is false alarm. ubuntu@ubuntu-armhf:~/R-3.0.1$ df -h Filesystem Size Used Avail Use% Mounted on /dev/mmcblk0p2 1.8G 1.1G 615M 64% / none 4.0K 0 4.0K 0% /sys/fs/cgroup devtmpfs 248M 4.0K 248M 1% /dev none 50M 224K 50M 1% /run none 5.0M 0 5.0M 0% /run/lock none 248M 0 248M 0% /run/shm none 100M 0 100M 0% /run/user /dev/mmcblk0p1 1004K 472K 532K 48% /boot/uboot
The complete process of running ./configure and make are recorded in
- ./configure Beaglebone and x86_64 box
- make Beaglebone and x86_64 box
Other configure options
http://cran.r-project.org/doc/manuals/R-admin.html#Configuration-on-a-Unix_002dalike
./configure --disable-byte-compiled-packages --enable-R-shlib
Performance Test
Qt cross compile
The list below is specific to beaglebone (black)
- http://derekmolloy.ie/beaglebone/qt-with-embedded-linux-on-the-beaglebone/
- http://www.michaelhleonard.com/cross-compile-for-beaglebone-black/ Install Eclipse and toolchain for cross-compile, Not Qt specific
- http://eewiki.net/display/linuxonarm/BeagleBone+Black Not Qt specific
- Bare Metal Qt 5.2 on BeagleBone Black Ubuntu Part 1 Part 2 Part 3
- http://wiki.mentorel.com/doku.php/qt-embedded Not BBB specific, based on Qt 4.8
- http://www.cloud-rocket.com/2013/07/building-qt-for-beaglebone/
- http://qt-project.org/doc/qt-4.8/embeddedlinux-support.html and http://qt-project.org/doc/qt-4.8/embeddedlinux-support.html
Other resource related to Raspberry Pi
sudo apt-get install gcc-arm-linux-gnueabi
What's wrong when running a binary created on x86_64 OS
For the hello world example, I will get an error in BBB if I just scp the binary file from x86_64 OS to BBB.
debian@beaglebone:~$ ./a.out -bash: ./a.out: cannot execute binary file
What we should do to compile hello.c
arm-linux-gnueabi-gcc -march=armv7-a -mtune=cortex-a8 -mfpu=neon -o hello hello.c scp hello [email protected]:
Then we run hello program in BBB. It should run successfully.
http://www.valvers.com/embedded-linux/beaglebone/step06-cross-compiling
What we should do to compile hello.cpp
Note: do not install g++-arm-linux-gnueabihf package. It will give me the following error when I try to compile a simple cpp program.
warning: ld-linux.so.3, needed by /usr/lib/gcc/arm-linux-gnueabihf/4.6/libstdc++.so, not found (try using -rpath or -rpath-link)
According to the above website or michaelhleonard.com we shall install the toolchain
sudo apt-get install gcc-arm-linux-gnueabi sudo apt-get install g++-arm-linux-gnueabi
I can build hello.cpp on my x86_64 host.
arm-linux-gnueabi-g++ -march=armv7-a -mtune=cortex-a8 -mfpu=neon -o hellocpp hello.cpp
But when I run the hellocpp program, I get the following error
debian@beaglebone:~$ ./hellocpp ./hellocpp: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory
I also try the following. It is a big download but still does not help.
sudo apt-get install ia32-libs
Some people suggested to add the following when compiling your program
-static -static-libstdc++
It works!!! The complete compile command is (-static-libstdc++ is not necessary)
arm-linux-gnueabi-g++ -march=armv7-a -mtune=cortex-a8 -mfpu=neon -static -o hellocpp hello.cpp
Linaro Toolchain
Although there are different toolchains, we are particularly interested in linaro toolchain. See https://wiki.linaro.org/WorkingGroups/ToolChain/FAQ.
Check out this page http://www.elinux.org/Toolchains for more information about toolchain.
Some paths
- arm-linux-gnueabi-gcc, arm-linux-gnueabi-g++, arm-linux-gnueabi-ar,... are located at /usr/bin/. This can be found by typing arm-linux-gnuabi-[TAB]
- ar, objcopy, strip also are located at /usr/arm-linux-gnueabi/bin.
brb@brb-P45T-A:~/Documents$ arm-linux-gnueabi- arm-linux-gnueabi-addr2line arm-linux-gnueabi-gprof arm-linux-gnueabi-ar arm-linux-gnueabi-ld arm-linux-gnueabi-as arm-linux-gnueabi-ld.bfd arm-linux-gnueabi-c++filt arm-linux-gnueabi-ld.gold arm-linux-gnueabi-cpp arm-linux-gnueabi-nm arm-linux-gnueabi-cpp-4.6 arm-linux-gnueabi-objcopy arm-linux-gnueabi-elfedit arm-linux-gnueabi-objdump arm-linux-gnueabi-g++ arm-linux-gnueabi-ranlib arm-linux-gnueabi-g++-4.6 arm-linux-gnueabi-readelf arm-linux-gnueabi-gcc arm-linux-gnueabi-size arm-linux-gnueabi-gcc-4.6 arm-linux-gnueabi-strings arm-linux-gnueabi-gcov arm-linux-gnueabi-strip arm-linux-gnueabi-gcov-4.6 brb@brb-P45T-A:~$ dpkg -L gcc-arm-linux-gnueabi /. /usr /usr/share /usr/share/doc /usr/share/man /usr/share/man/man1 /usr/bin /usr/share/doc/gcc-arm-linux-gnueabi /usr/share/man/man1/arm-linux-gnueabi-gcov.1.gz /usr/share/man/man1/arm-linux-gnueabi-gcc.1.gz /usr/bin/arm-linux-gnueabi-gcov /usr/bin/arm-linux-gnueabi-gcc brb@brb-P45T-A:~$ ls -l /usr/bin/arm-linux-gnueabi-gcc lrwxrwxrwx 1 root root 25 Feb 18 2012 /usr/bin/arm-linux-gnueabi-gcc -> arm-linux-gnueabi-gcc-4.6 brb@brb-P45T-A:~$ locate arm-linux-gnueabi-gcc-4.6 /usr/bin/arm-linux-gnueabi-gcc-4.6 /usr/share/man/man1/arm-linux-gnueabi-gcc-4.6.1.gz
Configure Eclipse for cross compile
http://zombiebabylabs.com/2014/02/hello-beaglebone-world-a-c-primer/
GUI not shown up
http://www.marshut.com/xkshy/beaglebone-black-qt-gui-application.html
Cross compile Qt
Some possible options
./configure -embedded arm -prefix /usr/local/QtEmbedded-arm -platform linux-g++ -little-endian -xplatform qws/linux-arm-g++ -qt-gfx-linuxfb -qt-gfx-vnc -qt-gfx-multiscreen -qt-mouse-pc -release -shared -no-fast -depths all -D QT_NO_QWS_CURSOR -confirm-license -no-pch # http://www.cloud-rocket.com/2013/07/building-qt-for-beaglebone/ # based on qt 4.8.5 ./configure -v -opensource -confirm-license -prefix /opt/qt -embedded arm -platform qws/linux-x86-g++ -xplatform qws/linux-am335x-g++ -depths 16,24,32 -no-mmx -no-3dnow -no-sse -no-sse2 -no-glib -no-cups -no-largefile -no-accessibility -no-openssl -no-gtkstyle -qt-mouse-pc -qt-mouse-linuxtp -qt-mouse-linuxinput -plugin-mouse-linuxtp -plugin-mouse-pc -fast -little-endian -host-big-endian -no-pch -no-sql-ibase -no-sql-mysql -no-sql-odbc -no-sql-psql -no-sql-sqlite -no-sql-sqlite2 -no-webkit -no-qt3support -nomake examples -nomake demos -nomake docs -nomake translations # http://armsdr.blogspot.com/2014/01/bare-metal-qt-52-on-beaglebone-black_10.html # Based on qt 5.2.0 # # qwx is located at mkspecs/qws. What does platform and xplatform do? ./qt-everywhere-opensource-src-5.2.0/configure -v -opensource -confirm-license -prefix /usr/local/qt-5.2 -no-largefile -no-accessibility -qt-zlib -no-gif -qt-libpng -qt-libjpeg -no-nis -no-cups -xplatform linux-linaro-gnueabihf-g++ -device linux-beaglebone-g++ -device-option CROSS_COMPILE=/usr/local/linaro/bin/arm-linux-g nueabihf-
- qws
QWS is a window server similar to X11 that works independently from it. Unlike X11, QWS windows cannot be forwarded to your Windows machine and will be displayed by your board directly. Before we proceed with starting our application in QWS mode ensure that your board is showing the text terminal and not the X11 session (press Ctrl-Alt-F1 to switch to it):
Native build Qt on BBB
The following screenshot demonstrates running qt-4.8.5/examples/painting/basicdrawing/ in BBB. That is, it is possible to compile the Qt directly in beaglebone black without using cross-compile.
The way I build Qt is
mv qt-everywhere-opensource-src-4.8.5 qt-4.8.5 cd qt-4.8.5 ./configure -v -opensource -confirm-license -no-largefile -no-accessibility -qt-zlib -no-gif -qt-libpng -qt-libjpeg -no-nis -no-cups -no-pch make sudo make install
- configure takes about 1 hour. Not much information is given after running configure. It only said Qt is now configured for building. Just run 'make'. Once everything is built, you must run 'make install'. Qt will be installed into /usr/local/Trolltech/Qt-4.8.5. To reconfigure, run make confclean and configure.
- Running make will take ~ 20 hours
- sudo make install is quick (~ 5 minutes)
- The std output shows /usr/local/Trolltech/Qt-4.8.5 is created
- If we want to save build time, we can add "-nomake examples -nomake demos" to your configure invocations, it works on both windows and linux.
It is interesting to compare the qt directory under $HOME and /usr/local/Trolltech. Note that even bin directory is copied to /usr/local, the contents inside bin folder are different (not shown here)
debian@beaglebone:~$ ls qt-4.8.5/ bin configure imports LICENSE.FDL plugins templates changes-4.8.5 configure.exe include LICENSE.GPL3 projects.pro tools config.profiles demos INSTALL LICENSE.LGPL qmake translations config.status doc LGPL_EXCEPTION.txt Makefile README util config.tests examples lib mkspecs src debian@beaglebone:~/qt-4.8.5$ ls /usr/local/Trolltech/Qt-4.8.5/ bin doc imports lib phrasebooks q3porting.xml translations demos examples include mkspecs plugins tests debian@beaglebone:~/qt-4.8.5$ ls /usr/local/Trolltech/Qt-4.8.5/examples/ animation draganddrop help mainwindows qtestlib threads widgets dbus effects helper multimedia README tools xml declarative examples-manifest.xml ipc network richtext touch xmlpatterns designer examples.pro itemviews opengl script tutorials desktop gestures layouts painting sql uitools dialogs graphicsview linguist qtconcurrent statemachine webkit debian@beaglebone:~/qt-4.8.5$
The final step is to change PATH environment variable by nano .profile
export PATH=/usr/local/Trolltech/Qt-4.8.5/bin:$PATH
Logout and login again to see if qmake is available.
It is also interesting to see the gcc version on BBB (v4.6.3)
debian@beaglebone:~$ gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-linux-gnueabihf/4.6/lto-wrapper Target: arm-linux-gnueabihf Configured with: ../src/configure -v --with-pkgversion='Debian 4.6.3-14' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --disable-sjlj-exceptions --with-arch=armv7-a --with-fpu=vfpv3-d16 --with-float=hard --with-mode=thumb --enable-checking=release --build=arm-linux-gnueabihf --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf Thread model: posix gcc version 4.6.3 (Debian 4.6.3-14) debian@beaglebone:~$ ls /usr/bin/arm* /usr/bin/arm-linux-gnueabihf-cpp /usr/bin/arm-linux-gnueabihf-gcc-4.6 /usr/bin/arm-linux-gnueabihf-cpp-4.6 /usr/bin/arm-linux-gnueabihf-gfortran /usr/bin/arm-linux-gnueabihf-g++ /usr/bin/arm-linux-gnueabihf-gfortran-4.6 /usr/bin/arm-linux-gnueabihf-g++-4.6 /usr/bin/arm-linux-gnueabihf-run /usr/bin/arm-linux-gnueabihf-gcc
Qt examples
Some great examples to try include
- examples/animation/appchooser
- examples/animation/states
- examples/dialogs/extension
- examples/dialogs/licensewizard
- examples/effects/lighting
- examples/effects/blurpicker
- examples/graphicsview/weatheranchorlayout
- examples/graphicsview/elasticnodes
- examples/graphicsview/diagramscene (a working app for drawing diagrams)
- examples/help/simpletextviewer (including image on help)
- examples/help/ipc/ (networking)
- examples/itemviews/chart (when a cell is selected, the corresponding text from another item list will be highlighted)
- examples/itemviews/dirview
- examples/itemviews/frozencolumn
- examples/itemviews/pixelator
- examples/itemviews/puzzle (Game)
- examples/layouts/dynamiclayouts (widgets location changed at real time)
- examples/network/bearermonitor (show all networks in a tree on lhs and status on rhs)
- examples/network/fortunateclient
- examples/network/http (download from an address)
- examples/network/loopback (with progress bar for sent and receved packets)
- examples/network/qftp (show contents in the textEdit. Cool!)
- examples/network/securesocketclient (allow input)
- examples/opengl (seems not working)
- examples/painting/concentriccircles (for fun)
- examples/painting/basicdrawing (basic test)
- examples/painting/painterpaths (fill gradient on different shapes or letters)
- examples/qtconcurrent/wordcount (becomes a background job running)
- examples/richtext/calendar
- examples/richtext/orderform
- examples/script/helloscript (not sure about what 'script' means)
- examples/statemachine/trafficlight
- examples/statemachine/twowaybutton (very simple)
- examples/statemachine/rogue (text game. How does it do it)
- examples/statemachine/pingpong (nothing show up on BBB)
- examples/threads/waitconditions (nothing show up on BBB)
- examples/tools/inputpanel (auto pop up input panel from an empty box)
- examples/tools/settingeditor
- examples/uitools/textfinder (can highlight text)
- examples/widgets/styles (use an image as background)
- examples/widgets/stylesheet (no image was used)
- examples/widgets/softkeys (no binary)
- examples/widgets/digitclock (simple)
- examples/widgets/calculator (classical)
- examples/widgets/charactermap (magnifier on mouse-over character)
- examples/widgets/codeeditor (highlight current line)
- examples/widgets/lineedits (contain license key input with format hint)
- examples/widgets/sliders (change widgets location at run time)
- examples/widgets/tablet (manipulate image)
- examples/widgets/tetrix (a game that works)
- examples/widgets/tooltip (tooltip on shapes created at run time)
- examples/xmlpatterns/trafficinfo (not working but background is cool)
- examples/xmlpatterns/schema (specify a background color on a textEdit is effective)
GPIO Projects
Use terminal to access GPIO pins
Google: beaglebone black gpio /sys/class/gpio
- http://derekmolloy.ie/beaglebone/beaglebone-gpio-programming-on-arm-embedded-linux/
- http://www.armhf.com/using-beaglebone-black-gpios/
- http://www.linux.com/learn/tutorials/725368-getting-started-with-the-beaglebone-black-a-1ghz-arm-linux-machine-for-45
- http://www.linux.com/learn/tutorials/765810-beaglebone-black-how-to-get-interrupts-through-linux-gpio
- http://www.chrisshiplet.com/static/bbb_gpio_pinout.png (GPIO pins diagram)
- http://elinux.org/EBC_Exercise_10_Flashing_an_LED
root@beaglebone:/sys/class/gpio# ls -l total 0 --w------- 1 root root 4096 Dec 31 1999 export lrwxrwxrwx 1 root root 0 Dec 31 1999 gpiochip0 -> ../../devices/virtual/gpio/gpiochip0 lrwxrwxrwx 1 root root 0 Dec 31 1999 gpiochip32 -> ../../devices/virtual/gpio/gpiochip32 lrwxrwxrwx 1 root root 0 Dec 31 1999 gpiochip64 -> ../../devices/virtual/gpio/gpiochip64 lrwxrwxrwx 1 root root 0 Dec 31 1999 gpiochip96 -> ../../devices/virtual/gpio/gpiochip96 --w------- 1 root root 4096 Dec 31 1999 unexport root@beaglebone:/sys/class/gpio# echo 7 > export root@beaglebone:/sys/class/gpio/gpio7# cat value 0 root@beaglebone:/sys/class/gpio/gpio7# cat direction in root@beaglebone:/sys/class/gpio/gpio7# echo low > direction root@beaglebone:/sys/class/gpio/gpio7# cat direction out root@beaglebone:/sys/class/gpio/gpio7# echo high > direction
The LED lit up now. The 'value' is changed by the 'direction'.
GPIO interactive map
http://eskimon.fr/beaglebone-black-gpio-interactive-map. It can toggle available pins (40), HDMI pins (20), emmc2 pins (10), I2C2 pins (2), power related pins (13).
- http://beagleboard.org/Support/bone101 for the Pin layout pictures.
- http://stuffwemade.net/post/beaglebone-pinout with a different format (eg GPIO3_14).
Onboard LEDs
$ ls /sys/class/leds/ beaglebone:green:usr0 beaglebone:green:usr1 beaglebone:green:usr2 beaglebone:green:usr3 ## 'trigger' determines what event is monitored $ ls /sys/class/leds/beaglebone\:green\:usr0/ brightness device max_brightness power subsystem trigger uevent $ cat /sys/class/leds/beaglebone\:green\:usr0/trigger none nand-disk mmc0 mmc1 timer oneshot [heartbeat] backlight gpio cpu0 default-on transient ## stop the heart # echo none > /sys/class/leds/beaglebone\:green\:usr0/trigger ## turn LED on (no blinking) # echo none > /sys/class/leds/beaglebone\:green\:usr0/trigger # echo 1 > /sys/class/leds/beaglebone\:green\:usr0/brightness ## strobe LED (get BeagleBone's heart racing at 20 'beats' per second) # echo timer > /sys/class/leds/beaglebone\:green\:usr0/trigger # echo 25 > /sys/class/leds/beaglebone\:green\:usr0/delay_off # echo 25 > /sys/class/leds/beaglebone\:green\:usr0/delay_on ## *whew* ... restore default heartbeat # echo heartbeat > /sys/class/leds/beaglebone\:green\:usr0/trigger
4D LCD Cape
It is a cool add-on for BBB. See official web site
Setting up an IO python library (GPIO, PWM, ADC, I2C, SPI, UART)
http://learn.adafruit.com/setting-up-io-python-library-on-beaglebone-black
- PWM: P8_13, P8_34, P8_36, P8_45, P8_46, P9_14, P9_21, P9_22, P9_29, P9_42. Eg. blink LED, fading LED, servo.
- ADC: P9_33, P9_35, P9_36, P9_37, P9_38, P9_39, P9_40. Eg. measure light, ultrasonic sensor, accelerometer, joystick, Potentiometer.
- I2C: P9_19, PI_20. Eg. temperature/pressure sensors.
- SPI: P9_17, P9_18, P9_21, P9_22, P9_28, P9_29, P9_30, P9_31.
- UART: 17 pins.
Adding a push button
http://learn.adafruit.com/connecting-a-push-button-to-beaglebone-black
Measure light
http://learn.adafruit.com/measuring-light-with-a-beaglebone-black My example:
import Adafruit_BBIO.ADC as ADC import time from time import localtime, strftime sensor_pin = 'P9_40' ADC.setup() #print('Reading\t\tVolts') print time.asctime(time.localtime(time.time())), '\tReading\t\tVolts' while True: reading = ADC.read(sensor_pin) volts = reading * 1.800 #print('%f\t%f' % (reading, volts)) #print(strftime("%Y-%m-%d %H:%M:%S", localtime())) print time.asctime(time.localtime(time.time())), '\t%f\t%f' % (reading, volts) time.sleep(60)
which can be run (and the output was written to a file for logging)
sudo python light.py > tmp.txt
If we want, we can follow the tutorial in here to have the light reading logged on the COMS or send to google docs like [1]. Alternatively, we can let BBB to send an email to you like here.
Fading RGB using PWM
http://learn.adafruit.com/fading-a-rgb-led-on-beaglebone-black/overview
Note that we don't have to use RGB led. We can just connect a single color led. But to use PWM, we cannot choose any pin we want. For example, p8_10 won't work. Below is a simplified example. Save it as fading.py and run it with sudo python fading.py.
import Adafruit_BBIO.PWM as PWM import time red = "P8_13" PWM.start(red, 0) def fade(colorA): for i in range(0, 100): PWM.set_duty_cycle(colorA, 100-i) time.sleep(0.05) while True: fade(red)
The led will fading using the above code. If we change line 7 to
PWM.set_duty_cycle(colorA, i)
the LED will grow.
Blinking an LED
Do not use a lower value resistor than 470Ω. The outputs can only provide about 4mA and the resistor prevents too much current flowing and potentially damaging the BBB.
But on another project (fading rgb LED), it mentioned you can use 220Ω to 1KΩ resistors.
Note that we have to run sudo su before we work on python program for any gpio project.
http://learn.adafruit.com/blinking-an-led-with-beaglebone-black
Controlling a servo
We can actually try the following simpler approach using bonescript without bothering a command line. Just open a browser tab and type the address http://beagleboard.org/Support/BoneScript/ServoMotor/. It just works! The SG90 micro motor operators at 4.0 to 7.2 volts according to here.
Measuring temperature
http://learn.adafruit.com/measuring-temperature-with-a-beaglebone-black
HC-SR04 (5v) sonar sensor
http://www.youtube.com/watch?v=bssyOCcU_Q4
Connect to 5v device
See 3.2.4 of the book "Bad to the Bone".
- Logic level
- BOB-08745 logic level shifter and BOB-11978 with a tutorial example and a hook up diagram.
- http://www.gigamegablog.com/2012/01/22/beaglebone-coding-101-using-the-serial-and-analog-pins/
Input voltage & voltage divider
http://beagleboard.org/Support/BoneScript/accelerometer/
PIR motion sensor (ADC)
http://beagleboard.org/Support/BoneScript/PIRMotionSensor
Pull-up Resistor
A very simple robot
http://beaglebone.cameon.net/beaglebone-robotics/1-robot-platform