GPIOs on HDMI pins - need tutorial

How are you changing the mux mode of the pins?

Hi Scott,
this is where I am looking for. I know that the BBB with the 3.8 kernel doesn’t have a “omap_mux”, therefor it deals with “device trees”. These files (.dtb) you can fin in the /boot directory.
These are a kind of “cape drivers” where the eMMC and the HDMI framer are also capes for BBB.

The trick is to write a “device tree overlay” that re- defines the pins and their mux mode. There are some articles to find on the internet and in this forum by “device tree overlay” or “BBB missing omux_map”.

For me as a Linux beginner (and non- native english speaker) it is a bit too hard to understand it in a deepness that allows me to change the examples to my needs. I orederd the book “bad to the bone” that deals with device tree overlays in one capitle. There are also other usefully things described.

My plan is to overlay the HDMI pins (I don’t need HDMI) to get 20 GPIOs more for my needs.

I guess that tey decided to go the way of device trees to make it easier to “hot- plug” the available capes. In these cases there is sometimes a EEPROM on the cape that tells the bone what cape it is. The device tree can than be overlayed dynamical. This can avoid wrong configurations and damages to the IO pins.

Some of the best device tree "tutorials" I have found are the *.dts
files found in the firmware directory of the kernel source, used to
build the *.dtbo files shipped with the 'Bone kernel.

I've also got an overlay file that enables a bunch of the LCD pins for
use with the BeBoPr cape so I know it can be done. Some pins have the
mux set to be GPIO, and some are set to be PRU outputs:

http://git.mah.priv.at/gitweb?p=emc2-dev.git;a=blob;f=configs/pru-examples/BB-LCNC-BEBOPR-00A0.dts;h=db271a1bcb0088b471d0b0b5390d8298f6073ac5;hb=refs/heads/arm335x-hal-pru-tasks

Note that before you do *ANYTHING* with the LCD pins on the BBB, you
need to make sure the HDMI cape is not getting loaded by putting the
following into your kernel configuration line:

   capemgr.disable_partno=BB-BONELT-HDMI

...otherwise, capemgr will complain when you try to re-assign the I/O
pins, and it currently seems unsafe to unload device tree overlays at
run-time.

Hi Charles,

thank you for the tip! I had a look into that .dts file and think that I will give it a try with de- commented LCD part in mode 7.

Is it right that the line “capemgr.disable_partno=BB-BONELT-HDMI” must be added to the file “uEnv.txt” ? And what is with the line that is currently there:

“optargs=run_hardware_tests quiet” - sould it still stay there ore must it be substituted by “capemgr.disable_partno=BB-BONELT-HDMI” ?

Yes, I also read abaout the issue with unloading devices.

Tomorrow I will give it a try (must sleep now, it is after midnight).

Good night. ==> AND MANY THANX ! ! !

You have to add the capemgr.disable text to the line that is generating
the kernel command line. I'm not exactly sure what it will look like,
as I'm running Debian from an SD card instead of the provided Angstrom
MMC image.

*wanders off to inspect MMC contents*

<gack!>

It looks like the boot loading for the MMC based BeagleBone Black images
is quite a bit different than the SD cards. The kernel is getting a
rational command line from somewhere:

root@beaglebone:~# cat /proc/cmdline
console=ttyO0,115200n8 quiet root=/dev/mmcblk0p2 ro rootfstype=ext4 rootwait

...but it's not coming from the uEnv.txt file in /boot/ or in
/media/BEAGLEBONE. It looks like there are defaults compiled into uBoot
and I'm not sure how to change it.

Anyone know how to tweak the boot process and pass a custom kernel
command line to the MMC Angstrom distribution the BBB ships with?

[...]

Anyone know how to tweak the boot process and pass a custom kernel
command line to the MMC Angstrom distribution the BBB ships with?

Custom kernel args should go to 'optargs' variable. If you don't have
it in your uEnv.txt, just add a line with assignment. My entire
uEnv.txt looks like this:
----- cut here -----
optargs=quiet drm.debug=7 capemgr.disable_partno=BB-BONELT-HDMI
----- cut here -----

'quiet' and 'drm.debug=7' may be omitted,
'capemgr.disable_partno=BB-BONELT-HDMI' disables allocation of pins
for the on-board HDMI and reclaims them for use as GPIOs.

regards,
j.

I changed the uEnv.txt by: optargs=quite drm.debug=7 capemgr.disable_partno=BB-BONELT-HDMI.
Then I did a reboot.

This is the result of ‘/sys/kernel/debug/pinctrl/44e10800.pinmux/ cat pinmux-pins’ (I copied just pins 40 to 59):

pin 40 (44e108a0): hdmi.12 (GPIO UNCLAIMED) function nxp_hdmi_bonelt_pins group nxp_hdmi_bonelt_pins
pin 41 (44e108a4): hdmi.12 (GPIO UNCLAIMED) function nxp_hdmi_bonelt_pins group nxp_hdmi_bonelt_pins
pin 42 (44e108a8): hdmi.12 (GPIO UNCLAIMED) function nxp_hdmi_bonelt_pins group nxp_hdmi_bonelt_pins
pin 43 (44e108ac): hdmi.12 (GPIO UNCLAIMED) function nxp_hdmi_bonelt_pins group nxp_hdmi_bonelt_pins
pin 44 (44e108b0): hdmi.12 (GPIO UNCLAIMED) function nxp_hdmi_bonelt_pins group nxp_hdmi_bonelt_pins
pin 45 (44e108b4): hdmi.12 (GPIO UNCLAIMED) function nxp_hdmi_bonelt_pins group nxp_hdmi_bonelt_pins
pin 46 (44e108b8): hdmi.12 (GPIO UNCLAIMED) function nxp_hdmi_bonelt_pins group nxp_hdmi_bonelt_pins
pin 47 (44e108bc): hdmi.12 (GPIO UNCLAIMED) function nxp_hdmi_bonelt_pins group nxp_hdmi_bonelt_pins
pin 48 (44e108c0): hdmi.12 (GPIO UNCLAIMED) function nxp_hdmi_bonelt_pins group nxp_hdmi_bonelt_pins
pin 49 (44e108c4): hdmi.12 (GPIO UNCLAIMED) function nxp_hdmi_bonelt_pins group nxp_hdmi_bonelt_pins
pin 50 (44e108c8): hdmi.12 (GPIO UNCLAIMED) function nxp_hdmi_bonelt_pins group nxp_hdmi_bonelt_pins
pin 51 (44e108cc): hdmi.12 (GPIO UNCLAIMED) function nxp_hdmi_bonelt_pins group nxp_hdmi_bonelt_pins
pin 52 (44e108d0): hdmi.12 (GPIO UNCLAIMED) function nxp_hdmi_bonelt_pins group nxp_hdmi_bonelt_pins
pin 53 (44e108d4): hdmi.12 (GPIO UNCLAIMED) function nxp_hdmi_bonelt_pins group nxp_hdmi_bonelt_pins
pin 54 (44e108d8): hdmi.12 (GPIO UNCLAIMED) function nxp_hdmi_bonelt_pins group nxp_hdmi_bonelt_pins
pin 55 (44e108dc): hdmi.12 (GPIO UNCLAIMED) function nxp_hdmi_bonelt_pins group nxp_hdmi_bonelt_pins
pin 56 (44e108e0): hdmi.12 (GPIO UNCLAIMED) function nxp_hdmi_bonelt_pins group nxp_hdmi_bonelt_pins
pin 57 (44e108e4): hdmi.12 (GPIO UNCLAIMED) function nxp_hdmi_bonelt_pins group nxp_hdmi_bonelt_pins
pin 58 (44e108e8): hdmi.12 (GPIO UNCLAIMED) function nxp_hdmi_bonelt_pins group nxp_hdmi_bonelt_pins
pin 59 (44e108ec): hdmi.12 (GPIO UNCLAIMED) function nxp_hdmi_bonelt_pins group nxp_hdmi_bonelt_pins

