User LEDs on the BeagleBone Black Rev. C

#1

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

#2

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.

#3

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,

#4

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

#5

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
#6

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