NOTICE: The Processors Wiki will End-of-Life on January 15, 2021. It is recommended to download any files or other content you may need that are hosted on processors.wiki.ti.com. The site is now set to read only.

CC3200 Idle Profile Application

From Texas Instruments Wiki
Jump to: navigation, search
Cc31xx cc32xx return home.png
Cc32xx return sample apps.png

Overview[edit]

Idle profile enables the user to measure current values, power consumption and other such parameters for CC3200, when the device is essentially idle(both NWP and APPS subsystems in low power deep sleep condition). The other main objective behind this application is to introduce the user to the easily configurable power management framework.

Application details[edit]

Power Management Framework[edit]

CC3200 device have multiple power modes, which can be exercised by the user as per the requirement of their application. Power management framework makes it easier to specify the power policy for APPS MCU. All user has to configure is the lowest power mode the device should go into. The framework tries to hide the intricacies of the underlying settings and helps the user to experience the low power mode capabilities of the device in a simple manner. If one wishes to have the custom settings for different power modes or use the framework for a different device, it can be accomplished with changing a couple of files. For more information regarding Power Management Framework, please refer to CC32xx Power Management Framework

Current Measurement[edit]

This application specify the Low Power Deep Sleep(LPDS) as the lowest power mode. At times, both NWP and APPS subsystem will be in LPDS. In which case, the current values can be as low as on the order of hundreds of micro amps. The procedure for measuring current can be found at CC3200 Low Power Modes Current Measurement page.

Program Flow[edit]

Most the parameters user will need to modify are specified as MACROs

  • SSID_NAME - Name of the Access Point used for this application.
  • GPIO_SRC_WKUP - Gpio number used as wake up source.
  • APP_UDP_PORT - Port number on which the device will wait for udp packets.
  • LPDS_DUR_SEC - Time (in seconds) after which the device will come out of LPDS.
  • LPDS_DUR_NSEC - Time (in addition to HIB_DUR_SEC) in nanoseconds after which the device will come out of LPDS.
#define SSID_NAME              "cc3200demo"
#define GPIO_13                 13
#define GPIO_SRC_WKUP		GPIO_13
#define APP_UDP_PORT            5001
#define LPDS_DUR_SEC		60
#define LPDS_DUR_NSEC		0

NoteNote: Security parameters for the AP can be configure inside WlanConnect function in "main.c".
NoteNote: Whatever Gpio is used as wake up source has to added in gpio_list array in "user_app_config.h" and pinmux for the same Gpio has to be added in "pinmux.c".

To start with, the board must be initialized and the power management framework have to be loaded.

    //
    // Board Initialization
    //
    BoardInit();

    //
    // Configure the pinmux settings for the peripherals exercised
    //
    PinMuxConfig();

    //
    // Initialize the platform
    //
    platform_init();

    //
    // Configuring UART
    //
    g_tUartHndl = uart_open(PRCM_UARTA0);

Which will be followed by creation of two tasks.

  1. One for creating and handling UDP Server
  2. Other for setting timer and GPIO as wake source from low power modes
    //
    // Task creation for providing host_irq as a wake up source(LPDS)
    //
    osi_TaskCreate(UDPServerTask,
                (const signed char *)"UDP Server waiting to recv packets",
                OSI_STACK_SIZE, NULL, tskIDLE_PRIORITY+1, NULL );
    //
    // setting up timer and gpio as source for wake up from lPDS
    //
    osi_TaskCreate(TimerGPIOTask, (const signed char*)
                   "Configuring Timer and GPIO as wake src",
                   OSI_STACK_SIZE, NULL, 1, NULL );

Task 1: UDPServerTask[edit]

  1. Blocked on a message from the Other Task(waiting for simplelink start and connection to AP).
  2. Creates a UDP server and wait for UDP packet in a while loop. As soon as the NWP subsystem receives any UDP packet, it will bring the APPS subsystem out of LPDS, if not already.
    //
    // waiting for the other task to start simplelink and connection to the AP
    //
    osi_MsgQRead(&g_tConnectionFlag, &ucSyncMsg, OSI_WAIT_FOREVER);
    .
    .
    //
    // creating a UDP socket
    //
    iSockDesc = sl_Socket(SL_AF_INET,SL_SOCK_DGRAM, 0);
    .
    .
    //
    // waiting on a UDP packet
    //
    iRetVal = sl_RecvFrom(iSockDesc, g_cBuffer, BUFF_SIZE, 0,
                          ( SlSockAddr_t *)&sClientAddr
                          (SlSocklen_t*)&iAddrSize );
    if(iRetVal > 0)
    {
        //
        // signal the other task about receiving the UDP packet
        //
        osi_MsgQWrite(&g_tWkupSignalQueue, &ucQueueMsg, OSI_WAIT_FOREVER);
    }

