I’ve been googling and watching device tree tutorials… all targeted at 3.8 kernel.
This is great for learning the basics, but I have 3.14 kernel: Linux beaglebone 3.14.19-ti-r30 #1 SMP PREEMPT Mon Oct 13 20:34:06 UTC 2014 armv7l GNU/Linux
From what I can find, the friendly device tree tools haven’t been ported to 3.14 yet.
The best way to work with the device tree is to decompile your existing dtb (I have a 4D LCD display, so I’ve decompiled the dub for it below)
I just ran across BBIOConfig (https://github.com/strahlex/BBIOConfig)
Very cool and easy to understand.
I saw there was a utility “config-pin” for setting up the pin configuration.
Does this work on BBB 3.14 now?
Is there an apt-get install package that will install it?
Using the dtb-rebuilder, I see the main include file for my cape, am335x-bone-4dcape-43t.dtsi.
I see the various includes for they key mappings and led includes.
However, I don’t see any includes for PWM configurations.
Looking at some of the existing includes, they seem a little different from a 3.8 kernel overlay.
Are there examples somewhere for what the include needs to look like to enable PWM functionality?
Do the A/D analog pins need include files also or are they always enabled?
Using the dtb-rebuilder, I see the main include file for my cape,
am335x-bone-4dcape-43t.dtsi.
I see the various includes for they key mappings and led includes.
However, I don't see any includes for PWM configurations.
I haven't figured out the pwm's yet.
Looking at some of the existing includes, they seem a little different from
a 3.8 kernel overlay.
Are there examples somewhere for what the include needs to look like to
enable PWM functionality?
Do the A/D analog pins need include files also or are they always enabled?
I know config-pin will solve a lot of the pain of mapping IO pins / features.
The BBIOConfig Qt GUI for allocating the pins looks very slick.
I’m looking forward to the release of the working versions.
The example you linked looks like the interface configuration for Microchip’s RTC I2C module. I’ve used them in a few projects before.
The RTC multi-purpose pin appears to be used for the alarm, so the GPIO pin on the am335x is configured for input, with an interrupt to wake up the CPU if in sleep.
So, based on that example, if I set up all the pins (I’ll skip PWM for now and use them as output pins) it looks like I need an include file that looks like:
&ocp {
P8_19_pinmux {
/* gpio0[22] /
status = “disabled”;
};
P8_13_pinmux {
/ gpio0[23] /
status = “disabled”;
};
P9_14_pinmux {
/ gpio1[18] /
status = “disabled”;
};
P8_14_pinmux {
/ gpio0[26] /
status = “disabled”;
};
P8_17_pinmux {
/ gpio0[27] /
status = “disabled”;
};
P8_12_pinmux {
/ gpio1[12] /
status = “disabled”;
};
P8_11_pinmux {
/ gpio1[13] /
status = “disabled”;
};
P8_16_pinmux {
/ gpio1[14] /
status = “disabled”;
};
P8_15_pinmux {
/ gpio1[15] /
status = “disabled”;
};
P9_15_pinmux {
/ gpio1[16] /
status = “disabled”;
};
P9_23_pinmux {
/ gpio1[17] /
status = “disabled”;
};
P9_12_pinmux {
/ gpio1[28] /
status = “disabled”;
};
P8_26_pinmux {
/ gpio1[29] */
status = “disabled”;
};
};
I didn’t see how to specify direction of default value. Does it just default to input?
Can you group the pins together like that in the gpio_keys section?
After looking through the dts and dtsi files, I think my problem lies in understanding how they all fit together.
The beaglebone default configurations appear in am335x-bone-common-pinmux.dtsi.
It lacks OUTPUT configuration for the pins (except the PWM configurations)
So, you have to disable the default configuration for the output pins and build your own.
Does this look correct?
/* configure output pins */
&am33xx_pinmux {
stepper_driver: stepper_driver_pins {
pinctrl-single,pins = <
0x030 (PIN_OUTPUT | MUX_MODE7) /* P8_12 */
0x034 (PIN_OUTPUT | MUX_MODE7) /* P8_11 */
0x038 (PIN_OUTPUT | MUX_MODE7) /* P8_16 */
0x03C (PIN_OUTPUT | MUX_MODE7) /* P8_15 */
0x040 (PIN_OUTPUT | MUX_MODE7) /* P9_15 */
0x044 (PIN_OUTPUT | MUX_MODE7) /* P9_23 */
0x078 (PIN_OUTPUT | MUX_MODE7) /* P9_12 */
0x07c (PIN_OUTPUT | MUX_MODE7) /* P8_26 */
;
};
};
/* Modify default pin configurations defined in am335x-bone-common-pinmux.dtsi */
&ocp {
/* Enable PWM mode for these pins */
P8_19_pinmux {
/* gpio0[22] */
mode = “P8_19_pwm_pin”;
};
P8_13_pinmux {
/* gpio0[23] */
mode = “P8_13_pwm_pin”;
};
P9_14_pinmux {
/* gpio1[18] */
mode = “P8_14_pwm_pin”;
};
/* Enable input with pullups for these pins */
P8_14_pinmux {
/* gpio0[26] */
mode = “P8_14_gpio_pu_pin”;
};
P8_17_pinmux {
/* gpio0[27] */
mode = “P8_17_gpio_pu_pin”;
};
/* There is no output configuration - disable the default configuration */
P8_12_pinmux {
/* gpio1[12] */
status = “disabled”;
};
P8_11_pinmux {
/* gpio1[13] */
status = “disabled”;
};
P8_16_pinmux {
/* gpio1[14] */
status = “disabled”;
};
P8_15_pinmux {
/* gpio1[15] */
status = “disabled”;
};
P9_15_pinmux {
/* gpio1[16] */
status = “disabled”;
};
P9_23_pinmux {
/* gpio1[17] */
status = “disabled”;
};
P9_12_pinmux {
/* gpio1[28] */
status = “disabled”;
};
P8_26_pinmux {
/* gpio1[29] */
status = “disabled”;
};
};
/* Enable the output configuration defined above */