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

Allow to use all STM32 targets prescaler for LPTIM #15051

Merged
merged 2 commits into from
Sep 10, 2021

Conversation

hallard
Copy link
Contributor

@hallard hallard commented Sep 3, 2021

Summary of changes

Allows using all prescalers available for STM32 LPTIM , allowing to have less consumption on long sleep such as LoRaWAN app

Impact of changes

Power consumption optimization

Migration actions required

Documentation

Power consumption graph below, measured just after LoRaWAN join at the begining
image

Setting to today maximum value to 4 show power peaks in red and average consumption (3m46s runtime) to 5.57uA

"target.lpticker_lptim_clock": 4,
"target.lpticker_lptim": 1,
"events.use-lowpower-timer-ticker": true,

This PR allows prescaler up to 128 resulting power peaks in green and average consumption (3m46s runtime) to 4.16uA

"target.lpticker_lptim_clock": 128,
"target.lpticker_lptim": 1,
"events.use-lowpower-timer-ticker": true,

Leaving default values to 1 provide following graph, power peaks in yellow and average consumption (3m46s runtime) to 9.85uA

"target.lpticker_lptim_clock": 1,

image

What's interesting is that longer is sleeping higher is consumption on wake up, my assumption is that mbed-os has more things to do so takes more time when waked less often, makes sense, confirmed by zooming peaks

image


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)
[x] Covered by existing mbed-os tests (Greentea or Unittest)
[] Tests / results supplied as part of this PR

Reviewers

@0xc0170 , @jeromecoutant , @MarceloSalazar


@ciarmcom ciarmcom added the release-type: patch Indentifies a PR as containing just a patch label Sep 3, 2021
@ciarmcom
Copy link
Member

ciarmcom commented Sep 3, 2021

@hallard, thank you for your changes.
@jeromecoutant @0xc0170 @MarceloSalazar @ARMmbed/mbed-os-maintainers please review.

@LMESTM
Copy link
Contributor

LMESTM commented Sep 6, 2021

@hallard please note that such change will reduce the LP timer resolution and will have impacts on mbed-os timer precision and therefore on scheduling. The precision will be 128 timers lower with pre-scaler set to 128 vs. 1.

mbed-os mandates that frequency is between 8KHz and 64KHz.
https://os.mbed.com/docs/mbed-os/v6.14/porting/low-power-ticker.html
I think this will not be the case with such setting. Nevertheless if this is acceptable for a given application, I'm ok with it, but clear documentation and "disclaimers" are needed.

@jeromecoutant
Copy link
Collaborator

Agree with Laurent, we can approve if there is some "comments" that choosing value greater than 4 can work, but out of mbed-os requirements.

@hallard
Copy link
Contributor Author

hallard commented Sep 6, 2021

I think this will not be the case with such setting. Nevertheless if this is acceptable for a given application, I'm ok with it, but clear documentation and "disclaimers" are needed.

Sure, of course, do you want me to update the documentation also or leaving targets.json unchanged so this one is not mentioned anywhere?

@ciarmcom ciarmcom added the stale Stale Pull Request label Sep 9, 2021
@ciarmcom
Copy link
Member

ciarmcom commented Sep 9, 2021

This pull request has automatically been marked as stale because it has had no recent activity. @0xc0170, @MarceloSalazar, @ARMmbed/mbed-os-maintainers, please complete review of the changes to move the PR forward. Thank you for your contributions.

@0xc0170 0xc0170 removed the stale Stale Pull Request label Sep 9, 2021
@mergify mergify bot added needs: CI and removed needs: review labels Sep 9, 2021
@0xc0170
Copy link
Contributor

0xc0170 commented Sep 10, 2021

CI started

@mbed-ci
Copy link

mbed-ci commented Sep 10, 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_cmake-cloud-example-ARM ✔️
jenkins-ci/mbed-os-ci_cmake-cloud-example-GCC_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-ARM ✔️
jenkins-ci/mbed-os-ci_build-greentea-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_cmake-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_cmake-example-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 ✔️

@0xc0170 0xc0170 merged commit 5a3f3f7 into ARMmbed:master Sep 10, 2021
@mergify mergify bot removed the ready for merge label Sep 10, 2021
@hallard hallard deleted the STM32_LPTIM_Prescaler branch September 10, 2021 15:59
@mbedmain mbedmain removed release-type: patch Indentifies a PR as containing just a patch Release-pending labels Sep 21, 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

7 participants