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
RTC specification with test headers (branch feature-hal-spec-rtc) #5226
RTC specification with test headers (branch feature-hal-spec-rtc) #5226
Conversation
This is an alternative to #5008 |
@0xc0170 @c1728p9 @bulislaw @jeromecoutant @bcostm @adustm |
Build : FAILUREBuild number : 46 |
This would be a new extension. What you are interested in is This is probably better to capture to a new issue on github as a new API request. |
Hi @LMESTM, that request makes sense to me, but I have a few concerns. Devices without low power ticker
Devices with low power ticker
Because of the above bold points, I don't think there would be much benefit for making if just an attach function is added to the RTC API. To make the RTC useful for sleep I think a new sleep mode, something like |
We will be adding powerdown/hibernate mode to mbed soonish. |
Build : FAILUREBuild number : 68 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Python looks good.
Maybe remove the ()
after yield?
ab9a024
to
8b1b47e
Compare
Rebased to master and removed |
Build : FAILUREBuild number : 80 |
8b1b47e
to
00165c9
Compare
Build : SUCCESSBuild number : 126 Triggering tests/test mbed-os |
Test : FAILUREBuild number : 46 |
@c1728p9 Failures are related, expected I assume? I restarted jenkins CI also |
I don't understand this point - can you elaborate on "RTOS timing violation" ?
Possible advantage to reduce the number of wake-ups when the only wake-up is scheduled after a long time. Do you mean that you may need to update the RTOS time when wakeing-up ?
Same Here .. do you mean that you need to update RTOS time based on elapsed RTC time? Same could be done in the deepsleep don't you think ? |
Without the low power timer the RTOS won't be able to wake up the system from deep sleep. Because of this the rtos will sleep for an undefined amount of time whenever all the threads become suspended.
In the case where tickless is enabled, the RTOS will properly be suspended for as long as requested. The problem I mentioned is for devices with a small bit-width counter like 16 bit. To keep track of time an interrupt needs to keep firing to account for overflows. For 32 bit counters this isn't really a problem since it take a long time for an overflow to occur.
The RTC is intended to be a low resolution long running timer. Since its time base is in seconds it can't be used for updating the RTOS time which requires millisecond resolution. Looking at the STM implementation of the low power ticker, it is already using the RTC. This allows going more than half an hour between wakeups with the existing low power API. Assuming deep sleep wakeup takes the worst case allow by the hal specification - 10ms this will correspond to being awake 0.00056% = 10ms / (30min + 10ms) of the time. Using the STM32F411 as an example device, power numbers due to the extra 30 minute wakeup with the low power timer can be computed given: Theoretical current draw with 100% deep sleep = 0.1000000mA Because the extra current from waking up is so small compared stop mode current there isn't a big advantage to extending the RTC API to allow for the system to sleep for longer with deep sleep mode. This is because deep sleep mode requires almost all state to be maintained which prevents some of the deepest sleep modes. The biggest advantage will be relaxing the requirement that peripherial and memory state is maintained by adding a new In summary, even without an RTC alarm function, deep sleep mode current draw is nearly as low as it can be, and adding this API would save very little power. The real power savings will come in the future when a new @LMESTM let me know what you think or if I made any math errors. |
Turned off the RTC for all devices. As devices conform to the new API they should re-enable RTC on this feature branch. |
Build : FAILUREBuild number : 159 |
There are CI failures, please resolve |
db39107
to
dc42a98
Compare
/morph build |
047a2bf
to
0663ade
Compare
/morph build |
Build : FAILUREBuild number : 326 |
@c1728p9 What else is there to do in this ticket? It seems that we are spinning in circles, can we just disable boards that are not working and merge it to the feature branch ASAP? |
Keep the prototypes in rtc_api.h even when DEVICE_RTC is not defined. This allows devices that aren't fully compliant with the RTC API to still use the header and prototypes.
Keep the RTC code if either DEVICE_RTC or DEVICE_LOWPOWERTIMER is defined on the devices which use the RTC for both the rtc api and the low power timer api. This allows DEVICE_LOWPOWERTIMER to be enabled while DEVICE_RTC is turned off.
Add requirements, tests, an example implementation and additional function documentation to the HAL RTC API.
Turn off RTC for all devices. When support for a device is added this should be re-enabled.
0663ade
to
beb4ff3
Compare
I cant disable the boards since CI fails when these boards aren't there. Yeah, I'm spinning in circles on this. |
/morph build |
Build : SUCCESSBuild number : 338 Triggering tests/morph test |
Test : FAILUREBuild number : 151 |
/morph test |
Test : FAILUREBuild number : 155 |
Test : FAILUREBuild number : 160 |
Test : SUCCESSBuild number : 167 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@c1728p9 Could you put tests headers in matching place to create a 'standard'? https://github.com/ARMmbed/mbed-os/pull/5164/files did it differently than this PR.
I think it's more readable if they are in their separate tests directory, but I don't have very strong opinion.
Hi @bulislaw, this PR puts the test header file along side the test itself, which should be the 'standard' way of doing things. The only reason this wasn't done in #5164 is because there aren't any tests yet so if the header files are put in a test directory without a main file they are picked up as tests that fail to build. |
Thanks makes sense. @mprse can you move that in your PR please. |
This PR should be ready for merging unless any anyone has additional feedback. |
Great job getting it all to pass! |
Can we merge that? |
Merging. No release label as it's not to master. |
@0xc0170 @c1728p9 @theotherjimmy @bulislaw this PR has a major impact on RTC support across multiple Silicon Partners, which will also prevent using the impacted targets with Mbed Cloud. To make this productive in the future, can you ensure that the following happens before a PR is merged:
cc @JanneKiiskila @ChiefBureaucraticOfficer @MarceloSalazar |
@screamerbg It's merged to a feature branch, to enable partners to add suport for the new API. We should discuss how we communicate it effectively to partners. |
Add the RTC HAL API specification along with tests which verify it.