Skip to content

Add tests for Sleep HAL API #5509

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

Conversation

mprse
Copy link
Contributor

@mprse mprse commented Nov 16, 2017

Description

This PR provides:

  • HAL Sleep test case specification to the sleep_api.h file.
  • test and test header to Sleep HAL API.

Status

READY

Migrations

NO

Related PRs

Todos

Implementation of the following test cases still needs to be added:

  • RTC should wake up a target from this mode - RTC alarm functionality is not yet available.
  • a watchdog timer should wake up a target from this mode - watchdog functionality is not yet available.
  • the processor can be woken up by external pin interrupt - @bulislaw @theotherjimmy @0xc0170 I need some information how CI environment is build and if there is any option to create such case. I tried to set USBRX pin as interrupt input pin and send some data from python part of test in order to wake up the board from sleep. This solution worked on K64F, but on NUCLEOF070RB did not - it looks like this pin could not be used as interrupt input.
    We need some general solution for all boards. From my point of view we need additional board which could be controlled by Green Tea in order to control its pins. For this test we would need to set specified pin on additional board as output and then be able to modify its logic level. This pin have to be connected to the specific pin in the tested boards. Then test could use this specific pin as interrupt input pin in order to wake up board from sleep.
    What do you think?
    Maybe some solution for this type of tests is already available if yes, then can some provide some piece of information how to use it?

Copy link
Member

@bulislaw bulislaw left a comment

Choose a reason for hiding this comment

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

I don't think we can test the GPIO wake up with current CI setup.

