External Thermistor#

APIs to measure temperature using an external thermistor.

This feature allows reading the temperature via an external thermistor on chips that support it. This will require connecting the necessary components and configuring the pins as required.

Modules#

RAIL_HFXOThermistorConfig_t

RAIL_HFXOCompensationConfig_t

sl_rail_hfxo_thermistor_config_t

sl_rail_hfxo_compensation_config_t

Functions#

RAIL_StartThermistorMeasurement(RAIL_Handle_t railHandle)

Start a thermistor measurement.

RAIL_GetThermistorImpedance(RAIL_Handle_t railHandle, uint32_t *thermistorImpedance)

Get the thermistor impedance measurement.

RAIL_ConvertThermistorImpedance(RAIL_Handle_t railHandle, uint32_t thermistorImpedance, int16_t *thermistorTemperatureC)

Convert the thermistor impedance into temperature, in Celsius.

RAIL_ComputeHFXOPPMError(RAIL_Handle_t railHandle, int16_t crystalTemperatureC, int8_t *crystalPPMError)

Compute the crystal PPM deviation from the thermistor temperature.

RAIL_ConfigHFXOThermistor(RAIL_Handle_t railHandle, const RAIL_HFXOThermistorConfig_t *pHfxoThermistorConfig)

Configure the GPIO for thermistor usage.

RAIL_ConfigHFXOCompensation(RAIL_Handle_t railHandle, const RAIL_HFXOCompensationConfig_t *pHfxoCompensationConfig)

Configure the temperature parameters for HFXO compensation.

RAIL_GetHFXOCompensationConfig(RAIL_Handle_t railHandle, RAIL_HFXOCompensationConfig_t *pHfxoCompensationConfig)

Get the temperature parameters for HFXO compensation.

RAIL_CompensateHFXO(RAIL_Handle_t railHandle, int8_t crystalPPMError)

Compute a frequency offset and compensate HFXO accordingly.

sl_rail_start_thermistor_measurement(sl_rail_handle_t rail_handle)

Start a thermistor measurement.

sl_rail_get_thermistor_impedance(sl_rail_handle_t rail_handle, uint32_t *p_thermistor_impedance_ohms)

Get the thermistor impedance measurement.

sl_railcb_convert_thermistor_impedance(sl_rail_handle_t rail_handle, uint32_t thermistor_impedance_ohms, int16_t *p_thermistor_temperature_8c)

Callback to convert the thermistor impedance into temperature, in Celsius.

sl_railcb_compute_hfxo_error_ppm(sl_rail_handle_t rail_handle, int16_t crystal_temperature_c, int8_t *p_crystal_error_ppm)

Callback to compute the crystal PPM deviation from the thermistor temperature.

sl_rail_config_hfxo_thermistor(sl_rail_handle_t rail_handle, const sl_rail_hfxo_thermistor_config_t *p_hfxo_thermistor_config)

Configure the GPIO for thermistor usage.

sl_rail_config_hfxo_compensation(sl_rail_handle_t rail_handle, const sl_rail_hfxo_compensation_config_t *p_hfxo_compensation_config)

Configure the temperature parameters for HFXO compensation.

sl_rail_get_hfxo_compensation_config(sl_rail_handle_t rail_handle, sl_rail_hfxo_compensation_config_t *p_hfxo_compensation_config)

Get the temperature parameters for HFXO compensation.

sl_rail_compensate_hfxo(sl_rail_handle_t rail_handle, int8_t crystal_error_ppm)

Compute a frequency offset and compensate HFXO accordingly.

Macros#

#define
RAIL_INVALID_THERMISTOR_VALUE (0xFFFFFFFFU)

A sentinel value to indicate an invalid thermistor measurement value.

#define
RAIL_INVALID_PPM_VALUE (-128)

A sentinel value to indicate an invalid PPM calculation value.

#define
SL_RAIL_INVALID_THERMISTOR_VALUE (0xFFFFFFFFU)

A sentinel value to indicate an invalid thermistor measurement value.

