User LEDs on the BeagleBone Black Rev. C

I was wondering if it was possible to mimic the user LED’s on the BBB board with external LED’s, i have a nice project that i put inside a box, was thinking it would be nice to see the user LED’s on the front panel. my web search only came up with how to disable them or repurpose them, but nothing eve close to what i would like to do. any help would be great and links if possible

rcn-ee.ne console Ubuntu Image 2018-06-08

Distributor ID: Ubuntu
Description: Ubuntu 18.04.2 LTS
Release: 18.04
Codename: bionic

Thank You for your time.
Miles Dyson

as my search continues i did find an older thread google groups that talks about this, however it is 5 years old so i am hesitant on trying it… but this is what i am wanting to do.

The pin’s used for the led’s are listed here:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm/boot/dts/am335x-bone-common.dtsi

	leds {
		pinctrl-names = "default";
		pinctrl-0 = <&user_leds_s0>;

		compatible = "gpio-leds";

		led2 {
			label = "beaglebone:green:heartbeat";
			gpios = <&gpio1 21 GPIO_ACTIVE_HIGH>;
			linux,default-trigger = "heartbeat";
			default-state = "off";
		};

		led3 {
			label = "beaglebone:green:mmc0";
			gpios = <&gpio1 22 GPIO_ACTIVE_HIGH>;
			linux,default-trigger = "mmc0";
			default-state = "off";
		};

		led4 {
			label = "beaglebone:green:usr2";
			gpios = <&gpio1 23 GPIO_ACTIVE_HIGH>;
			linux,default-trigger = "cpu0";
			default-state = "off";
		};

		led5 {
			label = "beaglebone:green:usr3";
			gpios = <&gpio1 24 GPIO_ACTIVE_HIGH>;
			linux,default-trigger = "mmc1";
			default-state = "off";
		};
	};

and

	user_leds_s0: user_leds_s0 {
		pinctrl-single,pins = <
			AM33XX_PADCONF(AM335X_PIN_GPMC_A5, PIN_OUTPUT_PULLDOWN, MUX_MODE7)	/* gpmc_a5.gpio1_21 */
			AM33XX_PADCONF(AM335X_PIN_GPMC_A6, PIN_OUTPUT_PULLUP, MUX_MODE7)	/* gpmc_a6.gpio1_22 */
			AM33XX_PADCONF(AM335X_PIN_GPMC_A7, PIN_OUTPUT_PULLDOWN, MUX_MODE7)	/* gpmc_a7.gpio1_23 */
			AM33XX_PADCONF(AM335X_PIN_GPMC_A8, PIN_OUTPUT_PULLUP, MUX_MODE7)	/* gpmc_a8.gpio1_24 */
		>;
	};

Just modify them to be pins used on the external headers and run your own wire/led to the box…

https://github.com/beagleboard/beaglebone-black/blob/master/BBB_SCH.pdf

But remember, the pin’s on the processor can not fully source the current for the led’s so you’ll need to do something similar to what was done on the BBB…

Screenshot

Regards,

Thank you for the reply RobertCNelson

to simplify things i will refer to the heartbeat led (led2)
say i want to move it to P8_7

my file : /opt/source/dtb-4.14-ti/src/arm/am335x-bone-common.dtsi

            led2 {
                    label = "beaglebone:green:usr0";
                    gpios = <&gpio1 21 GPIO_ACTIVE_HIGH>;
                    linux,default-trigger = "heartbeat";
                    default-state = "off";
            };

change gpio :

            led2 {
                    label = "beaglebone:green:usr0";
                    gpios = <&gpio1 P8_7 GPIO_ACTIVE_HIGH>;
                    linux,default-trigger = "heartbeat";
                    default-state = "off";
            };

