Skip to content

Commit c93860f

Browse files
gmarullkartben
authored andcommitted
soc: nrf54l: fix LFXO INTCAP calculation formula
The formula has been changed in latest version of the PS, adjust code accordingly. Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
1 parent 03f41eb commit c93860f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

soc/nordic/nrf54l/soc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ static inline void power_and_clock_configuration(void)
6161
int32_t slope_k = (int32_t)(slope_field_k ^ slope_sign_k) - (int32_t)slope_sign_k;
6262

6363
/* As specified in the nRF54L15 PS:
64-
* CAPVALUE = round( (CAPACITANCE - 4) * (FICR->XOSC32KTRIM.SLOPE + 0.765625 * 2^9)/(2^9)
64+
* CAPVALUE = round( (2*CAPACITANCE - 12) * (FICR->XOSC32KTRIM.SLOPE + 0.765625 * 2^9)/(2^9)
6565
* + FICR->XOSC32KTRIM.OFFSET/(2^6) );
6666
* where CAPACITANCE is the desired capacitor value in pF, holding any
6767
* value between 4 pF and 18 pF in 0.5 pF steps.
@@ -82,7 +82,7 @@ static inline void power_and_clock_configuration(void)
8282
* offset_k should be divided by 2^6, but to add it to value shifted by 2^9 we have to
8383
* multiply it be 2^3.
8484
*/
85-
uint32_t mid_val = (cap_val_encoded - 4UL) * (uint32_t)(slope_k + 392UL)
85+
uint32_t mid_val = (2UL * cap_val_encoded - 12UL) * (uint32_t)(slope_k + 392UL)
8686
+ (offset_k << 3UL);
8787

8888
/* Get integer part of the INTCAP code */

0 commit comments

Comments
 (0)