#define
SL_RAIL_INVALID_PPM_VALUE (-128)

A sentinel value to indicate an invalid PPM calculation value.

Function Documentation#

RAIL_StartThermistorMeasurement#

RAIL_Status_t RAIL_StartThermistorMeasurement (RAIL_Handle_t railHandle)

Start a thermistor measurement.

Parameters
TypeDirectionArgument NameDescription
RAIL_Handle_t[in]railHandle

A radio-generic or real RAIL instance handle.

Returns

  • Status code indicating success of the function call. Returns RAIL_STATUS_INVALID_STATE if the thermistor is started while the radio is transmitting.

To get the thermistor impedance, call the function RAIL_GetThermistorImpedance(). On platforms having RAIL_SUPPORTS_EXTERNAL_THERMISTOR, this function reconfigures GPIO_THMSW_EN_PIN located in GPIO_THMSW_EN_PORT. To locate this pin, refer to the data sheet or appropriate header files of the device. For proper operation, RAIL_Init() must be called before using this function.

Note

  • When an EFF is attached, this function must not be called during transmit.

Warnings

  • This API is not safe to use in a multiprotocol app.

  • As this function relies on EMU, GPIO and HFXO access and RAIL is meant to run in TrustZone non-secure world, it is not supported if EMU, GPIO or HFXO are configured as secure peripheral and it will return RAIL_STATUS_INVALID_CALL.

DeprecatedRAIL 2.x synonym of sl_rail_start_thermistor_measurement().


RAIL_GetThermistorImpedance#

RAIL_Status_t RAIL_GetThermistorImpedance (RAIL_Handle_t railHandle, uint32_t * thermistorImpedance)

Get the thermistor impedance measurement.

Parameters
TypeDirectionArgument NameDescription
RAIL_Handle_t[in]railHandle

A radio-generic or real RAIL instance handle.

uint32_t *[out]thermistorImpedance

A pointer to a uint32_t updated with the current thermistor impedance measurement in Ohms, or RAIL_INVALID_THERMISTOR_VALUE on error.

Sets the output parameter to RAIL_INVALID_THERMISTOR_VALUE if the thermistor is not properly configured or the thermistor measurement is not ready.

Returns

  • Status code indicating success of the function call.

Note

  • This function is already called in RAIL_CalibrateHFXO(). It does not need to be manually called during the compensation sequence.

  • When HFXO compensation is enabled and a measurement is in progress, this function returns RAIL_STATUS_NO_ERROR with the most recent cached thermistor value.

DeprecatedRAIL 2.x synonym of sl_rail_get_thermistor_impedance().


RAIL_ConvertThermistorImpedance#

RAIL_Status_t RAIL_ConvertThermistorImpedance (RAIL_Handle_t railHandle, uint32_t thermistorImpedance, int16_t * thermistorTemperatureC)

Convert the thermistor impedance into temperature, in Celsius.

Parameters
TypeDirectionArgument NameDescription
RAIL_Handle_t[in]railHandle

A radio-generic or real RAIL instance handle.

uint32_t[in]thermistorImpedance

Current thermistor impedance measurement in Ohms.

int16_t *[out]thermistorTemperatureC

A non-NULL pointer to an int16_t updated with the current thermistor temperature in eighth of Celsius degrees.

Returns

  • Status code indicating success of the function call.

A version of this function is provided in the Thermistor Utility plugin for Silicon Labs radio boards. For custom boards this function can be modified and re-implemented as needed in the plugin.

Note

DeprecatedRAIL 2.x synonym of sl_railcb_convert_thermistor_impedance().


RAIL_ComputeHFXOPPMError#

RAIL_Status_t RAIL_ComputeHFXOPPMError (RAIL_Handle_t railHandle, int16_t crystalTemperatureC, int8_t * crystalPPMError)

Compute the crystal PPM deviation from the thermistor temperature.

Parameters
TypeDirectionArgument NameDescription
RAIL_Handle_t[in]railHandle

A radio-generic or real RAIL instance handle.

int16_t[in]crystalTemperatureC

