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.

CC1310: Current consumption too high

Part Number: CC1310
Other Parts Discussed in Thread: CC1350, ENERGYTRACE,

Hello,

I'm working on a project which I'm sending ADC measurement through RF each 8 hours. For this, I get my board into standby during 8 hours using Task_sleep() while data is not sent. Briefly, "main_tirtos.c" (first code attached) create a thread that get ADC measurement and send it. The thread is located in "rfPacketTx.c" (second code attached), where I used Task_sleep() at the end of the file at while(1).

/*
 *  ======== main_tirtos.c ========
 */
#include <stdint.h>

/* POSIX Header files */
#include <pthread.h>

/* RTOS header files */
#include <ti/sysbios/BIOS.h>

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

extern void *mainThread(void *arg0);

/* Stack size in bytes */
#define THREADSTACKSIZE    1024

/*
 *  ======== main ========
 */
int main(void)
{
    pthread_t           thread;
    pthread_attr_t      attrs;
    struct sched_param  priParam;
    int                 retc;
    int                 detachState;

    /* Call driver init functions */
    Board_initGeneral();

    /* Set priority and stack size attributes */
    pthread_attr_init(&attrs);
    priParam.sched_priority = 1;

    detachState = PTHREAD_CREATE_DETACHED;
    retc = pthread_attr_setdetachstate(&attrs, detachState);
    if (retc != 0) {
        /* pthread_attr_setdetachstate() failed */
        while (1);
    }

    pthread_attr_setschedparam(&attrs, &priParam);

    retc |= pthread_attr_setstacksize(&attrs, THREADSTACKSIZE);
    if (retc != 0) {
        /* pthread_attr_setstacksize() failed */
        while (1);
    }

    retc = pthread_create(&thread, &attrs, mainThread, NULL);
    if (retc != 0) {
        /* pthread_create() failed */
        while (1);
    }

    BIOS_start();
    return (0);
}

/***** Includes *****/
/* Standard C Libraries */
#include <stdlib.h>
#include <unistd.h>

/* TI Drivers */
#include <ti/drivers/rf/RF.h>
#include <ti/drivers/PIN.h>
#include <ti/drivers/pin/PINCC26XX.h>
#include <math.h>
#include <smartrf_settings/smartrf_settings.h>
#include <time.h>
#include <ti/sysbios/hal/Seconds.h>
#include <ti/drivers/ADCBuf.h>
#include <ti/drivers/ADC.h>
//#include <ti/devices/cc13x0/driverlib/aon_ioc.h>
//#include <ti/sysbios/family/arm/cc26xx/Timer.h>
#include <ti/dpl/PowerCC26XX_tirtos.c>
#include <ti/drivers/Power.h>
#include <ti/drivers/power/PowerCC26XX.h>
#include <ti/devices/cc13x0/driverlib/aon_batmon.h>


/* Driverlib Header files */
#include DeviceFamily_constructPath(driverlib/rf_prop_mailbox.h)

/* Board Header files */
#include "Board.h"
#include <ti/drivers/GPIO.h>

/***** Defines *****/
#define ADCBUFFERSIZE    (28)

#define ADC_SAMPLE_COUNT  (10)

#define THREADSTACKSIZE   (768)

#define ID0 0
#define ID1 1

/* Do power measurement */
//#define POWER_MEASUREMENT

/* Packet TX Configuration */
#define PAYLOAD_LENGTH      9
#define NORM_VALUES         10
#ifdef POWER_MEASUREMENT
#define PACKET_INTERVAL     5  /* For power measurement set packet interval to 5s */
#else
#define PACKET_INTERVAL     300  /* Set packet interval to 500000us or 500ms */
#endif

/***** Prototypes *****/

/***** Variable declarations *****/
static RF_Object rfObject;
static RF_Handle rfHandle;
//Timer_Object *TimerObj;
//Timer_Handle TimerHandle;

/* Pin driver handle */
static PIN_Handle ledPinHandle;
static PIN_State ledPinState;

static uint8_t packet[PAYLOAD_LENGTH];
static uint16_t seqNumber;

/* ADC conversion result variables */
uint16_t adcValue0;
uint32_t adcValue0MicroVolt;
uint16_t adcValue1[ADC_SAMPLE_COUNT];
uint32_t adcValue1MicroVolt[ADC_SAMPLE_COUNT];

uint16_t sampleBufferOne[ADCBUFFERSIZE];
uint16_t sampleBufferTwo[ADCBUFFERSIZE];
float microVoltBuffer[ADCBUFFERSIZE];
float valor_temperatura=0;
float media[ADCBUFFERSIZE];
int_fast16_t val;

/*
 * Application LED pin configuration table:
 *   - All LEDs board LEDs are off.
 */
PIN_Config pinTable[] =
{
    Board_PIN_LED1 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,
#ifdef POWER_MEASUREMENT
#if defined(Board_CC1350_LAUNCHXL)
    Board_DIO30_SWPWR | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MAX,
#endif
#endif
    PIN_TERMINATE
};

