-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Low power timer needs to be reset when setting time #7849
Conversation
Adding @kegilbert for comment/review |
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.
LGTM, needs someone closer to the lpticker source to sign off though. Added @c1728p9 . Feel free to add anyone else.
@NeilMacMullen Would you mind confirming that this fixes the issue? |
@TacoGrandeTX Review travis failure, seems like this change fails to build |
@cmonr Unfortunately I'm on vacation for the next couple of weeks so can't confirm for a while but I think the original issue report should make a reasonable unit test. |
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.
We need tests to confirm the fix.
…you just end up adding to the time instead of setting it. ARMmbed#7849
Can this fix be progressed please? It's not good to have something as fundamental as |
@TacoGrandeTX Can you please add a test case ? |
Neil MacMullen's test case is a good one:
Before (note how seconds are not reset):
Now (seconds are reset after calling set_time()):
Tested this on nRF52_DK and also MAX32620FTHR as there was a community post like RobMeades' about set_time() not working more than once on that target. |
@TacoGrandeTX Something looks odd with this PR's history. Could you take a look at it? |
@TacoGrandeTX What @bulislaw requested, we have hal tests for RTC. If new test case could be added to check to confirm the fix |
I've just created #8094 as a HAL test case. |
To my understanding the test case should be part of this PR ? Otherwise test case PR cant be tested (fails). Can you add a test to this PR? |
@kjbracey-arm Has a good point, RTC->RTOS->LPTICKER->None sounds pretty solid to me. Should be fairly straight forward to add that ordering here: https://github.com/ARMmbed/mbed-os/blob/master/platform/mbed_rtc_time.cpp#L25-L74 |
As @kjbracey-arm pointed out, the tests in mbed_hal/rtc_time are only testing _rtc_maketime() and _rtc_localtime() which don't rely on having a running clock! @kjbracey-arm:
I think I'm going to have to do that. Thanks for pointing out the proper location. I'll try this again.
OK - I'll check with @kegilbert about raising a new issue for this. |
@TacoGrandeTX Yeah a new issue would be perfect, sorry should've clarified that as an aside and not blocking for this PR. |
Reset _rtc_lp_timer only if DEVICE_LPTICKER is defined.
When DEVICE_LPTICKER is defined set_time() only works correctly on the first call. This test calls set_time() twice and ensures the time set by both calls is correct. This test only runs if DEVICE_RTC or DEVICE_LPTICKER is defined.
Met with @studavekar yesterday and he advised protecting the test with #if, so that's been done. Performed a merge to pick up the template test changes so this should now be good to go. |
We need to revisit 6d90c27 and check if we can enable RTC on disabled devices. |
Who's doind this action? Is this blocking this PR? |
enablement RTC on disabled devices is not blocking this PR. |
@studavekar Mind creating an issue? The comment made it sound like this needed to be addressed in this PR. |
This is now entering CI /morph build |
Build : SUCCESSBuild number : 3571 Triggering tests/morph test |
Exporter Build : FAILUREBuild number : 3182 |
Test : FAILUREBuild number : 3351 |
Note: This PR is now a part of a rollup PR (#8675). Jenkins CI export nodes experienced many drops throughout the day causing false failures. In an attempt to get those PRs through CI, while keeping CI load low, several PRs have been bundled into a single rollup PR. If any more commits are made in this PR, this PR will remain open and have to go through CI on its own. |
/morph test |
Test : SUCCESSBuild number : 3356 |
Exporter Build : SUCCESSBuild number : 3192 |
Description
This PR addresses #7804.
When set_time() is called with DEVICE_LPTICKER the timer needs to be reset also, otherwise
the old _start value is incorrect and this taints the value returned by Timer::read().
Using the issue's test program, the minutes and seconds are now properly tracked after calling set_time():
Pull request type