Current crystal temperature, in Celsius.

int8_t *[out]crystalPPMError

A non-NULL pointer to an int8_t updated with the current ppm error in ppm units.

Returns

  • Status code indicating success of the function call.

A version of this function is provided in the Thermistor Utility plugin for Silicon Labs radio boards. For custom boards this function can be modified and re-implemented as needed in the plugin.

Note

DeprecatedRAIL 2.x synonym of sl_railcb_compute_hfxo_error_ppm().


RAIL_ConfigHFXOThermistor#

RAIL_Status_t RAIL_ConfigHFXOThermistor (RAIL_Handle_t railHandle, const RAIL_HFXOThermistorConfig_t * pHfxoThermistorConfig)

Configure the GPIO for thermistor usage.

Parameters
TypeDirectionArgument NameDescription
RAIL_Handle_t[in]railHandle

A radio-generic or real RAIL instance handle.

const RAIL_HFXOThermistorConfig_t *[in]pHfxoThermistorConfig

A non-NULL pointer to the thermistor configuration indicating the GPIO port and pin to use.

Returns

  • Status code indicating the result of the function call.

Note

Warnings

  • As this function relies on GPIO access and RAIL is meant to run in TrustZone non-secure world, it is not supported if GPIO is configured as secure peripheral and it will return RAIL_STATUS_INVALID_CALL.

DeprecatedRAIL 2.x synonym of sl_rail_config_hfxo_thermistor().


RAIL_ConfigHFXOCompensation#

RAIL_Status_t RAIL_ConfigHFXOCompensation (RAIL_Handle_t railHandle, const RAIL_HFXOCompensationConfig_t * pHfxoCompensationConfig)

Configure the temperature parameters for HFXO compensation.

Parameters
TypeDirectionArgument NameDescription
RAIL_Handle_t[in]railHandle

A RAIL instance handle.

const RAIL_HFXOCompensationConfig_t *[in]pHfxoCompensationConfig

A non-NULL pointer to HFXO compensation parameters indicating the temperature variations used to trigger a compensation.

Returns

  • Status code indicating the result of the function call.

Note

In RAIL_HFXOCompensationConfig_t, deltaNominal and deltaCritical define the temperature variation triggering a new compensation. The field zoneTemperatureC defines the temperature separating the nominal case (below) from the critical one (above).

When enabled and either deltaNominal or deltaCritical are exceeded, RAIL raises event RAIL_EVENT_CAL_NEEDED with RAIL_CAL_TEMP_HFXO bit set. The API RAIL_StartThermistorMeasurement() must be called afterwards. The latter will raise RAIL_EVENT_THERMISTOR_DONE with calibration bit RAIL_CAL_COMPENSATE_HFXO set and a call to RAIL_CalibrateHFXO() must follow.

Note

  • Set deltaNominal and deltaCritical to 0 to perform compensation after each transmit.

DeprecatedRAIL 2.x synonym of sl_rail_config_hfxo_compensation().


RAIL_GetHFXOCompensationConfig#

RAIL_Status_t RAIL_GetHFXOCompensationConfig (RAIL_Handle_t railHandle, RAIL_HFXOCompensationConfig_t * pHfxoCompensationConfig)

Get the temperature parameters for HFXO compensation.

Parameters
TypeDirectionArgument NameDescription
RAIL_Handle_t[in]railHandle

A RAIL instance handle.

RAIL_HFXOCompensationConfig_t *[out]pHfxoCompensationConfig

A non-NULL pointer to HFXO compensation parameters filled in by the function.

Returns

  • Status code indicating the result of the function call.

DeprecatedRAIL 2.x synonym of sl_rail_get_hfxo_compensation_config().


RAIL_CompensateHFXO#

RAIL_Status_t RAIL_CompensateHFXO (RAIL_Handle_t railHandle, int8_t crystalPPMError)

Compute a frequency offset and compensate HFXO accordingly.

Parameters
TypeDirectionArgument NameDescription
RAIL_Handle_t[in]railHandle

A RAIL instance handle.