Task 2: TimerGPIOTask[edit]

  1. Starts simplelink, switch to station mode(if not already), set NWP power policy and connects to the AP.
  2. Upon successful connection unblocks the other task.
  3. Set timer and GPIO as wake sources from low power modes.
  4. Set Power policy for the APPS MCU.
    //
    // starting the simplelink
    //
    iMode = sl_Start(NULL, NULL, NULL);

    //
    // Swtich to STA mode if device is not
    //
    SwitchToStaMode(iMode);

    //
    // Set the power management policy of NWP
    //
    sl_WlanPolicySet(SL_POLICY_PM, SL_NORMAL_POLICY, NULL, 0);
    .
    .
    //
    // connecting to the Access Point
    //
    if(-1 == WlanConnect())
    {
    	sl_Stop(SL_STOP_TIMEOUT);
    	UART_PRINT("Connection to AP failed\n\r");
    }
    else
    {
    	UART_PRINT("Connected to AP\n\r");
    	//
        //signal the other task about the sl start and connection to the AP
        //
	osi_MsgQWrite(&g_tConnectionFlag, &ucSyncMsg, OSI_WAIT_FOREVER);
    }
    .
    .
    //
    // setting Timer as one of the wakeup source
    //
    tTimerHndl = SetTimerAsWkUp();

    //
    // setting some GPIO as one of the wakeup source
    //
    tGPIOHndl = SetGPIOAsWkUp();
    .
    .
    //
    // setting Apps power policy
    //
    lp3p0_setup_power_policy(POWER_POLICY_STANDBY);

Porting to TI-RTOS[edit]

For porting this application on TI-RTOS, please refer to Steps to build a new application on CC3200 with TI-RTOS: and Notes section on CC32xx_TI-RTOS page. cc_idle_task_pm() is the function needed to be hooked to the idle task.

Source Files briefly explained[edit]

  • main.c - The main file implementing the idle profile.
  • lp3p0_board.c - Board specific initialization for Power Management framework .
  • lp3p0_plat_ops.c - Board specific APIs like IO parking and framework loading.

Supporting Files

  • pinmux.c - Generated by the PinMUX utility.

Common Files

  • startup_ccs.c - CCS related functions
  • startup_ewarm.c - IAR related functions
  • wdt_if.c - Interface file for Watchdog Timer

Prerequisites[edit]

This application facilitates the user to get the current numbers for LPDS mode. The prerequisites for running this application are the following:

  • Ensure that the device is in Station mode
  • Delete all previously stored AP profiles.

NoteNote: One can simply run UDP Socket application before executing this application, that will take care of the above mentioned points.

Usage[edit]

  • Modify MACROs according to the requirement and recompile.
  • Setup a serial communication application (HyperTerminal/TeraTerm). For detail info visit CC31xx & CC32xx Terminal Setting

    On the host PC. The settings are:
    - Port: Enumerated COM port
    - Baud rate: 115200
    - Data: 8 bit
    - Parity: None
    - Stop: 1 bit
    - Flow control: None

  • Run the application preferably from FLASH rather than from the debugger as debugger would disconnect in LPDS.
  • Different prints on serial communication will tell the cause of wake up from the LPDS.
  • Red LED (GPIO 09) will turn off whenever the device enters LPDS.
Teraterm Snapshot

Limitations/Known Issues[edit]

Refer to CC32xx_Power_Management_Framework for limitations and known issues.

Links[edit]

{{#invoke: Navbox | navbox }} {{#invoke: Navbox | navbox }}

E2e.jpg {{
  1. switchcategory:MultiCore=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article CC3200 Idle Profile Application here.

Keystone=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article CC3200 Idle Profile Application here.

C2000=For technical support on the C2000 please post your questions on The C2000 Forum. Please post only comments about the article CC3200 Idle Profile Application here. DaVinci=For technical support on DaVincoplease post your questions on The DaVinci Forum. Please post only comments about the article CC3200 Idle Profile Application here. MSP430=For technical support on MSP430 please post your questions on The MSP430 Forum. Please post only comments about the article CC3200 Idle Profile Application here. OMAP35x=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article CC3200 Idle Profile Application here. OMAPL1=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article CC3200 Idle Profile Application here. MAVRK=For technical support on MAVRK please post your questions on The MAVRK Toolbox Forum. Please post only comments about the article CC3200 Idle Profile Application here. For technical support please post your questions at http://e2e.ti.com. Please post only comments about the article CC3200 Idle Profile Application here.

}}

Hyperlink blue.png Links

Amplifiers & Linear
Audio
Broadband RF/IF & Digital Radio
Clocks & Timers
Data Converters

DLP & MEMS
High-Reliability
Interface
Logic
Power Management

Processors

Switches & Multiplexers
Temperature Sensors & Control ICs
Wireless Connectivity