libpruio  0.6.8
Fast and easy Digital/Analog Input/Output for Beaglebones
dts_universal.bas File Reference

Tool for creating an universal device tree overlay (run-time pinmuxing) More...

#include "pruiotools.bas"
#include "P8.bi"
#include "P9.bi"
#include "JT.bi"
#include "SD.bi"
Include dependency graph for dts_universal.bas:

Go to the source code of this file.

Macros

#define FILE_NAME   /* "libpruio" */
 The file name.
 
#define VERS_NAME   /* "00A0" */
 The version.
 

Variables

VAR TARG_PATH = "/lib/firmware/"
 The folder where to place the compiled overlay binary.
 
VAR COMPATIBL = "ti,beaglebone-black"
 The BB model.
 

Detailed Description

Tool for creating an universal device tree overlay (run-time pinmuxing)

This file contains the FB source code for a helper tool creating an universal device tree overlay. Adapt this code for your needs, compile it and run the executable. This will create a device tree overlay source file in the current directory, and, if you execute the binary with root privileges, this overlay gets compiled and installed in the specified directory (usually /lib/firmware).

The created universal overlay provides pinmuxing capability at run-time. The user can choose from a set of reasonable predefined pin configurations (modes). Root privileges are required to change the mode.

In order to create predefined (standard) overlays, compile the code by executing

fbc -w all dts_universal.bas

and run the executable

./dts_universal

This will create an overlay for the BeagleboneBlack with the source file named libpruio-00A0.dts in the current directory.

In order to create and install that overlay, execute with root privileges and add the destination path as parameter

sudo ./dts_universal /lib/firmware

Such an (complete) overlay wont load since there're conflicts with pins claimed for the board. In order to free those pins, specify your BeagleBone model as second parameter

sudo ./dts_universal /lib/firmware BBW

The available models are

  • BBW for BeagleboneWhite (EMMC2_Pins freed)
  • BBG for BeagleboneGreen (EMMC2_Pins freed)
  • ALL for experimental use (no pins freed)
  • default is BeagleboneBlack

If you want to free further pins (ie. to solve conflicts with a cape), you can adapt the source code before compiling and running the tool. In the code, first, the pin modes for all header pins get specified in files P8.bi, P9.bi and JTag.bi (all header pins get declared). Then the code frees unwanted pins, either by deleting the configurations for a pin group (defined in pruio_pins.bi) by a line like

PIN_DEL(HDMI_Pins)

or you can free a single pin by deleting its declaration by a line like

M(P9_41) = ""

Once you adapted the code to your needs, compile and run it by

fbc -w all dts_universal.bas
sudo ./dts_universal /lib/firmware

Then load the overlay by (kernel <= 3.8)

sudo su
echo libpruio > /sys/devices/bone_capemgr.?/slots
exit

or on kernel versions > 3.8

sudo su
echo libpruio > /sys/devices/platform/bone_capemgr/slots
exit

(Or execute this echo ... command in your boot sequence. Or use capemgr to load the overlay. See Pinmuxing for further information.)

Note
The universal overlays are experimental! There's a bug in the device tree compiler. Its number of pin configurations is limited and no error message or warning gets generated when reaching the limit. So double check the results! You may have to split a big overlay in two peaces.

Licence: GPLv3, Copyright 2014-2023 by Thomas{ doT ]Freiherr[ At ]gmx[ DoT }net

Since
0.2

Definition in file dts_universal.bas.