Difference between revisions of "Userspace Arduino"
(→HTTP post) |
|||
(57 intermediate revisions by 6 users not shown) | |||
Line 1: | Line 1: | ||
− | + | <div style="margin:0; margin-top:10px; margin-right:10px; border:1px solid #dfdfdf; padding:0 1em 1em 1em; background-color:#ffffcc; align:right; "> | |
+ | '''GitHub page for the Userspace Arduino project:''' | ||
+ | * [https://github.com/prpplague/Userspace-Arduino Userspace Arduino Repo] | ||
+ | '''Development Blogs for the Userspace Arduino project:''' | ||
+ | * [http://prpplague.github.io/Energia/ Primary Blog] for work on the project | ||
+ | * [http://meanbot.wordpress.com/ Parav Nagarsheth's Blog] about his work on the project | ||
+ | * [http://anujdeshpande.wordpress.com/ Anuj Deshpande's Blog] about his work on the project | ||
+ | </div> | ||
+ | <br /> | ||
+ | A Getting Started guide on compiling and executing "Arduino code" on embedded Linux boards. | ||
+ | <br /> | ||
+ | = Getting Started = | ||
+ | == new Debian images == | ||
+ | The [http://beagleboard.org/latest-images latest Debian images] for BeagleBone Black include the [https://github.com/prpplague/Userspace-Arduino Userspace Arduino libraries] and can be programmed from the Cloud9 IDE. Save the file with the extension .ino and click "Run" to build and run your sketch. To have your sketch run on bootup, drag it into the "autorun" folder. | ||
+ | == old-style == | ||
+ | Unlike the "standard" way of developing for the Arduino boards, we only have the [https://github.com/prpplague/Userspace-Arduino libraries] ready at the moment (The IDE is still under development). In short, you'll have to use your own editor for writing code. | ||
+ | <br />Currently there are 2 methods to compile and execute Arduino code on the BeagleBone Black. | ||
+ | # [[#native | Native compilation]] | ||
+ | # [[#cross | Cross compilation]] | ||
− | = | + | ==<span id="native">Native Compilation</span>== |
+ | You won't have to install any toolchain. | ||
+ | <p> Connect to your BeagleBone Black using ssh. Make sure that you have internet access on your BBB.</p> | ||
+ | ===Clone repo=== | ||
+ | * Clone the repo from the GitHub project page | ||
+ | git clone http://github.com/prpplague/Userspace-Arduino.git | ||
− | == | + | === Running a demo === |
+ | Running Blink LED program: | ||
+ | <pre> | ||
+ | cd Userspace-Arduino/arduino-makefile/examples/BlinkUserspace | ||
+ | make | ||
+ | </pre> | ||
+ | * A binary BlinkUserspace.elf should be created in a directory build-userspace | ||
+ | cd build-userspace | ||
+ | ./BlinkUserspace.elf | ||
+ | * You will now see USR LED 1 blinking at one second intervals. Press Ctrl-C to break from the loop. | ||
− | * | + | ==<span id="cross">Cross Compilation</span>== |
− | * | + | ===Install toolchain=== |
− | * | + | *You will need the Angstrom cross compilation toolchain for the BeagleBone Black. |
− | * | + | *Run the following commands on your host machine (i.e. laptop/PC) |
− | * | + | <pre> |
+ | ~$ wget http://www.angstrom-distribution.org/toolchains/angstrom-2011.03-x86_64-linux-armv7a-linux-gnueabi-toolchain.tar.bz2 | ||
+ | ~$ sudo tar -C / -xjf angstrom-2011.03-x86_64-linux-armv7a-linux-gnueabi-toolchain.tar.bz2 | ||
+ | ~$ export PATH=/usr/local/angstrom/arm/bin:$PATH | ||
+ | ~$ export CROSS_COMPILE=arm-angstrom-linux-gnueabi- | ||
+ | </pre> | ||
+ | <br /> | ||
+ | Links to 64 and 32 bit versions of Angstrom toolchain. | ||
+ | * [http://www.angstrom-distribution.org/toolchains/angstrom-2011.03-x86_64-linux-armv7a-linux-gnueabi-toolchain.tar.bz2 x86_64-linux-armv7a-linux-gnueabi-toolchain] | ||
+ | * [http://www.angstrom-distribution.org/toolchains/angstrom-2011.03-i686-linux-armv7a-linux-gnueabi-toolchain.tar.bz2 i686-linux-armv7a-linux-gnueabi-toolchain] | ||
+ | <br /> | ||
+ | ===Clone repo=== | ||
+ | * Clone the repo from https://github.com/prpplague/Userspace-Arduino | ||
+ | git clone https://github.com/prpplague/Userspace-Arduino.git | ||
+ | <br /> | ||
+ | ===Running a demo === | ||
+ | <br> | ||
+ | Running Blink LED program: | ||
+ | <pre> | ||
+ | cd Userspace-Arduino/arduino-makefile/examples/BlinkUserspace | ||
+ | make | ||
+ | </pre> | ||
+ | * A binary BlinkUserspace.elf should be created in a directory build-userspace | ||
+ | * To upload the created binary file, do | ||
+ | <pre> | ||
+ | make upload | ||
+ | </pre> | ||
+ | * You will now see USR LED 1 blinking at one second intervals. Press Ctrl-C to break from the loop. | ||
+ | * Check out some of the examples in /path/to/Userscape-Arduino/Arduino-Makefile/examples. | ||
+ | ** [http://github.com/prpplague/Userspace-Arduino/blob/master/arduino-makefile/examples/HelloWorldUserspace/HelloWorldUserspace.ino HelloWorldUserspace] | ||
+ | ** [http://github.com/prpplague/Userspace-Arduino/blob/master/arduino-makefile/examples/BlinkUserspace/BlinkUserspace.ino BlinkUserspace] | ||
+ | ** [http://github.com/prpplague/Userspace-Arduino/blob/master/arduino-makefile/examples/BaconDemo/BaconDemo.ino BaconDemo] | ||
+ | ** [https://github.com/prpplague/Userspace-Arduino/blob/master/arduino-makefile/examples/7segment/7segment.ino 7segment] | ||
+ | **[https://github.com/prpplague/Userspace-Arduino/blob/master/arduino-makefile/examples/PWM/PWM.ino PWM] | ||
− | == | + | == Setup SSH keys (optional) == |
− | * | + | * If you want to avoid a password prompt, you can set up the ssh keys for the Beaglebone Black: |
− | + | cd ~/.ssh | |
− | + | ssh-keygen -t dsa #set a password or you can leave it blank | |
− | + | ssh-copy-id -i ~/.ssh/id_dsa.pub root@$192.168.7.2 # replace id_dsa.pub by your public key file if some other name is given | |
− | + | ssh root@192.168.7.2 # login and enter password once | |
− | + | Here after, you won't be prompted for a password from this machine | |
+ | <br /> | ||
− | = | + | = Examples = |
− | + | Each of these examples have their own detailed wiki pages: | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | * [[Userspace_Arduino:BlinkUserspace|BlinkUserspace]] | |
+ | * [[Userspace Arduino:BlinkWithoutDelay|Blink Without Delay]] | ||
+ | * [[Userspace Arduino:AnalogReadSerial|AnalogReadSerial]] | ||
− | + | = Boards Supported = | |
− | * | + | <br /> |
+ | == Beaglebone Black == | ||
+ | Initial development is being done with the Beaglebone Black and the [[Bacon Cape]] | ||
+ | * if you have your Beaglebone Black loaded with a firmware image older that 07.11.2013, you will need copy the [[media:BB-BONE-BACONE-00A0.dtbo|Bacon Cape dtbo file]] on to your beaglebone black | ||
+ | <pre> | ||
+ | ~# scp ~/Downloads/BB-BONE-BACONE-00A0.dtbo root@192.168.7.2:/lib/firmware/BB-BONE-BACONE-00A0.dtbo | ||
+ | </pre> | ||
− | = | + | {| border="1" cellspacing="0" cellpadding="5" |
+ | |- style="background:#CCCCCC" | ||
+ | ! style="width:100px" | Arduino Pin | ||
+ | ! style="width:400px" | BBB Header Pin | ||
+ | ! style="width:200px" | Function | ||
+ | ! style="width:200px" | Alternate Function | ||
+ | |- align="center" | ||
+ | | 0 | ||
+ | | P9_11 | ||
+ | | UART (RXD) | ||
+ | | | ||
+ | |- align="center" | ||
+ | | 1 | ||
+ | | P9_13 | ||
+ | | UART (TXD) | ||
+ | | | ||
+ | |- align="center" | ||
+ | | 2 | ||
+ | | P9_15 | ||
+ | | GPIO | ||
+ | | | ||
+ | |- align="center" | ||
+ | | 3 | ||
+ | | P9_14 | ||
+ | | PWM | ||
+ | | | ||
+ | |- align="center" | ||
+ | | 4 | ||
+ | | P9_12 | ||
+ | | GPIO | ||
+ | | | ||
+ | |- align="center" | ||
+ | | 5 | ||
+ | | P9_16 | ||
+ | | PWM | ||
+ | | | ||
+ | |- align="center" | ||
+ | | 6 | ||
+ | | P9_42 | ||
+ | | PWM | ||
+ | | | ||
+ | |- align="center" | ||
+ | | 7 | ||
+ | | P8_19 | ||
+ | | GPIO | ||
+ | | PWM | ||
+ | |- align="center" | ||
+ | | 8 | ||
+ | | P9_19 | ||
+ | | I2C (SCL) | ||
+ | | | ||
+ | |- align="center" | ||
+ | | 9 | ||
+ | | P9_20 | ||
+ | | I2C (SDA) | ||
+ | | | ||
+ | |- align="center" | ||
+ | | 10 | ||
+ | | P9_17 | ||
+ | | GPIO | ||
+ | | SPI_CS0 | ||
+ | |- align="center" | ||
+ | | 11 | ||
+ | | P9_18 | ||
+ | | GPIO | ||
+ | | SPI_MOSI | ||
+ | |- align="center" | ||
+ | | 12 | ||
+ | | P9_21 | ||
+ | | SPI_MISO | ||
+ | | | ||
+ | |- align="center" | ||
+ | | 13 | ||
+ | | P9_22 | ||
+ | | GPIO | ||
+ | | SCK | ||
+ | |- align="center" | ||
+ | | 14 | ||
+ | | USR LED 0 | ||
+ | | LED | ||
+ | | | ||
+ | |- align="center" | ||
+ | | 15 | ||
+ | | USR LED 1 | ||
+ | | LED | ||
+ | | | ||
+ | |- align="center" | ||
+ | | 16 | ||
+ | | USR LED 2 | ||
+ | | LED | ||
+ | | | ||
+ | |- align="center" | ||
+ | | 17 | ||
+ | | USR LED 3 | ||
+ | | LED | ||
+ | | | ||
+ | |- align="center" | ||
+ | | 18 | ||
+ | | P9_33 | ||
+ | | AIN4 | ||
+ | | | ||
+ | |- align="center" | ||
+ | | 19 | ||
+ | | P9_35 | ||
+ | | AIN6 | ||
+ | | | ||
+ | |- align="center" | ||
+ | | 20 | ||
+ | | P9_36 | ||
+ | | AIN5 | ||
+ | | | ||
+ | |- align="center" | ||
+ | | 21 | ||
+ | | P9_37 | ||
+ | | AIN2 | ||
+ | | | ||
+ | |- align="center" | ||
+ | | 22 | ||
+ | | P9_38 | ||
+ | | AIN3 | ||
+ | | | ||
+ | |- align="center" | ||
+ | | 23 | ||
+ | | P9_39 | ||
+ | | AIN0 | ||
+ | | | ||
+ | |- align="center" | ||
+ | | 24 | ||
+ | | P9_40 | ||
+ | | AIN1 | ||
+ | | | ||
+ | |} | ||
+ | <br /> | ||
− | * | + | == MinnowBoard == |
− | * | + | * Initial support started |
− | * | + | * Need Lure accessory board for testing |
− | + | <br /> | |
+ | == Raspberry Pi == | ||
+ | * support planned | ||
+ | * will use [[RPi_Gertboard]] for initial development | ||
+ | <br /> | ||
+ | *[[Userspace_Arduino:To Do]] | ||
+ | *[[Userspace_Arduino:Libraries]] | ||
+ | <br /> | ||
+ | [[Category:Arduino]] | ||
+ | [[Category: RaspberryPi]] | ||
+ | [[Category: MinnowBoard]] | ||
+ | [[Category: BeagleBoard]] | ||
+ | [[Category: Userspace_Arduino]] |
Latest revision as of 23:16, 18 June 2014
GitHub page for the Userspace Arduino project:
Development Blogs for the Userspace Arduino project:
- Primary Blog for work on the project
- Parav Nagarsheth's Blog about his work on the project
- Anuj Deshpande's Blog about his work on the project
A Getting Started guide on compiling and executing "Arduino code" on embedded Linux boards.
Getting Started
new Debian images
The latest Debian images for BeagleBone Black include the Userspace Arduino libraries and can be programmed from the Cloud9 IDE. Save the file with the extension .ino and click "Run" to build and run your sketch. To have your sketch run on bootup, drag it into the "autorun" folder.
old-style
Unlike the "standard" way of developing for the Arduino boards, we only have the libraries ready at the moment (The IDE is still under development). In short, you'll have to use your own editor for writing code.
Currently there are 2 methods to compile and execute Arduino code on the BeagleBone Black.
Native Compilation
You won't have to install any toolchain.
Connect to your BeagleBone Black using ssh. Make sure that you have internet access on your BBB.
Clone repo
- Clone the repo from the GitHub project page
git clone http://github.com/prpplague/Userspace-Arduino.git
Running a demo
Running Blink LED program:
cd Userspace-Arduino/arduino-makefile/examples/BlinkUserspace make
- A binary BlinkUserspace.elf should be created in a directory build-userspace
cd build-userspace ./BlinkUserspace.elf
- You will now see USR LED 1 blinking at one second intervals. Press Ctrl-C to break from the loop.
Cross Compilation
Install toolchain
- You will need the Angstrom cross compilation toolchain for the BeagleBone Black.
- Run the following commands on your host machine (i.e. laptop/PC)
~$ wget http://www.angstrom-distribution.org/toolchains/angstrom-2011.03-x86_64-linux-armv7a-linux-gnueabi-toolchain.tar.bz2 ~$ sudo tar -C / -xjf angstrom-2011.03-x86_64-linux-armv7a-linux-gnueabi-toolchain.tar.bz2 ~$ export PATH=/usr/local/angstrom/arm/bin:$PATH ~$ export CROSS_COMPILE=arm-angstrom-linux-gnueabi-
Links to 64 and 32 bit versions of Angstrom toolchain.
Clone repo
- Clone the repo from https://github.com/prpplague/Userspace-Arduino
git clone https://github.com/prpplague/Userspace-Arduino.git
Running a demo
Running Blink LED program:
cd Userspace-Arduino/arduino-makefile/examples/BlinkUserspace make
- A binary BlinkUserspace.elf should be created in a directory build-userspace
- To upload the created binary file, do
make upload
- You will now see USR LED 1 blinking at one second intervals. Press Ctrl-C to break from the loop.
- Check out some of the examples in /path/to/Userscape-Arduino/Arduino-Makefile/examples.
Setup SSH keys (optional)
- If you want to avoid a password prompt, you can set up the ssh keys for the Beaglebone Black:
cd ~/.ssh ssh-keygen -t dsa #set a password or you can leave it blank ssh-copy-id -i ~/.ssh/id_dsa.pub root@$192.168.7.2 # replace id_dsa.pub by your public key file if some other name is given ssh root@192.168.7.2 # login and enter password once
Here after, you won't be prompted for a password from this machine
Examples
Each of these examples have their own detailed wiki pages:
Boards Supported
Beaglebone Black
Initial development is being done with the Beaglebone Black and the Bacon Cape
- if you have your Beaglebone Black loaded with a firmware image older that 07.11.2013, you will need copy the Bacon Cape dtbo file on to your beaglebone black
~# scp ~/Downloads/BB-BONE-BACONE-00A0.dtbo root@192.168.7.2:/lib/firmware/BB-BONE-BACONE-00A0.dtbo
Arduino Pin | BBB Header Pin | Function | Alternate Function |
---|---|---|---|
0 | P9_11 | UART (RXD) | |
1 | P9_13 | UART (TXD) | |
2 | P9_15 | GPIO | |
3 | P9_14 | PWM | |
4 | P9_12 | GPIO | |
5 | P9_16 | PWM | |
6 | P9_42 | PWM | |
7 | P8_19 | GPIO | PWM |
8 | P9_19 | I2C (SCL) | |
9 | P9_20 | I2C (SDA) | |
10 | P9_17 | GPIO | SPI_CS0 |
11 | P9_18 | GPIO | SPI_MOSI |
12 | P9_21 | SPI_MISO | |
13 | P9_22 | GPIO | SCK |
14 | USR LED 0 | LED | |
15 | USR LED 1 | LED | |
16 | USR LED 2 | LED | |
17 | USR LED 3 | LED | |
18 | P9_33 | AIN4 | |
19 | P9_35 | AIN6 | |
20 | P9_36 | AIN5 | |
21 | P9_37 | AIN2 | |
22 | P9_38 | AIN3 | |
23 | P9_39 | AIN0 | |
24 | P9_40 | AIN1 |
MinnowBoard
- Initial support started
- Need Lure accessory board for testing
Raspberry Pi
- support planned
- will use RPi_Gertboard for initial development