Coder Social home page Coder Social logo

beaglebone-spi-uart's Introduction

BeagleBone-SPI-UART

Enables SPI and UART (serial tty*) hardware ports on the BeagleBone Black.

Install

npm install bbio

How to use

On the BeagleBone Black, the SPI ports are both disabled by default, and only the UART0 serial port is accessible via dedicated headers. To easily bypass these limitations, you can use this library in your project, or configure the ports beforehand via the command line interface.

$ node BBIO.js --enable-spi 0
$ node BBIO.js --enable-uart 5

or

var BBIO = require("bbio");
BBIO.SPI.enable(0, function(){});
BBIO.UART.enable(5, function(){});

API

  • BBIO.SPI.enable(index, callback)

Enables the SPI ports on the BeagleBone Black. The index parameter specifies the SPI port to enable. Can be either 0 or 1 (there are only two SPI ports on the BeagleBone Black). Caveat: the HDMI port is inaccessible while the SPI1 is enabled. Be careful! The callback function is invoked after the SPI port is enabled.

  • BBIO.UART.enable(index, callback)

Enables the UART (serial tty*) ports on the BeagleBone Black. The index parameter specifies the UART port to enable. Can be either 1, 2, 4 or 5 (port 0 is enabled by default and has a dedicated header, while port 3 is sort of irrelevant as it can't receive data). The callback function is invoked after the UART port is enabled.

Activate SPI or UART on boot

As of kernel 3.8.13-r23a.17 the SPI or UART overlays can be automatically activated during system startup, if you already enabled them at least once. There is a special uEnv.txt on the boot partition that specifies the user environment setup, with the initial content of optargs=quiet drm.debug=7. To access it:

$ if [ ! -d /mnt/boot ]; then mkdir /mnt/boot; fi
$ mount /dev/mmcblk0p1 /mnt/boot
$ nano /mnt/boot/uEnv.txt

For example, to enable both SPI ports on boot, change the file contents to the following:

optargs=quiet drm.debug=7 capemgr.disable_partno=BB-BONELT-HDMI,BB-BONELT-HDMIN capemgr.enable_partno=BB-SPI1-01,BB-SPI0-01

Caveat: the HDMI port is inaccessible while the SPI1 is enabled. Be careful!

beaglebone-spi-uart's People

Contributors

victorporof avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

beaglebone-spi-uart's Issues

NPM install dies on 3.8 kernel for BBB

Do you have any specifics on what kernel version / BBB image is needed to use this to enable SPI? I used bone-debian-7.9-lxde-4gb-armhf-2015-11-12-4gb.img from a fresh install and I get a ton of errors.

Thanks!

Error Compiling dts source on latest kernel/ubuntu/dtc

root@arm:/home/ubuntu/wattup/src/dts# dtc -O dtb -o BB-SPI0-01-00A0.dtbo -b 0 -@ -I dts BB-SPI0-01-00A0.dts
Error: BB-SPI0-01-00A0.dts:5.1-2 syntax error
FATAL ERROR: Unable to parse input tree
root@arm:/home/ubuntu/wattup/src/dts# dtc -v
Version: DTC 1.4.0-gf345d9e4
root@arm:/home/ubuntu/wattup/src/dts# uname -a
Linux arm 3.8.13-bone63 #2 SMP Sat Aug 16 00:01:36 PDT 2014 armv7l armv7l armv7l GNU/Linux
root@arm:/home/ubuntu/wattup/src/dts# lsb_release -a
LSB Version: core-2.0-armhf:core-2.0-noarch:core-3.0-armhf:core-3.0-noarch:core-3.1-armhf:core-3.1-noarch:core-3.2-armhf:core-3.2-noarch:core-4.0-armhf:core-4.0-noarch:core-4.1-armhf:core-4.1-noarch:security-4.0-armhf:security-4.0-noarch:security-4.1-armhf:security-4.1-noarch
Distributor ID: Ubuntu
Description: Ubuntu 14.04.1 LTS
Release: 14.04
Codename: trusty

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.