Skip to content

Fix for issue #8155 (NRF52832: time stops after 35 minutes) #8165

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 1 commit into from
Sep 24, 2018

Conversation

mprse
Copy link
Contributor

@mprse mprse commented Sep 18, 2018

Description

Low power Timer is used as RTC for platforms that don't have HW RTC capabilities (like NRF52832).
_rtc_lpticker_read(void) function currently uses Timer::read() function to trace elapsed seconds.
Timer::read() returns seconds represented as float value, but this value is calculated from int since Timer::read_us() returns int.
This limits time tracing to ~35 min.
To fix this problem we will use timer::read_high_resolution_us() (which returns unsigned 64 bit value) instead of Timer::read().

Pull request type

[X] Fix
[ ] Refactor
[ ] Target update
[ ] Functionality change
[ ] Breaking change

Low power Timer is used as RTC for platforms that don't have HW RTC capabilities (like NRF52832).
`_rtc_lpticker_read(void)` function currently uses `Timer::read()` function to trace elapsed time.
`Timer::read()` returns seconds represented as `float` value, but this value is calculated from `int` since `Timer::read_us()` returns `int`.
This limits time tracing to ~35 min.
To fix this problem we will use `timer::read_high_resolution_us()` (which returns unsigned 64 bit value) instead of `Timer::read()`.
@RobMeades
Copy link
Contributor

Yup, that's the fix, my test code now sees no return to zero at the 35 minute (~2150 seconds) mark:

213: started wait at 2123, time now 2133, difference 10.
214: started wait at 2133, time now 2143, difference 10.
215: started wait at 2143, time now 2153, difference 10.
216: started wait at 2153, time now 2163, difference 10.
217: started wait at 2163, time now 2173, difference 10.

@TacoGrandeTX
Copy link
Contributor

Super - this also fixes #7836. My PR for that was not good and I haven't returned to it yet.

@cmonr
Copy link
Contributor

cmonr commented Sep 23, 2018

/morph build

@mbed-ci
Copy link

mbed-ci commented Sep 23, 2018

Build : SUCCESS

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

Triggering tests

/morph test
/morph export-build
/morph mbed2-build

@mbed-ci
Copy link

mbed-ci commented Sep 24, 2018

@mbed-ci
Copy link

mbed-ci commented Sep 24, 2018

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

Successfully merging this pull request may close these issues.

7 participants