@@ -27,6 +27,42 @@
extern "C" {
#endif

/**
Copy link
Member

Choose a reason for hiding this comment

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

What is that? That should be on the branch already?

Copy link
Contributor Author

@mprse mprse Nov 22, 2017

Choose a reason for hiding this comment

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

I added requirements section since it wasn't available on this branch. Requirements have been created based on function descriptions which are precise.

Copy link
Contributor

Choose a reason for hiding this comment

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

That explains it, thanks @mprse

@bulislaw
Copy link
Member

@mprse ping

@mprse
Copy link
Contributor Author

mprse commented Nov 22, 2017

If GPIO wake-up can not be tested, then this PR is ready for now.
Additional test cases will have to be added when watchdog timer and RTC alarm modules are ready.

@0xc0170
Copy link
Contributor

0xc0170 commented Nov 22, 2017

/morph build

@mbed-ci
Copy link

mbed-ci commented Nov 22, 2017

Build : FAILURE

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

@mprse mprse force-pushed the feature-hal-spec-sleep_tests branch from 3875e15 to 92e02e4 Compare November 22, 2017 14:39
@mprse
Copy link
Contributor Author

mprse commented Nov 22, 2017

    [Error] main.cpp@118,0:  #20: identifier "get_lp_ticker_data" is undefined
    [Error] main.cpp@131,0:  #20: identifier "lp_ticker_read" is undefined
    [Error] main.cpp@132,0:  #20: identifier "lp_ticker_set_interrupt" is undefined

Fix has been provided for targets without low power timers.

@bulislaw
Copy link
Member

/morph build

@mbed-ci
Copy link

mbed-ci commented Nov 23, 2017

Build : FAILURE

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

@bulislaw
Copy link
Member

NOT SUPPORTED should be NOT_SUPPORTED -> _ matters

@mprse mprse force-pushed the feature-hal-spec-sleep_tests branch from 92e02e4 to 9afcfb2 Compare November 24, 2017 07:38
@mprse
Copy link
Contributor Author

mprse commented Nov 24, 2017

NOT SUPPORTED should be NOT_SUPPORTED -> _ matters

Fixed as suggested.

Copy link
Contributor

@0xc0170 0xc0170 left a comment

Choose a reason for hiding this comment

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

rtc_sleep_test is part of RTC feature branch?

@0xc0170
Copy link
Contributor

0xc0170 commented Nov 24, 2017

/morph build

@mprse
Copy link
Contributor Author

mprse commented Nov 24, 2017

rtc_sleep_test is part of RTC feature branch?

Yes its already on ARMmbed:feature-hal-spec-rtc. I didn't want to duplicate tests.

@mbed-ci
Copy link

mbed-ci commented Nov 24, 2017

Build : SUCCESS

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

Triggering tests

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

@mbed-ci
Copy link

mbed-ci commented Nov 24, 2017

@mbed-ci
Copy link

mbed-ci commented Nov 24, 2017

@0xc0170
Copy link
Contributor

0xc0170 commented Nov 24, 2017

@mprse Please review the tests results, 3 targets might break the expected behavior

@mprse
Copy link
Contributor Author

mprse commented Nov 24, 2017

Target Result Comment
NCS36510-ARM :76::FAIL: Values Not Within Delta 16 Expected 6280721 Was 6280741 waking from sleep exceeds limit (10 us)
NCS36510-GCC_ARM :77::FAIL: Values Not Within Delta 16 Expected 6326302 Was 6326323 waking from sleep exceeds limit (10 us)
NCS36510-IAR :77::FAIL: Values Not Within Delta 16 Expected 6293332 Was 6293353 waking from sleep exceeds limit (10 us)
NRF51_DK-ARM :76::FAIL: Values Not Within Delta 16 Expected 2375956 Was 2376190 waking from sleep exceeds limit (10 us)
NRF51_DK-GCC_ARM Timeout us ticker interrupt did not wake up target from sleep
NRF51_DK-IAR Timeout us ticker interrupt did not wake up target from sleep
NRF52_DK-ARM :76::FAIL: Values Not Within Delta 16 Expected 6375712 Was 6375793 waking from sleep exceeds limit (10 us)
NRF52_DK-GCC_ARM :77::FAIL: Values Not Within Delta 16 Expected 2381968 Was 2382019 waking from sleep exceeds limit (10 us)
NRF52_DK-IAR Timeout us ticker interrupt did not wake up target from sleep

@mprse
Copy link
Contributor Author

mprse commented Nov 24, 2017

Note:
Sleep test assume that we have new ticker drivers:

  • ticker counter counts ticks not us and is incremented by one,
  • ticker has defined frequency,
  • based on ticker frequency ticker count is converted to us.

I believe that most boards have ticker drivers are not ready. As far as I remember ticker frequency for all targets is declared as 1 MHz. I remember that on NRF51_DK high frequency ticker has 32kHz frequency, but it is scaled to 1MHz - incremented by 32. This might cause some us<-->ticks conversion problems.

@bulislaw
Copy link
Member

@mprse it's 3 boards, can we fix them? Or work it around another way?

@mbed-ci
Copy link

mbed-ci commented Jan 11, 2018

Exporter Build : FAILURE

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

@0xc0170
Copy link
Contributor

0xc0170 commented Jan 11, 2018

We are investigating the failure in exporters (some of the last builds have the same problem)

@mbed-ci
Copy link

mbed-ci commented Jan 11, 2018

@mprse
Copy link
Contributor Author

mprse commented Jan 12, 2018

In the last test run only sleep tests have failed on NFR52_DK. This means that there is a relation between disabling SLEEP support on this board and problems with other tests. Try to disable also features which are related to sleep mode.

@mprse mprse force-pushed the feature-hal-spec-sleep_tests branch from 4e23237 to 1ca3b24 Compare January 12, 2018 06:50
@0xc0170
Copy link
Contributor

0xc0170 commented Jan 12, 2018

/morph build

@mbed-ci
Copy link

mbed-ci commented Jan 12, 2018

Build : SUCCESS

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

Triggering tests

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

@mbed-ci
Copy link

mbed-ci commented Jan 12, 2018

@mbed-ci
Copy link

mbed-ci commented Jan 12, 2018

@mprse
Copy link
Contributor Author

mprse commented Jan 12, 2018

The results are better but still two tests did not pass on NRF52_DK/IAR:

  • tests-mbed_drivers-timer
  • tests-mbed_drivers-ticker.

@0xc0170
Copy link
Contributor

0xc0170 commented Jan 12, 2018

/morph test

@mbed-ci
Copy link

mbed-ci commented Jan 12, 2018

@mprse mprse force-pushed the feature-hal-spec-sleep_tests branch from 1ca3b24 to 72aa953 Compare January 15, 2018 10:09
@mprse
Copy link
Contributor Author

mprse commented Jan 15, 2018

For NRF52_DK removing of "SLEEP" feature causes some timing issues which have influence on tests. In order to successfully disable this board related features like "USTICKER", "LOWPOERTIMER" have been disabled and ticker tests were slightly modified, so they will not be executed if usticker support is not available (by default all targets support us ticker).

These boards will be re-enabled when sleep driver for them is ready.

Note:
This operation is done by removing "SLEEP" feature from target's "device_has" list (in targets.json config file).
For NRF52_DK removing of "SLEEP" feature causes some timing issues which have influence on tests. In order to successfully disable this board we need to disable also related features like "USTICKER", "LOWPOERTIMER" and slightly modify ticker tests, so they will not be executed if usticker support is not available (by default all targets support us ticker).
@mprse mprse force-pushed the feature-hal-spec-sleep_tests branch from 72aa953 to 7ee9b0e Compare January 15, 2018 10:25
@0xc0170
Copy link
Contributor

0xc0170 commented Jan 15, 2018

/morph build

@mbed-ci
Copy link

mbed-ci commented Jan 15, 2018

Build : SUCCESS

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

Triggering tests

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

@mbed-ci
Copy link

mbed-ci commented Jan 15, 2018

@0xc0170
Copy link
Contributor

0xc0170 commented Jan 15, 2018

/morph export-build

@mbed-ci
Copy link

mbed-ci commented Jan 15, 2018

@mbed-ci
Copy link

mbed-ci commented Jan 15, 2018

@bulislaw
Copy link
Member

Is that ready to go?

@mprse
Copy link
Contributor Author

mprse commented Jan 15, 2018

Finally CI has passed. Three boards are disabled. Its ready to go.

@0xc0170 0xc0170 merged commit e81d4f1 into ARMmbed:feature-hal-spec-sleep Jan 16, 2018
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

Successfully merging this pull request may close these issues.

6 participants