Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@
/drivers/bluetooth/ @joerchan @jhedberg @Vudentz
/drivers/can/ @alexanderwachter
/drivers/can/*mcp2515* @karstenkoenig
/drivers/clock_control/*nrf* @nordic-krch
/drivers/counter/ @nordic-krch
/drivers/counter/counter_cmos.c @gnuless
/drivers/display/ @vanwinkeljan
Expand Down
2 changes: 1 addition & 1 deletion boards/posix/nrf52_bsim/hw_models_version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1.4
v1.8
1 change: 1 addition & 0 deletions drivers/clock_control/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ zephyr_sources_ifdef(CONFIG_CLOCK_CONTROL_MCUX_PCC clock_control_mcux
zephyr_sources_ifdef(CONFIG_CLOCK_CONTROL_MCUX_SCG clock_control_mcux_scg.c)
zephyr_sources_ifdef(CONFIG_CLOCK_CONTROL_MCUX_SIM clock_control_mcux_sim.c)
zephyr_sources_ifdef(CONFIG_CLOCK_CONTROL_NRF nrf_power_clock.c)
zephyr_sources_ifdef(CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC_CALIBRATION nrf_clock_calibration.c)
zephyr_sources_ifdef(CONFIG_CLOCK_CONTROL_RV32M1_PCC clock_control_rv32m1_pcc.c)

if(CONFIG_CLOCK_CONTROL_STM32_CUBE)
Expand Down
57 changes: 50 additions & 7 deletions drivers/clock_control/Kconfig.nrf
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,57 @@ config CLOCK_CONTROL_NRF_K32SRC_EXT_FULL_SWING

endchoice

config CLOCK_CONTROL_NRF_K32SRC_BLOCKING
bool "Blocking 32KHz crystal oscillator startup"
depends on CLOCK_CONTROL_NRF_K32SRC_XTAL
config CLOCK_CONTROL_NRF_K32SRC_RC_CALIBRATION
bool
depends on !SOC_SERIES_NRF91X
default y if CLOCK_CONTROL_NRF_K32SRC_RC

if CLOCK_CONTROL_NRF_K32SRC_RC_CALIBRATION

config CLOCK_CONTROL_NRF_CALIBRATION_PERIOD
int "Calibration opportunity period (in 250ms units)"
default 16
range 1 127
help
Periodically, calibration action is performed. Action includes
temperature measurement followed by clock calibration. Calibration may
be skipped if temperature change (compared to measurement of previous
calibration) did not exceeded CLOCK_CONTROL_NRF_CALIBRATION_TEMP_DIFF
and number of consecutive skips did not exceeded
CLOCK_CONTROL_NRF_CALIBRATION_MAX_SKIP.

config CLOCK_CONTROL_NRF_CALIBRATION_MAX_SKIP
int "Maximum number of calibration skips"
default 1
range 0 255
help
Calibration is skipped when temperature change since last calibration
was less than configured threshold. If number of consecutive skips
reaches configured value then calibration is performed
unconditionally. Set to 0 to perform calibration periodically
regardless of temperature change.

config CLOCK_CONTROL_NRF_CALIBRATION_TEMP_DIFF
Copy link
Contributor

Choose a reason for hiding this comment

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

This description suggests different behaviour than the CLOCK_CONTROL_NRF_CALIBRATION_MAX_SKIP description.

According to CLOCK_CONTROL_NRF_CALIBRATION_MAX_SKIP, the calibration is run every CLOCK_CONTROL_NRF_CALIBRATION_PERIOD and it skipped if temperature not changed more than CLOCK_CONTROL_NRF_CALIBRATION_TEMP_DIFF (i hope that the difference is calculated from last calibration temp).

According to CLOCK_CONTROL_NRF_CALIBRATION_TEMP_DIFF, we are periodically measure temp (how often?) and if the temp changed more than CLOCK_CONTROL_NRF_CALIBRATION_TEMP_DIFF we are triggering calibration).

The difference between these two descriptions is subtle, bit we should avoid uncertainty in the docs interpretation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i've rephrased it, please take another look.

int "Temperature change triggering calibration (in 0.25 degree units)"
default 2
help
Clock control driver will spin wait in CPU sleep until 32KHz
crystal oscillator starts up. If not enabled, RC oscillator will
initially start running and automatically switch to crystal when
ready.
Calibration is triggered if the temperature has changed by at least
this amount since the last calibration.

config CLOCK_CONTROL_NRF_CALIBRATION_DEBUG
bool "Calibration intrumentation"
help
Enables retrieving debug information like number of performed or
skipped calibrations.

config CLOCK_CONTROL_NRF_USES_TEMP_SENSOR
bool
default y if CLOCK_CONTROL_NRF_CALIBRATION_MAX_SKIP > 0 && \
CLOCK_CONTROL_NRF_CALIBRATION_TEMP_DIFF > 0
select TEMP_NRF5
select SENSOR

endif # CLOCK_CONTROL_NRF_K32SRC_RC_CALIBRATION

choice CLOCK_CONTROL_NRF_ACCURACY
prompt "32KHz clock accuracy"
Expand Down
Loading