Re: Nucleo STM32F411RE PWM support


Florian Hester
 

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> <florian=celaeno.org@lists.zephyrproject.org <mailto:celaeno.org@lists.zephyrproject.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>

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.