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.

CC2640R2F: How make simple_peripheral enter Shutdown mode

Part Number: CC2640R2F
Other Parts Discussed in Thread: CC1350

Hi All,

the project of Simple_Peripheral enters Standby mode by default. How to change it to enter Shutdown mode in place of Standby?

Thanks!

Victor Chu

  • You can refer to pinshutdown example and porting to your own Simple_Peripheral application.

  • Hi YiKai,

    I thought that it was just to change the PowerCC26xx_ENTERING_STANDBY to PowerCC26xx_ENTERING_SHUTDOWN is ok.  It seems that there will be a lot of job to do. Let me read about itl.

    I have a question about the POWER_SAVING macro definition.

    Why the POWER_SAVING work with CC1350_LAUNCHXL only in Simple_Peripheral demo? I can't find other codes relate with CC26xx in the case of POWER_SAVING. Does it mean Simple_Peripheral entering STANDBY mode has none business with POWER_SAVING definition? 

    Thank you!

    Best regards,

    Victor Chu

  • 1. I don't think there will be a lot of job to do. You only need to add a few lines of code according to pinshutdown example.

    2. Basically, simple_peripheral example define POWER_SAVING and it's handled in TI RTOS and Stack layer.

  • Hi YiKai,

    I read the pinShutdown demo of entering Shutdown mode. Except the configuration of IOs, the only codes to active Shutdown mode is Power_shutdown(0,0) as following?

    Frankly, I really don't know where to modify the codes of Simple_Peripheral. It would be of very nice of you if you could teach me how to do the changes in the codes.

    Thank you !

    Best regards,

    Victor Chu

  • Where to put the code depends on when your application wants to enter shut down mode. Usually, it’s triggered by button press so you can put it inside a button triggered event.

  • Hi YiKai,

    I don't need a button to rigger it into shutdown mode. I want my application enter Shutdown mode automatically just like the way of Standby (PowerSaving macro definition) mode works. Actually, I don't know and don't care how Standby mode works. For  example of Simple_Peripheral, could you give me some codes to show how let the Shutdown mode replaces the Standby mode?

    Thank you!

    Best regards,

    Victor Chu

  • After device enters shutdown mode, it can only be wake up by GPI or power cycle. Do you aware of this?

  • Hi YiKai,

    Yes. I have a button to wake it up from shutdown mode. 

    Thank you for kindly help!

    Best regards,

    Victor Chu

  • Basically, I don’t think you can put device into shutdown mode like standby mode since standby mode can wake up on timer event. For shutdown mode, there must be a specific trigger scenario.

  • Hi YiKai,

    What are these specific trigger scenario? Except a button, can a Timer trigger it? Or, can Power_shutdown(0,0) push it entering Shutdown mode, if I add this instructions anywhere I want?

    Thank you!

    Best regards,

    Victor Chu

  • Yes, you can use a timer event to trigger shut mode.

  • Hi YiKai,

    I tested and measured the current of pinShutdown demo on the LAUNCHXL EVM board. The current changed between 6.45uA and 0.09uA alternatively when I push wake button and make it into shutdown mode periodically. If this time is 0.09uA in shutdown mode, and then the next time in shutdown mode must be 6.45uA. And vice versa.

    Why the current in shutdown switches between 6.45uA and 0.09uA?

    Why the shutdown current is 6.45uA? This current like a standby current.

    Thank you!

    Best regards,

    Victor Chu

  • Hi Victor,

    See, post below.

    -kel

  • Hi Markel,

    Thank you for your kindly help.

    1) Where are the code for shutdown External SPI flash in the pinShudtown demo?

    2) The pinShutdown absolutely entered Shtudown mode, because I measured 90nA on LAUNCHXL board. My question is why the current is 90nA and 6uA alternatively? 6uA is obviously not an active current, since it is too low to make a LED on. 6uA seems like the current in Standby mode. Why the pinShutdown demo sometime enter Shutdown and sometime enter Standby.

    Best regards,

    Victor Chu

  • Hi Victor,

    It's in Board.h just call this at init Board_shutDownExtFlash(). Your setup needs to be powered externally and JTAG jumpers remove like this below. The 6uA your seeing when the board is not in shutdown mode, maybe because the UART is being used. So remove all code that uses UART.

    -kel

  • Hi Victor,

    Reviewing the pin_shutdown example program the Board_shutDownExtFlash(), is already called within Board_init(). Another thing you can do is comment out the UART pin init here like this and set the drive strength of LEDs to MIN. Also drive strength of LEDs at pinShutdown.c.

    CC2640R2_LAUNCHXL.c

    const PIN_Config BoardGpioInitTable[] = {
    
        CC2640R2_LAUNCHXL_PIN_RLED | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MIN,       /* LED initially off */
        CC2640R2_LAUNCHXL_PIN_GLED | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MIN,       /* LED initially off */
        CC2640R2_LAUNCHXL_PIN_BTN1 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS,          /* Button is active low */
        CC2640R2_LAUNCHXL_PIN_BTN2 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS,          /* Button is active low */
        CC2640R2_LAUNCHXL_SPI_FLASH_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MIN,  /* External flash chip select */
        //CC2640R2_LAUNCHXL_UART_RX | PIN_INPUT_EN | PIN_PULLDOWN,                                              /* UART RX via debugger back channel */
        //CC2640R2_LAUNCHXL_UART_TX | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL,                         /* UART TX via debugger back channel */
        CC2640R2_LAUNCHXL_SPI0_MOSI | PIN_INPUT_EN | PIN_PULLDOWN,                                            /* SPI master out - slave in */
        CC2640R2_LAUNCHXL_SPI0_MISO | PIN_INPUT_EN | PIN_PULLDOWN,                                            /* SPI master in - slave out */
        CC2640R2_LAUNCHXL_SPI0_CLK | PIN_INPUT_EN | PIN_PULLDOWN,                                             /* SPI clock */
    
        PIN_TERMINATE
    };

  • Try to refer to discussions in to close all GPIO and peripherals such as UART.

  • Sharing, Improving Simple Peripheral Current Consumption, video.

    -kel

  • Hi YiKai,

    I tried to Enter Shutdown mode in my project. It does decrease the current, however, it can't reach to 0.1uA. When in Standby mode, my current is from 2uA ~ 6uA changed periodically. When I added following code, the current is changed to 1.5uA ~ 4uA. And I can't wake it from Shutdown mode.

    I don't have UART and any other peripheral. The watchdog is enabled. My project is based on SDK Version 3.4.0.10.

    -------------------------------------------------------------------------------

    ====== main.c ===========

    /* Configure shutdown semaphore. */
    Semaphore_Params_init(&semParams);
    semParams.mode = Semaphore_Mode_BINARY;
    Semaphore_construct(&shutdownSem, 0, &semParams);

    /* enable interrupts and start SYS/BIOS */
    BIOS_start();

    ====== board_key.c ===========

    PIN_setConfig(hKeyPins, PINCC26XX_BM_WAKEUP, WAKESW_IO | PIN_IRQ_NEGEDGE);   // IO of Waking from Shutdown config

    // ------ Shutdwon Key process --------

    /* Pend on semaphore before going to shutdown */
    Semaphore_pend(Semaphore_handle(&shutdownSem), BIOS_WAIT_FOREVER);
    /* Go to shutdown */
    Power_shutdown(0, 0);
    while(1);

    -------------------------------------------------------------------------------

    Could you tell me where is the problem?

    Thank you!

    Best regards,

    Victor Chu

  • Hi,

    Here is the code to set the pins for wake up from shutdown. If you watched the video above the UART is completely disabled. The UART pins are not initialized at BoardGpioInitTable[].

    /* Wake-up Button pin table */
    PIN_Config ButtonTableWakeUp[] = {
        Board_PIN_BUTTON0 | PIN_INPUT_EN | PIN_PULLUP | PINCC26XX_WAKEUP_NEGEDGE,
        PIN_TERMINATE                                 /* Terminate list */
    };

        /* Configure DIO for wake up from shutdown */
        PINCC26XX_setWakeup(ButtonTableWakeUp);
    
        /* Go to shutdown */
        Power_shutdown(0, 0);
    
        /* Should never get here, since shutdown will reset. */
        while (1);

  • Hi Markel,

    It works, and the current is arond 0.12uA. That's not because of the UART issue. Since I even did not enable it from the beginning. I just put a 2-seconds delay before these instructions that you gave me, then it enter Shutdown properly.

    Thanks a lot!

    I still have some questions about the Shutdown mode.

    1) UART

    If I want use UART in my code, and enabled the macro definition of UART, how to disable it before entering Shutdown?

    2) I2C peripheral

    I have a I2C peripheral. I did not do anything before entering Shutdown. From the current, I found it works well. The current just the I2C peripheral standby current plus 0.1uA. Why I don't need to turn off the I2C? 

    3) Shutdown and Reset

    Is the procedure of waking from Shutdown just the a reset? Can I get it is a Wake from Shutdown reset in the code? Can I know which Key wake it up from Shutdown when I have more than one Wake input sources?

    Thank you!

    Best regards,

    Victor Chu

  • Victor Chu said:
    If I want use UART in my code, and enabled the macro definition of UART, how to disable it before entering Shutdown?

    You can call UART_close() before going to shutdown mode.

    Victor Chu said:
    I have a I2C peripheral. I did not do anything before entering Shutdown. From the current, I found it works well. The current just the I2C peripheral standby current plus 0.1uA. Why I don't need to turn off the I2C? 

    Maybe your I2C device is set in low power mode. 0.1 uA  0.02 uA current consumption contributed by your I2C device in shutdown is very low. To completely remove this you need to cut off power to your I2C device. I have achieved this before by adding a MOSFET switch circuitry which will turn on and off the power to I2C device.

    Victor Chu said:
    Is the procedure of waking from Shutdown just the a reset? Can I get it is a Wake from Shutdown reset in the code? Can I know which Key wake it up from Shutdown when I have more than one Wake input sources?

    When you enter Shutdown mode RAM is erased so your program is not running anymore. So when it wakes from Shutdown mode its like a reset. From what I know you can set several keys to wake the device from Shutdown mode.

    -kel

     . . . post edited

  • Hi Markel,

    1) UART_close(); - OK

    2) I2C peripheral issue - OK

    3) OK for the 3 answers.

    When the device waked from Shutdown mode, can the program know it is waken from Shutdown? Like the function of SysCtrlResetSourceGet()? 

    Can it know itself was waked by which key input ?

    Thank you!

    Best regards,

    Victor Chu

  • Victor Chu said:
    When the device waked from Shutdown mode, can the program know it is waken from Shutdown? Like the function of SysCtrlResetSourceGet()? 

    Yes.

    Victor Chu said:
    Can it know itself was waked by which key input ?

    No.

    -kel

  • Hi Markel,

    how to know it waked from Shutdown mode or from a power reset?

    Thank you!

    Best regards,

    Victor Chu

  • After power cycle, you can use SysCtrlResetSourceGet to get reset source to know it.

  • Hi YiKai,

    could you tell what's the meaning of return results from SysCtrlResetSourceGet()? I know something about it, but I did find  any detailed information about it.

    Thank you!

    Best regards,

    Victor Chu

  • You can refer to

  • Hi YiKai & Markel,

    It works now. Many thanks for both of you!

    Best regards,

    Victor Chu