int8_t[in]crystalPPMError

The current ppm error. Positive values indicate the HFXO frequency is too high; negative values indicate it's too low.

Returns

  • Status code indicating success of the function call.

Note

DeprecatedRAIL 2.x synonym of sl_rail_compensate_hfxo().


sl_rail_start_thermistor_measurement#

sl_rail_status_t sl_rail_start_thermistor_measurement (sl_rail_handle_t rail_handle)

Start a thermistor measurement.

Parameters
TypeDirectionArgument NameDescription
sl_rail_handle_t[in]rail_handle

A radio-generic or real RAIL instance handle.

Returns

  • Status code indicating success of the function call. Returns SL_RAIL_STATUS_INVALID_STATE if the thermistor is started while the radio is transmitting.

To get the thermistor impedance, call the function sl_rail_get_thermistor_impedance(). On platforms having SL_RAIL_SUPPORTS_EXTERNAL_THERMISTOR, this function reconfigures GPIO_THMSW_EN_PIN located in GPIO_THMSW_EN_PORT. To locate this pin, refer to the data sheet or appropriate header files of the device. For proper operation, sl_rail_init() must be called before using this function.

Note

  • When an EFF is attached, this function must not be called during transmit.

Warnings

  • This API is not safe to use in a multiprotocol app.

  • As this function relies on EMU, GPIO and HFXO access and RAIL is meant to run in TrustZone non-secure world, it is not supported if EMU, GPIO or HFXO are configured as secure peripheral and it will return SL_RAIL_STATUS_INVALID_CALL.


sl_rail_get_thermistor_impedance#

sl_rail_status_t sl_rail_get_thermistor_impedance (sl_rail_handle_t rail_handle, uint32_t * p_thermistor_impedance_ohms)

Get the thermistor impedance measurement.

Parameters
TypeDirectionArgument NameDescription
sl_rail_handle_t[in]rail_handle

A radio-generic or real RAIL instance handle.

uint32_t *[out]p_thermistor_impedance_ohms

A pointer to a uint32_t updated with the current thermistor impedance measurement in Ohms, or SL_RAIL_INVALID_THERMISTOR_VALUE on error.

Sets the output parameter to SL_RAIL_INVALID_THERMISTOR_VALUE if the thermistor is not properly configured or the thermistor measurement is not ready.

Returns

  • Status code indicating success of the function call.

Note

  • This function is already called in sl_rail_calibrate_hfxo(). It does not need to be manually called during the compensation sequence.

  • When HFXO compensation is enabled and a measurement is in progress, this function returns SL_RAIL_STATUS_NO_ERROR with the most recent cached thermistor value.


sl_railcb_convert_thermistor_impedance#

sl_rail_status_t sl_railcb_convert_thermistor_impedance (sl_rail_handle_t rail_handle, uint32_t thermistor_impedance_ohms, int16_t * p_thermistor_temperature_8c)

Callback to convert the thermistor impedance into temperature, in Celsius.

Parameters
TypeDirectionArgument NameDescription
sl_rail_handle_t[in]rail_handle

A radio-generic or real RAIL instance handle.

uint32_t[in]thermistor_impedance_ohms

Current thermistor impedance measurement in Ohms.

int16_t *[out]p_thermistor_temperature_8c

A non-NULL pointer to an int16_t updated with the current thermistor temperature in eighth of Celsius degrees.

Returns

  • Status code indicating success of the function call.

A version of this function is provided in the Thermistor Utility plugin for Silicon Labs radio boards. For custom boards this function can be modified and re-implemented as needed in the plugin.

Note


sl_railcb_compute_hfxo_error_ppm#

sl_rail_status_t sl_railcb_compute_hfxo_error_ppm (sl_rail_handle_t rail_handle, int16_t crystal_temperature_c, int8_t * p_crystal_error_ppm)

Callback to compute the crystal PPM deviation from the thermistor temperature.

Parameters
TypeDirectionArgument NameDescription
sl_rail_handle_t[in]rail_handle

A radio-generic or real RAIL instance handle.

int16_t[in]crystal_temperature_c

Current crystal temperature, in Celsius.

int8_t *[out]p_crystal_error_ppm

A non-NULL pointer to an int8_t updated with the current ppm error in ppm units.

Returns

  • Status code indicating success of the function call.

A version of this function is provided in the Thermistor Utility plugin for Silicon Labs radio boards. For custom boards this function can be modified and re-implemented as needed in the plugin.

Note


sl_rail_config_hfxo_thermistor#

sl_rail_status_t sl_rail_config_hfxo_thermistor (sl_rail_handle_t rail_handle, const sl_rail_hfxo_thermistor_config_t * p_hfxo_thermistor_config)

Configure the GPIO for thermistor usage.

Parameters
TypeDirectionArgument NameDescription
sl_rail_handle_t[in]rail_handle

A radio-generic or real RAIL instance handle.

const sl_rail_hfxo_thermistor_config_t *[in]p_hfxo_thermistor_config

A non-NULL pointer to the thermistor configuration indicating the GPIO port and pin to use.

Returns

  • Status code indicating the result of the function call.

Note

Warnings

  • As this function relies on GPIO access and RAIL is meant to run in TrustZone non-secure world, it is not supported if GPIO is configured as secure peripheral and it will return SL_RAIL_STATUS_INVALID_CALL.


sl_rail_config_hfxo_compensation#

sl_rail_status_t sl_rail_config_hfxo_compensation (sl_rail_handle_t rail_handle, const sl_rail_hfxo_compensation_config_t * p_hfxo_compensation_config)

Configure the temperature parameters for HFXO compensation.

Parameters
TypeDirectionArgument NameDescription
sl_rail_handle_t[in]rail_handle

A real RAIL instance handle.

const sl_rail_hfxo_compensation_config_t *[in]p_hfxo_compensation_config

A non-NULL pointer to HFXO compensation parameters indicating the temperature variations used to trigger a compensation.

Returns

  • Status code indicating the result of the function call.

Note

In sl_rail_hfxo_compensation_config_t, delta_nominal_celsius and delta_critical_celsius define the temperature variation triggering a new compensation. The field zone_temperature_celsius defines the temperature separating the nominal case (below) from the critical one (above).

When enabled and either delta_nominal_celsius or delta_critical_celsius are exceeded, RAIL raises event SL_RAIL_EVENT_CAL_NEEDED with SL_RAIL_CAL_TEMP_HFXO bit set. The API sl_rail_start_thermistor_measurement() must be called afterwards. The latter will raise SL_RAIL_EVENT_THERMISTOR_DONE with calibration bit SL_RAIL_CAL_COMPENSATE_HFXO set and a call to sl_rail_calibrate_hfxo() must follow.

Note

  • Set delta_nominal_celsius and delta_critical_celsius to 0 to perform compensation after each transmit.


sl_rail_get_hfxo_compensation_config#

sl_rail_status_t sl_rail_get_hfxo_compensation_config (sl_rail_handle_t rail_handle, sl_rail_hfxo_compensation_config_t * p_hfxo_compensation_config)

Get the temperature parameters for HFXO compensation.

Parameters
TypeDirectionArgument NameDescription
sl_rail_handle_t[in]rail_handle

A real RAIL instance handle.

sl_rail_hfxo_compensation_config_t *[out]p_hfxo_compensation_config

A non-NULL pointer to HFXO compensation parameters filled in by the function.

Returns

  • Status code indicating the result of the function call.


sl_rail_compensate_hfxo#

sl_rail_status_t sl_rail_compensate_hfxo (sl_rail_handle_t rail_handle, int8_t crystal_error_ppm)

Compute a frequency offset and compensate HFXO accordingly.

Parameters
TypeDirectionArgument NameDescription
sl_rail_handle_t[in]rail_handle

A real RAIL instance handle.

int8_t[in]crystal_error_ppm

The current ppm error. Positive values indicate the HFXO frequency is too high; negative values indicate it's too low.

Returns

  • Status code indicating success of the function call.

Note