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

STM: Fix us_ticker timestamp after deep sleep #8136

Merged
merged 1 commit into from Sep 19, 2018

Conversation

Projects
None yet
7 participants
@fkjagodzinski
Member

fkjagodzinski commented Sep 14, 2018

Description

Use the mbed_sdk_inited flag to correct the HAL_GetTick() behavior
after waking up from deep sleep mode. ticker_read_us() must not be
used to read us_ticker timestamp after waking up until the us_ticker
context is restored. More detailed description in issue #8117.

Fixes #8117

CC @jeromecoutant @c1728p9 @jamesbeyond @maciejbocianski

Pull request type

[X] Fix
[ ] Refactor
[ ] Target update
[ ] Functionality change
[ ] Breaking change
@jeromecoutant

This comment has been minimized.

Contributor

jeromecoutant commented Sep 14, 2018

@bcostm FYI

CI tests started

@@ -199,6 +200,7 @@ void hal_deepsleep(void)
#else /* TARGET_STM32L4 */
HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);
#endif /* TARGET_STM32L4 */
mbed_sdk_inited = 0;

This comment has been minimized.

@bcostm

bcostm Sep 14, 2018

Contributor

Do you mind to add a comment explaining why we do this here (copy your PR description for example) ? For future reference... Thanks.

This comment has been minimized.

@fkjagodzinski

fkjagodzinski Sep 14, 2018

Member

Sorry about that. 😉 Comments added as requested.

STM: Fix us_ticker timestamp after deep sleep
Use the `mbed_sdk_inited` flag to correct the `HAL_GetTick()` behavior
after waking up from deep sleep mode. `ticker_read_us()` must not be
used to read us_ticker timestamp after waking up until the us_ticker
context is restored. More detailed description in issue #8117.

Fixes #8117

@fkjagodzinski fkjagodzinski force-pushed the fkjagodzinski:fix-stm-us_ticker_after_deepsleep branch from 09c365c to 6821556 Sep 14, 2018

@bcostm

bcostm approved these changes Sep 17, 2018

@@ -200,6 +201,10 @@ void hal_deepsleep(void)
HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);
#endif /* TARGET_STM32L4 */
/* Prevent HAL_GetTick() from using ticker_read_us() to read the

This comment has been minimized.

@LMESTM

LMESTM Sep 17, 2018

Contributor

What about moving restore_timer_ctx(); at this stage so that HAL_GetTick can be called in the next functions ?
Have you tried this ?

This comment has been minimized.

@fkjagodzinski

fkjagodzinski Sep 17, 2018

Member

The following functions:

  1. ForceClockOutofDeepSleep(),
  2. SetSysClock(),
  3. restore_timer_ctx(),

have to be called in that order. If the timer context was restored earlier, it would have been reset anyway.

This comment has been minimized.

@LMESTM

LMESTM Sep 17, 2018

Contributor

Ok good point indeed. will approve as it is

@0xc0170 0xc0170 added the needs: CI label Sep 17, 2018

@LMESTM

LMESTM approved these changes Sep 17, 2018

@0xc0170

This comment has been minimized.

Member

0xc0170 commented Sep 17, 2018

Starting the build as oldest needs: CI PR depends on this fix

/morph build

@mbed-ci

This comment has been minimized.

mbed-ci commented Sep 17, 2018

Build : SUCCESS

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

Triggering tests

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

@mbed-ci

This comment has been minimized.

@cmonr

This comment has been minimized.

Contributor

cmonr commented Sep 17, 2018

Pausing Test CI (it was still in queue, not running) for now. Will restart later today.

@cmonr

This comment has been minimized.

Contributor

cmonr commented Sep 19, 2018

/morph test

@mbed-ci

This comment has been minimized.

@0xc0170 0xc0170 added ready for merge and removed needs: CI labels Sep 19, 2018

@0xc0170 0xc0170 merged commit 6d5cb6c into ARMmbed:master Sep 19, 2018

14 checks passed

ci-morph-build build completed
Details
ci-morph-exporter build completed
Details
ci-morph-mbed2-build build completed
Details
ci-morph-test test completed , RTOS ROM(+0.0%) RAM(+0.0%)
Details
continuous-integration/jenkins/pr-head This commit looks good
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
jenkins-ci/cloud_client_smoke_test Test job: successful
Details
travis-ci/astyle Passed, 598 files
Details
travis-ci/docs Local docs testing has passed
Details
travis-ci/events Passed, runtime is 9092 cycles (-793 cycles)
Details
travis-ci/gitattributestest Local gitattributestest testing has passed
Details
travis-ci/licence_check Local licence_check testing has passed
Details
travis-ci/littlefs Passed, code size is 8372B (+0.00%)
Details
travis-ci/tools-py2.7 Local tools-py2.7 testing has passed
Details

@fkjagodzinski fkjagodzinski deleted the fkjagodzinski:fix-stm-us_ticker_after_deepsleep branch Oct 19, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment