<div dir="ltr">Hi all,<div><br></div><div>Problem solved! </div><div><br></div><div>After coming back to this fresh the next day I realised I had gone down a blind alley with the device tree thinking. The PWM driver does all hardware configuration required - no fdt required.</div><div><br></div><div>I started double checking everything in the driver code and eventually found the bug. The register offsets for the PWM output on P9_14 and P9_16 were wrong. I've created a patch for this and submitted it to the developer list.</div><div><br></div><div>Cheers,</div><div>James Fitzsimons</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, 4 Jul 2020 at 22:36, James Fitzsimons <<a href="mailto:james.fitzsimons@gmail.com">james.fitzsimons@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">After thinking about this some more I realised the pinmux setup is part of the PWM driver code, so I assume the fdt overlay isn't required to set the pin mux. I tried reducing the overlay to just the following:<div><br></div><div>/dts-v1/;<br>/plugin/;<br><br>/ {<br> compatible = "ti,am335x-bone-black-wireless", "ti,am335x-bone-black", "ti,am335x-bone", "ti,am33xx"; <br><br> fragment@0 {<br> target = <&epwmss1>;<br> __overlay__ {<br> status = "okay";<br> };<br> };<br><br> fragment@1 {<br> target = <&ehrpwm1>;<br> __overlay__ {<br> status = "okay";<br> };<br> };<br>};<br></div><div><br></div><div>uboot now loads the fdt correctly and the RTEMS application runs, but there is still no PWM output on pin P9_14. </div><div><br></div><div>I'm at a bit of a loss. If anyone can shine a light on what I'm doing wrong please let me know!</div><div><br></div><div>Cheers,</div><div>James Fitzsimons</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, 4 Jul 2020 at 20:46, James Fitzsimons <<a href="mailto:james.fitzsimons@gmail.com" target="_blank">james.fitzsimons@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi all,<div><br></div><div>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.</div><div><br></div><div>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.</div><div><br></div><div>Questions:</div><div>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?</div><div>2. If yes to 1. above, is there anything special that needs to be added to enable fdt support in RTEMS for pinmux changes?</div><div><br></div><div>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.</div><div><br></div><div>...</div><div>Loaded environment from /uEnv.txt<br></div><div>Importing environment from mmc ...<br>Checking if uenvcmd is set ...<br>gpio: pin 56 (gpio 56) value is 1<br>Running uenvcmd ...<br>81815 bytes read in 8 ms (9.8 MiB/s)<br>53130 bytes read in 6 ms (8.4 MiB/s)<br>373 bytes read in 2 ms (181.6 KiB/s)<br>1065 bytes read in 2 ms (519.5 KiB/s)<br>failed on fdt_overlay_apply(): FDT_ERR_NOTFOUND<br>## Booting kernel from Legacy Image at 80800000 ...<br> Image Name: RTEMS<br> Created: 2020-07-04 5:52:20 UTC<br> Image Type: ARM Linux Kernel Image (gzip compressed)<br> Data Size: 81751 Bytes = 79.8 KiB<br> Load Address: 80000000<br> Entry Point: 80000000<br> Verifying Checksum ... OK<br>ERROR: Did not find a cmdline Flattened Device Tree<br>Could not find a valid device tree<br></div><div>....</div><div><br></div><div>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.</div><div><br></div><div>Any advice greatly appreciated!</div><div><br></div><div>Cheers,</div><div>James Fitzsimons</div><div><br></div><div>overlay source:</div><div><br></div><div>/*<br> * Copyright (C) 2018 James Fitzsimons<br> *<br> * This program is free software; you can redistribute it and/or modify<br> * it under the terms of the GNU General Public License version 2 as<br> * published by the Free Software Foundation.<br> *<br> * It sets up the following devices:<br> * - P9.14 PWM ehrpwm1A on epwmss1 for motor control<br> * - P9.16 PWM ehrpwm1B on epwmss1 for motor control<br> *<br> */<br>/dts-v1/;<br>/plugin/;<br><br>//#include "am33xx.dtsi"<br>//#include "am335x-bone-common.dtsi"<br>//#include "am335x-boneblack-common.dtsi"<br><br>/ {<br> compatible = "ti,am335x-bone-black-wireless", "ti,am335x-bone-black", "ti,am335x-bone", "ti,am33xx";<br><br> // -- PWM section --<br> fragment@0 {<br> target = <&am33xx_pinmux>;<br> __overlay__ {<br> pwm1_pins: pinmux_pwm1_pins {<br> pinctrl-single,pins = <<br> 0x048 0x06 //AM33XX_IOPAD(0x848, PIN_OUTPUT_PULLDOWN | MUX_MODE6) /* (U14) gpmc_a2.ehrpwm1A P9_14 */<br> 0x04c 0x06 //AM33XX_IOPAD(0x84c, PIN_OUTPUT_PULLDOWN | MUX_MODE6) /* (T14) gpmc_a3.ehrpwm1B P9_16 */<br> >;<br> }; <br> };<br> }; <br><br> fragment@1 {<br> target = <&ocp>;<br> __overlay__ {<br> pwm_pin_helper {<br> compatible = "rtems";<br> pinctrl-names = "default";<br> pinctrl-0 = <&pwm1_pins>;<br> status = "okay";<br> };<br> };<br> };<br> <br> fragment@2 {<br> target = <&epwmss1>;<br> __overlay__ {<br> status = "okay";<br> };<br> };<br><br> fragment@3 {<br> target = <&ehrpwm1>;<br> __overlay__ {<br> status = "okay";<br> };<br> };<br>};<br><br></div><div><br></div><div><br></div></div>
</blockquote></div>
</blockquote></div>