Wiring an LED Guide for BeagleBone (Black/Green) Table of Contents. by Brian Fraser Last update: November 16, Target Linux Kernel: 4.

Similar documents
How to connect the LCD screen

Assignment 1: Build Environment

NGS IoT Bone (rev. MRF-1)

Development Environment Embedded Linux Primer Ch 1&2

I2C Guide: 14-Seg Display. Table of Contents. by Brian Fraser Last update: June 8, 2018

Zen Cape Audio Guide. Table of Contents. by Brian Fraser Last update: June 26, 2018

1/Build a Mintronics: MintDuino

CODESYS Control for BeagleBone SL

Assembly Instructions for 128x64 Graphics Display Unit

This guide is used as an entry point into the Petalinux tool. This demo shows the following:

Quick Start Guide for BeagleBone. Table of Contents. by Brian Fraser Last update: Sept 24, 2017

EE 354 August 1, 2017 Assembly of the AT89C51CC03 board

Internet Of Things You Search. IOTCape User manual IOTYS SARL All rights reserved IOTCape - User manual Page 1 of 17

USB Type A Female Breakout Hookup Guide

IoT with Intel Galileo Gerardo Carmona. makerobots.tk

Gooligum Electronics 2015

Zero2Go. User Manual (revision 1.03) Wide Input Range Power Supply for Your Raspberry Pi. Copyright 2017 UUGear s.r.o. All rights reserved.

Supporting 200 different expansionboards. The broken promise of device tree

ABOUT THE DEVICE TREE

December 1, 2015 Jason Kridner

ARDUINO MINI 05 Code: A000087

96Boards UART Adapter User Guide

UF-3701 Power Board Construction Guide

INDEX. Analog Board Boot and Voltage Test 2 Testing Input Channels 3 Testing Output Channels 4

PiRyte Mini ATX PSU Revision User Manual

Java_Embedded_Open_Onli...

VirtualSCADA VSU-485G USB to RS422/485 Isolated Converter User Manual

Sidewinder Development Board rev 1.0

The DVT Ethernet IO Module (CON-IOE)

Linux. For BCT RE2G2. User Guide. Document Reference: BCTRE2G2 Linux User Guide. Document Issue: Associated SDK release: 1.

Getting started with your DGH module:

Panther. CNC Cape for Beaglebone Black. Users Manual. Version 1.1. Warning!

Kvaser PC104+ User's Guide

F28HS Hardware-Software Interface: Systems Programming

Pi PoE Switch HAT Quick Start And FAQ. Getting started. Kit contents

Replicape Rev B 3D printer controller board

OPT3001EVM Linux Getting Started Guide. Felipe Balbi

Physics E-1bxl and PS3 Lab 4: Neuron Model 2016

Micro USB Lamp Kit ESSENTIAL INFORMATION. Version 2.0 DESIGN A STYLISH LAMP WITH THIS

Experimental Procedure

Thursday, September 15, electronic components

ATTENTION: OBSERVE PRECAUTIONS FOR HANDLING ESD-SENSITIVE DEVICES

Quick Start XLe Source Expansion Kit

Instruction Guide. 2 Channel Ultra ATA/100 PCI Card PCI2IDE100. The Professionals Source For Hard-to-Find Computer Parts. Revised: December 5, 2002

Foundation Fieldbus Hardware and NI-FBUS Software for Windows 2000/XP

Matrix-700 Linux-Ready Cortex-A5 Industry IoT Gateway Hardware Guide

How-To: Make an RGB combination door lock (Part 1)

Kvaser PCI104 User's Guide

Lab 0: Wire Wrapping Project: Counter Board

DATASHEET. 4D 4.3 LCD CAPE Beagle Bone Black 4.3 LCD CAPE. Document Date: 3 rd February 2014 Document Revision: 1.9

TQ2440 Development Platform Manual

Dialogic Voice Board & Driver Installation

Click-A-Tune. User Manual

PXI The PXI-8210 is a Fast Ethernet/Ultra Wide SCSI interface for the PXI/CompactPCI bus.

Videum Duo & Quattro Xpress

The following file is used for updating the boot loader: xboot.bin: XSTREAM development platform boot loader image

