Hi all, Problem solved!
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. 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. Cheers, James Fitzsimons On Sat, 4 Jul 2020 at 22:36, James Fitzsimons <james.fitzsim...@gmail.com> wrote: > 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: > > /dts-v1/; > /plugin/; > > / { > compatible = "ti,am335x-bone-black-wireless", "ti,am335x-bone-black", > "ti,am335x-bone", "ti,am33xx"; > > fragment@0 { > target = <&epwmss1>; > __overlay__ { > status = "okay"; > }; > }; > > fragment@1 { > target = <&ehrpwm1>; > __overlay__ { > status = "okay"; > }; > }; > }; > > uboot now loads the fdt correctly and the RTEMS application runs, but > there is still no PWM output on pin P9_14. > > I'm at a bit of a loss. If anyone can shine a light on what I'm doing > wrong please let me know! > > Cheers, > James Fitzsimons > > On Sat, 4 Jul 2020 at 20:46, James Fitzsimons <james.fitzsim...@gmail.com> > wrote: > >> 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@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@1 { >> target = <&ocp>; >> __overlay__ { >> pwm_pin_helper { >> compatible = "rtems"; >> pinctrl-names = "default"; >> pinctrl-0 = <&pwm1_pins>; >> status = "okay"; >> }; >> }; >> }; >> >> fragment@2 { >> target = <&epwmss1>; >> __overlay__ { >> status = "okay"; >> }; >> }; >> >> fragment@3 { >> target = <&ehrpwm1>; >> __overlay__ { >> status = "okay"; >> }; >> }; >> }; >> >> >> >>
_______________________________________________ users mailing list users@rtems.org http://lists.rtems.org/mailman/listinfo/users