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.

LP-CC2652R7: How to configure Standby for UARt and SPI

Part Number: LP-CC2652R7
Other Parts Discussed in Thread: CC2652R7, SYSCONFIG

Hello,

I am using Launchpad CC2652R7. I want to verify the current consumption of approx. 1uA  as per mentioned in data sheet for Standby mode.

After downloading TI-RTOS sample application name-  "pinStandby_LP_CC2652R7_tirtos_ccs" I found that it is consuming 0.5mA with the help of energy trace. But after checking using multimeter (by removing jumper at 3V and adding multimeter) it is come around 1uA. 

Now as per my application I want to use UARt and SPI. When I add these two peripheral and sending write operation from both and go to sleep for 5 seconds, the current consumption is much higher when in sleep. I  am referring "SimpleLink SDK Power Management: MSP432, MSP432E4, CC13xx/CC26xx, and CC32xx User’s Guide" and as per that after UARt write I called following api

/* Stop the receive to go into low power state */
UART_control(uart0, UART_CMD_RXDISABLE, NULL);

Post this it get stuck in UARt write operation. 

Need help with this launchpad setup. Please help to provide any sample application or guide on how to achieve 1uA power when in standby mode with SPI and UART? How to configure these peripherals so that system can enter in standby mode once tx/Rx operation is done.

Best Regards,

