Using PWM on the beaglebone black

James Fitzsimons james.fitzsimons at gmail.com
Sat Jul 4 08:46:45 UTC 2020


Hi all,

I'm planning to start development on adding the QEP driver to the
Beaglebone BSP soon, but want to make sure I can use the PWM driver
properly first as this will almost certainly require some changes to add
the QEP functionality.

I've been able to get the PWM driver to output a signal on P8_13 (which is
EHRPWM2B by default). However, trying to get the same program to output the
PWM signal on P9_14 is not working.

Questions:
1. Am I correct in assuming that I will need to add a fdt overlay to enable
P9_14 for PWM output before that will work?
2. If yes to 1. above, is there anything special that needs to be added to
enable fdt support in RTEMS for pinmux changes?

I have tried creating an overlay (source at the end of this email) and
adding it to the u-boot start up but when RTEMS starts I get the following
error displayed in the console output.

...
Loaded environment from /uEnv.txt
Importing environment from mmc ...
Checking if uenvcmd is set ...
gpio: pin 56 (gpio 56) value is 1
Running uenvcmd ...
81815 bytes read in 8 ms (9.8 MiB/s)
53130 bytes read in 6 ms (8.4 MiB/s)
373 bytes read in 2 ms (181.6 KiB/s)
1065 bytes read in 2 ms (519.5 KiB/s)
failed on fdt_overlay_apply(): FDT_ERR_NOTFOUND
## Booting kernel from Legacy Image at 80800000 ...
   Image Name:   RTEMS
   Created:      2020-07-04   5:52:20 UTC
   Image Type:   ARM Linux Kernel Image (gzip compressed)
   Data Size:    81751 Bytes = 79.8 KiB
   Load Address: 80000000
   Entry Point:  80000000
   Verifying Checksum ... OK
ERROR: Did not find a cmdline Flattened Device Tree
Could not find a valid device tree
....

Obviously this  error "failed on fdt_overlay_apply(): FDT_ERR_NOTFOUND" is
signifying something wrong with my overlay, but I'm struggling to figure
out what. I have a much more complex overlay working on Linux.

Any advice greatly appreciated!

Cheers,
James Fitzsimons

overlay source:

/*
 * Copyright (C) 2018 James Fitzsimons
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 *
 *  It sets up the following devices:
 * - P9.14 PWM ehrpwm1A on epwmss1 for motor control
 * - P9.16 PWM ehrpwm1B on epwmss1 for motor control
 *
 */
/dts-v1/;
/plugin/;

//#include "am33xx.dtsi"
//#include "am335x-bone-common.dtsi"
//#include "am335x-boneblack-common.dtsi"

/ {
compatible = "ti,am335x-bone-black-wireless", "ti,am335x-bone-black",
"ti,am335x-bone", "ti,am33xx";

// -- PWM section --
    fragment at 0 {
        target = <&am33xx_pinmux>;
        __overlay__ {
        pwm1_pins: pinmux_pwm1_pins {
                pinctrl-single,pins = <
                    0x048 0x06  //AM33XX_IOPAD(0x848, PIN_OUTPUT_PULLDOWN |
MUX_MODE6) /* (U14) gpmc_a2.ehrpwm1A  P9_14 */
                    0x04c 0x06  //AM33XX_IOPAD(0x84c, PIN_OUTPUT_PULLDOWN |
MUX_MODE6) /* (T14) gpmc_a3.ehrpwm1B  P9_16 */
>;
            };
        };
    };

fragment at 1 {
   target = <&ocp>;
       __overlay__ {
       pwm_pin_helper {
        compatible = "rtems";
           pinctrl-names = "default";
           pinctrl-0 = <&pwm1_pins>;
           status = "okay";
       };
   };
};

    fragment at 2 {
        target = <&epwmss1>;
        __overlay__ {
            status = "okay";
        };
    };

    fragment at 3 {
        target = <&ehrpwm1>;
        __overlay__ {
            status = "okay";
        };
    };
};
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20200704/3812121d/attachment.html>


More information about the users mailing list