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.

CC3220MOD: Current consumption at WLAN transmission

Part Number: CC3220MOD
Other Parts Discussed in Thread: CC3220SF

Hello,

The sample program sends 24KB TCP traffic every 0.16s using sl_Send API.

This figure is the current graph captured by ITEMER-BOOST.


(1) shows transmission the TCP traffic.
(2) After transmission completed, the module continues RX about 50ms.
(3) Then TX about 0.5ms.
(4) Finally, RX about 15ms.

(2)...(4) cause increase current consumption.

I have some questions.
What are (2)...(4)?
Why the NWP does not go back idle state immediately after (1)?

Target: CC3220MODSF custom board
SDK: simplelink_cc32xx_sdk_2_10_00_04

Best regards,
Nobuhiro

  • Hi Nobuhiro,

    Can you please send me the code for the sample program you are using?


    Thanks,
    Alexis
  • Hello Alexis,

    Thanks for your quick response.

    The spike also appears by network_terminal_CC3220SF_LAUNCHXL_tirtos_ccs demo app.
    This picture shows the current graph when act "send -c IP address -u -n 100" in the app.


    SDK: simplelink_cc32xx_sdk_2_10_00_04

    Best regards,
    Nobuhiro

  • Hello Alexis,

    I attached the sample program below.

    Sample program usage:

    1) Import serial_wifi_CC3220SF_LAUNCHXL_tirtos_ccs from SDK 2.10.

    2) Replace serial_wifi.c in the project with attached file.

    3) Build, load, and run.

    In addition, this sample program assumes...

    - Any receiver whose IP address is 192.168.0.108, listening to TCP 5001 port.

    - AP (Security: Open) defined at line 22.

    Best regards,

    Nobuhiro

    #include <stddef.h>
    #include <ti/drivers/GPIO.h>
    #include <ti/drivers/Timer.h>
    #include <ti/drivers/SPI.h>
    #include <ti/drivers/net/wifi/slnetifwifi.h>
    #include <ti/sysbios/BIOS.h>
    #include <ti/sysbios/knl/Task.h>
    #include <ti/sysbios/knl/Semaphore.h>
    #include <ti/devices/cc32xx/inc/hw_types.h>
    #include <ti/devices/cc32xx/inc/hw_memmap.h>
    #include <ti/devices/cc32xx/inc/hw_ints.h>
    #include <ti/devices/cc32xx/inc/hw_timer.h>
    #include <ti/devices/cc32xx/driverlib/timer.h>
    #include <ti/devices/cc32xx/driverlib/prcm.h>
    #include <ti/devices/cc32xx/driverlib/rom_map.h>
    #include <ti/devices/cc32xx/driverlib/interrupt.h>
    #include "pthread.h"
    #include "Board.h"
    
    
    #define INTR_PERIOD_COUNTS_VALUE  16000 // 200us
    #define AP_SSID "XXXXXXXXXXX"   // Access Point (Open security)
    #define PAYLOAD_SIZE 24576          // 24KB
    #define SEND_PERIOD_INT 800         // WLAN sending occurs every 800 interrupts (160ms).
    
    Timer_Params timerParams;
    Timer_Handle timerHandle = 0;
    
    pthread_t gSpawnThread = (pthread_t)NULL;
    pthread_attr_t pAttrs_spawn;
    struct sched_param  priParam;
    
    Task_Params taskParams;
    Task_Struct taskStruct;
    Char taskStack[4096];
    
    Semaphore_Params semParams;
    Semaphore_Struct semStruct;
    Semaphore_Handle semHandle;
    
    int32_t sock;
    SlNetCfgIpV4Args_t ipV4;
    SlSockAddrIn_t sAddr;
    SlWlanSecParams_t secParams;
    
    unsigned long send_count = 0;
    unsigned char payload[PAYLOAD_SIZE] = {};
    unsigned long interruptCount = 0;
    
    // Callback Functions from SimpleLink Wifi Driver - must be defined
    void SimpleLinkWlanEventHandler(SlWlanEvent_t *pWlanEvent) {}
    void SimpleLinkNetAppEventHandler(SlNetAppEvent_t *pNetAppEvent) {}
    void SimpleLinkHttpServerEventHandler(SlNetAppHttpServerEvent_t *pHttpEvent, SlNetAppHttpServerResponse_t *pHttpResponse) {}
    void SimpleLinkGeneralEventHandler(SlDeviceEvent_t *pDevEvent) {}
    void SimpleLinkSockEventHandler(SlSockEvent_t *pSock) {}
    void SimpleLinkFatalErrorEventHandler(SlDeviceFatal_t *slFatalErrorEvent){}
    void SimpleLinkNetAppRequestEventHandler(SlNetAppRequest_t *pNetAppRequest, SlNetAppResponse_t *pNetAppResponse) {}
    void SimpleLinkNetAppRequestMemFreeEventHandler(uint8_t *buffer) {}
    
    
    // WLAN send
    void sendTask(UArg arg0, UArg arg1)
    {
        int i;
        unsigned char dummy_data;
    
        for (;;) {
            Semaphore_pend(semHandle, BIOS_WAIT_FOREVER);
            send_count++;
            dummy_data = send_count % 64;
            for (i = 0; i < PAYLOAD_SIZE / 2; i++) {
                payload[i * 2] = dummy_data;
            }
            payload[0] = 99;    // marker
            sl_Send(sock, payload, sizeof(payload), 0);
        }
    }
    
    
    void timerCallback(void)
    {
        MAP_TimerIntClear(TIMERA2_BASE, 0x2FFF);
    
        interruptCount++;
        if (interruptCount > 10000) { // ignore init spike
            if (interruptCount % SEND_PERIOD_INT == 0) {
                Semaphore_post(semHandle);
            }
        }
    }
    
    
    void *mainThread(void *arg0)
    {
        SPI_init();
    
        Semaphore_Params_init(&semParams);
        semParams.mode = Semaphore_Mode_BINARY;
        Semaphore_construct(&semStruct, 0, &semParams);
        semHandle = Semaphore_handle(&semStruct);
    
        // Create sl_Task
        pthread_attr_init(&pAttrs_spawn);
        priParam.sched_priority = 9;
        pthread_attr_setschedparam(&pAttrs_spawn, &priParam);
        pthread_attr_setstacksize(&pAttrs_spawn, 4096);
        pthread_create(&gSpawnThread, &pAttrs_spawn, sl_Task, NULL);
    
        // Create send task
        Task_Params_init(&taskParams);
        taskParams.stackSize = 4096;
        taskParams.stack = &taskStack;
        taskParams.priority = 10;
        Task_construct(&taskStruct, (Task_FuncPtr)sendTask, &taskParams, NULL);
    
        // Establish connection to AP
        sl_Stop(10000);
        sl_Start(0, 0, 0);
        ipV4.Ip =        (_u32)SL_IPV4_VAL(192, 168, 0, 6); // my(sender) ip
        ipV4.IpMask =    (_u32)SL_IPV4_VAL(255, 255, 255, 0);
        ipV4.IpGateway = (_u32)SL_IPV4_VAL(192, 168, 0, 1); // dummy
        ipV4.IpDnsServer=(_u32)SL_IPV4_VAL(192, 168, 0, 1); // dummy
        sl_NetCfgSet(SL_NETCFG_IPV4_STA_ADDR_MODE, SL_NETCFG_ADDR_STATIC, sizeof(SlNetCfgIpV4Args_t), (uint8_t *)&ipV4);
        secParams.Key = "";
        secParams.KeyLen = 0;
        secParams.Type = SL_WLAN_SEC_TYPE_OPEN;
        sl_WlanConnect(AP_SSID, strlen(AP_SSID),0,&secParams,0);
    
        Task_sleep(5000);   // wait 5s
    
        // Create socket
        sAddr.sin_family = SL_AF_INET;
        sAddr.sin_port = sl_Htons(5001);
        sAddr.sin_addr.s_addr = sl_Htonl(SL_IPV4_VAL(192, 168, 0, 108));    // receiver's ip
        sock = sl_Socket(SL_AF_INET, SL_SOCK_STREAM, 0);
        sl_Connect(sock, (const SlSockAddr_t *)&sAddr, sizeof(SlSockAddrIn_t));
    
        // Create timer
    
        /* Initialize hardware timer */
        MAP_PRCMPeripheralClkEnable(PRCM_TIMERA2, PRCM_RUN_MODE_CLK);
        MAP_IntDisable(INT_TIMERA2A);
        MAP_IntDisable(INT_TIMERA2B);
        MAP_TimerIntDisable(TIMERA2_BASE, TIMER_CAPB_EVENT | TIMER_CAPB_MATCH | TIMER_TIMB_TIMEOUT | TIMER_CAPA_EVENT | TIMER_CAPA_MATCH | TIMER_TIMA_TIMEOUT);
        MAP_TimerDisable(TIMERA2_BASE, TIMER_BOTH);
        MAP_TimerIntClear(TIMERA2_BASE, TIMER_CAPB_EVENT | TIMER_CAPB_MATCH | TIMER_TIMB_TIMEOUT | TIMER_CAPA_EVENT | TIMER_CAPA_MATCH | TIMER_TIMA_TIMEOUT);
    
        /* set timer interrupt to 0, highest app priority */
        MAP_IntPrioritySet(INT_TIMERA2A, 0<<5);
        MAP_IntPrioritySet(INT_TIMERA2B, 0<<5);
    
        /* Configure timer as periodic count-down with period of INTR_PERIOD_COUNTS_VALUE ticks */
        MAP_TimerConfigure(TIMERA2_BASE, TIMER_CFG_PERIODIC);
        MAP_TimerLoadSet(TIMERA2_BASE, TIMER_A, INTR_PERIOD_COUNTS_VALUE);
        MAP_TimerIntRegister(TIMERA2_BASE, TIMER_A, timerCallback);
    
        /* Start the timer */
        MAP_IntEnable(INT_TIMERA2A);
        MAP_TimerIntEnable(TIMERA2_BASE, TIMER_TIMA_TIMEOUT);
        MAP_TimerEnable(TIMERA2_BASE, TIMER_A);
    
        return (NULL);
    }
    

  • Hello Alexis,

    Could you reproduce this issue in your environment?

    I attempted this sample program run on SDK 2.20.
    At first, transmission worked well, then a few seconds later, it suddenly stopped.
    When PAYLOAD_SIZE is set smaller value, it works well.

    Is specification changed from SDK 2.10 to 2.20?

    Best regards,
    Nobuhiro

    P.S. Insertion of "sl_WlanSetMode(ROLE_STA)" might need after line 118 in my sample program.

  • Hi Nobuhiro,

    Yes I will try to reproduce the issue here on my end and see if I can determine what that spike is.


    Thanks,
    Alexis
  • Hi,

    In order to reproduce this issue the most simple way is using "send -c address -u -n 100" command on network_terminal app, I think.
    Even though the transmission has finished, the current continues for 50-60ms.
    Is this normal behavior?
    In your site, does current consumption fall down to base level immediately?
    In our app, TX happens every 160ms, this trail current consumes many energy.
    This issue occurs even with SDK 2.20.

    Regards,
    Nobuhiro

  • Hello Alexis,

    I got the current data and Wi-Fi packet capture data at the same time.

    Action: send -c 192.168.0.108 -u -n 100 (network_terminal app)

    Below is packet capture result when TX started.

    Below is packet capture result when TX finished.


    Frame no. Time offset Description
    32             2.9530844  1st UDP packet
    187           3.0301390  Last(100th) UDP packet

    Tail spike in the IMETER screenshot does not appear in the packet capture file.

    Condition

    LAUNCH-CC3220MODASF, CCS 8.1.0, SDK 2.20, network_terminal_CC3220SF_tirtos_ccs

    Regards,
    Nobuhiro

  • Hello Nobuhiro,

    My apologies for the delayed response. I have recreated the behavior here on my end and after reviewing your packet captures and running a few tests, I believe I I understand what is happening.

    It appears that this behavior occurs in power policies that allow the NWP to go sleep. The spike seems to appear right before the device transitions to a lower power mode. I will speak with our R&D guys and see if they can give me more definitive information.

    Thanks,
    Alexis
  • Nobuhiro,

    As it turns out, the CC3220 sends a null data packet to notify the AP that it is going into 802.11 power save. That is what the spike is.

    Thanks for your patience,
    Alexis
  • Hello Alexis,

    It is more important that high current continues for a long time (50-60ms) after transmission completed for energy consumption aspect, rather than spike.

    Regards,

    Nobuhiro

  • Hi Nobuhiro,

    The default power policy enters a lower power mode after considering current activities and predicting future activities. I believe that 50-60ms before it sends the null packet and goes into a low power mode is the NWP to trying to predict future activities.


    Thanks,
    Alexis
  • Hello Alexis,

    Thanks for your reply.

    Is it a specification of this module?
    The current consumption for the prediction is critical issue for our app.
    Are there any alternatives for this issue?

    Regards,
    Nobuhiro