This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

RTOS/TMP116: RTOS/TMP116

Part Number: TMP116
Other Parts Discussed in Thread: SYSBIOS, , CC1310, CC2541

Tool/software: TI-RTOS

hello,

I measure the total consumption of my personal PCB (CC1310 4x4 mm) intrefacée with a Tmp 116 sensor, in standby mode and I get readings around 129 μA. Our application requires a total system current consumption of less than 4 μA. What steps are we taking to achieve this, please?
NB: Mon capteur consomme 129 μA  and i used the sail librairy?
I'm working with the SDK for simplelink_CC13x0 and using CCS 8.0.

This is my code:

/*
* Copyright (c) 2015-2016, Texas Instruments Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

/*
* ======== rfEasyLinkTx.c ========
*/
/* XDCtools Header files */
#include <pthread.h>
#include <stdlib.h>
#include <xdc/std.h>
#include <xdc/runtime/System.h>
#include <xdc/runtime/Error.h>
#include <stdint.h>
#include <stddef.h>
#include <unistd.h>
#include <semaphore.h>
#include <ti/drivers/Power.h>
#include <ti/drivers/power/PowerCC26XX.h>


/* BIOS Header files */
#include <ti/drivers/rf/RF.h>
#include <ti/sysbios/BIOS.h>
#include <ti/sysbios/knl/Task.h>
#include <ti/sysbios/knl/Clock.h>
#include <ti/drivers/GPIO.h>
#include <ti/drivers/I2C.h>


/* TI-RTOS Header files */
#include <ti/drivers/PIN.h>
#include <ti/drivers/Power.h>

#include <ti/devices/cc13x0/driverlib/aon_batmon.h>
#include <ti/devices/cc13x0/driverlib/aux_adc.h>
#include <ti/devices/cc13x0/driverlib/chipinfo.h>
#include <ti/devices/cc13x0/driverlib/sys_ctrl.h>
#include <semaphore.h>
#include <ti/sail/tmp116/tmp116.h>

/* Board Header files */
#include "Board.h"

/* EasyLink API Header files */
#include "easylink/EasyLink.h"

#include "sc/scif.h"

#include "version.h"
#include "../sonde_gw_fw/sys_intf.h"

#include <string.h>
#include <math.h>


#define RFEASYLINKTX_TASK_STACK_SIZE 1024
#define RFEASYLINKTX_TASK_PRIORITY 2

#define RFEASYLINKTX_BURST_SIZE 1

Task_Struct txTask; /* not static so you can see in ROV */
static Task_Params txTaskParams;
static uint8_t txTaskStack[RFEASYLINKTX_TASK_STACK_SIZE];

Task_Struct sensorTask; /* not static so you can see in ROV */
static Task_Params sensorTaskParams;
static uint8_t sensorTaskStack[RFEASYLINKTX_TASK_STACK_SIZE];

typedef struct {
uint8_t reason;
int16_t temp_deg_frac_8;
uint8_t bat_20mV;
} opto_sonde_data_t;

void sleepAndReset(uint32_t sleep_time_secs) {

// Enable button interrupt wake up
uint32_t secs = sleep_time_secs;
while (secs > 0)
{
uint32_t sleep_s = secs > 2000 ? 2000 : secs;
Task_sleep((sleep_s * 1000u * 1000) / Clock_tickPeriod);
secs -= sleep_s;
}

SysCtrlSystemReset();
}

static void rfEasyLinkTxFnx(UArg arg0, UArg arg1)
{

opto_sonde_data_t* optosonde_data = (opto_sonde_data_t*) arg0;
// rtc_cmd_t* rtc_cmd = arg1;

// EasyLink_init(EasyLink_Phy_625bpsLrm);
// EasyLink_init(EasyLink_Phy_5kbpsSlLr);
EasyLink_init(EasyLink_Phy_Custom);

/*
* If you wish to use a frequency other than the default, use
* the following API:
* EasyLink_setFrequency(868000000);
*/

/* Set output power to 12dBm */
// EasyLink_setRfPwr(12);
EasyLink_setRfPwr(10);

EasyLink_TxPacket txPacket;

// Fill packet data
uint8_t payload_ptr = 0;
// Payload version
txPacket.payload[payload_ptr++] = (uint8_t) (0x0);
// Src MAC
EasyLink_getIeeeAddr(&txPacket.payload[payload_ptr]);
payload_ptr += 8;

// Copy data
txPacket.payload[payload_ptr++] = (uint8_t) (optosonde_data->reason);
txPacket.payload[payload_ptr++] = (uint8_t) (optosonde_data->temp_deg_frac_8 >> 8);
txPacket.payload[payload_ptr++] = (uint8_t) (optosonde_data->temp_deg_frac_8);

txPacket.payload[payload_ptr++] = (uint8_t) (optosonde_data->bat_20mV);

// Firmware version
memcpy(&txPacket.payload[payload_ptr], &VERSION_HASH, sizeof(VERSION_HASH));
payload_ptr += sizeof(VERSION_HASH);

txPacket.len = payload_ptr;
txPacket.absTime = 0;
txPacket.dstAddr[0] = OPTOSONDE_ADDR;

EasyLink_Status result = EasyLink_transmit(&txPacket);

if (result == EasyLink_Status_Success)
{
/* Toggle LED1 to indicate TX */
// PIN_setOutputValue(pinHandle, Board_PIN_LED1,!PIN_getOutputValue(Board_PIN_LED1));
}
else
{
/* Toggle LED1 and LED2 to indicate error */
// PIN_setOutputValue(pinHandle, Board_PIN_LED1,!PIN_getOutputValue(Board_PIN_LED1));
// PIN_setOutputValue(pinHandle, Board_PIN_LED2,!PIN_getOutputValue(Board_PIN_LED2));
}

// Prevent button reset overload
if (optosonde_data->reason == optosonde_reason_button) {
Task_sleep(1000000 / Clock_tickPeriod);
}
Task_sleep(5000 * 100);
// Tell RTC to sleep

uint32_t sleep_time_s = 1 * 30;

sleepAndReset(sleep_time_s);
}

void sendorTask(UArg arg0, UArg arg1)
{
static opto_sonde_data_t optosonde_data;


float temperature;
I2C_Handle i2c;
TMP116_Handle tmp116Handle;
I2C_Params i2cParams;

I2C_Params_init(&i2cParams);
i2cParams.transferMode = I2C_MODE_BLOCKING;
i2cParams.bitRate = I2C_400kHz;
i2c = I2C_open(Board_I2C_TMP, &i2cParams);
if (i2c == NULL) {

}
else {
}

TMP116_init();
tmp116Handle = TMP116_open(Board_I2C_TMP, i2c, NULL);

if (tmp116Handle == NULL){
}else
{
}

sleep(2);
if (TMP116_getTemp(tmp116Handle, TMP116_CELSIUS, &temperature)) {

}

else {
}


if (TMP116_close(tmp116Handle)){

} else {

}
I2C_close(i2c);

uint16_t MSB = (uint8_t) (temperature);
uint8_t LSB = (uint8_t) ((temperature - MSB ) * 100);


optosonde_data.temp_deg_frac_8 = (MSB<<8) +LSB;

while (!AONBatMonNewBatteryMeasureReady())
{
// Wait
Task_sleep(1000 * 1000 / Clock_tickPeriod);
}
optosonde_data.bat_20mV = (AONBatMonBatteryVoltageGet() * 390625) / 2000000;
AONBatMonDisable();

// Init Tx task
Task_Params_init(&txTaskParams);
txTaskParams.stackSize = RFEASYLINKTX_TASK_STACK_SIZE;
txTaskParams.priority = RFEASYLINKTX_TASK_PRIORITY + 1;
txTaskParams.stack = &txTaskStack;
txTaskParams.arg0 = (xdc_UArg) &optosonde_data;

Task_construct(&txTask, rfEasyLinkTxFnx, &txTaskParams, NULL);

}

