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

fix reboot loop - set REGOUT0 only when value is erased to default #344

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

fanoush
Copy link
Contributor

@fanoush fanoush commented Nov 16, 2024

This fixes reboot loop when REGOUT0 is explicitly set to different value (like 3.0V).

The main rationale for setting REGOUT0 UICR value at boot time is to correct the 1.8V default which is there when UICR is mass erased. However when user sets different value explicitly, current code causes never-ending reboot loop with board default of 3.3V because you can't set flash bits back from 0 to 1.

This code fragment is typical to change the value only if it is the default (all FFs), see other places
https://github.com/search?q=UICR_REGOUT0_VOUT_DEFAULT&type=code

this fixes reboot loop when REGOUT0 is explicitly set to different value that cannot be rewritten by clearing bits in flash
@fanoush
Copy link
Contributor Author

fanoush commented Nov 16, 2024

Actually when thinking about it, it would now still cause loop if someone #defines UICR_REGOUT0_VALUE to be UICR_REGOUT0_VOUT_DEFAULT. This makes little sense and other code I see don't handle such misconfiguration too, but to be 100% correct we could change the #if above it to be
#if defined(UICR_REGOUT0_VALUE) && (UICR_REGOUT0_VALUE != UICR_REGOUT0_VOUT_DEFAULT) as with this value the whole block has nothing to do like if it was undefined.

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.

1 participant