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

lp_timeout test in TICKLESS mode #7328

Closed
jeromecoutant opened this issue Jun 26, 2018 · 17 comments
Closed

lp_timeout test in TICKLESS mode #7328

jeromecoutant opened this issue Jun 26, 2018 · 17 comments

Comments

@jeromecoutant
Copy link
Collaborator

Description

Hi

In TICKLESS mode, I got 2 questions in TESTS/mbed_drivers/timeout/timeout_tests.h

  • is direct call to sleep() function still allowed ?

  • there are some wait_ms() call function to allow hardware serial buffers to completely flush.
    But maybe these call should be protected by sleep_manager_lock_deep_sleep() ?

Thx

Issue request type

[x] Question
[ ] Enhancement
[ ] Bug

@ciarmcom
Copy link
Member

ARM Internal Ref: MBOTRIAGE-924

@jeromecoutant
Copy link
Collaborator Author

Another question in sleep_lock driver test:
is it relevant to check this deepsleep lock status in TICKLESS mode as it seems that systimer is constantly called ?

@jeromecoutant
Copy link
Collaborator Author

It seems that issues appear when LPTICKER_DELAY_TICKS is set...

@bulislaw @c1728p9

@jeromecoutant
Copy link
Collaborator Author

@ashok-rao @screamerbg

@bulislaw
Copy link
Member

Hi Jerome! Sorry missed that the first time round. sleep calls are allowed, but hopefully most of the people won't need them.

there are some wait_ms() call function to allow hardware serial buffers to completely flush.
But maybe these call should be protected by sleep_manager_lock_deep_sleep() ?

Serial is protected with deep sleep locks anyway, so as long as transfer is in progress that shouldn't be necessary: https://github.com/ARMmbed/mbed-os/blob/master/drivers/SerialBase.cpp

@bulislaw
Copy link
Member

@c1728p9 could you have a look at:

Another question in sleep_lock driver test:
is it relevant to check this deepsleep lock status in TICKLESS mode as it seems that systimer is constantly called ?

It seems that issues appear when LPTICKER_DELAY_TICKS is set...

@LMESTM
Copy link
Contributor

LMESTM commented Jun 28, 2018

@bulislaw I think that deep sleep protection applies only up to the serial putc to be empty, but I am not sure that it will check for HW serial buffer to be really complete.
See Initial concern raised 2 years back #1849
Other issues where same issue was raised according to @bridadan : #3132 #2966
Request for enhancement #4408 1 year old
Current workaround: #3017 => this adds a wait to let HW buffer enough time to empty ... except with tickless wait() will actually proceed with deep sleep entry ...
But maybe I missed a fix somewhere and #4408 should be closed ... just let me know.

@c1728p9
Copy link
Contributor

c1728p9 commented Jun 28, 2018

Hi @LMESTM the issue of going to sleep while there is a byte in the HW serial buffer has not been fixed. I'll make sure this gets fixed as part of the HAL specification for uarts.

Another question in sleep_lock driver test:
is it relevant to check this deepsleep lock status in TICKLESS mode as it seems that systimer is constantly called ?

This is still relevant, but the test is broken at the moment, as LPTICKER_DELAY_TICKS makes use of the microsecond ticker which locks deep sleep at different points in time. @0xc0170 you added this test right? Do you have any suggestions on how to work around this? What are your thoughts on sleeping for a second or two and reading the time in deep sleep? This may be a good indication of if deep sleep and the sleep lock are working.

@0xc0170
Copy link
Contributor

0xc0170 commented Jun 29, 2018

Another question in sleep_lock driver test:
is it relevant to check this deepsleep lock status in TICKLESS mode as it seems that systimer is constantly called ?

@jeromecoutant Can you reference the file and lines for this.

@jeromecoutant
Copy link
Collaborator Author

TEST_ASSERT_EQUAL(true, sleep_manager_can_deep_sleep());

If a ticker is on going due to LPTICKER_DELAY_TICKS, tests starts in a wrong state

@jeromecoutant
Copy link
Collaborator Author

@c1728p9 any update about LPTICKER_DELAY_TICKS in TICKLESS mode ?

@jeromecoutant
Copy link
Collaborator Author

@bulislaw any update about wait protection for deepsleep ?

@screamerbg
Copy link
Contributor

@bulislaw @c1728p9 Bump

@c1728p9
Copy link
Contributor

c1728p9 commented Jul 16, 2018

@jeromecoutant I created a PR #7524 to fix some of the problems of LPTICKER_DELAY_TICKS and TICKLESS. It doesn't fix the dropped UART bytes from entering deep sleep though. That problem will need to be fixed by a serial HAL specification or maybe even a high-priority change directly to master.

LMESTM added a commit to LMESTM/mbed that referenced this issue Aug 7, 2018
As suggested by Russ Butler in mbed-os issue ARMmbed#7328, and until there is an
implementation of mbed-os issue ARMmbed#4408, we are implementing a workaround
at HAL level to check if there is any ongoing serial transfer (which happens
if HW FIFO is not yet empty).

In case a transfer is ongoing, we're not entering deep sleep and
return immediately.
adbridge pushed a commit that referenced this issue Aug 10, 2018
As suggested by Russ Butler in mbed-os issue #7328, and until there is an
implementation of mbed-os issue #4408, we are implementing a workaround
at HAL level to check if there is any ongoing serial transfer (which happens
if HW FIFO is not yet empty).

In case a transfer is ongoing, we're not entering deep sleep and
return immediately.
adbridge pushed a commit that referenced this issue Aug 13, 2018
As suggested by Russ Butler in mbed-os issue #7328, and until there is an
implementation of mbed-os issue #4408, we are implementing a workaround
at HAL level to check if there is any ongoing serial transfer (which happens
if HW FIFO is not yet empty).

In case a transfer is ongoing, we're not entering deep sleep and
return immediately.
pan- pushed a commit to pan-/mbed that referenced this issue Aug 22, 2018
As suggested by Russ Butler in mbed-os issue ARMmbed#7328, and until there is an
implementation of mbed-os issue ARMmbed#4408, we are implementing a workaround
at HAL level to check if there is any ongoing serial transfer (which happens
if HW FIFO is not yet empty).

In case a transfer is ongoing, we're not entering deep sleep and
return immediately.
@jeromecoutant
Copy link
Collaborator Author

Hi all

Check #7858, it seems that LPTICKER_DELAY_TICKS is still not fully compatible with TICKLESS ?

@screamerbg
Copy link
Contributor

@c1728p9 @bulislaw please see question above.

@jeromecoutant
Copy link
Collaborator Author

Thx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants