-
Notifications
You must be signed in to change notification settings - Fork 8.4k
soc: nordic: nrf54l: Clean up internal capacitance calculations. #89710
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
soc: nordic: nrf54l: Clean up internal capacitance calculations. #89710
Conversation
50c7c20 to
6e6734a
Compare
db1b331 to
ffa2c9b
Compare
soc/nordic/nrf54l/soc.c
Outdated
| uint32_t lfxo_intcap = (lfxo_intcap_mid_val >> 9UL) / 1000UL; | ||
|
|
||
| /* Round based on fractional part */ | ||
| if ((mid_val & BIT_MASK(9)) > (BIT_MASK(9) / 2)) { | ||
| /* Round based on fractional part. */ | ||
| if (lfxo_intcap_mid_val % 1000 >= 500) { |
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.
This rounding is incorrect, since lfxo_intcap is lfxo_intcap_mid_val divided by 512000, not by 1000.
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.
You are right, corrected.
soc/nordic/nrf54l/soc.c
Outdated
|
|
||
| /* Get integer part of the INTCAP code */ | ||
| uint32_t lfxo_intcap = mid_val >> 9UL; | ||
| /* Get integer part of the INTCAP code and concert to pico Farads. */ |
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.
typo: "concert"
soc/nordic/nrf54l/soc.c
Outdated
|
|
||
| /* Convert the calculated value to piko Farads */ | ||
| uint32_t hfxo_intcap = mid_val_intcap / 1000; | ||
| /* Convert the calculated value to pikc Farads. */ |
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.
typo "pikc"
ffa2c9b to
18d9377
Compare
soc/nordic/nrf54l/soc.c
Outdated
| /* Get integer part of the INTCAP code */ | ||
| uint32_t lfxo_intcap = mid_val >> 9UL; | ||
| /* Get integer part of the INTCAP code and convert to pico Farads. */ | ||
| uint32_t lfxo_intcap = (lfxo_intcap_mid_val >> 9UL) / 1000UL; |
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.
Just to make the rounding that follows a bit more obvious.
| uint32_t lfxo_intcap = (lfxo_intcap_mid_val >> 9UL) / 1000UL; | |
| uint32_t lfxo_intcap = lfxo_intcap_mid_val / 512000UL; |
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.
Done
Code responsible for internal capacitor values containted leftover workarounds in the calculations after PS update. Removed redundant conversions and cleaned up both code and comments to align both LFXO and HFXO calculation. Signed-off-by: Michał Stasiak <michal.stasiak@nordicsemi.no>
18d9377 to
b9516db
Compare
|



Code responsible for internal capacitor values containted leftover workarounds in the calculations after PS update. Removed redundant conversions and cleaned up both code and comments to align both LFXO and HFXO calculation.