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.

CC3135MOD: Simplelink WiFi Driver Crashes in Transceiver Mode using sl_Send() or sl_Recv()

Part Number: CC3135MOD
Other Parts Discussed in Thread: MSP432E401Y, UNIFLASH, CC3135

Hardware: MSP432E401Y (Clock 120MHz) + CC3135MOD on a custome PCB

Software:  CCSv10 + TI-RTOS + Simplelink WiFi

Hi.

I am using the WiFi module in transceiver mode (raw socket). I find that if I call the sl_Send() or sl_Recv() functions repeatedly the microcontroller will either crash on a Hardware Fault or the Simplelink driver will have a Fatal Error event.

The only way to prevent a crash is to call Task_sleep(2) after each sl_Send() or sl_Recv()  function. However, this is not very efficient and slows down the communication process resulting in packets being missed.

Is there any way to remedy this problem so that I do not have to continuously call Task_sleep(2) after each sl_Send() or sl_Recv()  function?

Is there a way to poll the Simplelink driver to see if sl_Send() or sl_Recv() are ready before calling them to prevent a crash?

I have tried to increase the Simplelink SPI bus speed and the DMA size but this has very little effect.

const SIMPLELINKWIFI_HWAttrsV1 wifiSimplelinkHWAttrs =
{
    .spiIndex       = MSP_EXP432E401Y_SPI3,
    .hostIRQPin     = CC3135_IRQ_INTR,
    .nHIBPin        = CC3135_nHIB,
    .csPin          = CC3135_SPI_CS,
    .maxDMASize     = 10240,
    .spiBitRate     = 20000000
};

const uint_least8_t WiFi_count = 1;

