Cannot set pins by overlay

118 views
Skip to first unread message

bremenpl

unread,
Sep 9, 2015, 12:41:21 PM9/9/15
to BeagleBoard
Hello there,
I just got back to my BeagleBone Black and i have no idea why but I just cannot change a pin configuration using overlay nor through export. This is what I am trying to do:

I want to set P8_29 and P8_31 Pins to inputs with a pullup (0x37). here is my overlay:

/dts-v1/;
/plugin/;

/{
       compatible = "ti,beaglebone", "ti,beaglebone-black";
       part-number = "BB-AVRDUDE";
       version = "00A0";

       fragment@0 {
             target = <&am33xx_pinmux>;
           
             __overlay__ {
                  ebb_example: BB-AVRDUDE {
            pinctrl-single,pins = <
                0x0E4 0x37  /
/ P8_29, AVR #RST pin, Input Mode7 pullup
               
0x0D8 0x37  // P8_31, AVR #HWB pin, Input Mode7 pullup
 
                   
/* INPUT   GPIO(mode7) 0x27 pulldown, 0x37 pullup, 0x?f no pullup/down */
           
>;
         
};
             
};
       
};

       fragment@1
{
        target
= <&ocp>;
        __overlay__
{
            gpio_helper
{
                compatible
= "gpio-of-helper";
                status
= "okay";
                pinctrl
-names = "default";
                pinctrl
-0 = <&ebb_example>;
           
};
       
};
   
};
};

Then I load the DTS and see in the list (last). HDMI is disabled:

 0: 54:PF---
 
1: 55:PF---
 
2: 56:PF---
 
3: 57:PF---
 
4: ff:P-O-L Bone-LT-eMMC-2G,00A0,Texas Instrument,BB-BONE-EMMC-2G
 
5: ff:P-O-- Bone-Black-HDMI,00A0,Texas Instrument,BB-BONELT-HDMI
 
6: ff:P-O-- Bone-Black-HDMIN,00A0,Texas Instrument,BB-BONELT-HDMIN
 
7: ff:P-O-L Override Board Name,00A0,Override Manuf,NEOSEC-TINYLCD22
 
8: ff:P-O-L Override Board Name,00A0,Override Manuf,BB-BONE-KEYS
 
9: ff:P-O-L Override Board Name,00A0,Override Manuf,BB-BONE-SPI1-2CS
10: ff:P-O-L Override Board Name,00A0,Override Manuf,am33xx_pwm
11: ff:P-O-L Override Board Name,00A0,Override Manuf,BB-COOLER
12: ff:P-O-L Override Board Name,00A0,Override Manuf,BB-UART5
13: ff:P-O-L Override Board Name,00A0,Override Manuf,BB-BUZZER
14: ff:P-O-L Override Board Name,00A0,Override Manuf,BB-W1
15: ff:P-O-L Override Board Name,00A0,Override Manuf,BB-AVRDUDE


Dmesg says it was OK:

root@beaglebone:~# dmesg | grep BB-AVRDUDE
[  151.732517] bone-capemgr bone_capemgr.9: part_number 'BB-AVRDUDE', version 'N/A'
[  151.732633] bone-capemgr bone_capemgr.9: slot #15: 'Override Board Name,00A0,Override Manuf,BB-AVRDUDE'
[  151.732729] bone-capemgr bone_capemgr.9: slot #15: Requesting part number/version based 'BB-AVRDUDE-00A0.dtbo
[  151.732744] bone-capemgr bone_capemgr.9: slot #15: Requesting firmware 'BB-AVRDUDE-00A0.dtbo' for board-name 'Override Board Name', version '00A0'
[  151.736445] bone-capemgr bone_capemgr.9: slot #15: dtbo 'BB-AVRDUDE-00A0.dtbo' loaded; converting to live tree


Then I check the pins and they remain as they were in default:

root@beaglebone:~# cat $PINS | grep "pin 57"
pin
57 (44e108e4) 00000027 pinctrl-single
root@beaglebone
:~# cat $PINS | grep "pin 54"
pin
54 (44e108d8) 0000002f pinctrl-single


