beagleboard url

BeagleBoard 101

Use left and right arrows on your keyboard to change slides

Latest slides available at: http://beagleboard.org/beagleboard101

This is your introduction to BeagleBone and Bonescript where you will learn:

BeagleBoard.org is open access to ARM processors

http://beagleboard.org/static/flyer_latest.pdf

BeagleBoard.org is an open hardware project leveling access to low-power mobile processing

BeagleBoard-xM: Open software desktop experience with extra MHz and extra memory BeagleBone: Hardware I/O focus with single cable development experience
BeagleBoard-xM_hand_shot Beagle Bone A5 + Extras - Rev. A5

BeagleBone: open hardware expandable computer

Latest ARM open source focused on easy hardware experimentation

BeagleBone Hardware Details

http://beagleboard.org/bone

BeagleBone image

Expansion header state

Pin mux can be read and altered with pinMode and getPinMode

P9P8
1212
45464546

Capes extend BeagleBone capability

 


BeBoPr Cape
AES electronics


BeagleBone LCD7 Cape
BeagleBoardToys


TT3201 CAN Cape
TowerTech


BeagleBone Camera Cape
BeagleBoardToys


Proto Cape Kit
Adafruit


BeagleBone VGA Cape
BeagleBoardToys


BeagleBone MSTP Cape
Plano CAD


BeagleBone LCD3 Cape
BeagleBoardToys

Attached capes

Any attached capes with ID EEPROMs would be listed here

Bonescript enables physical computing exploration

Linux handles the interfaces, JavaScript provides the glue

First experience of Bonescript

Familiar Arduino function calls, exported to the browser

The links below are live and will impact the USR3 LED on your BeagleBone. The exact code used in the browser is below and will send messages to your board using Socket.IO.

Set pin high: run

pinMode(bone.USR3, 'out');
digitalWrite(bone.USR3, 1);

Set pin low: run

digitalWrite(bone.USR3, 0);

All GPIOs accessible via digitalWrite and digtalRead.

Native sketch-like applications

Bonescript application code uses the typical setup/loop global functions

Some boilerplate required, but fairly minimal. Below is blinking LED app with the familiar blocking style:

require('bonescript');
ledPin = bone.USR3;
setup = function() {
    pinMode(ledPin, OUTPUT);
};
loop = function() {
    digitalWrite(ledPin, HIGH);
    delay(1000);
    digitalWrite(ledPin, LOW);
    delay(1000);
};

Installation and execution of above 'blinkled.js' with node 0.6.x on a supported platform would look something like:

# npm install bonescript
# node blinkled.js

Blinking an LED

The "hello world" of hardware

Using JavaScript timers

Run repeatedly without invoking a process or delay

Blink USR3 LED for 30 seconds: run

value = 0;
pinMode(bone.USR3, 'out');

interval = setInterval(function() {
  value = value ? 0 : 1;
  digitalWrite(bone.USR3, value);
}, 100);

setTimeout(function() {
 clearInterval(interval);
}, 30000);

doEval

Run something remotely just once

What if we want to invoke the previous example on the target, rather than the browser?

Blink USR3 LED for 30 seconds: run

doEval(function(callback) {
 var value = 0;
 pinMode(bone.USR3, 'out');
 
 var interval = setInterval(function() {
  value = value ? 0 : 1;
  digitalWrite(bone.USR3, value);
 }, 100);
 
 setTimeout(function() {
  clearInterval(interval);
  callback({'notice': "Removing doEval demo interval function"});
 }, 30000);
 
 return({'notice': "Launched doEval demo interval function"});
}, doAlert);

addLoop/getLoops/removeLoop

Run something repeatedly

Blink USR3 LED: run

pinMode(bone.USR3, 'out');
addLoop(function() {
  digitalWrite(bone.USR3, 1);
  delay(100);
  digitalWrite(bone.USR3, 0);
  delay(100);
});

Halt all loops: run

getLoops(function(x) {
  for(var loop in x.loops) {
    removeLoop(loop);
  }
});

Connecting up some inputs

Wire up this Fritzing drawing to give us some stimulus

You can download the BeagleBone Fritzing part

attachInterrupt/detachInterrupt