const WiFi_Config WiFi_config[1] =
{
    {
        .hwAttrs = &wifiSimplelinkHWAttrs,
    }
};

  • Hi Andrew,

    Can you check the output of the SPI clock pin and verify the actual bit rate is 20 MHz?

    Also be sure you have a servicepack flashed to the CC3135MOD. If you are using the latest SimpleLink SDK Wi-Fi Plugin v4.20, this must be sp_4.7.0.3_3.1.0.5_3.1.0.26 or later.

    Best regards,

    Sarah

  • Hi Sarah.
    Sorry for the delay, my CC3135MOD has stopped communicating and the pins on the PCB are not exposed to allow me to factory reset it or upgrade the service pack. I will have to wait until next week to get our newer PCB that will have these features, and then I will get back with the results.
    Andrew

  • Hi Sarah.

    Sorry for the delay, the new PCBs arrived, but the Simplelink WiFi driver fails to work properly when my cheap logic analyser is connected to the SPI line. I have ordered a better logic analyser but it will take a week to get here.

    Andrew

  • Hi.

    I have ensured that the latest services pack “sp_4.7.0.3_3.1.0.5_3.1.0.26.bin” has been flashed to the CC3135MOD with UniFlash.

    I have measured the SPI clock speed with the logic analyser, and it is definitely running at 20MHz as per the Simplelink settings.

    In the attached file I have written a simple function that opens a raw socket and scans each channel for Access Points. Each time the Simplelink driver crashes after scanning a few different channels.

    I have captured the SPI signals with the logic analyser, and the MISO/MOSI sequence right before it crashes is always the same. Please see the spreadsheet attached below.

    5873.Access Point Scan on all Channels.xlsx

    Can you please advise as to what I could try next?

    /***********************************************************************************************************
                      _____        _____                  _                    _____
               /\    |  __ \      |  __ \                (_)                  / ____|
              /  \   | |__) |     | |__) |__ _  ___  ___  _ __   __ ___      | (___    ___  __ _  _ __
             / /\ \  |  ___/      |  ___// _` |/ __|/ __|| |\ \ / // _ \      \___ \  / __|/ _` || '_ \
            / ____ \ | |          | |   | (_| |\__ \\__ \| | \ V /|  __/      ____) || (__| (_| || | | |
           /_/    \_\|_|          |_|    \__,_||___/|___/|_|  \_/  \___|     |_____/  \___|\__,_||_| |_|
    
    ************************************************************************************************************/
    
    /* Standard includes */
    #include <stdlib.h>
    #include <stdint.h>
    
    /* POSIX Header files */
    #include <pthread.h>
    
    /* RTOS header files */
    #include <ti/sysbios/BIOS.h>
    
    /* TI-RTOS Header files */
    #include <ti/sysbios/knl/Task.h>
    #include <ti/drivers/GPIO.h>
    
    /* TI-DRIVERS Header files */
    #include "ti_drivers_config.h"
    
    /* TI-DRIVERS Header files */
    #include <ti/drivers/net/wifi/simplelink.h>
    #include <ti/drivers/Power.h>
    #include <ti/drivers/net/wifi/netcfg.h>
    
    #include "main.h"
    #include "wifi_ap_tools.h"
    #include "wifi_errors.h"
    #include "wifi_tools.h"
    #include "wifi_device_tools.h"
    
    
    
    extern void wt_StopPassiveScan();
    
    #define     _AP_EVENT_LOG_SIZE      (100)
    
    /****************************************************************************
          _____                  _                    _____
         |  __ \                (_)                  / ____|
         | |__) |__ _  ___  ___  _ __   __ ___      | (___    ___  __ _  _ __
         |  ___// _` |/ __|/ __|| |\ \ / // _ \      \___ \  / __|/ _` || '_ \
         | |   | (_| |\__ \\__ \| | \ V /|  __/      ____) || (__| (_| || | | |
         |_|    \__,_||___/|___/|_|  \_/  \___|     |_____/  \___|\__,_||_| |_|
    
        RETURN:
            0 = Success
           -1 = ERROR - Cannot setup passive AP scan
           -2 = ERROR - WiFi Thread commanded to shutdown
           -3 = ERROR - Fatal WiFi Driver error occurred
    *****************************************************************************/
    int16_t  AP_Passive_Scan  ( uint16_t RunTime, uint16_t ChannelScanTime )
    {
        int16_t         Result;
        uint16_t        i;
        uint16_t        CH_ctr      = 0;
        uint64_t        EndTime;
        char            rxBuff[WT_RX_BEACON_SIZE];
        uint8_t         HaveNotScannedAllChannels_flg;  // 1 = Have not yet scanned all channels.
        uint8_t         noFrameCnt  = 0;
        uint8_t         badFrameCnt = 0;
        uint64_t        startTime   = 0;
        uint8_t         EventLogMAC[_AP_EVENT_LOG_SIZE][6];
        uint16_t        EventLogMAC_ctr = 0;
    
        SlTransceiverRxOverHead_t*  macHeader;
    
        SlWlanRxFilterOperationCommandBuff_t filterBitmap = {  {0}  };
        _u16    len;
    
        SlWlanRxFilterFlags_u       nonManagementFilterFlags;
        SlWlanRxFilterRule_u        nonManagementRule;
        SlWlanRxFilterTrigger_t     nonManagementTrigger;
        SlWlanRxFilterAction_t      nonManagementAction;
        SlWlanRxFilterID_t          nonManagementFrameFilterID;
    
        SlWlanRxFilterFlags_u       ManagementFilterFlags;
        SlWlanRxFilterRule_u        ManagementRule;
        SlWlanRxFilterTrigger_t     ManagementTrigger;
        SlWlanRxFilterAction_t      ManagementAction;
        SlWlanRxFilterID_t          ManagementFrameFilterID;
    
        SlWlanRxFilterFlags_u       BeaconFilterFlags;
        SlWlanRxFilterRule_u        BeaconRule;
        SlWlanRxFilterTrigger_t     BeaconTrigger;
        SlWlanRxFilterAction_t      BeaconAction;
        SlWlanRxFilterID_t          BeaconFilterID;
    
    
    
    
        /************************************************
        *   IS THE WIFI THREAD STILL ACTIVE ?           *
        ************************************************/
        if (WiFi.End_Thread_flg != 0)
            return -2;      //  -2 = ERROR - WiFi Thread commanded to shutdown.
    
    
    
        /************************************************
        *   CHECK WIFI DRIVER IS OK ?                   *
        ************************************************/
        if( WiFi.FatalError_flg )
            return  -3;     // -3 = ERROR - Fatal WiFi Driver error occurred
    
    
    
        /************************************************
        *   START WIFI DRIVER                           *
        ************************************************/
        sl_Stop(50);
        Result = sl_Start(0, 0, 0);
        if (Result < 0)
        {
            #ifdef _DEBUG_MODE
                    Print_DeBug("\r\nERROR: sl_Start  %i\r\n", Result );
                    switch( Result )
                    {
                    case SL_ERROR_ROLE_STA_ERR:             Print_DeBug("ERROR: SL_ERROR_ROLE_STA_ERR\r\n");          break;
                    case SL_ERROR_ROLE_AP_ERR:              Print_DeBug("ERROR: SL_ERROR_ROLE_AP_ERR\r\n");           break;
                    case SL_ERROR_ROLE_P2P_ERR:             Print_DeBug("ERROR: SL_ERROR_ROLE_P2P_ERR\r\n");          break;
                    case SL_ERROR_CALIB_FAIL:               Print_DeBug("ERROR: SL_ERROR_CALIB_FAIL\r\n");            break;
                    case SL_ERROR_FS_CORRUPTED_ERR:         Print_DeBug("ERROR: SL_ERROR_FS_CORRUPTED_ERR\r\n");      break;
                    case SL_ERROR_FS_ALERT_ERR:             Print_DeBug("ERROR: SL_ERROR_FS_ALERT_ERR\r\n");          break;
                    case SL_ERROR_RESTORE_IMAGE_COMPLETE:   Print_DeBug("ERROR: SL_ERROR_RESTORE_IMAGE_COMPLETE\r\n");   break;
                    case SL_ERROR_ROLE_TAG_ERR:             Print_DeBug("ERROR: SL_ERROR_ROLE_TAG_ERR\r\n");          break;
                    case SL_ERROR_FIPS_ERR:                 Print_DeBug("ERROR: SL_ERROR_FIPS_ERR\r\n");              break;
                    case SL_ERROR_GENERAL_ERR:              Print_DeBug("ERROR: SL_ERROR_GENERAL_ERR\r\n");           break;
                    }
            #endif
    
            /************************************************
            *   RESET WIFI MODULE AND TRY AGAIN             *
            ************************************************/
            Print_DeBug("\r\nERROR - Reset WiFi Module.\r\n");
            GPIO_write( CC3135_nRESET,  0 );
            Task_sleep(50);
            GPIO_write( CC3135_nRESET,  1 );
            Task_sleep(100);
            sl_Stop(50);
            Result = sl_Start(0, 0, 0);
            if (Result < 0)
            {
                Print_DeBug("\r\nERROR: sl_Start 2nd time.  %i\r\n", Result );
                return Result;
            }
        }
        Task_sleep(20);
    
    
        WiFi.State = WIFI_AP_SCANNING;
    
    
        /************************************************
        *   SET COUNTRY CODE - All Channels             *
        ************************************************/
        Result = sl_WlanSet(SL_WLAN_CFG_GENERAL_PARAM_ID, SL_WLAN_GENERAL_PARAM_OPT_COUNTRY_CODE, 2, "00");
        if( Result != 0 )
            Print_DeBug("ERROR - Could not set Country Code.\n\r");
        Task_sleep(10);
    
    
    
        /************************************************
        *   CLEAR WLAN POLICIES                         *
        ************************************************/
        Result = sl_WlanPolicySet( SL_WLAN_POLICY_CONNECTION, SL_WLAN_CONNECTION_POLICY(0,0,0,0), NULL, 0);
        if( Result != 0 )
            Print_DeBug("ERROR - Connection Policy Failed.\n\r");
        Task_sleep(5);
        sl_WlanDisconnect();
        Task_sleep(5);
        sl_WlanSetMode(ROLE_STA);
        Task_sleep(5);
    
    
    
        /************************************************
        *  DISABLE & DELETE ALL FILTERS                 *
        ************************************************/
        // Turn Off All Filters
        for(i=0; i<sizeof(filterBitmap.FilterBitmap); i++)
            filterBitmap.FilterBitmap[i] = 0x00;
        len = sizeof(filterBitmap);
        sl_WlanSet(SL_WLAN_RX_FILTERS_ID, SL_WLAN_RX_FILTER_STATE,  len, (uint8_t *)&filterBitmap);
    
        // Remove All Filters
        for(i=0; i<sizeof(filterBitmap.FilterBitmap); i++)
            filterBitmap.FilterBitmap[i] = 0xFF;
        len = sizeof(filterBitmap);
        sl_WlanSet(SL_WLAN_RX_FILTERS_ID, SL_WLAN_RX_FILTER_REMOVE, len, (uint8_t *)&filterBitmap);
    
    
    
    
    //    http://asciiflow.com/
    //    +------------------------+   +------------------------+
    //    |FRAME_TYPE != MANAGEMENT|   |FRAME_TYPE == MANAGEMENT|
    //    |                        |   |                        |
    //    |          DROP          |   |          PASS          |
    //    +------------------------+   +------------+-----------+
    //                                              |
    //                                              v
    //                                 +------------------------+
    //                                 |FRAME_SUBTYPE != BEACON |
    //                                 |                        |
    //                                 |          DROP          |
    //                                 +------------------------+
    
    
        /************************************************
        *   NON-MANAGEMENT FRAME FILTER                 *
        ************************************************/
    //    +------------------------+
    //    |FRAME_TYPE != MANAGEMENT|
    //    |                        |
    //    |          DROP          |
    //    +------------------------+
        nonManagementFilterFlags                         = SL_WLAN_RX_FILTER_BINARY | SL_WLAN_RX_FILTER_ENABLE;
        nonManagementRule.Header.Args.Value.Frametype[0]    = 0;     // Management Frames
        nonManagementRule.Header.Args.Value.FrameSubtype[0] = 0;
        nonManagementRule.Header.Field                   = SL_WLAN_RX_FILTER_HFIELD_FRAME_TYPE;      // Management Frames
        nonManagementRule.Header.CompareFunc             = SL_WLAN_RX_FILTER_CMP_FUNC_NOT_EQUAL_TO;
        nonManagementTrigger.ParentFilterID              = 0;                                        // Parent - none
        nonManagementTrigger.Counter                     = SL_WLAN_RX_FILTER_NO_TRIGGER_COUNTER;     // No counter is used, which is the common scenario
        nonManagementTrigger.Role                        = SL_WLAN_RX_FILTER_ROLE_TRANCIEVER;        // Role is set to Transceiver mode
        nonManagementTrigger.ConnectionState             = SL_WLAN_RX_FILTER_STATE_STA_NOT_CONNECTED;// The connection state is ignored since the filter works in the Transceiver mode
        nonManagementAction.Type                         = SL_WLAN_RX_FILTER_ACTION_DROP;            // request an event as one of the actions to perform
        nonManagementAction.UserId                       = 1;                                        // The output of the event is to set bit number.
    
        Result = sl_WlanRxFilterAdd(
                            SL_WLAN_RX_FILTER_HEADER,
                            nonManagementFilterFlags,
                            &nonManagementRule,
                            &nonManagementTrigger,
                            &nonManagementAction,
                            &nonManagementFrameFilterID);
        if( Result != 0 )
            Print_DeBug("ERROR - NonManagement Filter\n\r");
        Task_sleep(5);
    
    
    
    
    
        /************************************************
        *   MANAGEMENT FRAME FILTER                     *
        ************************************************/
    //    +------------------------+
    //    |FRAME_TYPE == MANAGEMENT|
    //    |                        |
    //    |          PASS          |
    //    +------------+-----------+
        ManagementFilterFlags                         = SL_WLAN_RX_FILTER_BINARY | SL_WLAN_RX_FILTER_ENABLE;
        ManagementRule.Header.Args.Value.Frametype[0]    = 0;     // Management Frames
        ManagementRule.Header.Args.Value.FrameSubtype[0] = 0;
        ManagementRule.Header.Field                   = SL_WLAN_RX_FILTER_HFIELD_FRAME_TYPE;      // Management Frames
        ManagementRule.Header.CompareFunc             = SL_WLAN_RX_FILTER_CMP_FUNC_EQUAL;
        ManagementTrigger.ParentFilterID              = 0;                                        // Parent - none
        ManagementTrigger.Counter                     = SL_WLAN_RX_FILTER_NO_TRIGGER_COUNTER;     // No counter is used, which is the common scenario
        ManagementTrigger.Role                        = SL_WLAN_RX_FILTER_ROLE_TRANCIEVER;        // Role is set to Transceiver mode
        ManagementTrigger.ConnectionState             = SL_WLAN_RX_FILTER_STATE_STA_NOT_CONNECTED;// The connection state is ignored since the filter works in the Transceiver mode
        ManagementAction.Type                         = SL_WLAN_RX_FILTER_ACTION_NULL;            // request an event as one of the actions to perform
        ManagementAction.UserId                       = 2;                                        // The output of the event is to set bit number.
    
        Result = sl_WlanRxFilterAdd(
                            SL_WLAN_RX_FILTER_HEADER,
                            ManagementFilterFlags,
                            &ManagementRule,
                            &ManagementTrigger,
                            &ManagementAction,
                            &ManagementFrameFilterID);
        if( Result != 0 )
            Print_DeBug("ERROR - Management Filter\n\r");
        Task_sleep(5);
    
    
    
    
    
        /************************************************
        *   BEACON FILTER                               *
        ************************************************/
    //  +------------------------+
    //  |FRAME_SUBTYPE != BEACON |
    //  |                        |
    //  |          DROP          |
    //  +------------------------+
        BeaconFilterFlags                         = SL_WLAN_RX_FILTER_BINARY | SL_WLAN_RX_FILTER_ENABLE;
        BeaconRule.Header.Args.Value.Frametype[0]    = 0;
        BeaconRule.Header.Args.Value.FrameSubtype[0] = 0x80;      // Beacon Frame
        BeaconRule.Header.Field                   = SL_WLAN_RX_FILTER_HFIELD_FRAME_SUBTYPE;
        BeaconRule.Header.CompareFunc             = SL_WLAN_RX_FILTER_CMP_FUNC_NOT_EQUAL_TO;
        BeaconTrigger.ParentFilterID              = ManagementFrameFilterID;                  // Parent - Management Frame Filter ID
        BeaconTrigger.Counter                     = SL_WLAN_RX_FILTER_NO_TRIGGER_COUNTER;     // No counter is used, which is the common scenario
        BeaconTrigger.Role                        = SL_WLAN_RX_FILTER_ROLE_TRANCIEVER;        // Role is set to Transceiver mode
        BeaconTrigger.ConnectionState             = SL_WLAN_RX_FILTER_STATE_STA_NOT_CONNECTED;// The connection state is ignored since the filter works in the Transceiver mode
        BeaconAction.Type                         = SL_WLAN_RX_FILTER_ACTION_DROP;            // request an event as one of the actions to perform
        BeaconAction.UserId                       = 3;                                        // The output of the event is to set bit number.
    
        Result = sl_WlanRxFilterAdd(
                            SL_WLAN_RX_FILTER_HEADER,
                            BeaconFilterFlags,
                            &BeaconRule,
                            &BeaconTrigger,
                            &BeaconAction,
                            &BeaconFilterID);
        if( Result != 0 )
            Print_DeBug("ERROR - Beacon Filter\n\r");
        Task_sleep(5);
    
    
    
    
    
        /************************************************
        *   ENABLE FILTERS                              *
        ************************************************/
        for(i=0; i<sizeof(filterBitmap.FilterBitmap); i++)
            filterBitmap.FilterBitmap[i] = 0x00;
        SL_WLAN_SETBIT8(filterBitmap.FilterBitmap, nonManagementFrameFilterID);
        SL_WLAN_SETBIT8(filterBitmap.FilterBitmap, ManagementFrameFilterID);
        SL_WLAN_SETBIT8(filterBitmap.FilterBitmap, BeaconFilterID);
    
        Result = sl_WlanSet(SL_WLAN_RX_FILTERS_ID, SL_WLAN_RX_FILTER_STATE,
                            sizeof(SlWlanRxFilterOperationCommandBuff_t),
                            (uint8_t*)&filterBitmap);
        Task_sleep(5);
        if( Result != 0 )
            Print_DeBug("ERROR - Filter Enabled Failed.\n\r");
    
    
        /**************************
        *  SETUP Rx FILTERS       *
        **************************/
    //    Result = setupPassiveScanFilters();
    //    if (Result != 0)
    //        Print_DeBug("ERROR: Failed to setup filters!\r\n");
    
    
    
        /**************************
        *  OPEN SOCKET            *
        **************************/
        wt_OpenSocket();
    
    
        /**************************
        *  SETUP Tx POWER         *
        **************************/
        wt_Set_Tx_Power();    // Set Tx Power according to the Profile setting.
    
    
    
        /**************************
        *  SET FIRST CHANNEL      *
        **************************/
        CH_ctr = 0;
        Result    = wt_SetSocketChannel( WiFi.ApScanChannelArray[CH_ctr] );
        if (Result != 0)
            Print_DeBug("ERROR: Socket Change Channel Failed.\r\n");
    
    
    
        /**************************
        *  SETUP END TIME         *
        **************************/
        EndTime = WiFi.timer + (uint64_t) RunTime * 1000;
    
    
    
        /**************************
        *  PERFORM AP SCAN        *
        **************************/
        Print_DeBug("\n\r    **** PASSIVE SCAN ****\n\r");
        Task_sleep(5);
        HaveNotScannedAllChannels_flg = 1;  // 1 = Have not yet scanned all channels.
        while ( (HaveNotScannedAllChannels_flg | (WiFi.timer < EndTime)) && (WiFi.End_Thread_flg == 0) )      // This flag causes the timer to only take effect when all channels have been scanned.
        {
            /* Loop through all channels in AP Channel array */
            if (CH_ctr < (WiFi.ApScanChannelArrayLen - 1))
            {
    
                /* Scan on each channel for user set time */
                if ((WiFi.timer - startTime) > ((uint64_t) ChannelScanTime))
                {
                    startTime = WiFi.timer;
                    noFrameCnt  = 0;
                    badFrameCnt = 0;
    
                    CH_ctr++;
                    WiFi.sockChannel = (_u32) WiFi.ApScanChannelArray[CH_ctr];
                    if( WiFi.FatalError_flg == 0 )
                        sl_SetSockOpt( WiFi.sockHandle, SL_SOL_SOCKET, SL_SO_CHANGE_CHANNEL, &WiFi.sockChannel, sizeof(WiFi.sockChannel));
                    Print_FieldTest("\r\nCH: %d", WiFi.sockChannel);
                    Task_sleep(5);
                }
    
                /* Receive Frame */
                if( WiFi.FatalError_flg == 0 )
                    Result = sl_Recv(WiFi.sockHandle, rxBuff, WT_RX_BEACON_SIZE, 0);
                Task_sleep(5);
    
                /* Filter out frames from AP's we already have */
                if ( (Result > 0) && (rxBuff[8] == (char) 0x80) )
                {
    
                    // Have we see this AP before during this AP Scan instants ?
                    for (i = 0; i < EventLogMAC_ctr; i++)
                    {
                        if( (rxBuff[18] == EventLogMAC[i][0]) && (rxBuff[19] == EventLogMAC[i][1]) && (rxBuff[20] == EventLogMAC[i][2]) && (rxBuff[21] == EventLogMAC[i][3]) && (rxBuff[22] == EventLogMAC[i][4]) && (rxBuff[23] == EventLogMAC[i][5]) )
                        {
                            break;
                        }
                    }
                    if( i == EventLogMAC_ctr )
                    {
                        /* Copy the MAC Address of AP */
                        EventLogMAC[i][0] = rxBuff[18];
                        EventLogMAC[i][1] = rxBuff[19];
                        EventLogMAC[i][2] = rxBuff[20];
                        EventLogMAC[i][3] = rxBuff[21];
                        EventLogMAC[i][4] = rxBuff[22];
                        EventLogMAC[i][5] = rxBuff[23];
                        if( EventLogMAC_ctr < _AP_EVENT_LOG_SIZE )
                            EventLogMAC_ctr++;
                        /**********************************************
                        *                                             *
                        *       Create an Event for AP Details        *
                        *                                             *
                        **********************************************/
                        Create_AP_Capture_Event(rxBuff,  Result);
                    }
    
                    // Is this already on the AP Schedule ?
                    for (i = 0; i < WiFi.AP_Schedule_No_of_Items; i++)
                    {
                        if( memcmp(&rxBuff[18], WiFi.AP_Schedule[i].MAC, 6) == 0 )
                        {
                            // Extract the MAC Header
                            macHeader = (SlTransceiverRxOverHead_t*) rxBuff;
                            // Update Schedule with the latest Channel Number
                            WiFi.AP_Schedule[i].Channel = macHeader->Channel;
                            WiFi.AP_Schedule[i].RSSI    = macHeader->Rssi;
                            // Already on AP Schedule
                            Result = 0;
                            // Exit for() loop
                            i = WiFi.AP_Schedule_No_of_Items;
                        }
                    }
    
                }
                /* Ensure frame is beacon frame */
                if ( (Result > 0) && (rxBuff[8] == (char) 0x80) )
                {
                    /* Parse Beacon Frame to AP Details structure */
                    wt_FrameToAPSchedule(rxBuff,  Result);
                }
                /* Filter allowed other packets to be received, handle this error here */
                else if ( (Result > 0) && (rxBuff[8] != (char) 0x80) && (i < _AP_SCHEDULE_ITEMS_MAX_SIZE) )
                {
                    badFrameCnt++;
                }
                /* Frame was ignored */
                else
                {
                    noFrameCnt++;
                }
    
            }
            else
            {
                // Go back to the beginning of the Channel list
                CH_ctr = 0;
                HaveNotScannedAllChannels_flg = 0;  // Change flag to '0'.  <--  1 = Have not yet scanned all channels.
            }
            Task_yield();
        }//  END        while ( (HaveNotScannedAllChannels_flg | (WiFi.timer < EndTime)) && (WiFi.End_Thread_flg == 0) )
    
    
        /************************************************
        *  CLOSE SOCKET                                 *
        ************************************************/
        sl_Close( WiFi.sockHandle );
        Task_sleep(5);
    
    
    
        /************************************************
        *  DISABLE & DELETE ALL FILTERS                 *
        ************************************************/
        // Turn Off All Filters
        for(i=0; i<sizeof(filterBitmap.FilterBitmap); i++)
            filterBitmap.FilterBitmap[i] = 0x00;
        len = sizeof(filterBitmap);
        sl_WlanSet(SL_WLAN_RX_FILTERS_ID, SL_WLAN_RX_FILTER_STATE,  len, (uint8_t *)&filterBitmap);
        Task_sleep(5);
    
        // Remove All Filters
        for(i=0; i<sizeof(filterBitmap.FilterBitmap); i++)
            filterBitmap.FilterBitmap[i] = 0xFF;
        len = sizeof(filterBitmap);
        sl_WlanSet(SL_WLAN_RX_FILTERS_ID, SL_WLAN_RX_FILTER_REMOVE, len, (uint8_t *)&filterBitmap);
        Task_sleep(5);
    
    
    
    
        /************************************************
        *   END WIFI DRIVER                             *
        ************************************************/
        sl_Stop(50);
    
    
    
        /*****************
        *  SUCCESS       *
        *****************/
        Print_FieldTest("\r\n>> Finished Passive AP Scan!\r\n");
        return 0;
    }
    
    
    
    /***********************************************************************************************
     * END
     */
    

  • Hi Andrew,

    Since the CC3135 is a separate processor and cannot cause a hardware fault on the host MCU, you should focus on how the application is passing the socket buffers and the state of the host driver.

    I see you are using TI-RTOS. Can you use the ROV to debug your application? Check the heap and the task size for each thread, including sl_Task.

    Best regards,

    Sarah