Tech Note 16 XDS220 I/O Interface

(310254) Semester VI

MOTION COORDINATOR MC403 / MC403-Z Quick Connection Guide

User's Manual. USB 2.0 Audio PCA with 16 Bit I/O, 4 x 4 Audio Mixer

xpico Wi-Fi Embedded Device Server Evaluation Kit User Guide

Update Instructions for V4.9.x.xxx V Vi1 and Vi2/4/6 consoles

Pandora Assembly Instructions With Diamond Systems PC/104 CPUs (Athena, Elektra and Prometheus) November, 2006

xpico 110 Wired Device Server Module Evaluation Kit User Guide

UTS485 & ULOG485 USB Converter Owner's Manaul

Issue : 1.1 Date : 19/1/2004. Trigger IO. C-Cam Technologies. a division of. Vector International 1 / 6

Delta T Dew Heater for CDK

Adafruit Metro Mini. Created by lady ada. Last updated on :12:28 PM UTC

MCS-TOUCHSCREEN Auto Disk Clean up

Kvaser PCIcanx II User's Guide

Grayhill 3Dxx Display Products. Setup and Usage with CoDeSys Development Software

PiRyte Mini ATX PSU Revision 1.0 User Manual

into the EMU E4 Classic and E4 Platinum Samplers

Digital Circuits. Page 1 of 5. I. Before coming to lab. II. Learning Objectives. III. Materials

Shack Clock kit. U3S Rev 2 PCB 1. Introduction

Lab 2.2 Ohm s Law and Introduction to Arduinos

SPECIAL INSTRUCTIONS FOR CAPACITORS COMPACT GENERATORS

Panther. CNC Cape for Beaglebone Black. Users Manual. Version 1.2. Warning!

Discharge by touching: BNC coax shield, outlet metal cover plate, wire connected to GND

ULTIMATE CART FIRMWARE UPGRADE GUIDE

ATARI ST IDE - INTERFACE V2.00 SINGLE SIDED VERSION PCB Version 1.4 Documentation 19. November 2008

UTS400 series USB Converter

Kvaser PCIcan II User's Guide

Mark Schutzer December 9, 2007 (updated fix for older rev B and C ProCabs)

Installation Instructions. Ecast Mojo B75B Motherboard Upgrade Kit Kit #