Detect input changes

Please connect P8-3 to P8-5 with a 1khom resistor

Attach interrupt and toggle P8-3 for 30 seconds: run

Last value read was: unknown

pinMode(bone.P8_5, 'in');
pinMode(bone.P8_3, 'out');
value = 0;
digitalWrite(bone.P8_3, value);
function interruptHandler(x) { return({'value': x.value}); }
function interruptCallback(x) {
 if(x.output) $('#attachInterruptValue').text(x.output.value);
 else doAlert(x);
}
function toggleP8_3() {
  value = value ? 0 : 1;
  digitalWrite(bone.P8_3, value);
}
attachInterrupt(bone.P8_5, interruptHandler, 'both', interruptCallback);
var interval = setInterval(toggleP8_3, 200);
setTimeout(function() {
 clearInterval(interval);
 detachInterrupt(bone.P8_5, doAlert);
}, 30000);

analogRead/analogWrite

Use ADCs and PWMs to read/write analog values

Monitor analog in: run

pinMode(bone.P8_13, 'out', 4);
addLoop(function() {
 var value = analogRead(bone.P9_36);
 analogWrite(bone.P8_13, value);
}, 25, doAlert);

Fade in and out: run

 pinMode(bone.P8_13, 'out', 4);
 addLoop(function() {
  if(!this.awDirection) { this.awValue = 0.01; this.awDirection = 1; }
  analogWrite(bone.P8_13, this.awValue);
  this.awValue = this.awValue + (this.awDirection*0.01);
  if(this.awValue > 1.0) { this.awValue = 1.0; this.awDirection = -1; }
  else if(this.awValue < 0.01) { this.awValue = 0.01; this.awDirection = 1; }
 }, 10, doAlert);

Halt all loops: run

 getLoops(function(loops){for(var loop in loops.loops){removeLoop(loop, doAlert);}});

Using a slider with analogWrite

 

Please connect P8-13 to LED through 1khom resistor

Attach to slider: run

pinMode(bone.P8_13, 'out', 4);
$("#slider1").bind("slidechange", function(event, ui) {
 analogWrite(bone.P8_13, ui.value/100.0);
})

Using a slider with analogRead

 

Please connect P9-36 to potentiometer and adust from 0V to 1.8V

Attach to slider for 30 seconds: run

arUpdateSlider = function(x) {
 if(x.value) $("#slider2").slider("option", "value", x.value*100);
 if(x.halt) alert("Halting analogRead slider update");
};

doEval(function(callback) {
 var interval = setInterval(function() {
  analogRead(bone.P9_36, callback);
 }, 100);
 
 setTimeout(function() {
  clearInterval(interval);
  callback({'halt':true});
 }, 30000);
}, arUpdateSlider);

Engaging the community

Ask questions the smart way

Why work with community?

 

Why Community?

Why push code to mainline?

 

Why Mainline?

On what do I work with the community?

 

Typical BeagleBone boot process

The five phases

  1. ROM loads u-boot SPL (MLO)
    • Default location is /media/mmcblk0p1/MLO
    • Performs external DRAM configuration
  2. u-boot SPL (MLO) loads u-boot
    • Default location is /media/mmcblk0p1/u-boot.img
  3. u-boot executes default environment/commands
    • Default location is /media/mmcblk0p1/uEnv.txt
    • By default, 'uenvcmd' variable is executed
  4. Commands load kernel
    • Default location is /media/mmcblk0p1/uImage
  5. Kernel reads root file system

Baseline software

http://beagleboard.org/linux

Highlighted community projects

 

Linaro

www.linaro.org

Yocto

www.yoctoproject.org

Giving back!

http://github.com/jadonk/bonescript

Backup slides

 

Services running on BeagleBone

Default web services ready for you to try

The interactivity presented on the previous slide is provided through a set of services running on your BeagleBone. You can experiment with some of these services below. The immediately following slides will provide you with some dynamic information about your BeagleBone.

Other starting point software

http://beagleboard.org/project

Your BeagleBone is currently running the Angstrom Distribution. Below are links to upgrades for Angstrom and various other starting points you might choose for your project.

Programming an SD card

Your get-out-of-jail-free card