now my am335x-bone-common.dtsi seams a bit different from the one you linked and it kinda confuses me some, it has an extra argument with a hexadecimal of 0x854, on line 71 of the file and I’m not exactly sure but i think its the pin 21, is there a chart for this or how do i find what it will be for my pin P8_7.

    user_leds_s0: user_leds_s0 {
            pinctrl-single,pins = <
                    AM33XX_IOPAD(0x854, PIN_OUTPUT_PULLDOWN | MUX_MODE7)    /* gpmc_a5.gpio1_21 */
                    AM33XX_IOPAD(0x858, PIN_OUTPUT_PULLUP | MUX_MODE7)      /* gpmc_a6.gpio1_22 */
                    AM33XX_IOPAD(0x85c, PIN_OUTPUT_PULLDOWN | MUX_MODE7)    /* gpmc_a7.gpio1_23 */
                    AM33XX_IOPAD(0x860, PIN_OUTPUT_PULLUP | MUX_MODE7)      /* gpmc_a8.gpio1_24 */
            >;
    };

if you could please show me an example with the heartbeat moved to pin P8_7, also once the changes are made, is it just a reboot for the changes to take effect?
as for the circuit i was thinking of something like this but with different pins, which is what i think you were referring to for lighting the LED’s.

and as always thank you for your time and help
Miles Dyson

P8_7 is gpio2_2…

https://github.com/derekmolloy/boneDeviceTree/blob/master/docs/BeagleboneBlackP8HeaderTable.pdf

gpios = <&gpio2 2 GPIO_ACTIVE_HIGH>;

Then for the pinmux, it’s 0x890:

AM33XX_IOPAD(0x890, PIN_OUTPUT_PULLDOWN | MUX_MODE7)

Regards,

1 Like

thank you this clears up a lot for me… :+1:

yah …

sudo nano /opt/source/dtb-4.14-ti/src/arm/am335x-bone-common.dtsi

made changes to line 33 & 71

reboot BBB

Nothing changes heartbeat still on user led

so i am still missing something

from /opt/source/dtb-4.14-ti/ run:

make
sudo make install
sudo reboot

Regards,

still no luck with this unfortunately, i have gone over every thing here many times to make sure i am not missing something, i even installed your latest release console Ubuntu Image 2019-06-15, after making the changes, running the make commands, rebooting, all the user leds light up for a few seconds then go out, my external led lights solid and i can ssh into it fine but no heartbeat on the external led and no user LED’s.

i have tried several variations when editing the file and different pins with no luck, every thing i do simply disables all the user LED’s and when i put a volts meter on the pin i get a solid 3.21v (3.3v) no heartbeat

sudo nano /opt/source/dtb-4.14-ti/src/arm/am335x-bone-common.dtsi

gpios = <&gpio2 2 GPIO_ACTIVE_HIGH>;

AM33XX_IOPAD(0x890, PIN_INPUT_PULLDOWN | MUX_MODE7)

cd /opt/source/dtb-4.14-ti/

sudo make clean

sudo make

sudo make install

sudo reboot now

I’m sorry man, I swear I am really trying here…

Let’s check something, i bet P8_7 is tied up in the cape universal… Please run this script, it should dump some more debugging information.

sudo /opt/scripts/tools/version.sh

Regards,

$ sudo /opt/scripts/tools/version.sh

