Skip to content

Fix LFCLK initialization on nRF#85

Merged
gmarull merged 2 commits intopebble-dev:mainfrom
teslabs:nrf-fixes
Mar 14, 2025
Merged

Fix LFCLK initialization on nRF#85
gmarull merged 2 commits intopebble-dev:mainfrom
teslabs:nrf-fixes

Conversation

@gmarull
Copy link
Collaborator

@gmarull gmarull commented Mar 14, 2025

We should really have a platform level init code, it's not strictly board specific, but this can come later.

@gmarull gmarull requested review from Hexxeh and jwise March 14, 2025 18:01
/*!nrf_clock_lf_is_running(NRF_CLOCK)) {*/
}
nrf_clock_event_clear(NRF_CLOCK, NRF_CLOCK_EVENT_LFCLKSTARTED);
}
Copy link

Choose a reason for hiding this comment

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

this should time out after some time and sadwatch (or TODO for that) if LFXO fails to come up

Copy link
Collaborator Author

@gmarull gmarull Mar 14, 2025

Choose a reason for hiding this comment

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

Hmm, even nrfx doesn't time out:

https://github.com/nrfconnect/nrfx/blob/ad604db99489a3cce43620abeb3cf839a2a649b7/drivers/src/nrfx_clock.c#L496-L498

Assuming bootloader will leave WDT on, if this fails the system will reboot anyway. If this fails, we're in trouble as well (e.g. BLE won't work at all). Not sure if BLE SCA can be adjusted at runtime, so we could potentially fall back to a calibrated LF RC.

Copy link

Choose a reason for hiding this comment

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

Yeah, this was on previous Pebbles to mark hardware failure (usually water incursion). Boot cannot proceed but providing the correct error code explicitly (by triggering a sadwatch) can help diagnose the failure.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I've added a comment for now if that's ok

Copy link

Choose a reason for hiding this comment

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

LGTM

gmarull added 2 commits March 14, 2025 19:53
Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
It is no longer used.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
Copy link

@jwise jwise left a comment

Choose a reason for hiding this comment

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

LGTM

@gmarull gmarull merged commit fcfbe46 into pebble-dev:main Mar 14, 2025
5 checks passed
@gmarull gmarull deleted the nrf-fixes branch March 14, 2025 19:08
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.

3 participants