It is like before and the pins cannot work as GPIOs.

What does 'cat /proc/cmdline' say? If you don't see the disable_partno
parameter, that means that u-boot completely ignored your changes.
Check also HDMI-related messages from kernel: 'dmesg|grep -i hdmi'.
This is what I can see on my system:

root@beaglebone:~# dmesg|grep -i hdmi
[ 0.000000] Kernel command line: console=ttyO0,115200n8 quiet
drm.debug=7 capemgr.disable_partno=BB-BONELT-HDMI root=/dev/mmcblk0p2
ro rootfstype=ext4 rootwait
[ 0.251357] bone-capemgr bone_capemgr.9: Skipping disabled cape
with part# BB-BONELT-HDMI
[ 0.399577] bone-capemgr bone_capemgr.9: slot #5:
'Bone-Black-HDMI,00A0,Texas Instrument,BB-BONELT-HDMI'
[ 0.399856] bone-capemgr bone_capemgr.9: Skipping loading of
disabled cape with part# BB-BONELT-HDMI

j.

My results are:

root@beaglebone:~# cat /proc/cmdline
console=ttyO0,115200n8 quiet drm.debug=7 root=/dev/mmcblk0p2 ro rootfstype=ext4 rootwait
root@beaglebone:~#

and

root@beaglebone:~# dmesg|grep -i hdmi
[ 231.376935] [drm:output_poll_execute], [CONNECTOR:5:HDMI-A-1] status updated from 2 to 2
[ 241.408176] [drm:output_poll_execute], [CONNECTOR:5:HDMI-A-1] status updated from 2 to 2
[ 251.439454] [drm:output_poll_execute], [CONNECTOR:5:HDMI-A-1] status updated from 2 to 2
[ 261.470715] [drm:output_poll_execute], [CONNECTOR:5:HDMI-A-1] status updated from 2 to 2
[ 271.501944] [drm:output_poll_execute], [CONNECTOR:5:HDMI-A-1] status updated from 2 to 2
[ 281.533177] [drm:output_poll_execute], [CONNECTOR:5:HDMI-A-1] status updated from 2 to 2
[ 291.564422] [drm:output_poll_execute], [CONNECTOR:5:HDMI-A-1] status updated from 2 to 2
[ 301.595676] [drm:output_poll_execute], [CONNECTOR:5:HDMI-A-1] status updated from 2 to 2
[ 311.626915] [drm:output_poll_execute], [CONNECTOR:5:HDMI-A-1] status updated from 2 to 2
[ 321.658152] [drm:output_poll_execute], [CONNECTOR:5:HDMI-A-1] status updated from 2 to 2
[ 331.689430] [drm:output_poll_execute], [CONNECTOR:5:HDMI-A-1] status updated from 2 to 2
[ 341.720662] [drm:output_poll_execute], [CONNECTOR:5:HDMI-A-1] status updated from 2 to 2
[ 351.752008] [drm:output_poll_execute], [CONNECTOR:5:HDMI-A-1] status updated from 2 to 2
[ 361.783163] [drm:output_poll_execute], [CONNECTOR:5:HDMI-A-1] status updated from 2 to 2
[ 371.814422] [drm:output_poll_execute], [CONNECTOR:5:HDMI-A-1] status updated from 2 to 2
[ 381.845679] [drm:output_poll_execute], [CONNECTOR:5:HDMI-A-1] status updated from 2 to 2
[ 391.876919] [drm:output_poll_execute], [CONNECTOR:5:HDMI-A-1] status updated from 2 to 2
[ 401.908160] [drm:output_poll_execute], [CONNECTOR:5:HDMI-A-1] status updated from 2 to 2
[ 411.939424] [drm:output_poll_execute], [CONNECTOR:5:HDMI-A-1] status updated from 2 to 2
[ 421.970691] [drm:output_poll_execute], [CONNECTOR:5:HDMI-A-1] status updated from 2 to 2
[ 432.001932] [drm:output_poll_execute], [CONNECTOR:5:HDMI-A-1] status updated from 2 to 2
root@beaglebone:~#

