Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for PWM resume issue, SWINTEGRATION-57 #15139

Merged
merged 1 commit into from
Oct 25, 2021

Conversation

billwatersiii
Copy link
Contributor

Summary of changes

This is a workaround for the problem described here - #15135 (comment)

The PwmOut::resume() function in mbed-os/drivers/source/PwmOut.cpp sets the "percentage of the period" (the duty cycle) before it sets the period.

void PwmOut::resume()
{
    core_util_critical_section_enter();
    if (!_initialized) {
        PwmOut::init();
        PwmOut::write(_duty_cycle);
        PwmOut::period_us(_period_us);
    }
    core_util_critical_section_exit();
}

We capture the duty cycle in microseconds when the PwmOut::write()->pwmout_write() function is called. We do not update the duty cycle when the PwmOut::period_us()->pwmout_period_us() function is called. Before this update, we didn't have the percent value to do so. With this update, the percent value is saved whenever pwmout_write() is called. And the percentage is used, when appropriate, in the pwmout_period_us() function. If the duty cycle is updated with a time value before the pwmout_period_us() function is called, that percentage will not be used.

There are no Greentea or Unittest that cover this functionality. The problem can be observed on the output of the pin. This was manually tested by multiple team members at Infineon.

Impact of changes

Likely none. If there is an impact, it will be positive. The PWM signal will now be correct and as expected after PwmOut::resume() is called.

Migration actions required

Not applicable

Documentation

None


Pull request type

[X] Patch update (Bug fix / Target update / Docs update / Test update / Refactor)
[] Feature update (New feature / Functionality change / New API)
[] Major update (Breaking change E.g. Return code change / API behaviour change)

Test results

[] No Tests required for this change (E.g docs only update)
[] Covered by existing mbed-os tests (Greentea or Unittest)
[X] Tests / results supplied as part of this PR

Reviewers

@ARMMbed/team-cypress


@ciarmcom ciarmcom added the release-type: patch Indentifies a PR as containing just a patch label Oct 12, 2021
@ciarmcom ciarmcom requested a review from a team October 12, 2021 18:30
@ciarmcom
Copy link
Member

@billwatersiii, thank you for your changes.
@ARMmbed/mbed-os-maintainers please review.

Copy link

@ifyall ifyall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved

@0xc0170
Copy link
Contributor

0xc0170 commented Oct 15, 2021

CI started

0xc0170
0xc0170 previously approved these changes Oct 15, 2021
@mbed-ci
Copy link

mbed-ci commented Oct 15, 2021

Jenkins CI Test : ✔️ SUCCESS

Build Number: 1 | 🔒 Jenkins CI Job | 🌐 Logs & Artifacts

CLICK for Detailed Summary

jobs Status
jenkins-ci/mbed-os-ci_unittests ✔️
jenkins-ci/mbed-os-ci_build-greentea-ARM ✔️
jenkins-ci/mbed-os-ci_build-cloud-example-ARM ✔️
jenkins-ci/mbed-os-ci_build-cloud-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-greentea-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-example-ARM ✔️
jenkins-ci/mbed-os-ci_build-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_greentea-test ✔️

@billwatersiii
Copy link
Contributor Author

@0xc0170, the checks that are failing don't have anything to do with the one file that I modified in this pull request. Is this something that you can look into and resolve?

@0xc0170
Copy link
Contributor

0xc0170 commented Oct 18, 2021

Yes, looking at it now.

@0xc0170
Copy link
Contributor

0xc0170 commented Oct 18, 2021

There was a fix merged few days back #15138 - can you rebase this pull request? I'll restart testing.

@mergify mergify bot dismissed 0xc0170’s stale review October 21, 2021 16:23

Pull request has been modified.

@billwatersiii
Copy link
Contributor Author

@0xc0170, the rebase is complete. Please restart testing.

@0xc0170
Copy link
Contributor

0xc0170 commented Oct 22, 2021

Ci restarted

@mbed-ci
Copy link

mbed-ci commented Oct 22, 2021

Jenkins CI Test : ✔️ SUCCESS

Build Number: 2 | 🔒 Jenkins CI Job | 🌐 Logs & Artifacts

CLICK for Detailed Summary

jobs Status
jenkins-ci/mbed-os-ci_unittests ✔️
jenkins-ci/mbed-os-ci_build-cloud-example-ARM ✔️
jenkins-ci/mbed-os-ci_build-cloud-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-greentea-ARM ✔️
jenkins-ci/mbed-os-ci_build-greentea-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-example-ARM ✔️
jenkins-ci/mbed-os-ci_greentea-test ✔️

@0xc0170 0xc0170 merged commit 84e0d5d into ARMmbed:master Oct 25, 2021
@mergify mergify bot removed the ready for merge label Oct 25, 2021
@mbedmain mbedmain added Release-pending and removed release-type: patch Indentifies a PR as containing just a patch Release-pending labels Nov 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants