Stanley Lio‎ > ‎

BeagleBone Black Note

Goals

Save potential development time (Python)
Some tasks are just too awkward for 8-bit AVR (SD card, Ethernet, USB host...)


SSH

Ethernet over USB
Ethernet
Internal USB-serial converter (ttyO0, over USB, appears as "Gadget Serial" on Windows 7)
External USB-serial converter (dedicated 6-pin header on BBB)





Network

Changes made by route or ifconfig won't stick after reboot because the BBB Angstrom uses connman (Connection Manager, "con man" HAHA). It rewrites the routing table after reset for example.

1. Call get-services in /usr/lib/connman/test
2. Find out the name tag for your Ethernet interface ("ethernet_blah blah blah_cable")
cd /usr/lib/connman/test
./get-services
./set-nameservers ethernet_????????_cable 8.8.8.8 8.8.4.4
./set-ipv4-method ethernet_????????_cable manual 192.168.3.2 255.255.255.0 192.168.3.1

ifconfig


(optional but nice)
Share your laptop's internet with the BBB: Windows 7 Shared Connection
share with either the Ethernet over USB or Ethernet (I prefer the latter as it's more reliable).






Time

BBB has no battery-powered RTC
after you have internet access

/usr/bin/ntpdate -b -s -u pool.ntp.org






Boot from microSD

To boot from microSD instead of the internal eMMC with older images, the "boot" button need to be held down during power up. I got my BBB in April 2014, and it boots into the microSD automatically even if I don't press the "boot" button. The bootloader attempts to boot from uSD first before resorting to eMMC.

I wonder if I could reuse the "boot" button in run time.


Python GPIO

Adafruit_BBIO

opkg update
opkg install python-pip python-setuptools python-smbus
pip install Adafruit_BBIO

python -c "import Adafruit_BBIO.GPIO as GPIO; print GPIO"

pip install pyserial

Now to blink an external LED:

blink.py

import Adafruit_BBIO.GPIO as GPIO
import time

GPIO.setup("P8_10",GPIO.OUT)

t = 0.5

try:
    while True:
        GPIO.output("P8_10",GPIO.HIGH)
        time.sleep(t)
        GPIO.output("P8_10",GPIO.LOW)
        time.sleep(t)
except KeyboardInterrupt:
    print 'user interrupted'

GPIO.cleanup()






"GPS mouse"

My "GPS mouse" (often named "BU-353") works out of the box since it has a PL-2303 and is recognized by Linux.




BMP180 Pressure Sensor


Barometric pressure and temperature
I2C pins - confusion

I2C pins

The correct pins are in the "NAME" column, NOT the "MODE2" column. Wasted me over an hour of debugging.

This is a very useful command:
i2cdetect -y -r 1



Log I2C Sensor on Power Up


use cron:
first make your script executable by
chmod +x haha.py

then to edit the crontab file,
env EDITOR=nano crontab -e

"env EDITOR=nano" make sure the nano editor is used. I don't know how to use vim.

then add this line:
@reboot /usr/bin/python /home/root/haha.py

to verify the task, do this
crontab -l

you should see your task there.

Now just reboot and enjoy.


Resizing the Root Partition on a uSD Card

Several sources point to the same technique, but the method bricks the BBB (the uSD card) if run on Angstrom. Works fine on Debian though.







All Rights Reserved. Stanley Lio, 2014
Comments