Did I forget something? I really cant think of anything. I would really apreciate all help here!

Bremenpl

unread,
Sep 10, 2015, 3:38:09 AM9/10/15
to BeagleBoard
Anyone please?

Charles Steinkuehler

unread,
Sep 10, 2015, 9:34:43 AM9/10/15
to beagl...@googlegroups.com
On 9/9/2015 11:41 AM, bremenpl wrote:
> Hello there,
> I just got back to my BeagleBone Black and i have no idea why but I just
> cannot change a pin configuration using overlay nor through export. This is
> what I am trying to do:
>
> I want to set P8_29 and P8_31 Pins to inputs with a pullup (0x37). here is
> my overlay:

<snip overlay stuff>

> Then I check the pins and they remain as they were in default:
>
> root@beaglebone:~# cat $PINS | grep "pin 57"
> pin 57 (44e108e4) 00000027 pinctrl-single
> root@beaglebone:~# cat $PINS | grep "pin 54"
> pin 54 (44e108d8) 0000002f pinctrl-single
>
>
> Did I forget something? I really cant think of anything. I would really
> apreciate all help here!

Well, since you're using gpio-of-helper (designed to allow export of
GPIO pins via the device tree instead of using sysfs), but *NOT*
actually defining any GPIO pins, I'm not sure the gpio-of-helper
driver is applying your pinmux settings.

Try adding the GPIO pins you want to the gpio_helper stanza in
fragment 1 and configure them as inputs.

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

Bremenpl

unread,
Sep 10, 2015, 12:43:52 PM9/10/15
to beagl...@googlegroups.com
Im.not sure I understand. I am setting the pins in the dts file i pasted.
Wrting 0x37 to them to set them as inputs with pullups. I then compile a
dtbo, load then load the dtbo. It gets loaded. I check the pins and they
are not 0x37. Could you explain again what did you mean exacly? I wanted to
simply init the pin with device tree overlay and then manage it with sysfs.


On September 10, 2015 3:34:44 PM Charles Steinkuehler
> --
> For more options, visit http://beagleboard.org/discuss
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "BeagleBoard" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/beagleboard/kL9YPe8NuPg/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> beagleboard...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.


Charles Steinkuehler

unread,
Sep 10, 2015, 1:15:56 PM9/10/15
to beagl...@googlegroups.com
I mean you have pinmux settings, but you're not using the
gpio-of-helper driver to actually export anything, which it what it
was written for. There is a difference between the *PINMUX* is setup
for input and the *GPIO PIN* is setup as an input.

Try adding some actual GPIO entries like these:

https://github.com/beagleboard/devicetree-source/blob/master/arch/arm/boot/dts/BB-GPIOHELP-00A0.dts#L48-L62
--
Charles Steinkuehler
cha...@steinkuehler.net

Bremenpl

unread,
Sep 10, 2015, 1:39:58 PM9/10/15
to beagl...@googlegroups.com
I think i get it. I will try this first thing in the morning. Thank you.


On September 10, 2015 7:15:57 PM Charles Steinkuehler

Bremenpl

unread,
Sep 11, 2015, 4:41:13 AM9/11/15
to beagl...@googlegroups.com
I have compiled this dts:
https://pastebin.com/EFQ9R8bg

Then added it to slots (it got loaded) and checked the pins. It still doesnt work:

root@beaglebone:/home/debian/my_dts# echo BB-AVRDUDE > $SLOTS
root@beaglebone:/home/debian/my_dts# cat $SLOTS

 0: 54:PF---
 1: 55:PF---
 2: 56:PF---
 3: 57:PF---
 4: ff:P-O-L Bone-LT-eMMC-2G,00A0,Texas Instrument,BB-BONE-EMMC-2G
 5: ff:P-O-- Bone-Black-HDMI,00A0,Texas Instrument,BB-BONELT-HDMI
 6: ff:P-O-- Bone-Black-HDMIN,00A0,Texas Instrument,BB-BONELT-HDMIN
 7: ff:P-O-L Override Board Name,00A0,Override Manuf,NEOSEC-TINYLCD22
 8: ff:P-O-L Override Board Name,00A0,Override Manuf,BB-BONE-KEYS
 9: ff:P-O-L Override Board Name,00A0,Override Manuf,BB-BONE-SPI1-2CS
10: ff:P-O-L Override Board Name,00A0,Override Manuf,am33xx_pwm
11: ff:P-O-L Override Board Name,00A0,Override Manuf,BB-COOLER
12: ff:P-O-L Override Board Name,00A0,Override Manuf,BB-UART5
13: ff:P-O-L Override Board Name,00A0,Override Manuf,BB-BUZZER
14: ff:P-O-L Override Board Name,00A0,Override Manuf,BB-W1
15: ff:P-O-L Override Board Name,00A0,Override Manuf,BB-AVRDUDE
root@beaglebone:/home/debian/my_dts# cat $PINS | grep "pin 57"
pin 57 (44e108e4) 00000027 pinctrl-single (Should be 0x37)


Am I still doing something wrong?


Charles Steinkuehler

unread,
Sep 11, 2015, 9:41:51 AM9/11/15
to beagl...@googlegroups.com
On 9/11/2015 3:41 AM, Bremenpl wrote:
>
> Am I still doing something wrong?

Two things to check:

1) The kernel will load any compiled in overlays in preference to
files in /lib/firmware. I don't think there's a BB_AVRDUDE overlay
compiled into the kernel, but you can test by changing the name of
your *.dtbo file to something guaranteed to be unique (or give it a
custom version number) and try to load that instead. That will force
the kernel to look for the file in /lib/firmware.

2) You can crawl through the live device tree (/proc/device-tree/*)
and make sure it's what you're expecting. It's easy to have one typo
or similar that will mess up everything you're trying to do. :)

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

Bremenpl

unread,
Sep 12, 2015, 6:57:49 AM9/12/15
to beagl...@googlegroups.com
I also dont think that there is a device tree with this name. I will
however try you tips at mo day in the morning and let know here. Thank you
for help.


On September 11, 2015 3:41:52 PM Charles Steinkuehler

Davide Picchi

unread,
Dec 31, 2015, 5:26:35 AM12/31/15
to BeagleBoard
@bremenpl

try removing the follwing part in your code:

                                test_input1 {
                                        gpio
-name = "test_input1";
                                        gpio
= <&gpio3 23 0x00>;        /* gpio4 is gpio3 */
                                        input
;
                                        count
-rising-edge;
                                        count
-falling-edge;
                               
};
 
                                test_input2
{
                                        gpio
-name = "test_input2";
                                        gpio
= <&gpio1 10 0x00>;        /* gpio4 is gpio3 */
                                        input
;
                                        count
-rising-edge;
                                        count
-falling-edge;                                 };



and just leave the following part as it is:

....


       fragment@1
{
                target
= <&ocp>;
                __overlay__
{
                        gpio_helper
{
                                compatible
= "gpio-of-helper";
                                status
= "okay";
                                pinctrl
-names = "default";
                                pinctrl
-0 = <&ebb_example>;
 
                       
};
               
};         };

...

Davide Picchi

unread,
Dec 31, 2015, 5:30:37 AM12/31/15
to BeagleBoard
And if you need some help I can suggest you to try the code generated in this page.

At least you have the chance to check, whether your code is right or not. You can simplify debugging of your code.

Regards

Bremenpl

unread,
Dec 31, 2015, 5:40:17 AM12/31/15
to beagl...@googlegroups.com

Didnt know about this page, thabk you a lot :).

--

Davide Picchi

unread,
Dec 31, 2015, 7:28:55 AM12/31/15
to beagl...@googlegroups.com
I discovered that (at least in my ubuntu Linux arm 4.1.13-ti-r36) trying to load and unload overlays on the fly doesn't work.
I did it many times, in the right way. But you should reboot your system at first and THEN try to load your overlay.
Your changes at the pinmux should be visible now.

I don't know why one should reboot the system everytime.

You received this message because you are subscribed to the Google Groups "BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beagleboard...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages