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:电流消耗过高

Guru**** 1831610 points
Other Parts Discussed in Thread: ENERGYTRACE, CC1310
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/wireless-connectivity/sub-1-ghz-group/sub-1-ghz/f/sub-1-ghz-forum/1117709/cc1310-current-consumption-too-high

器件型号:CC1310
主题中讨论的其他器件:CC1350ENERGYTRACE

您好!

我正在进行一个项目、每8小时通过射频发送一次 ADC 测量。 为此,在数据未发送的情况下,我使用 Task_sleep()在8小时内使电路板进入待机状态。 简单地说、"main_tirtos.c"(附加的第一个代码)创建了一个线程、用于获取 ADC 测量值并发送它。 该线程位于"rfPacketTx.c"(附加的第二个代码)中、其中我在 while (1)的文件末尾使用了 Task_sleep()。

/*
 *  ======== 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

    }
}

我 μA 到的问题是、睡眠模式下的电流消耗为1.7mA、但电流消耗应低得多(几 μ A)。 我将测量3V3跳线中的电流、如图所示。 我查看了用于测量电流消耗的应用手册、但我没有移除任何跳线、因为它是通过 USB 编程的。

为什么电流消耗如此高?

提前感谢、

Alberto

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Alberto、  

    要获得正确的测量值、请在独立模式下运行能量跟踪、您必须移除跳线。

    首先对器件进行编程、然后在执行能量测量时移除跳线。

    此致、

    SID  

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好 Sid、

    感谢您的回复。 我对器  件进行了编程并移除了除3V3和 RXD 之外的所有跳线、但当我单击绿色"Play"按钮开始在 EnergyTrace 中捕获数据时、它突然结束、因此不显示任何内容。 EnergyTrace 配置参数如应用手册所示进行设置。

    此致、

    Alberto

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Alberto、

    您是否遵循了 Energytrace 用户指南中提到的步骤来设置 Energytrace?

    https://dev.ti.com/tirex/explore/node?node=AGQDX07KBijdMR-Z7mbDSA__BSEc4rl__LATEST

    此致、

    SID

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好 Sid、

    我 在该主题中看到 CC1310不支持 Energytrace。 没有直流分析仪时、是否有另一种测量电流消耗的方法?

    加载代码后、我将测量将其连接到3V3和 GND 引脚的外部电源的电流、如图所示。 我移除了所有跳线、但电流约为5mA。

    此致、

    Alberto

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Alberto、  

    如果您有另一个 cc13x2 launchpad、则可以对 cc1310 Launchpad 使用能量跟踪。  
    https://e2e.ti.com/support/wireless-connectivity/sub-1-ghz-group/sub-1-ghz/f/sub-1-ghz-forum/1029931/launchxl-cc1310-does-energytrace-support-launchxl-cc1310?tisearch=e2e-sitesearch&keymatch=ENERGYTRACE

    使用本帖子中提到的第一个设置。  这应提供正确的电流测量值。

    此外、在您的设置中、当您从外部电源上电时、请将跳线放在 BTN-2旁边、以达到 ExternPwr 位置。

    此致、

    SID

     

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好 Sid、

    我只有 cc1310 Launchpad。 我放置了 ExternPwr 跳线、现在电流为10mA、仅放置该跳线。 可能是由于软件代码造成的? 如果跳线设置正确、我假设这是 LaunchPad 消耗的实际输入电流。

    此致、

    Alberto

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    10mA 似乎过高。 请您分享您的项目、以便我可以使用 Energytrace 测量电流。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好 Sid、

    这里是项目。

    e2e.ti.com/.../rfPacketTx_5F00_CC1310_5F00_LAUNCHXL_5F00_tirtos_5F00_ccs_5F00_Working.zip

    感谢你的帮助。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Alberto、

    我遵循 与这里的 e2e 线程相同的连接。 和已用能量迹线。  待机功耗似乎在 uA 范围内。 TX 上观察到的峰值为23mA、这也是预期值。

    此致、

    SID

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好 Sid、

    好的、在本例中、我将错误地测量电流。 非常感谢您的支持。

    此致、

    Alberto

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好 Sid、

    您的 LaunchPad 和我的 LaunchPad 之间是否有任何区别? 如果两个连接相同、我不知道为什么要测量更高的功耗。 您加载了我的项目、因此它不应该是软件、可能是一些硬件?

    要加载项目、请放置这些跳线、稍后将其移除。

    此致、

    Alberto

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Alberto、

    这是我的设置。  

    此设置与线程中的第一个回复相同。 它看起来是不同的 launchpad 修订版本、但仍应与测量的电流相同。   

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好 Sid、

    我想我们将购买 CC13x2 Launchpad 来执行相同的测试。 是否有更便宜的选择? 例如、不购买完整的 CC1312 Launchpad、而是仅购买调试器部件、仅使用 Energy Trace。

    此致、

    Alberto

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Alberto、  

    很抱歉耽误你的回答、我不在办公室。 如果您仍在寻找替代选项、则可以获取独立的 XDS110调试器、它似乎支持器件的 Energytrace 测量。  

    https://www.ti.com/lit/ug/sprui94/sprui94.pdf

    https://www.ti.com/tool/TMDSEMU110-U

    此致、

    SID