Skip to content

PwmOut resets settings after suspend. #13480

Closed
@lefebvresam

Description

@lefebvresam

Description of defect

When using PwmOut and putting the settings to 4kHz/25% it starts to output the right PWM-signal, but as soon as you do a suspend and resume, the frequency will be reset to 50Hz and you need to redo the settings again. Maybe it's a suggestion to use a start/stop functionality which is separate from the configuration settings.

Target(s) affected by this defect ?

NUCLEO_G474RE

Toolchain(s) (name and version) displaying this defect ?

GCC_ARM

What version of Mbed-os are you using (tag or sha) ?

mbed-os-6.2.0
#a2ada74770f043aff3e61e29d164a8e78274fcd4

What version(s) of tools are you using. List all that apply (E.g. mbed-cli)

mbed-cli 1.10.4

How is this defect reproduced ?

Create a small project to test:

PwmOut buzzer(PC_0);

void stopBuzzer() {
    buzzer.suspend();
}

void startBuzzer() {
    buzzer.resume();
}

void initBuzzer() {
    buzzer.period_us(250);
    buzzer.write(0.25f);
    buzzer.suspend();
}

int main()
{
    Timeout t;
    initBuzzer();

    ThisThread::sleep_for(5s);

    startBuzzer();
    t.attach(&stopBuzzer, 2s);

    while(true) ThisThread::sleep_for(1s);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions