Skip to content
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

nRF Desktop Failsafe module: migration to the Zephyr HWinfo driver and activation on the nRF54H20 DK #19142

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

kapi-no
Copy link
Contributor

@kapi-no kapi-no commented Nov 28, 2024

Depends on:

#19028

Issues:

  • Watchdog reset reason bit is always set for the nRF54H20 DK regardless whether the reset is caused by the reset pin (RESET_PIN: 0x00000011) or software reset (RESET_SOFTWARE: 0x00000012).

Out standing items:

  • Changelog and the documentation update for the Failsafe module.

Updated sdk-zephyr to include the Zephyr HWinfo driver.

Signed-off-by: Kamil Piszczek <[email protected]>
Updated the nRF Desktop Failsafe module to use the Zephyr HWinfo
driver as its dependency instead of relying on the nrfx reset reason
helper.

Ref: NCSDK-25090

Signed-off-by: Kamil Piszczek <[email protected]>
Enabled the nRF Desktop Failsafe module in the release configuration
of the nRF54H20 DK target.

Ref: NCSDK-25090

Signed-off-by: Kamil Piszczek <[email protected]>
@github-actions github-actions bot added manifest changelog-entry-required Update changelog before merge. Remove label if entry is not needed or already added. labels Nov 28, 2024
@NordicBuilder
Copy link
Contributor

The following west manifest projects have been modified in this Pull Request:

Name Old Revision New Revision Diff
zephyr nrfconnect/sdk-zephyr@8bc628d nrfconnect/sdk-zephyr#2293 nrfconnect/sdk-zephyr#2293/files

Note: This message is automatically posted and updated by the Manifest GitHub Action.

@NordicBuilder
Copy link
Contributor

CI Information

To view the history of this post, clich the 'edited' button above
Build number: 1

Inputs:

Sources:

more details

Github labels

Enabled Name Description
ci-disabled Disable the ci execution
ci-all-test Run all of ci, no test spec filtering will be done
ci-force-downstream Force execution of downstream even if twister fails
ci-run-twister Force run twister
ci-run-zephyr-twister Force run zephyr twister
List of changed files detected by CI (0)

Outputs:

Toolchain

Version:
Build docker image:

Test Spec & Results: ✅ Success; ❌ Failure; 🟠 Queued; 🟡 Progress; ◻️ Skipped; ⚠️ Quarantine

  • ❌ Toolchain
  • ❌ Build twister
  • ❌ Integration tests

Note: This message is automatically posted and updated by the CI

@@ -55,17 +67,27 @@ static bool app_event_handler(const struct app_event_header *aeh)
cast_module_state_event(aeh);

if (check_state(event, MODULE_ID(main), MODULE_STATE_READY)) {
int err;
bool check_result;
Copy link
Contributor

Choose a reason for hiding this comment

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

check_result -> erase_settings?

@@ -15,14 +15,24 @@
LOG_MODULE_REGISTER(MODULE, CONFIG_DESKTOP_FAILSAFE_LOG_LEVEL);


static bool failsafe_check(void)
static bool failsafe_check(bool *ret)
Copy link
Contributor

Choose a reason for hiding this comment

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

ret -> settings_erase_needed/failure_detected?


*ret = ((reas & mask) != 0);

LOG_INF("Reset reason (0x%08X) trigger %s for Failsafe erase operation",
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we make it a bit shorter: "Reset reason (0x%08X), trigger %s? Log would be prefixed with module name by the logger anyway

{
nrfx_reset_reason_clear(nrfx_reset_reason_get());
int err = hwinfo_clear_reset_cause();
Copy link
Contributor

Choose a reason for hiding this comment

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

return hwinfo_clear_reset_cause(); - for simplicity?


module_set_state(MODULE_STATE_READY);
if (!err) {
err = failsafe_clear();
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider avoiding clearing the reset reason if failsafe_erase call fails.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This worked a bit differently in the previous implementation, where we cleared the reset reason unconditionally. Are you sure about that?

Copy link
Contributor

Choose a reason for hiding this comment

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

I am aware that it used to work differently.
I am wondering a bit which approach would be better here: if we desist from clearing the reset reason on settings erase error, we give failsafe module another chance to erase settings which could be safer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog-entry-required Update changelog before merge. Remove label if entry is not needed or already added. DNM manifest manifest-zephyr
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants