Tuesday, December 31, 2013

BeagleBone Black - Debian

After setting up the BeagleBone Black with Angstrom and Ubuntu decided I would try Debian.  The link for the flasher by Robert C. Nelson is found here (Look under the flasher section).  Uncompress using Unarchiver on my Apple Mac laptop and the copy to a micro SD card as follows:

sudo dd bs=1m if=~/Downloads/BBB-eMMC-flasher-debian-7.3-2013-12-17-2gb.img of=/dev/rdisk3

where the disk number is found using Disk Utility or the terminal command df -k (remember to unmount the SD card if necessary).  When done just stick the micro SD into the Beaglebone Black.  Hold down switch S2 while connecting the 5 Volt power and wait for the 4 LEDs to turn on, let go when the lights start to flash and wait for all 4 LEDs to go solid again.  Then unplug, remove the SD card and then power back up.

Login and password are root or debian/temppwd.  cat /etc/*release* to see the version of debian.  Run apt-get update and then apt-get upgrade (or apt-get dist-upgrade) to get the latest content.  Then apt-get install the following - some are already added (vim, gcc, python, python-serial, python3, python3-serial).

To allow ssh/scp access without having to enter a password just enter the following (assuming your public key has already been created):

From Mac:
scp ~/.ssh/id_rsa.pub root@<ip address>:temp_keys.pub
From BBB:
mkdir -p ~/.ssh
cat ~/temp_keys.pub >> ~/.ssh/authorized_keys
rm ~/temp_keys.pub
chmod 600 ~/.ssh/authorized_keys
chmod 700 ~/.ssh

Next is to play with some IO using python, Adafruit has a nice python library for the Beaglebone Black, just enter these commands:

ntpdate pool.ntp.org
apt-get install build-essential python-dev python-pip -y
easy_install -U distribute
pip install Adafruit_BBIO

Adafruit has another nice tutorial on the device tree and how to configure it for different capes.  /lib/firmware has a collection of pre-built overlays.  The following command will show what is currently active:

cat /sys/devices/bone_capemgr.*/slots

We would like to activate UART1 and UART4 for use on the beaglebone.  To accomplish this enter the following commands:

mkdir /mnt/boot
mount /dev/mmcblk0p1 /mnt/boot
(some setups have it mounted at /boot/uboot already)
vim /mnt/boot/uEnv.txt

Find the line of code that has optargs and replace it with the following:

optargs=quiet capemgr.enable_partno=BB-UART1,BB-UART4

if you want to disable the hdmi interface add the following:

optargs=quiet capemgr.disable_partno=BB-BONELT-HDMI,BB-BONELT-HDMIN capemgr.enable_partno=BB-UART1,BB-UART4

when done just reboot and check the slots to make sure it worked:

root@arm:~# cat /sys/devices/bone_capemgr.*/slots
 0: 54:PF---
 1: 55:PF---
 2: 56:PF---
 3: 57:PF---
 4: ff:P-O-L Bone-LT-eMMC-2G,00A0,Texas Instrument,BB-BONE-EMMC-2G
 5: ff:P-O-- Bone-Black-HDMI,00A0,Texas Instrument,BB-BONELT-HDMI
 6: ff:P-O-- Bone-Black-HDMIN,00A0,Texas Instrument,BB-BONELT-HDMIN
 7: ff:P-O-L Override Board Name,00A0,Override Manuf,BB-UART1
 8: ff:P-O-L Override Board Name,00A0,Override Manuf,BB-UART4

You will find the two serial ports at /dev/ttyO1 and /dev/ttyO4.  You can then run these serial ports using pyserial.

Now we would like to get a Verizon Novatel Wireless USB760 cell modem working with the BBB.  First download and install the .deb package from the novatel website.

dpkg -i novatel_modem_drivers_config_1.1_6.deb

Then power down connect the USB cell modem and power back up.  lsusb will show something like the following:

Bus 001 Device 003: ID 1410:6000 Novatel Wireless
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

usb-devices will give more detailed information about the usb modem.

Now run /etc/udev/nvtl_modem.sh which runs modprobe and sets up the usb port
Now run wvdialconf /etc/wvdial.conf which will try and configure the cell modem. If this step doesn't work just move on to the next step and create wvdial.conf from scratch.
Now edit /etc/wvdial.conf so that it contains the following:

[Dialer Defaults]
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Modem Type = Analog Modem
Baud = 9600
New PPPD = yes
Modem = /dev/modem
ISDN = 0
Stupid Mode = 1
Phone = #777
Username = anything@vzw3g.com
Password = vzw

now just enter wvdial to connect.




To backup the eMMC image I have found the following method to work well:
Download the Debian BBB image, not the flasher image and follow previous instructions to copy it onto a micro SD card.

sudo dd bs=1m if=BBB-debian-7.3-2013-12-17-4gb.img of=/dev/rdisk1

Insert SD card and power up BBB (don't push any buttons)
You will want to remove your ip from the known_hosts list in .ssh since it will think it is a different computer.
df -k will tell you if any of the eMMC is mounted (/dev/mmcblk1*).  If anything is mounted just umount
then from the Mac:
ssh root@<ip address> dd if=/dev/mmcblk1 | dd of=bbbBackup.dd
to apply the back up just reverse the process:
dd if=bbbBackup.dd | ssh root@<ip address> dd of=/dev/mmcblk1





No comments:

Post a Comment