You made a typo. The command should be
dmesg>grep -i hdmi

not 'demesg'

j.

Stupid question: where exactly is the uEnv.txt you modified?

j.

Yes, I saw it and have correct it (see above)

The file is in: /boot/

I made a copy (uEnv.txt.original) then I edited it with nano

This is the content of that directory:

root@beaglebone:/boot# ls -l
total 4428
-rw-r–r-- 1 root root 23382 May 27 16:20 am335x-bone.dtb
-rw-r–r-- 1 root root 23801 May 27 16:20 am335x-boneblack.dtb
-rw-r–r-- 1 root root 22014 May 27 16:20 am335x-evm.dtb
-rw-r–r-- 1 root root 21454 May 27 16:20 am335x-evmsk.dtb
-rw-r–r-- 1 root root 22410 May 27 16:20 am335x-tester.dtb
-rw-r–r-- 1 root root 4824 May 27 16:20 omap2420-h4.dtb
-rw-r–r-- 1 root root 12266 May 27 16:20 omap3-beagle-xm.dtb
-rw-r–r-- 1 root root 11591 May 27 16:20 omap3-beagle.dtb
-rw-r–r-- 1 root root 11402 May 27 16:20 omap3-evm.dtb
-rw-r–r-- 1 root root 11555 May 27 16:20 omap3-tobi.dtb
-rw-r–r-- 1 root root 18940 May 27 16:20 omap4-panda-a4.dtb
-rw-r–r-- 1 root root 18896 May 27 16:20 omap4-panda-es.dtb
-rw-r–r-- 1 root root 18940 May 27 16:20 omap4-panda.dtb
-rw-r–r-- 1 root root 21727 May 27 16:20 omap4-sdp.dtb
-rw-r–r-- 1 root root 15703 May 27 16:20 omap4-var-som.dtb
-rw-r–r-- 1 root root 14994 May 27 16:20 omap5-evm.dtb
-rwxr-xr-x 1 xuser xuser 64 Jun 6 17:40 uEnv.txt
-rwxr-xr-x 1 root root 33 Jun 6 16:21 uEnv.txt.original
lrwxrwxrwx 1 root root 13 Mar 18 12:47 uImage → uImage-3.8.13
-rw-r–r-- 1 root root 4226000 May 27 16:14 uImage-3.8.13
root@beaglebone:/boot#

I believe this is a copy of the file in the FAT partition created at runtime. You need to edit the real file in the FAT partition.

Gerald

uEnx.txt in /boot is irrelevant. u-boot reads the config file from the
first partition. It is not mounted by default, so you need to either
connect USB cable to BBB and mount the USB disk on your host computer,
or mount the partition on the beaglebone:

mount /dev/mmcblk0p1 /mnt/card

Edit the uEnv.txt on the mounted partition, add
"capemgr.disable_partno=BB-BONELT-HDMI" to optargs, save the file,
umount the partition and reboot the board.

j.

Jacec - you are god !!!

Thank you very very much for that !!!

Look at that :-))
The LED can now be swiched on and off !
Also Thanx to Gerald!

pin 40 (44e108a0): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 41 (44e108a4): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 42 (44e108a8): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 43 (44e108ac): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 44 (44e108b0): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 45 (44e108b4): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 46 (44e108b8): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 47 (44e108bc): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 48 (44e108c0): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 49 (44e108c4): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 50 (44e108c8): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 51 (44e108cc): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 52 (44e108d0): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 53 (44e108d4): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 54 (44e108d8): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 55 (44e108dc): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 56 (44e108e0): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 57 (44e108e4): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 58 (44e108e8): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 59 (44e108ec): (MUX UNCLAIMED) (GPIO UNCLAIMED)

Hello Charles,

now I have the HDMI pins working as GPIOs. Thank you for yor support!!