Because of the holidays, TI E2E™ design support forum responses will be delayed from Dec. 25 through Jan. 2. Thank you for your patience.

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.

CC3135: blocking in function _SlDrvWaitForPoolObj

Part Number: CC3135

Tool/software:

Hello, I am a new SimpleLink user with a CC3135 module. I have a new Project, it allows you to open a socket between two devices.

with UART communication interface. And no OS

I recently noticed that the server application crashes randomly inside the *_SlDrvWaitForPoolObj* function in the source file SDK/source/ti/drivers/net/wifi/source/driver.c.
In While, when calling the sl_Recv() function. From what I've observed, the highlighted condition is still true and the code stays here. the address of the pending element (0x0).

I can't figure out why it's blocking in this while in this function.

anyone have an idea?

I thank you in advance.

  • Hi,

    what do you mean by the 'address of the pending element"?

    can you share a code snippet of the application?

    Shlomi

  • Hello, thank you for this response.
    In this loop, there is the line

    /* wait for action to be free */
    (void)_SlDrvSyncObjWaitForever(&g_pCB->ObjPool[CurrObjIndex].SyncObj);


    or g_pCB->ObjPool[CurrObjIndex].SyncObj is null.

    The two devices communicate via Modbus TCP.

    the biggest problem is that the error occurs randomly from around 6 to 20 hours

    I inserted the functions used :

    int16_t wireless_simplelink_init(char *ssid, char *pass, uint8_t channel) {
        
        int16_t sl = sl_WifiConfig();
        
        if (sl >= 0)
        {
            if(ssid != NULL) 
            {
                // printf("\r\nsl_Start");
                sl_Start(NULL, NULL, NULL);
                
                // ssid string of 32 characters
                sl = sl_WlanSet(SL_WLAN_CFG_AP_ID, SL_WLAN_AP_OPT_SSID, strlen(ssid), (const uint8_t *)ssid);
                
                // pass string of 64 characters
                if(pass != NULL) sl = sl_WlanSet(SL_WLAN_CFG_AP_ID, SL_WLAN_AP_OPT_PASSWORD, strlen(pass), (const uint8_t *)pass);
                
                _u8 val = SL_WLAN_SEC_TYPE_WPA;
                sl = sl_WlanSet(SL_WLAN_CFG_AP_ID, SL_WLAN_AP_OPT_SECURITY_TYPE, 1, (_u8 *)&val);
                
                val = channel ? channel : 1;
                sl = sl_WlanSet(SL_WLAN_CFG_AP_ID, SL_WLAN_AP_OPT_CHANNEL, 1, (_u8 *)&val);
                
                val = 1; //_u8 Enabled5GStatus = 1;
                sl = sl_WlanSet(SL_WLAN_CFG_GENERAL_PARAM_ID, SL_WLAN_GENERAL_PARAM_OPT_ENABLE_5G, sizeof (_u8), (_u8 *)&val);
                
                _u16 max_ap_sta_aging = 10; // (seconds) Set Max station aging time - default is 60 seconds
                sl_WlanSet(SL_WLAN_CFG_AP_ID, SL_WLAN_AP_OPT_MAX_STA_AGING, sizeof(max_ap_sta_aging), (_u8 *)&max_ap_sta_aging);
                
                /* For changes to take affect, we restart the NWP
                 */
                sl = sl_Stop(200);
                
                sl = sl_Start(NULL, NULL, NULL);
            }
            
            if (sl < 0) {
                sl = -1;
            }
        } else {
            #if defined(_DEBUGINITPRINTF)
            _DEBUGINITPRINTF("\r\nsl_WifiConfig failed: %i", sl);
            #endif
        }
        
        return sl;
    }
    int16_t wireless_simplelink_Open(void) {
        // printf("\r\nsl_Start");
        int16_t sl = sl_Start(NULL, NULL, NULL);
    
        cc3135Module.cc3135_socket = sl_Socket(SL_AF_INET, SL_SOCK_STREAM, 0);
        SlSockNonblocking_t nonBlocking = {.NonBlockingEnabled = 1};
        sl_SetSockOpt(cc3135Module.cc3135_socket, SL_SOL_SOCKET, SL_SO_NONBLOCKING, &nonBlocking,
                sizeof (SlSockNonblocking_t));
    
        /* create socket */
        SlSockAddrIn_t LocalAddr;
        LocalAddr.sin_family = SL_AF_INET;
        LocalAddr.sin_port = sl_Htons(((uint16_t) 2000));
        LocalAddr.sin_addr.s_addr = sl_Htonl(SL_IPV4_VAL(200, 200, 200, 1));
        /* Bind socket to local port */
        // printf("\r\nsl_Bind");
        sl_Bind(cc3135Module.cc3135_socket, (const SlSockAddr_t *) &LocalAddr, sizeof (SlSockAddrIn_t));
    
        /* Listen on the socket. Ready to accept a connection */
        // printf("\r\nsl_Listen");
        sl_Listen(cc3135Module.cc3135_socket, 0);
    
        wirelessModule.token = interruptDispatcher_addCb(wireless_simplelink_accept, &wirelessModule, INT_1S);
        wireless_simplelink_stop_accept();
        
        return sl;
    }
    int16_t wireless_simplelink_send(const uint8_t *buf, uint8_t len) {
        int16_t ret = sl_Send(cc3135Module.cc3135_activeSocket, buf, len, 0);
    
        if (ret < 0) {
            wireless_simplelink_device_disconnected(false);
        }
        
        return ret;
    }
    int16_t wireless_simplelink_recv(uint8_t *buf, uint8_t len) {
    
        int16_t ret = sl_Recv(cc3135Module.cc3135_activeSocket, buf, len, 0);
            
        if (ret == 0) {
            wireless_simplelink_device_disconnected(false);
        }
    }

  • Hi,

    If the SyncObj is NULL, then you would get stuck.

    Sounds like a memory corruption somewhere.

    The SyncObj are all set statically during initialization and should have valid memory address.

    Maybe the best shot here is to try and add a data watchpoint and catch when one of the pool objects get NULL-ed.

    BTW, if you are working in non-blocking mode, send/recv may get EAGAIN error which just means to try again and you abort on any type of error so you may want to change that.

    Regards,

    Shlomi