Skip to content

Porting guide: Add Sleep API pg page #209

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 4 commits into from
Sep 15, 2017

Conversation

bulislaw
Copy link
Member

Status: Work in progress

It's basically Martin's proposal.

@c1728p9 @0xc0170

1. Wake-up sources - RTC, low power ticker or GPIO should be able to wake-up the MCU
1. Latency - should wake-up within 5 ms

The deep sleep latency (5 ms) was chosen as the higher limit of the vendors we support. Most of targets have wake-up latency for deep sleep within few microseconds. This wake-up time does not include reinitializing clocks or other related configuration to return to previous state after the deep sleep.
Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure I like that. We should either give a strict limit to go back to previous state or explicitly mark it as undefined.

Copy link
Contributor

Choose a reason for hiding this comment

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

I believe our intention was to have those 10ms (we increased it from 5) as a strict limit. Most of MCU can wake up within few microseconds, the part that takes are clocks related config reinit, up to few milliseconds. Shall we update this accordingly ?

Copy link
Member Author

@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.

Some things to think about/do:

  • Reference the header API
  • Add section about testing
  • Reference tests
  • Are there anything undefined?
  • Add info about the `SLEEP' macro
  • This API is optional

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.

Having to mention SLEEP in device_has would be good to have here. If this is porting guide, also add two functions that should be ported (hal_sleep) and (hal_deepsleep) ?

1. Wake-up sources - RTC, low power ticker or GPIO should be able to wake-up the MCU
1. Latency - should wake-up within 5 ms

The deep sleep latency (5 ms) was chosen as the higher limit of the vendors we support. Most of targets have wake-up latency for deep sleep within few microseconds. This wake-up time does not include reinitializing clocks or other related configuration to return to previous state after the deep sleep.
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe our intention was to have those 10ms (we increased it from 5) as a strict limit. Most of MCU can wake up within few microseconds, the part that takes are clocks related config reinit, up to few milliseconds. Shall we update this accordingly ?

The core system clock is disabled. The low precision clocks are enabled, RAM is retained.

1. Wake-up sources - RTC, low power ticker or GPIO should be able to wake-up the MCU
1. Latency - should wake-up within 5 ms
Copy link
Contributor

Choose a reason for hiding this comment

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

10ms


## Implementing the Sleep API

There are two functions that target needs to implement to support sleep, their prototypes are located in [hal/sleep_api.h]():
Copy link
Member Author

Choose a reason for hiding this comment

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

We'll embed the header here instead of copying and linking, when the changes are committed.

Copy edit for active voice, branding, consistent tense and other minor grammar issues.
@AnotherButler
Copy link
Contributor

@bulislaw I've added some minor copy edits. Please review, and make sure I didn't accidentally change the content.

@bulislaw
Copy link
Member Author

Thanks, looks good :)

@AnotherButler
Copy link
Contributor

@bulislaw Is this ready to merge, or is is still waiting on any engineering review/changes?

@bulislaw
Copy link
Member Author

I think I've addressed all the points raised by @0xc0170 so we should be ready to merge.


### Testing

The [sleep HAL API test suite]() validates:
Copy link
Contributor

Choose a reason for hiding this comment

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

Query: Where should this link?

Copy link
Contributor

Choose a reason for hiding this comment

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

@0xc0170 Do you know where this should link?

Copy link
Contributor

Choose a reason for hiding this comment

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

@c1728p9 Do you know where this should link?

Copy link
Contributor

Choose a reason for hiding this comment

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

Lets remove the testing for now and add it in a seperate PR once there is a link.

Delete section. Please add its content in a new PR once it's ready for the docs.
@AnotherButler AnotherButler merged commit ab86b64 into ARMmbed:new_engine Sep 15, 2017
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.

4 participants