Beagle Bone Black Setup for iLidar
This post will enumerate and explain the steps that were taken to configure the Beagle Bone Black (BBB) for development of the iLidar cape. The commands on the host computer will be run on Mac OS X. Some details of the installation of the BBB drivers are omitted, this post assumes the user has already installed all the necessary drivers for the BBB and knows how to use the command line interface (terminal).
To configure the BBB, the following must be performed:
- Install operating system
- Install 3rd party software
- Customize settings
Install Operating System
The default operating system (OS) for the BBB rev. C is the Debian Linux Distribution. Ubuntu was chosen to replace Debian. Ubuntu is Debian based, but is more familiar to me and seems to have a new version of Vim in its apt-cache.
Acquire and Flash Image
There are two ways to run an OS on the BBB. From the SD card or the eMMC which is the onboard flash. eMMC performance is much better so that is what is being used.
The disk image to be flashed to the eMMC changes periodically so check here for the latest version. Currently, as of August 21, 2014, this is the latest version.
Once the image is downloaded decompress image:
unxz BBB-eMMC-flasher-ubuntu-14.04-console-armhf-2014-08-13-2gb.img.xz
Insert a MicroSD card and determine which disk it is by using
diskutil list
If you are having problems figuring out what disk it is, rerun the command before and after plugging in the drive.
Once the correct disk has been identified, you are ready to flash the image.
Be sure you have the correct disk number, if not, you could overwrite another drive.
Flash the card replacing the N
with whatever disk number was determined in the previous step.
This could take up to 30 minutes.
diskutil unmountDisk /dev/diskN
sudo dd if=BBB-eMMC-flasher-ubuntu-14.04-console-armhf-2014-08-13-2gb.img of=/dev/sdN bs=1m
Load onto BBB
Once the image has been copied to MicroSD card, unmount it and remove it from host computer. While the BBB is powered down, insert the card. Holding the boot button, press the power button. Wait until all the LEDs are lit and release all the boot button, a more detailed explanation can be found here.
Once all the LEDs are lit again, power down the board and remove the card. The BBB is ready to be used now. Connect a microUSB to the BBB and connect it to the host computer.
To connect to the BBB use the default password temppwd
ssh ubuntu@192.168.7.2
The following section will require an Internet connection. I have tried without success to share the OS X Internet connection over USB with the BBB. Instead a Ethernet cable was used.
3rd Party Software
There are several packages available from apt-get that will be used in the iLidar project. Some packages are not available from the apt-cache so they will be installed manually. Before installing any new packages update the current software.
sudo apt-get update
Then install the rest of the packages
sudo apt-get install libopencv-dev gcc make
PRU Software
The Programmable Realtime Unit (PRU) is used to interface with the camera. To get the software clone the github repo onto your path.
git clone https://github.com/beagleboard/am335x_pru_package.git
Make a directory for the headers that will be included in your c\c++ files.
sudo mkdir /usr/include/pruss
Now copy the headers into that folder.
sudo cp pru_sw/app_loader/include/*.h /usr/include/pruss/
Compile the libraries.
cd pru_sw/app_loader/interface; CROSS_COMPILE= make
Copy the libraries to /usr/lib.
sudo cp pru_sw/app_loader/lib/* /usr/lib/
Compile PASM
ldconfig
cd pru_sw/utils/pasm_source; source linuxbuild
Copy binaries to /usr/bin/
sudo cp pru_sw/util/pasm /usr/bin/
There is an included makefile that does some of the above include with the repo. I've opted to do it all manually here because it copies over the files in a way that I understand. Perhaps the makefile works just as above, but I am not sure.
I2C Library
This I2C library will be used for communication with the camera
It is a special library that wraps the SCCB protocol of the Omnivision cameras to I2C. The precompiled library did not work for me, but The non-compiled version did. I believe this is because it was compiled against a different kernel or with different settings.
Device Tree Compiler (DTC)
To enable certain modes on the BBB, the device tree must be manipulated. A newer version of the DTC needs to be installed than what is in the apt-cache. The following will install the newer version of the DTC.
wget -c https://raw.githubusercontent.com/RobertCNelson/tools/master/pkgs/dtc.sh; chmod +x dtc.sh; ./dtc.sh
Customize Settings
Most of the editing of files will be done on the BBB.
Vim is my editor of choice so the .vimrc in my dotfiles will be copied over to both /home/ubuntu/
and /home/root/
.
Macfuse will be used to mount the filesystem of the BBB and view or edit files from a host computer.
Disable HDMI framer
The iLidar will use pins on the P8 header that are used by the LCD and HDMI framer.
To use these pins for the PRU, the HDMI framer must be unloaded at boot time.
This is done by modifiying the /boot/uEnv.txt
and adding
optargs=quiet capemgr.disable_partno=BB-BONELT-HDMI,BB-BONELT-HDMIN
This must be done as root. As a general note, root is required for so much, might as well apply
sudo -i
to go into root interactive mode.