/***** Function definitions *****/
float conversionTemp(uint16_t value){
    float NTC;
    float Temp;

//    NTC = ((2.27*100000)/value)-100000;
//    NTC = NTC/1000;
    NTC = 100000*4096/value - 100000;
    NTC = NTC/1000;

    Temp = 66.266*exp((-0.01*NTC));
//    Temp = exp((NTC-421.37)/-96.7);

    return(Temp);
}

void conversionFloat(float temp, float battery, uint8_t * packet)
{
    float aux=roundf(temp * 100);
    int n=(int)aux;

    uint8_t i;
    for(i=5;i>1;i--)
    {
        packet[i]=n%10;
        n=n/10;
    }

    aux=roundf(battery * 100);
    n=(int)aux;

    for(i=8;i>5;i--)
        {
            packet[i]=n%10;
            n=n/10;
        }
}

uint16_t readADC(){

    ADC_Handle   adc;
    ADC_Params   params;
    int_fast16_t res;
    float floatValue;
    uint16_t normValue = 0;
    uint8_t i;

    ADC_init();
    ADC_Params_init(&params);
    adc = ADC_open(2, &params);

    if (adc != NULL) {

        for (i=0; i < NORM_VALUES; i++){
            /* Blocking mode conversion */
            res = ADC_convert(adc, &adcValue0);

            if (res == ADC_STATUS_SUCCESS) {

                adcValue0MicroVolt = ADC_convertRawToMicroVolts(adc, adcValue0);
//                floatValue = adcValue0MicroVolt*1.00/1000000.00;
                normValue += adcValue0;
                adcValue0 = 0;

            }else{
                i--;
            }
        }

        normValue = normValue/NORM_VALUES;

        ADC_close(adc);
    }

    return (normValue);
}

float getBatteryValue(){
//    uint32_t battery, BATstatus;
//    float BATvoltage;
//
//    battery = AONBatMonBatteryVoltageGet();
//
//    // convert in Milli volts
//    BATstatus = (BATstatus * 125) >> 5;
//
//    //convert in floating point value
//    BATvoltage = (float)BATstatus / 1000;

    float MeasuredVoltage = (float)(((uint32_t)HWREG(AON_BATMON_BASE + AON_BATMON_O_BAT)*125) >> 5)/1000; // Convert to milivolts, then convert to float

    return (MeasuredVoltage);
}

void *mainThread(void *arg0)
{
    RF_Params rfParams;
    RF_Params_init(&rfParams);

    struct tm next_time;
    struct tm current_time;
    time_t next_seconds;
    time_t current_seconds;
    uint32_t sleep_interval;
//    float batteryValue;

    memset(&next_time, 0, sizeof(struct tm));
//    memset(&current_time, 0, sizeof(struct tm));

//    float microVoltValue;
    uint16_t ADCvalue;
    float Temperature;

    RF_cmdPropTx.pktLen = PAYLOAD_LENGTH;
    RF_cmdPropTx.pPkt = packet;
    RF_cmdPropTx.startTrigger.triggerType = TRIG_NOW;

    /* Request access to the radio */
    rfHandle = RF_open(&rfObject, &RF_prop, (RF_RadioSetup*)&RF_cmdPropRadioDivSetup, &rfParams);

    /* Set the frequency */
    RF_postCmd(rfHandle, (RF_Op*)&RF_cmdFs, RF_PriorityNormal, NULL, 0);

    // Set the struct date / time to 2016 / 5 / 21 18:00:00
    current_time.tm_year = 2016 - 1970;
    current_time.tm_mon = 5 - 1;
    current_time.tm_mday = 21;
    current_time.tm_hour = 18;
    current_time.tm_min = 0;
    current_time.tm_sec = 0;

    // Set the struct date / time to 2016 / 5 / 21 18:00:00
    next_time.tm_year = 2016 - 1970;
    next_time.tm_mon = 5 - 1;
    next_time.tm_mday = 21;
    next_time.tm_hour = 18;
    next_time.tm_min = 0;
    next_time.tm_sec = 0;

    AONBatMonEnable();

    /* Create packet with incrementing sequence number and random payload */
    packet[0] = (uint8_t)ID0;
    packet[1] = (uint8_t)ID1;


    while(1)
    {
        // Get Battery level
        float MeasuredVoltage = (float)(((uint32_t)HWREG(AON_BATMON_BASE + AON_BATMON_O_BAT)*125) >> 5)/1000; // Convert to milivolts, then convert to float

        ADCvalue = readADC();
        Temperature = conversionTemp(ADCvalue);
        conversionFloat(Temperature, MeasuredVoltage, packet);

        /* Send packet */
        RF_EventMask terminationReason = RF_runCmd(rfHandle, (RF_Op*)&RF_cmdPropTx, RF_PriorityNormal, NULL, 0);

        RF_yield(rfHandle); // Radio powered off

        Task_sleep(2880000000); // 8 hours

    }
}

The problem I've found is that current consumption is 1.7 mA during sleep mode, but it should be much lower (few μA). I'm measuring current in the 3V3 jumper, as shown in the image. I looked at the application note to measure current consumption but I didn't remove any jumpers because it's programmed through USB.

Is there something I'm missing why current consumption is as high?

Thanks in advance,

Alberto