PCB-STM32-F3U. Development baseboard for the STMicro Discovery-F3 module (STMicro part# STM32F3DISCOVERY)

Schematic Diagram: R2,R3,R4,R7 are ¼ Watt; R5,R6 are 220 Ohm ½ Watt (or two 470 Ohm ¼ Watt in parallel)

RS-232 Driver Module

Building and using JasperMIDI

DATASHEET. 4D 7.0 LCD CAPE Beagle Bone Black 7.0 LCD CAPE. Document Date: 3 rd February 2014 Document Revision: 1.2

COS 116 The Computational Universe Laboratory 7: Digital Logic I

PCI/PXI Gigabit Ethernet Adapters

USB-to-I2C Basic. Hardware User s Manual.

Adafruit DPI Display Kippah

EAN-GPIO and I 2 C. PN: EAN-GPIO-and-I 2 C 2/28/2018. SightLine Applications, Inc.

Network Controller. Installation/Troubleshooting Instructions NK220 COM1131C

MicroTech III Water Source Heat Pump BACnet MS/TP Communication Module

MP3 Trigger v2 User Guide

Grand Central Soundboard in Ten Minutes Created by Mike Barela. Last updated on :11:24 PM UTC

PCS-2. Universal Infrared Remote PC Power Switch

Transcription:

Wiring an LED Guide for BeagleBone (Black/Green) by Brian Fraser Last update: November 16, 2017 Target Linux Kernel: 4.4 This document guides the user through: 1. Wiring an LED on P9.23 & controlling it via GPIO on BeagleBone Black/Green. 2. Controlling the LED via Linux kernel s LED support. Table of Contents 1. Wiring an LED...2 2. Drive LED via GPIO...4 3. Device Tree: Enabling the LED...4 4. Driving the LEDs...5 5. Device Tree Source (LED_P9_23.dts)...6 6. LED Wiring Photos...7 Formatting: 1. Host (desktop) commands starting with $ are Linux console commands: $ echo "Hello world" 2. Target (board) commands start with #: # echo "On embedded board" 3. Almost all commands are case sensitive. Revision History: Nov 16: Initial version for Kernel 4.4.

1. Wiring an LED 1. Critical tips: Do all your wiring and wiring changes with the power to the BeagleBone turned off (safest!) Try to have some space between the components you place on the breadboard to prevent them from unexpectedly shorting (touching the wire leads). For example, on the breadboard, wire your resistor into column A, and your LED into column E so that they don t touch. Avoid static! Before working on the components, try grounding yourself by touching some unpainted metal on your computer, such as the USB port. 2. Turn power off to BeagleBone. 3. If not done so already, place breadboard onto plastic mounting plate beside the BeagleBone. Peal off the paper on the back of the breadboard to allow it to stick to the mounting plate. 4. Understand the LED circuit in Schematic 1: P9.23 is the BealgeBone s GPIO port, configured as output. When P9.23 is set to high (1) it s 3.3V (same voltage as voltage source on top) so no current flows through circuit. (Current needs a voltage differential to push it). Therefore the LED is off. When P9.23 is set to low (0) it s 0V, so current flows from 3.3V to 0V, through the current limiting resistor. On the way, it flows through the LED and lights it up. Therefore, this circuit is active-low. Schematic 1: Active-low LED circuit.

Diagram 1: BeagleBone and breadboard with LED wiring. 5. Wire up the circuit as shown in in Diagram 1 and photos at end of guide. In the diagram, the Ethernet connector on the BeagleBone is at the top; P9 is on the left. Unplug power (micro-usb) from the BeagleBone. Connect BBG s power pin (P9.3 is +3.3V) to + rail of your breadboard. Insert your LED into two rows of the breadboard as shown. NOTE: Longer lead (end) of LED is where current must flow in; in the diagram it is on top, connecting to the resistor. Connect 470 Ohm resistor between + rail of breadboard to longer lead of LED. It does not matter the orientation of the resistor. Connect shorter lead of LED to P9.23 on BeagleBone via a jumper. 6. Troubleshooting: Double check your circuit: P9.3 is +3.3V, connected to + rail of your breadboard. Resistor connects + rail of breadboard to longer lead of LED. Jumper connects shorter lead of LED to P9.23. Ensure you have your BeagleBone oriented the correct way (i.e., you re using P9 not P8). Remember that for row 1 on the breadboard, holes a, b, c, d, and e are all shorted together. For example, you can connect the LED to a resistor by plugging the pin of the LED into row 17 pin e, and one end of the resistor into row 17 pin b.

2. Drive LED via GPIO The LED is wired to P9.23, which is Linux GPIO number 49. 1. Boot your BeagleBone. Any kernel version should be OK (need not be 4.4+). Note that when powering on, the LED may turn on dimly due to an internal pull-down resistor on the CPU when the pin is configured for input (default). 2. Enable the pin for GPIO: # echo 49 > /sys/class/gpio/export 3. Change to folder # cd /sys/class/gpio/gpio49 4. Set direction # echo out > direction 5. Turn on/off: It is active low, so turn on with: # echo 0 > value And turn off with # echo 1 > value 6. Troubleshooting: See the GPIO guide for more information on how to setup and troubleshoot GPIO pins. If you turn on the LED and the LED does not light up, double check your circuit. 3. Device Tree: Enabling the LED For Linux to treat the LED as an LED to be controlled via the kernel s LED support (vs a GPIO pin), we must load a device tree using the cape manage. Do all the following on the target. 1. Reboot your beaglebone and load a Linux 4.4+ kernel; if you previously had the pin mapped for GPIO it can interfere with the LED driver, even if you unexport the pin. 2. Download the file LED_P9_23.dts from the course website: # wget http://www.cs.sfu.ca/cc/433/bfraser/other/guide-code/led_p9_23.dts This requires an internet connection. Alternatively, you could wget the file on the host and then copy it to the target via NFS. 3. Compile the device tree source (.dts) file into a blob object file (.dtbo): # dtc -O dtb -o LED_P9_23-00A0.dtbo -b 0 -@ LED_P9_23.dts 4. Deploy the.dtbo file to the target's /lib/firmware folder: # cp LED_P9_23-00A0.dtbo /lib/firmware 5. Using the cape manager, enable this cape: # export SLOTS=/sys/devices/platform/bone_capemgr/slots # echo LED_P9_23 > $SLOTS You can see what happened by checking dmesg: # dmesg [..] bone_capemgr bone_capemgr: part_number 'LED_P9_23', version 'N/A' [..] bone_capemgr bone_capemgr: slot #4: override [..] bone_capemgr bone_capemgr: Using override eeprom data at slot 4 [..] bone_capemgr bone_capemgr: slot #4: 'Override Board Name,00A0,Override Manuf,LED_P9_23' [..] bone_capemgr bone_capemgr: slot #4: dtbo 'LED_P9_23-00A0.dtbo' loaded; overlay id #0

6. Check listed capes (slot numbers may vary): # cat $SLOTS 0: PF---- -1 1: PF---- -1 2: PF---- -1 3: PF---- -1 4: P-O-L- 0 Override Board Name,00A0,Override Manuf,LED_P9_23 7. Troubleshooting If the cape overlay loads but you are unable to control the LED, try rebooting the board, and ensure you are loading a v4.4+ Linux kernel. This overlay may not work with older kernels (such as the one that may be pre-installed on your BeagleBone). Check kernel version with: # uname -r 4.4.95-bfraser-bone19 Check dmesg for any error messages when loading the cape overlay. 4. Driving the LEDs You must have installed the LED driver (previous section) for this section to work. 1. List all files in the /sys/class/leds/ directory: # ls /sys/class/leds/ beaglebone:green:usr0 beaglebone:green:usr1 beaglebone:green:usr2 beaglebone:green:usr3 leds:p9.23 2. Change to the new LED s folder: # cd /sys/class/leds/leds\:p9.23 Note that you cannot just type ':' in a path, you must escape it. 3. Change the trigger to a heartbeat: # echo heartbeat > trigger It should now be flashing. If not, double check your wiring. 4. Manually turn on/off the LED: # echo none > trigger # echo 1 > brightness # echo 0 > brightness Note that the device tree was created for an active low LED circuit. Therefore, the logic for controlling this LED is not inverted (i.e., writing a 1 turns on, 0 turns off).

5. Device Tree Source (LED_P9_23.dts) Here is the device tree source file used. You need not know its internal structure. /* * Configure P9_23 ("gpio1_17", Linux pin #47) to be an LED in Linux * Based on: https://github.com/nomel/beaglebone/blob/master/led-header/generated/led-p9.23-00a0.dts * Written by Brian Fraser; released under GPL and BSD. * * Updated Nov 2017 for Kernel 4.4: Change "gpio2" to "gpio1" for gpios entry. * * Compile with: * dtc -O dtb -o LED_P9_23-00A0.dtbo -b 0 -@ LED_P9_23.dts * Copy the.dtbo to /lib/firmware * cp LED_P9_23-00A0.dtbo /lib/firmware * Load with: * echo LED_P9_23 > /sys/devices/platform/bone_capemgr/slots * Use like any Linux LEDs via /sys/class/leds/leds:p9.23/... */ /dts-v1/; /plugin/; / { compatible = "ti,beaglebone", "ti,beaglebone-black"; /* identification */ part-number = "led-p9.23"; /* version = "00A0"; */ /* state the resources this cape uses */ exclusive-use = /* the pin header uses */ "P9.23", /* the hardware IP uses */ "gpio1_17"; /* rxdisable_pullnone state */ fragment@0 { target = <&am33xx_pinmux>; overlay { gpio_p9_23_rxdisable_pullnone: pinmux_gpio_p9.23_rxdisable_pullnone { pinctrl-single,pins = < 0x44 0xf >; fragment@1 { target = <&ocp>; overlay { led_p9.23_helper { compatible = "gpio-leds"; pinctrl-names = "default"; pinctrl-0 = <&gpio_p9_23_rxdisable_pullnone>; leds-p9.23 { label = "leds:p9.23"; gpios = <&gpio1 17 1>; /* flag 1 means active low */ linux,default-trigger = "none"; default-state = "off";

6. LED Wiring Photos