Sanket

  • Hello Sanket,

    The UART and SSI peripheral will consume 131 and 61 µA, respectively, when enabled so that the MCU can wake upon valid incoming data.  You can disable these peripherals at any time by calling UART_close/SPI_close if you wish to not use the RX operation.  I would recommend trying this instead of the UART_control instructions provided in the TI Drivers Power Management User's Guide.  You can also check the return status code of UART_control to observe whether there are any issues.  Be aware that the UART driver will be removed in the 2Q22 release and that the UART2 driver has a direct UART2_rxDisable API.  You can learn more from the TI Drivers Runtime APIs.

    Regards,
    Ryan

  • Hello Ryan,

    Thanks for the reply. I used UART_open() & SPI_oepn() before transmitting and after that calling UART_close() and SPI_close() and go to sleep for 5seconds. 

    Still I can see current consumption around 45uA. For your reference I am attaching my test files where  Ijust bring in UARt and SPI driver into pinStandby_LP example.

    pinStandby.c
    /*
     * Copyright (c) 2016-2019, 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.
     */
    
    /*
     *  ======== pinStandby.c ========
     */
    #include <unistd.h>
    
    /* Driver Header files */
    //#include <ti/drivers/PIN.h>
    
    /* TI-Drivers Configuration */
    #include "ti_drivers_config.h"
    #include <ti/sysbios/knl/Semaphore.h>
    #include <ti/sysbios/BIOS.h>
    #include <ti/drivers/SPI.h>
    /* Driver Header files */
    #include <ti/drivers/UART.h>
    
    
    #define SPI_MSG_LENGTH  (32)
    #define MASTER_MSG      ("Hello from master, msg num is: ")
    
    #define MAX_LOOP        (10)
    
    //static Display_Handle display;
    
    unsigned char masterRxBuffer[SPI_MSG_LENGTH];
    unsigned char masterTxBuffer[SPI_MSG_LENGTH];
    
    
    const char tiUartDisplay_0[]   = "/fUart Initialized Successfull\r\n";
    const char tiUartDisplay_1[]   = "/fUart1 Transmitting 32 - bytes.\n";
    
    /* Led pin table */
    PIN_Config LedPinTable[] =
    {
        CONFIG_PIN_LED_0 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */
        CONFIG_PIN_LED_1 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */
        PIN_TERMINATE                                                                      /* Terminate list */
    };
    
    
    
    /*
     *  ======== mainThread ========
     */
    void *mainThread(void *arg0)
    {
        PIN_State   pinState;
        PIN_Handle  hPin;
        uint32_t    currentOutputVal;
        uint32_t    standbyDuration = 5;
        Semaphore_Params semParams;
        Semaphore_Struct semStruct;
        Semaphore_Handle semHandle;
        SPI_Handle      masterSpi;
        SPI_Params      spiParams;
        SPI_Transaction transaction;
        uint32_t        cntr = 0;
        bool            transferOK;
        uint32_t status = 0;
    
        /*
         * SPI master is inherit from "spimaster" example for TIRTOS.
         * Some modification has been done as per requirements
         */
    
        SPI_init();
    
        /* Open SPI as master (default) */
        SPI_Params_init(&spiParams);
        spiParams.frameFormat = SPI_POL0_PHA0;  //SPI_POL0_PHA1  sanket
        spiParams.bitRate = 8000000;
        /*masterSpi = SPI_open(CONFIG_SPI_MASTER, &spiParams);
        if (masterSpi == NULL) {
            //Error initializing master SPI
            while (1);
        }
        else {
            //Master SPI initialized
        }*/
    
        /* Copy message to transmit buffer */
        strncpy((char *) masterTxBuffer, MASTER_MSG, SPI_MSG_LENGTH);
    
    
    
        /* Allocate LED pins */
        hPin = PIN_open(&pinState, LedPinTable);
    
        PIN_close(hPin);
        /* Construct a Semaphore object to be use as a resource lock, inital count 1 */
        /*Semaphore_Params_init(&semParams);
        Semaphore_construct(&semStruct, 1, &semParams);*/
    
        /* Obtain instance handle */
        /*semHandle = Semaphore_handle(&semStruct);*/
    
        UART_Params commUartParams;
        UART_Handle commuart_handle;
    
        UART_init();
    
        /*
         *  Initialize the UART parameters outside the loop. Let's keep
         *  most of the defaults (e.g. baudrate = 115200) and only change the
         *  following.
         */
        UART_Params_init(&commUartParams);
        commUartParams.writeDataMode  = UART_DATA_BINARY;
        commUartParams.readDataMode   = UART_DATA_BINARY;
        commUartParams.readReturnMode = UART_RETURN_FULL;
    
        /* Create a UART for the console */
        commuart_handle = UART_open(CONFIG_UART_1, &commUartParams);
        if (commuart_handle == NULL)
        {
            //there is an error while UART_open
            while (1);
        }
    
       status = UART_write(commuart_handle, tiUartDisplay_0, sizeof(tiUartDisplay_0));
        if (UART_STATUS_ERROR != status)
        {
            UART_close(commuart_handle);
        }
        /*
         * Repeatedly sleeps for a duration, to allow repeated entry/exit
         * from standby. The LED states are toggled on each iteration
         */
        while(1) {
    
            /* Create a UART for the console */
            commuart_handle = UART_open(CONFIG_UART_1, &commUartParams);
            if (commuart_handle == NULL)
            {
                //there is an error while UART_open
                while (1);
            }
            status = UART_write(commuart_handle, tiUartDisplay_1, sizeof(tiUartDisplay_0));
            if (UART_STATUS_ERROR != status)
            {
                UART_close(commuart_handle);
            }
    
            /* Get access to resource */
            //Semaphore_pend(semHandle, BIOS_WAIT_FOREVER);
    
            /* Read current output value for all pins */
            //currentOutputVal =  PIN_getPortOutputValue(hPin);
    
            /* Toggle the LEDs, configuring all LEDs at once */
            //PIN_setPortOutputValue(hPin, ~currentOutputVal);
    
            masterSpi = SPI_open(CONFIG_SPI_MASTER, &spiParams);
            if (masterSpi == NULL) {
                //Error initializing master SPI
                while (1);
            }
    
            masterTxBuffer[sizeof(MASTER_MSG) - 1] = (cntr % 10) + '0';
            memset((void *) masterRxBuffer, 0, SPI_MSG_LENGTH);
            transaction.count = SPI_MSG_LENGTH;
            transaction.txBuf = (void *) masterTxBuffer;
            transaction.rxBuf = (void *) masterRxBuffer;
    
            /* Perform SPI transfer */
            transferOK = SPI_transfer(masterSpi, &transaction);
            if (transferOK) {
                //Transfer OK
    
                SPI_close(masterSpi);
            }
            else {
                //Transfer Unsuccessfull
            }
    
    
            sleep(standbyDuration);
    
    
        }
    }
    

    I am not able to upload SYSCfg file. I have only enabled UART and SPI in it. Please have a look and let me know how can I minimize the current consumption.

  • When not in use, the UART RX pin is typically configured as a pulled-down input (refer to the SysConfig module).  This is to avoid damage if the partner device transmits data at any time.  One drawback is that this setup will result in a GPIO pulldown current, which has been characterized as 19 µA at 1.8 V and 110 µA at 3.6 V.  This is known as input leakage current.

    Regards,
    Ryan

  • So this means

    1. when I use UART , SPI, the power consumption would be 110uA at 3.6V and is there any way to further optimize to 1uA in standby mode?

    Regards,

    Sanket

  • SPI initialization in SysConfig does not appear to be an issue, so you could try removing the UART RX pull when not in use.  Otherwise it is not recommended to initialize pins intended to receive signals in Output mode, and any input pin configuration will result in some form of current leakage such that 1 uA standby cannot likely be achieved.

    Regards,
    Ryan