BJT Temperature Sensor#

Introduction#

Bipolar Junction Transistor (BJT) can be utilized as a temperature sensor and its temperature-dependent characteristics. The BJT temperature sensor peripheral converts a digital output into a temperature in degrees Celsius. The process involves:

  • Reading the Band-gap Reference: The sensor first measures the band-gap voltage.

  • Reading the BJT Output: After successful calibration, the BJT output is read.

  • Computing the Temperature: The temperature is calculated by taking the difference between the BJT output and the band-gap reference value.

Additionally, by switching the current temperature mode, you can also obtain the temperature value in Kelvin and Fahrenheit.

Configuration#

The configurable parameters by using structured macros are:

Usage#

The BJT temperature sensor will first call the callback event after initializing and configuring the channel settings and operating mode. It will enable, configure, and read the BJT temperature value in the read data along with configuring and reading the band-gap value. Once the values are successfully read, the temperature in Celsius will be computed.

  1. Initialize the BJT temperature sensor:sl_si91x_bjt_temperature_sensor_init

  2. Read data from the BJT temperature sensor:sl_si91x_bjt_temperature_sensor_read_data

  3. Enable or disable the BJT temperature sensor:sl_si91x_bjt_temperature_sensor_state

  4. Configure the channel of BJT:sl_si91x_bjt_temperature_sensor_set_channel_configuration

  5. Configure band gap channel for BJT temperature sensor:sl_si91x_bjt_temperature_sensor_bg_set_channel_configuration

Enumerations#

enum
SL_BJT_DEGREE_CELSIUS
SL_BJT_FAHRENHEIT
SL_BJT_KELVIN
}

Enumeration for BJT temperature sensor types.

enum
SL_BJT_TEMPERATURE_SENSOR_DISABLE
SL_BJT_TEMPERATURE_SENSOR_ENABLE
SL_BJT_TEMPERATURE_SENSOR_LAST
}

Enumeration for BJT temperature sensor state.

Functions#

sl_status_t
sl_si91x_bjt_temperature_sensor_init(adc_ch_config_t sl_bjt_temperature_sensor_channel_config, adc_config_t sl_bjt_temperature_sensor_config)

To initialize the BJT temperature sensor by configuring ADC channels and settings.

sl_status_t

To read data from the BJT temperature sensor and convert it to temperature.

sl_status_t
sl_si91x_bjt_temperature_sensor_state(sl_bjt_temperature_sensor_state_t state)

To enable or disable the BJT temperature sensor.

sl_status_t
sl_si91x_bjt_temperature_sensor_set_channel_configuration(adc_ch_config_t sl_bjt_temperature_sensor_channel_config)

To configure the BJT temperature sensor with the specified channel.

sl_status_t
sl_si91x_bjt_temperature_sensor_bg_set_channel_configuration(adc_ch_config_t sl_bjt_temperature_sensor_channel_config)

To configure the band gap for the BJT temperature sensor.

sl_status_t
sl_si91x_get_bjt_temperature_sensor_conversion(double *temp_data, sl_bjt_temperature_sensor_enum_t current_temperature_mode)

To convert the sensor reading to temperature in Celsius, Fahrenheit, or Kelvin.

sl_status_t
sl_si91x_bjt_temperature_sensor_deinit(adc_config_t sl_bjt_temperature_sensor_config)

To de-initialize the BJT temperature sensor and release resources.

Enumeration Documentation#

sl_bjt_temperature_sensor_enum_t#

sl_bjt_temperature_sensor_enum_t

Enumeration for BJT temperature sensor types.

Enumerator
SL_BJT_DEGREE_CELSIUS

Temperature in degree Celsius.

SL_BJT_FAHRENHEIT

Temperature in Fahrenheit.

SL_BJT_KELVIN

Temperature in Kelvin.


Definition at line 58 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_bjt_temperature_sensor.h

sl_bjt_temperature_sensor_state_t#

sl_bjt_temperature_sensor_state_t

Enumeration for BJT temperature sensor state.

Enumerator
SL_BJT_TEMPERATURE_SENSOR_DISABLE

Temperature sensor state is disabled.

SL_BJT_TEMPERATURE_SENSOR_ENABLE

Temperature sensor state is enabled.

SL_BJT_TEMPERATURE_SENSOR_LAST

Last member of enum is used to validate the sensor state.


Definition at line 67 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_bjt_temperature_sensor.h

Function Documentation#

sl_si91x_bjt_temperature_sensor_init#

sl_status_t sl_si91x_bjt_temperature_sensor_init (adc_ch_config_t sl_bjt_temperature_sensor_channel_config, adc_config_t sl_bjt_temperature_sensor_config)

To initialize the BJT temperature sensor by configuring ADC channels and settings.

Parameters
[in]sl_bjt_temperature_sensor_channel_config

BJT channels configuration structure containing channel number, sampling rate, and sample length.

[in]sl_bjt_temperature_sensor_config

BJT configuration structure containing the operation mode and number of channels.

This API performs ADC initialization and configuration, sets the register callback, and starts the ADC.

  • Pre-conditions:

    • Ensure that the ADC peripheral clock is enabled.

    • Ensure that the necessary GPIOs for the ADC channels are configured.

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK (0x0000) - Success.

    • SL_STATUS_FAIL (0x0001) - Fail.

    • SL_STATUS_INVALID_PARAMETER (0x0021) - Invalid parameter.

    • SL_STATUS_INVALID_RANGE (0x0028) - Invalid range.

    • SL_STATUS_INVALID_COUNT (0x002B) - Invalid count.