git:/opt/scripts/:[36f5d06d76970c66653ad0536ebf9c7a26af13e3]
eeprom:[A335BNLT000C1316BBBK1210]
model:[TI_AM335x_BeagleBone_Black]
dogtag:[rcn-ee.net console Ubuntu Image 2019-06-15]
bootloader:[eMMC-(default)]:[/dev/mmcblk1]:[U-Boot 2019.04-00002-g9ca2c5819f]:[location: dd MBR]
kernel:[4.14.108-ti-r107]
uboot_overlay_options:[enable_uboot_overlays=1]
uboot_overlay_options:[disable_uboot_overlay_video=1]
uboot_overlay_options:[disable_uboot_overlay_audio=1]
uboot_overlay_options:[uboot_overlay_pru=/lib/firmware/AM335X-PRU-UIO-00A0.dtbo]
uboot_overlay_options:[enable_uboot_cape_universal=1]
pkg check: to individually upgrade run: [sudo apt install --only-upgrade ]
pkg:[bb-cape-overlays]:[4.4.20190610.0-0rcnee0~bionic+20190610]
pkg:[bb-wl18xx-firmware]:[1.20190227.1-0rcnee0~bionic+20190227]
pkg:[kmod]:[24-1ubuntu3.2rcnee0~bionic+20190208]
WARNING:pkg:[librobotcontrol]:[NOT_INSTALLED]
cmdline:[console=ttyO0,115200n8 bone_capemgr.uboot_capemgr_enabled=1 root=/dev/mmcblk1p1 ro rootfstype=ext4 rootwait coherent_pool=1M net.ifnames=0 rng_core.default_quality=100 cape_universal=enable quiet]
dmesg | grep remote
[ 1.461415] remoteproc remoteproc0: wkup_m3 is available
[ 1.542964] remoteproc remoteproc0: powering up wkup_m3
[ 1.543084] remoteproc remoteproc0: Booting fw image am335x-pm-firmware.elf, size 217168
[ 1.547546] remoteproc remoteproc0: remote processor wkup_m3 is now up
dmesg | grep pru
dmesg | grep pinctrl-single
[ 1.106129] pinctrl-single 44e10800.pinmux: 142 pins at pa f9e10800 size 568
dmesg | grep gpio-of-helper
[ 1.118382] gpio-of-helper ocp:cape-universal: ready
lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
END

i did disable the video and audio thinking that it was perhaps blocking the pins as they will not be used in this setup…

Thank You

@milesbdyson, so sadly i see nothing obvious. By chance do you have a usb-serial adapter, so we can see what’s happening in u-boot on bootup…

Regards,

@milesbdyson In your circuit, instead of using AAA batteries maybe try connecting SYS_5V from bbb and keep a common ground from bbb to ULN2003.

No i do not but i did just order one … will be about a week or so and i will post the info for you.

the image is just an example of the circuit, i am actually using an AC to DC 5v power supply plugged into my bread board, BBB and power supply both share the common ground for the LED’s to work. thank you for the input.

Hello RobertCNelson

got my usb-serial adapter in the mail today and after a bit of reading i was able to collect the data you needed.

  1. unplugged all wires from both headers except a single GPIO P8_7 and a Ground for the breadboard for the circuit shown above
  2. logged in, sudo apt update; sudo apt upgrade, yes there were a few updates.
  3. logged out and powered down bbb

after changes to /opt/source/dtb-4.14-ti/src/arm/am335x-bone-common.dtsi
recompile and shutdown

Starting kernel …

[ 0.002216] timer_probe: no matching timers found
[ 1.120726] wkup_m3_ipc 44e11324.wkup_m3_ipc: could not get rproc handle
[ 1.415674] pinctrl-single 44e10800.pinmux: pin PIN36 already requested by ocp:P8_07_pinmux; cannot claim for leds
[ 1.426559] pinctrl-single 44e10800.pinmux: pin-36 (leds) status -22
[ 1.433089] pinctrl-single 44e10800.pinmux: could not request pin 36 (PIN36) from group user_leds_s0 on device pinctrl-single
[ 1.445653] leds-gpio leds: Error applying setting, reverse things back
[ 1.484192] omap_voltage_late_init: Voltage driver support not added
[ 1.491355] PM: Cannot get wkup_m3_ipc handle

i do see where it tried to use P8_7 (pin36) but not sure what to do about it. i also have the output for a normal boot before i made any changes if that may help you any, let me know

any way again i would like to thank you for your help and time
Miles Dyson

There’s your answer, P8_07 is already “taken” by something…

To disable it, you need to either purge all 8_07 references, or setup an overlay that just does this:

But with P8_07_pinmux…

Regards,

2 Likes

That did the trick, I now have three of the user LED’s on GPIO pins P8_7 P8_9 P8_11

Thank you
Miles Dyson

oh snap… even got the overlay working :heart_eyes: I am so happy !!! :champagne:

and by the way man you are absolutely every where on the web…

thanks again.
MilesDyson

1 Like