Instructions for creating a custom cape

723 views
Skip to first unread message

Deepak Sekar

unread,
Dec 29, 2014, 3:14:00 PM12/29/14
to machi...@googlegroups.com

Thought the below stuff would be useful to new users of Machinekit... 

--------------------------------------------------------------------------------------------------------


Instructions for Creating a Custom Cape (eg. For making a touchscreen/display work with a Machinekit-controlled device)

Acknowledgements: Many thanks to Charles Steinkuehler, Michael Haberler and many others for the suggestions they gave when I was ramping up on Machinekit and trying to build a custom cape.


A typical Machinekit setup such as CRAMPS utilizes a universal cape which allows the user to utilize all pins not used by HDMI and eMMC. However, when a display/touchscreen (eg. the 4D Systems ones) is used for the UI, it uses up certain additional pins and loads a cape of its own – this can cause “pin conflicts” with the universal cape. A solution for this is to create a custom cape in place of the universal cape that configures only the pins not utilized by the touchscreen, HDMI and eMMC. Steps for this are:


Step 1:

Download universal-cape's DTS file


Since we're going to start off by modifying the universal cape, let's download the dts file of the universal cape. The config pin utility is installed with the below commands as well, which will be useful in future steps (for configuring pins of the Beaglebone).

#git clone https://github.com/cdsteinkuehler/beaglebone-universal-io
#cd beaglebone-universal-io/
#make
#sudo make install


Step 2:

Create a custom cape by modifying the universal cape and Compile Device Tree Overlay

Remove the lines in the device tree overlay (universal-cape-00A0.dts) that cause pin conflicts. For example, for my touchscreen LCD, P9.12 and many other pins cause conflicts. I resolve the issues by making the following changes to universal-cape-00A0.dts:

  • Change the part-number from “cape-universal” to “my-custom-cape”

  • Comment out the line P9.12 from the exclusive-use section. Do this for other pins that cause pin conflicts. Things like the I2C busses, SPI busses, UARTs and other components can cause pin conflicts too. For example, my touchscreen had pin conflicts with pretty much all SPI busses and UARTs. Components like these that cause conflicts need to be commented out from the exclusive-use section as well.

  • In the PINMUX settings in the rest of the file, remove the conflicting pins and sections on I2C, SPI, UARTs, PWM, etc

  • Save the file as my-custom-cape.dts and compile it to get a dtbo device tree overlay file. Copy this dtbo file to /lib/firmware

    # dtc -O dtb -o my-custom-cape-00A0.dtbo -b 0 -@ my-custom-cape-00A0.dts
    # sudo cp my-custom-cape-00A0.dtbo /lib/firmware


Step 3:

Change hal and ini files in your project directory

To remove pin conflicts, if they exist


Step 4:

Change setup.sh file in your project directory

  • Point towards my-custom-cape instead of cape-universal when loading device tree overlay

  • In the config pin section, comment out the pins/lines of the universal cape which cause conflicts

Step 5:

Change config-pin script to point towards my-custom-cape instead of cape-universal

First figure out where config-pin has been installed in Step 1.

#which config-pin

In the directory that comes up, open up the config-pin utility and in the P9.12 section and in other pins which are being used, say P09_12_CAPE=”my-custom-cape” instead of “cape-universal” or something else. This helps the config-pin utility initialize/config pin settings in the setup.sh file


Charles Steinkuehler

unread,
Dec 29, 2014, 3:24:57 PM12/29/14
to machi...@googlegroups.com
On 12/29/2014 2:13 PM, Deepak Sekar wrote:
>
>
> Thought the below stuff would be useful to new users of Machinekit...
>
> *--------------------------------------------------------------------------------------------------------*
>
>
> *Instructions for Creating a Custom Cape (eg. For making a
> touchscreen/display work with a Machinekit-controlled device)*
>
> *Acknowledgements: Many thanks to Charles Steinkuehler, Michael Haberler
> and many others for the suggestions they gave when I was ramping up on
> Machinekit and trying to build a custom cape.*
>
>
> A typical Machinekit setup such as CRAMPS utilizes a universal cape which
> allows the user to utilize all pins not used by HDMI and eMMC. However,
> when a display/touchscreen (eg. the 4D Systems ones) is used for the UI, it
> uses up certain additional pins and loads a cape of its own – this can
> cause “pin conflicts” with the universal cape. A solution for this is to
> create a custom cape in place of the universal cape that configures only
> the pins not utilized by the touchscreen, HDMI and eMMC. Steps for this are:
>
>
> *Step 1:*
>
> *Download universal-cape's DTS file*

It should already be on any recent image, but you might want to update
to the latest version:

# cd /opt/source/beaglebone-universal-io/
# git pull origin

The git clone is only needed if the above directory isn't already there
(IIRC this happens on _really_ old images, and images that don't come
from RCN).

Thanks for the writeup!

--
Charles Steinkuehler
cha...@steinkuehler.net

signature.asc

Bas de Bruijn

unread,
Dec 29, 2014, 3:38:54 PM12/29/14
to Deepak Sekar, machi...@googlegroups.com
Hi Deepak,

Thanks for the writeup,
would you be willing to add this into the documentation of Machinekit when I’ve done some more reworking the documentation?

Bas

--
website: http://www.machinekit.io blog: http://blog.machinekit.io github: https://github.com/machinekit
---
You received this message because you are subscribed to the Google Groups "Machinekit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to machinekit+...@googlegroups.com.
Visit this group at http://groups.google.com/group/machinekit.
For more options, visit https://groups.google.com/d/optout.

Deepak Sekar

unread,
Dec 30, 2014, 8:55:23 AM12/30/14
to machi...@googlegroups.com
Sure Bas. I'd be happy to help by adding this writeup to the documentation you're preparing. I could add other pieces of documentation moving forward as well.

Thanks for the additional inputs re custom overlays, Charles.

Smart Factory Academy

unread,
Oct 22, 2019, 1:55:02 PM10/22/19
to Machinekit
Is it normal to have multiple lines of 
cape-universal-00A0.dtbo: Warning (unit_address_vs_reg): Node /fragment@0 has a unit name, but no reg property
 when doing the sudo make/ sudo make install?
Reply all
Reply to author
Forward
0 new messages