/*
* ======== main ========
*/
int opto_main(void)
{
/* Call driver init functions. */
Board_initGeneral();
Board_initI2C();

// Sensor task
Task_Params_init(&sensorTaskParams);
txTaskParams.stackSize = RFEASYLINKTX_TASK_STACK_SIZE;
txTaskParams.priority = RFEASYLINKTX_TASK_PRIORITY;
txTaskParams.stack = &sensorTaskStack;
txTaskParams.arg0 = 0;
txTaskParams.arg1 = 0;

Task_construct(&sensorTask,sendorTask,&sensorTaskParams, NULL);

/* Start BIOS */
BIOS_start();

return (0);
}

  • Hello,
    Correct :
    N.b: My sensor consumes 129 ua ?
  • Hi abdelkader,

    I previously answered your questions about TMP116's current consumption, see here: e2e.ti.com/.../693844 I can't help you debug current consumption of this software or the CC13xx device.

    Thanks,
    Ren
  • Hello thank for your repley;
    Just to explain the problem clearly to you, when I add the part of the reading of the temperature (here is the code), the consumption of the current increases to 129 uA, please Why?

    static opto_sonde_data_t optosonde_data;
    float temperature;
    I2C_Handle i2c;
    TMP116_Handle tmp116Handle;
    I2C_Params i2cParams;

    I2C_Params_init(&i2cParams);
    i2cParams.transferMode = I2C_MODE_BLOCKING;
    i2cParams.bitRate = I2C_400kHz;
    i2c = I2C_open(Board_I2C_TMP, &i2cParams);
    if (i2c == NULL) {

    }
    else {
    }

    TMP116_init();
    tmp116Handle = TMP116_open(Board_I2C_TMP, i2c, NULL);

    if (tmp116Handle == NULL){
    }else
    {
    }

    sleep(2);
    if (TMP116_getTemp(tmp116Handle, TMP116_CELSIUS, &temperature)) {

    }

    else {
    }


    if (TMP116_close(tmp116Handle)){

    } else {

    }
    I2C_close(i2c);
  • The software appears to retrieve temperature data from TMP116, but there is not enough shown here to know for sure. Retrieving the temperature from TMP116 would not cause it to change its current consumption. Executing this code may cause the controller to consume more current. Please direct your software questions and your questions about the CC1310 current consumption to the Sub 1 Ghz forums. e2e.ti.com/.../156

    Thanks,
    Ren
  • Hello,
    can you explain this, please,

    I debug, why when i get to this statement: tmp116Handle = TMP116_open (Board_I2C_TMP, i2c, NULL); the consumption current of my controller rises and stays at 129 uA?

    this is my code for reading the temperature:

    ----------------------------------------------------------------------------------------------------------------------------------
    void sendorTask(UArg arg0, UArg arg1)
    {
    static opto_sonde_data_t optosonde_data;


    float temperature;
    I2C_Handle i2c;
    TMP116_Handle tmp116Handle;
    I2C_Params i2cParams;
    uint32_t TIMEOUT = 0;

    I2C_Params_init(&i2cParams);
    i2cParams.transferMode = I2C_MODE_BLOCKING;
    i2cParams.bitRate = I2C_400kHz;
    i2c = I2C_open(Board_I2C_TMP, &i2cParams);
    if (i2c == NULL) {

    }
    else {
    }

    TMP116_init();
    Task_sleep(500 * 100);
    tmp116Handle = TMP116_open(Board_I2C_TMP, i2c, NULL);

    if (tmp116Handle == NULL){
    }else
    {
    }

    sleep(2);

    while(!TMP116_configConversions(tmp116Handle,TMP116_OS_MODE,TMP116_0CONV,TMP116_0SAMPLES) && TIMEOUT != 5000){

    usleep(200); // attente 200 uS , alors un Time out de 1s
    TIMEOUT++;
    }

    if (TMP116_getTemp(tmp116Handle, TMP116_CELSIUS, &temperature)) {

    }

    else {
    }

    TIMEOUT =0;

    while (!TMP116_close(tmp116Handle) && TIMEOUT != 10000 ){

    usleep(200);
    TIMEOUT ++;
    }

    I2C_close(i2c);

    uint16_t MSB = (uint8_t) (temperature);
    uint8_t LSB = (uint8_t) ((temperature - MSB ) * 100);


    optosonde_data.temp_deg_frac_8 = (MSB<<8) +LSB;

    while (!AONBatMonNewBatteryMeasureReady())
    {
    // Wait
    Task_sleep(1000 * 1000 / Clock_tickPeriod);
    }
    optosonde_data.bat_20mV = (AONBatMonBatteryVoltageGet() * 390625) / 2000000;
    AONBatMonDisable();

    // Init Tx task
    Task_Params_init(&txTaskParams);
    txTaskParams.stackSize = RFEASYLINKTX_TASK_STACK_SIZE;
    txTaskParams.priority = RFEASYLINKTX_TASK_PRIORITY + 1;
    txTaskParams.stack = &txTaskStack;
    txTaskParams.arg0 = (xdc_UArg) &optosonde_data;

    Task_construct(&txTask, rfEasyLinkTxFnx, &txTaskParams, NULL);

    }
  • Please direct your software questions and your questions about the CC1310 current consumption to the Sub 1 Ghz forums. e2e.ti.com/.../156

    Thanks,
    Ren
  • Dear Ren ,
    I am Abdelkader manager , he is struggling since a few weeks to make the tmp116 works on cc1310 . We clearly identified that the consumption of 135µA was coming only from tmp116 . He used the configuration prescribed in the tmp 116 datasheet and implimented it in the furnished TI program , we have tried for example to set CC mode with 16 secondes cycle time and avg 0 or single shot mode but we still had the same 135µA current. Something seems to be missing to put the tmp116 in shut down mode .Any hit ?
    thank you for help
  • Hi Bernard,

    TMP116 only consumes 135uA when it is actively making a temperature measurement, known as a conversion. By default, this occurs every second and lasts for 125ms. If you use a multimeter with a long enough integration cycle, you should only see an average current consumption of 16uA in this mode. In order to verify these measurements, you would need to insert your meter or a shunt resistor at the TMP116 V+ pin. If you have successfully configured the device for Shutdown and observed no change in current consumption, then the current is being consumed by something else on your board.

    Thanks,
    Ren
  • well , I am wondering if the 2 pull up resistors on sda and scl , 4.7kohm,  would explain this current ? 

  • Hello,
    My RF sending application is based on SimpleLink CC13x0 SDK version 1.40.0.10, this poses a problem? While the example provided of the TMP 116 is based version 2.10.0.36.
  • Hi Bernard,

    Assuming a 3.3V power supply, the I2C devices must sink 700uA to ground to create logic low. This should only occur for a few microseconds per clock cycle assuming a modest fSCL >100kHz. When the bus is idle, the size of the pull-up doesn't determine the leakage current.

    Thanks,
    Ren
  • Hi abdelkader,

    Please direct your software questions and your questions about the CC1310 to the Sub 1 Ghz forums. e2e.ti.com/.../156

    Thanks,
    Ren
  • Hello,

    Before the opening of the sensor my system goes into standby mode just after the opening of the sensor the system consumes 129 uA, despite after the sending of RF data I added a Tasksleep, how to return to standby mode and why the sensor remains active?

    Thanks for help;


    TMP116_init();

    Task_sleep(50000 * 100);

    tmp116Handle = TMP116_open(Board_I2C_TMP, i2c, NULL);

    if (tmp116Handle == NULL){
    }else
    {
    }

    sleep(2);

    while(!TMP116_configConversions(tmp116Handle,TMP116_OS_MODE,TMP116_0CONV,TMP116_0SAMPLES) && TIMEOUT != 5000){

    usleep(200); // attente 200 uS , alors un Time out de 1s
    TIMEOUT++;
    }

    if (TMP116_getTemp(tmp116Handle, TMP116_CELSIUS, &temperature)) {

    }

    else {
    }

    TIMEOUT =0;

    while (!TMP116_close(tmp116Handle) && TIMEOUT != 10000 ){

    usleep(200);
    TIMEOUT ++;
    }

    I2C_close(i2c);

    uint16_t MSB = (uint8_t) (temperature);
    uint8_t LSB = (uint8_t) ((temperature - MSB ) * 100);


    optosonde_data.temp_deg_frac_8 = (MSB<<8) +LSB;


    // Init Tx task
    Task_Params_init(&txTaskParams);
    txTaskParams.stackSize = RFEASYLINKTX_TASK_STACK_SIZE;
    txTaskParams.priority = RFEASYLINKTX_TASK_PRIORITY + 1;
    txTaskParams.stack = &txTaskStack;
    txTaskParams.arg0 = (xdc_UArg) &optosonde_data;

    Task_construct(&txTask, rfEasyLinkTxFnx, &txTaskParams, NULL);
  • Hi abdelkader,

    You've asked this same question several times. I have no reason to believe that the current you're observing is consumed by TMP116. We've discussed the sources of current consumption that pertain to TMP116 already. I can't tell you why you see high current consumption when the MCU has paused it's execution. Your comments about RF data, tasksleep, and standby mode don't pertain to TMP116.

    Please direct your software questions and your questions about the CC1310 to the Sub 1 Ghz forums. e2e.ti.com/.../156

    Thanks,
    Ren
  • Dear Ren,

    As I don't see the way to solve our problem which could result from just a line of code either in the cc1310 or in tmp116 part, is there is someone at TI that could help us , either we send the hardware ( custom cc1310 card + tmp board ) or either we go with the hardware to a place ( paris , sophia antipolis or somewhere else in europe  , england or germany ?) were a TI  field application engineer ( at least someone fluent in code composer studio ) could spend half a day solving our problem  . It becomes very urgent since we have to deliver our customers ( winemarkers ) by middle of july since wineyards production doesn't wait for us .I asked the major distributors for french companies using cc1310 but no one could answer this questions and even worse , one answered that TI doesn't give anymore support to distributors . 

    I am just afraid that I made the wrong choice since I am coping with problems and problems with TI parts since more than 2 years  .

    another story : we are also developping BLE applications for agriculture and we cooperate with freelance people . After 2 months they were sorry to tell us that they couldn't program the cc2541 ( on HM10 modules ) for independant use ( through arduino it is easy ) and that we were forced to switch to esp32 module .

    TI programming with code composer is really complicated and requires experienced people . So, as a small company, we can't invest and hire 10 years experienced people . And we can't also subcontrat project to engineering bureau were the minimum development budget is over 60 000 euros .

    So we are dead with our 2 major programs if TI doesn't support us more than a few general advices through a public forum .

    Thank you for really finding us a solution , we are ready to pay a minimum if necessary . 

  • Hi Bernard,

    I'm sorry that you are not satisfied with TI support. The E2E workload is divided up by product lines. My team has expertise, and is responsible for, temperature sensors like TMP116. I have answered your questions about TMP116 to the best of my ability. If you have further questions about the TMP116 device, please ask.

    However, I must ask you to direct your software questions to the team responsible for that device. They have the expertise to answer your questions about a specific line of code.

    When you submit a new question to E2E, you are prompted to enter a part number. This is how E2E is organized, and how responsibility is assigned. Please enter RTOS or CC1310 as the part number.

    Thanks,
    Ren
  • Hello Abdelkader ZAABOUBI

    Here is my list of possible reasons what can go wrong in your design and create an extra supply current:

    1. SCL and SDA signals levels are inside the range 10%...90% of part supply. For minimal consumption it is recommended to keep levels out of this range

    2. Your device default mode (stored in EEPROM) is cont. conversion without pauses. During operation TMP116 became reset (wrong command or supply glitch) and comes into Cont. Conv. mode with typical consumption = 130 uA. Suggestion: Program your needed mode in TMP116 EEPROM

    3. Somewhere in your MP code is hidden command which program the TMP116 into cont. conversion mode without pauses. Sorry, you have to find it by yourselves. We can't help you there.

    TMP116 proved that is reliable and easy operated device. Many questions about it application is answered in

    http://www.ti.com/lit/an/snoa986/snoa986.pdf article,

    Good luck.

    Please let us known was you able to solve the problem

    Best regards, Michael

  • Hi Mihail

    Thank you very much for replying,


    I tried to redo the code and when I try to build my project, I am getting "fatal error #10192: Failed linktime optimization".


    Please help me to solve the linker error.

    With Warm Regards,



    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    -l"C:/ti/simplelink_cc13x0_sdk_1_60_00_21/source/ti/devices/cc13x0/driverlib/bin/ccs/driverlib.lib" -llibc.a
    <Linking>
    error: symbol "TMP116_config" redeclared with incompatible type:

    "TMP116_Config[][struct TMP116_Config
    >> Compilation failure

    >> Compilation failure

    >> Compilation failure
    makefile:176: recipe for target 'sonde_fw.out' failed
    hwAttrs off: 0 (const void *)
    object off: 32 (void *)]"
    in "../tmp116.c" at line 43 and:
    "const TMP116_Config[2][struct TMP116_Config
    hwAttrs off: 0 (const void *)
    object off: 32 (void *)]"
    in "../CC1310_LAUNCHXL.c" at line 643)
    fatal error #10192: Failed linktime optimization
    gmake[2]: *** [sonde_fw.out] Error 1
    gmake[1]: *** [main-build] Error 2
    gmake: *** [all] Error 2
    makefile:169: recipe for target 'main-build' failed
    makefile:164: recipe for target 'all' failed

    **** Build Finished ****
    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  • Sorry Abdelkader. I never worked with this MP. Cannot help you with this.
    Best Regards
    Michael
  • Hi Mihail

    Thank you very much for replying, It's good I found answer to my questions, thanks for the help to you and your team,


    Best regards