For more information on the status documentation, see SL STATUS DOCUMENTATION.


Definition at line 98 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_bjt_temperature_sensor.h

sl_si91x_bjt_temperature_sensor_read_data#

sl_status_t sl_si91x_bjt_temperature_sensor_read_data (double * temp_data)

To read data from the BJT temperature sensor and convert it to temperature.

Parameters
[out]temp_data

Pointer to the variable where the converted temperature data will be stored.

The API is used to read raw data from the BJT temperature sensor and convert it to a temperature value.

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK (0x0000) - Success.

    • SL_STATUS_FAIL (0x0001) - Fail.

    • SL_STATUS_NULL_POINTER (0x0022) - The parameter is a null pointer.

    • SL_STATUS_INVALID_PARAMETER (0x0021) - Parameters are invalid.

    • SL_STATUS_INVALID_RANGE (0x0028) - Mismatch Range.

For more information on the status documentation, see SL STATUS DOCUMENTATION.


Definition at line 121 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_bjt_temperature_sensor.h

sl_si91x_bjt_temperature_sensor_state#

sl_status_t sl_si91x_bjt_temperature_sensor_state (sl_bjt_temperature_sensor_state_t state)

To enable or disable the BJT temperature sensor.

Parameters
[in]state

Value indicating whether to enable or disable the BJT temperature sensor:

  • SL_BJT_TEMPERATURE_SENSOR_ENABLE (1) - Enable

  • SL_BJT_TEMPERATURE_SENSOR_DISABLE (0) - Disable

The API is used to enable or disable the BJT temperature sensor.

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK (0x0000) - Success.

    • SL_STATUS_INVALID_PARAMETER (0x0021) - The parameter is an invalid argument.

For more information on the status documentation, see SL STATUS DOCUMENTATION.


Definition at line 143 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_bjt_temperature_sensor.h

sl_si91x_bjt_temperature_sensor_set_channel_configuration#

sl_status_t sl_si91x_bjt_temperature_sensor_set_channel_configuration (adc_ch_config_t sl_bjt_temperature_sensor_channel_config)

To configure the BJT temperature sensor with the specified channel.

Parameters
[in]sl_bjt_temperature_sensor_channel_config

BJT channel configuration structure containing the positive input to BJT value.

The API is used to configure the BJT temperature sensor with the specified channel.

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK (0x0000) - Success.

    • SL_STATUS_NULL_POINTER (0x0022) - The parameter is a null pointer.

    • SL_STATUS_INVALID_PARAMETER (0x0021) - Parameters are invalid.

    • SL_STATUS_INVALID_RANGE (0x0028) - Mismatch range.

For more information on the status documentation, see SL STATUS DOCUMENTATION.


Definition at line 164 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_bjt_temperature_sensor.h

sl_si91x_bjt_temperature_sensor_bg_set_channel_configuration#

sl_status_t sl_si91x_bjt_temperature_sensor_bg_set_channel_configuration (adc_ch_config_t sl_bjt_temperature_sensor_channel_config)

To configure the band gap for the BJT temperature sensor.

Parameters
[in]sl_bjt_temperature_sensor_channel_config

Band gap channel configuration structure containing the positive input to OPAMP value.

The API is used to configure the band gap for the BJT temperature sensor.

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK (0x0000) - Success.

    • SL_STATUS_NULL_POINTER (0x0022) - The parameter is a null pointer.

    • SL_STATUS_INVALID_PARAMETER (0x0021) - Parameters are invalid.

    • SL_STATUS_INVALID_RANGE (0x0028) - Mismatch range.

For more information on the status documentation, see SL STATUS DOCUMENTATION.


Definition at line 186 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_bjt_temperature_sensor.h

sl_si91x_get_bjt_temperature_sensor_conversion#

sl_status_t sl_si91x_get_bjt_temperature_sensor_conversion (double * temp_data, sl_bjt_temperature_sensor_enum_t current_temperature_mode)

To convert the sensor reading to temperature in Celsius, Fahrenheit, or Kelvin.

Parameters
[out]temp_data

Pointer to the variable where the converted temperature data will be stored.

[in]current_temperature_mode

Current temperature mode sl_bjt_temperature_sensor_enum_t

This API converts the sensor reading to temperature in Celsius, Fahrenheit, or Kelvin.

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK (0x0000) - Success.

    • SL_STATUS_FAIL (0x0001) - Fail.

    • SL_STATUS_NULL_POINTER (0x0022) - The parameter is a null pointer.

    • SL_STATUS_INVALID_PARAMETER (0x0021) - Parameters are invalid.

For more information on the status documentation, see SL STATUS DOCUMENTATION.


Definition at line 210 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_bjt_temperature_sensor.h

sl_si91x_bjt_temperature_sensor_deinit#

sl_status_t sl_si91x_bjt_temperature_sensor_deinit (adc_config_t sl_bjt_temperature_sensor_config)

To de-initialize the BJT temperature sensor and release resources.

Parameters
[in]sl_bjt_temperature_sensor_config

Configuration structure used for de-initializing the BJT temperature sensor.

The API is used to de-initialize the BJT temperature sensor and release any allocated resources.

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK (0x0000) - Success.

    • SL_STATUS_FAIL (0x0001) - Fail.

For more information on the status documentation, see SL STATUS DOCUMENTATION.


Definition at line 230 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_bjt_temperature_sensor.h