Re: Nucleo STM32F411RE PWM support


Erwan Gouriou
 

Thanks for feedback.

 I don't see a particular reason why some channels would not work.
For pins, there's alway a possibility of pin conflicts (as I can see that pa8 is also used on i2c2).
So please take care to this.

Otherwise, don't hesitate to raise a bug if things don't work as expected.

Erwan




On Thu, 12 Nov 2020 at 18:37, Florian Hester <florian@...> wrote:
Hello,

I've added the pin PA8 to PWM of timers1:

timers1: timers@40010000 {
             status = "okay";

             pwm {
                 status = "okay";
                 pinctrl-0 = <&tim1_ch1_pwm_pa8>;
             };
  };

This did not work (no output pulse, no error logged either).

However, the PA5 pin (configured like above for PWM of timers2) did
work, and now i have a nice 100 microsecond period pulse on that pin.

I've tried the second channel (tim1_ch2_pwm_pa9) of the first timer, but
that one (like the first channel) also does not work (no output pulse).

Im going try more of the PWM channels, to see what is working and what
is not, but it seems like the first pwm device (PWM_1, as part of
timers1) is not working, any reason why not?

Florian

Op 12/11/2020 om 17:03 schreef Erwan Gouriou:
> Hi Florian,
>
> You also need to configure a pin, something like:
> &timers2 {
>            status = "okay";
>
>            pwm2: pwm {
>            status = "okay";
> +           pinctrl-0 = <&tim2_ch1_pwm_pa5>;
>            };
> };
>
> Please let us know if this was helpful.
>
> Erwan
>
> On Thu, 12 Nov 2020 at 13:58, Florian Hester via
> lists.zephyrproject.org <http://lists.zephyrproject.org>
> <florian=celaeno.org@...
> <mailto:celaeno.org@...>> wrote:
>
>     Hello,
>
>     I have used the following overlay:
>
>     / {
>          soc {
>              timers1: timers@40010000 {
>                  status = "okay";
>
>                  pwm {
>                      status = "okay";
>                  };
>              };
>
>              timers2: timers@40000000 {
>                  status = "okay";
>
>                  pwm {
>                      status = "okay";
>                  };
>              };
>
>              timers3: timers@40000400 {
>                  status = "okay";
>
>                  pwm {
>                      status = "okay";
>                  };
>              };
>
>              timers4: timers@40000800 {
>                  status = "okay";
>
>                  pwm {
>                      status = "okay";
>                  };
>              };
>          };
>     };
>
>     The prj.conf file contains the following regarding PWM:
>
>     CONFIG_PWM=y
>     CONFIG_PWM_STM32=y
>
>     I used the following code to test:
>
>          auto dev_pwm = device_get_binding("PWM_1");
>
>          if (dev_pwm != nullptr)
>          {
>              LOG_INF("Have PWM device.");
>
>              int ret = pwm_pin_set_usec(dev_pwm, 1, 100, 50, 0);
>
>              if (ret != 0)
>              {
>                  LOG_ERR("Could not set PWM.");
>              }
>              else
>              {
>                  LOG_INF("PWM set.");
>              }
>          }
>
>     The output:
>
>     [00:00:00.006,000] <inf> main: Have PWM device.
>     [00:00:00.006,000] <inf> main: PWM set.
>
>     I am measuring pin D7 on the board (PA8 for the chip), and no pulse.
>
>     Florian
>
>     Op 12/11/2020 om 08:36 schreef Adam Podogrocki:
>     > Hi Florian,
>     >
>     > have you set /status/ of the appropriate Timer & PWM device to
>     "okay"?
>     > Have you activated the PWM driver in Zephyr Menu Config? Have you
>     > successfully got device binding in the source code?
>     >
>     > Cheers,
>     > Adam
>     >
>     > On Thu, 12 Nov 2020 at 01:54, Florian Hester via
>     > lists.zephyrproject.org <http://lists.zephyrproject.org>
>     <http://lists.zephyrproject.org <http://lists.zephyrproject.org>>
>     > <florian=celaeno.org@...
>     <mailto:celaeno.org@...>
>     > <mailto:celaeno.org@...
>     <mailto:celaeno.org@...>>> wrote:
>     >
>     >     Hello,
>     >
>     >     When i look at the documentation of the Nucleo F411RE board at:
>     >
>     >
>     https://docs.zephyrproject.org/latest/boards/arm/nucleo_f411re/doc/index.html
>     <https://docs.zephyrproject.org/latest/boards/arm/nucleo_f411re/doc/index.html>
>     >   
>      <https://docs.zephyrproject.org/latest/boards/arm/nucleo_f411re/doc/index.html
>     <https://docs.zephyrproject.org/latest/boards/arm/nucleo_f411re/doc/index.html>>
>     >
>     >     I can see PWM as a supported feature. However,  the board
>     YAML file
>     >     (boards/arm/nucleo_f411re.yml) does not list PWM as
>     supported and the
>     >     board DTS (boards/arm/nucleo_f411re/nucleo_f411re.dts) does not
>     >     enable
>     >     any PWM device present on the hardware.
>     >
>     >     I've tried using an overlay to enable it anyway (the timers
>     and the
>     >     pwms), this compiles successfully and flashes (via JLink)
>     >     successfully,
>     >     but using the PWM API (or the shell pwm commands) does not
>     appear to
>     >     have any effect (no output pulse).
>     >
>     >     I have tried the PWM functionality in ARM mbed, where it works.
>     >
>     >     Why does Zephyr not have support for PWM on this board?
>     >
>     >
>     >     Florian
>     >
>     >
>     >
>     >
>     >
>     >
>     >
>     >
>
>
>     
>
>

Join users@lists.zephyrproject.org to automatically receive all group messages.