Skip to content

tests-mbed_hal-lp_ticker: change implementation of the delay before deep-sleep. #7494

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

Merged
merged 1 commit into from
Jul 13, 2018

Conversation

mprse
Copy link
Contributor

@mprse mprse commented Jul 12, 2018

Description

This is fix for issue reported in PR #7419 (comment)

Serial buffer must be flushed before entering deep sleep mode. In the test this is done by the additional delay which is implemented on the busy loop which decrements given value down to 0 (void wait_cycles(volatile unsigned int cycles)).
This solution is not appropriate since it is very target specific and the cycles value has been already increased few times. Additionally very big number of loop cycles which is suitable for fast targets may take much longer on slower boards and results in test timeout.
It has been verified that 20ms is sufficient delay for the green-tea transmission. In this test we cannot simply use wait_ms(20) since this potentially may put board to sleep and wake up using lp ticker. The test re-initialzies the lp ticker(disables ticker interrupt) and this operation may break the schedule and time tracing by the upper layer. But we can use us ticker which is not affected by this test. The solution is to add a delay routine based on busy loop and us ticker only. This way are able to wait exactly 20 ms.

Pull request type

[X] Fix
[ ] Refactor
[ ] New target
[ ] Feature
[ ] Breaking change

@mprse mprse force-pushed the lp_ticker_deep_sleep_delay_fix branch from e6a3bef to 10e53b0 Compare July 12, 2018 11:27
…eep-sleep.

Serial buffer must be flushed before entering deep sleep mode. In the test this is done by the additional delay which is implemented on the busy loop which decrements given value down to 0 (`void wait_cycles(volatile unsigned int cycles)`). This solution is not appropriate since it is very target specific and the cycles value has been already increased few times. Additionally very big number of loop cycles which is suitable for fast targets may take much longer on slower boards and results in test timeout.
It has been verified that 20ms is sufficient delay for the green-tea transmission. In this test we cannot simply use `wait_ms(20)` since this potentially may put board to sleep and wake up using lp ticker. The test re-initialzies the lp ticker(disables ticker interrupt) and this operation may break the schedule and time tracing by the upper layer. But we can use us ticker which is not affected by this test. The solution is to add a delay routine based on busy loop and us ticker only. This way are able to wait exactly 20 ms.
@mprse mprse force-pushed the lp_ticker_deep_sleep_delay_fix branch from 10e53b0 to 832e8b3 Compare July 12, 2018 11:30
@0xc0170 0xc0170 requested a review from a team July 12, 2018 11:42
@OPpuolitaival
Copy link
Contributor

Cannot review, I don't know enough where this is affected

Copy link
Contributor

@studavekar studavekar left a comment

Choose a reason for hiding this comment

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

the number of cycles been replaced with definite time 👍

@0xc0170
Copy link
Contributor

0xc0170 commented Jul 13, 2018

/morph build

@mbed-ci
Copy link

mbed-ci commented Jul 13, 2018

Build : SUCCESS

Build number : 2594
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/7494/

Triggering tests

/morph test
/morph uvisor-test
/morph export-build
/morph mbed2-build

@mbed-ci
Copy link

mbed-ci commented Jul 13, 2018

@mbed-ci
Copy link

mbed-ci commented Jul 13, 2018

@cmonr cmonr merged commit def1ef2 into ARMmbed:master Jul 13, 2018
@0xc0170 0xc0170 removed the needs: CI label Jul 13, 2018
pan- pushed a commit to pan-/mbed that referenced this pull request Aug 22, 2018
…_fix

tests-mbed_hal-lp_ticker: change implementation of the delay before deep-sleep.
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.

6 participants