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.

CC3200: CC3200 sl_Recv() error code -11 followed by -100

Part Number: CC3200
soc = sl_Socket(SL_AF_RF, SL_SOCK_RAW, channel);
    SlTimeval_t timeVal;
    timeVal.tv_sec = 0;
    timeVal.tv_usec = TU;
    SlSockNonblocking_t enableOption;
    enableOption.NonblockingEnabled = 1;
    sl_SetSockOpt(soc,SL_SOL_SOCKET,SL_SO_NONBLOCKING, (_u8 *)&enableOption,sizeof(enableOption)); // Enable/disable nonblocking mode
    sl_SetSockOpt(soc, SL_SOL_SOCKET, SL_SO_RCVTIMEO,  (_u8 *)&timeVal, sizeof(timeVal));
    if(soc < 0){
        ERR_PRINT(soc);
        LOOP_FOREVER();
    }
    // receive
    while(1){
        byteNum = sl_Recv(soc, buff, 1469, 0);
        if(byteNum >= 0){
            int i;
            if(byteNum > 18 && (buff[18] == 0xd6 || buff[23] == 0xb7)){
                for(i = 8; i < byteNum; i++){
                    UART_PRINT("%02X", buff[i]);
                }
                UART_PRINT("\n\r");
            }
        }
        else{
            ERR_PRINT(byteNum);
        }
        UART_PRINT("Pass\n\r");
    }

I'm using CC3200SDK_1.5.0 version. CC3200 is configured into transceiver mode.

The above is my code based on FreeRTOS framework. My questions are

  1. the error code return should be -11 from sl_Recv() no matter how many times I call it, as it runs.The actual situation is several -11 first, then  followed by infinite amount of -100, and -100 is not a socket error.How to solve it ?
  2. Does the receive timeout work properly if the raw socket is configured to blocking mode and SL_SO_RCVTIMEO is set to a specific amount of time ? (Will it still return until timeout is reached ? Because I want to minimize the times of calling sl_Recv(), only timeout or a successful receive can return, an empty receive should be avoided)

  • Hi,

    Socket option SL_SO_RCVTIMEO is not related to non-blocking sockets. This option is valid for a blocking sockets only. Error code -11 (=SL_EAGAIN) in normal for a non-blocking sockets. This error code means that there are no incoming data and you need to call API again.

    I think you call sl_Recv() too much often. Please ad small delay into your while loop. This should solve your -100 error.

    Jan