i2ctmp

Example Summary

Sample application that reads the temperature from a TMP sensor.

Peripherals & Pin Assignments

When this project is built, the SysConfig tool will generate the TI-Driver configurations into the ti_drivers_config.c and ti_drivers_config.h files. Information on pins and resources used is present in both generated files. Additionally, the System Configuration file (*.syscfg) present in the project may be opened with SysConfig’s graphical user interface to determine pins and resources used.

BoosterPacks, Board Resources & Jumper Settings

This example requires a BP-BASSENSORSMKII BoosterPack.

For board specific jumper settings, resources and BoosterPack modifications, refer to the Board.html file.

If you’re using an IDE such as Code Composer Studio (CCS) or IAR, please refer to Board.html in your project directory for resources used and board-specific jumper settings.

The Board.html can also be found in your SDK installation:

    <SDK_INSTALL_DIR>/source/ti/boards/<BOARD>

Example Usage

The connection will have the following settings:

    Baud-rate:     115200
    Data bits:          8
    Stop bits:          1
    Parity:          None
    Flow Control:    None
  1. CONFIG_GPIO_LED_0 turns ON to indicate the I2C driver initialization is complete.

    I2C Initialized!
  2. If required, the TMP sensor is enabled using a GPIO output.

  3. The I2C bus is queried for all supported TMP sensors. The output varies depending on which TMP sensor(s) is found.

    I2C slave address 0x41 not acknowledged!
    I2C slave address 0x49 not acknowledged!
    Detected TMP116 sensor with slave address 0x48
  4. The last known TMP sensor will be used to read temperature samples. Samples are converted to celcius and displayed via UART.

    Sample 0: 24 (C)
    Sample 1: 24 (C)
           .
           .
           .
    Sample 18: 24 (C)
    Sample 19: 24 (C)
  5. After a number of samples, the I2C driver instance is closed.

    I2C closed!

Application Design Details

This application uses one task:

'mainThread' - performs the following actions:

  1. Opens and initializes an I2C driver object.

  2. Determines which TMP sensor is available. Sensors are described in the sensors data structure at the top of the source.

  3. Uses the I2C driver in blocking mode to get data from the TMP sensor.

  4. Extracts the temperature (in Celsius) and prints the value via the UART.

  5. The task sleeps for 1 second.

TI-RTOS:

FreeRTOS:

SimpleLink Sensor and Actuator Plugin: