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.

_SlDrvSyncObjWaitForever hangs while changing socket channel

Other Parts Discussed in Thread: CC3100

Happens seemingly randomly, other times works fine.  I first open the socket

sl_Socket(SL_AF_RF,SL_SOCK_RAW,channel);

Followed by putting it into non-blocking mode

sl_SetSockOpt(socket, SL_SOL_SOCKET, SL_SO_NONBLOCKING,&nonBlockingValue, sizeof(nonBlockingValue));

I then receive data from the socket for ~200ms

sl_Recv(sd,buffer,1472,0);

Then I am cycling through all channels, so I call

sl_SetSockOpt(socket, SL_SOL_SOCKET, SL_SO_CHANGE_CHANNEL, &channel,1);

And the device seems to hang there

  • Hi Jeremy,

    Can you please provide me your code snippet and I'll try to recreate the issue?

    Thanks,
    Alon
  • This all takes place in main, along with some other functionality, other timers and ADC12 interrupts happening.

    //CC3100 power supply turned on here
    {
    S32 retVal = -1;
    initializeAppVariables();
    retVal = configureSimpleLinkToDefaultState();
    if(retVal < 0) {
    return 0;
    }
    retVal = sl_Start(0, 0, 0);
    if ((retVal < 0) || (ROLE_STA != retVal) ) {
    return 0;
    }
    /** make sure the connection policy is not set (so no scan is run in the background) **/
    U8 policyOpt = SL_CONNECTION_POLICY(0, 0, 0, 0, 0);
    retVal = sl_WlanPolicySet(SL_POLICY_CONNECTION , policyOpt, NULL, 0);
    Delay(100);
    socket = sl_Socket(SL_AF_RF,SL_SOCK_RAW,channel);
    Delay(100);
    SlSockNonblocking_t nonBlockingValue;
    nonBlockingValue.NonblockingEnabled = 1;
    sl_SetSockOpt(socket, SL_SOL_SOCKET, SL_SO_NONBLOCKING,&nonBlockingValue, sizeof(nonBlockingValue));
    }
    //Timer running, waits for 200ms, interrupt routine sets WifiTimeOut
    if (WifiTimeOut) {
    channel++;
    if (channel > 11) {
    channel = 1;
    scanCycles++;
    }
    Delay(10);
    sl_SetSockOpt(socket, SL_SOL_SOCKET, SL_SO_CHANGE_CHANNEL, &channel,1);
    Delay(10);
    }


    if (scanCycles < CyclesToScan) { //CyclesToScan = 7
    S16 wifiPacketLength = sl_Recv(socket,buffer,1472,0);
    }
    else {
    sl_Close(socket);
    //Turn off CC3100
    }