wiced_wifi_scan_networks returns success but does not find AP when AP is connected

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
MaMe_1509466
Level 4
Level 4
25 replies posted 10 replies posted 5 replies posted

Scanning code that uses the wiced_wifi_scan_networks api works fine if run before creating an AP association.

But if an AP is brought up, the wiced_wifi_scan_networks function returns WICED_SUCCESS when called, but the scan

does not find any AP's even though there are many AP's present.

The call to wiced_wifi_scan_networks is from a main thread and not from a callback.

0 Likes
28 Replies
MichaelF_56
Moderator
Moderator
Moderator
250 sign-ins 25 comments on blog 10 comments on blog

Adding andrew997​ as I understand he is working with you to resolve as well.

miltmiller

0 Likes
VikramR_26
Employee
Employee
25 sign-ins 10 sign-ins 10 comments on KBA

wiced_result_t wiced_wifi_scan_networks( wiced_scan_result_handler_t results_handler, void* user_data )

The WICED_SUCCESS you are looking for is the response for caliing the wiced_wifi_scan_networks(), the scan result can found in results_handler.

are you referring to the snip--> scan example ? You should see list of AP's around you being printed in the console log. Which version of SDK and what platform are you using ?

hth

vik86

0 Likes

Thanks for the response vik86

The SDK is 3.3.1

The results handler is not called when connected to an AP. If

the AP is not connected, the results handler is called multiple

times.

0 Likes
MaMe_1509466
Level 4
Level 4
25 replies posted 10 replies posted 5 replies posted

The platform is an EMW3162 which is a 43362 module.

0 Likes
Anonymous
Not applicable

This is partly by design

The 43362 is a single Radio design.

Once you have connected to a specific AP, then the radio is locked on to that channel and needs to service the AP for beacons to maintain a connection

Due to this we cannot switch back to scan mode across all channels without losing a connection

0 Likes

Shouldn't the API have returned an error instead of success if a connection

was up and it could not perform the Scan?

Also, now that we know this fact, we wiced_wifi_down() to kill any connections,

do a wiced_wifi_up() and then do the Scan, but it does not work reliably. What

else needs to be performed procedurally to take the network down, take the

wifi down, put wifi up, scan successfully, and then bring the network back up?

0 Likes

Here is the code snippet we are using to take down the MQTT

and AP connections so we can do the Scan

.

.

.

     wiced_network_down(WICED_STA_INTERFACE);

    /* Wait for MQTT to report that it is disconnected */

    while ( mqtt_is_connected() ) {

        // mqtt still connected... wait.

        wiced_rtos_delay_milliseconds(1000);

    }

   

wiced_result = wiced_wifi_down();

    // wifi down

    wiced_result = wiced_wifi_up();

    // Scanning WiFi networks...

    result = wiced_wifi_scan_networks(ble_wifi_scan_result2_handler, &ble_wifi_connection);

    wiced_rtos_get_semaphore(&(ble_wifi_connection.semaphore), 10000);            // 10 second timeout.

Anonymous
Not applicable

If this functionality is absolutely needed - then currently you would have to wrap the scan with a wiced_wlan_connectivity_deinit and a wiced_wlan_connectivity_init

wiced_wifi_down and wiced_wifi_up currently are not completely reliable for guaranteeing that the radio is free from any associations. This is being worked on.

0 Likes

nsankar

Tried wrapping the scan in wiced_wlan_connectivity_deinit and

wiced_wlan_connectivity_init as suggested.

Results are that Scan is still not returning results and WIfi

can not get re-estabished after the attempt.

Traces of a good scan executed before Wifi is connected

and a bad scan attempted after Wifi is connected are attached.

0 Likes
Anonymous
Not applicable

Can you share the actual source snippet of the code you are using to do this?

0 Likes

wiced_network_down(WICED_STA_INTERFACE);

    /* Wait for MQTT to report that it is disconnected */

    while ( mqtt_is_connected() ) {

    SPRINKL_LOG_INFO("mqtt still connected... wait.\r\n");

    wiced_rtos_delay_milliseconds(1000);

    }

    wiced_result = wiced_wlan_connectivity_deinit();

    SPRINKL_LOG_INFO("wifi deinit%d\n", wiced_result);

    SPRINKL_LOG_INFO("wiced_network_is_ip_up %d\n", wiced_network_is_ip_up(WICED_STA_INTERFACE));

    SPRINKL_LOG_INFO("wiced_network_is_up %d\n", wiced_network_is_up(WICED_STA_INTERFACE));

    wiced_result = wiced_wlan_connectivity_init();

    SPRINKL_LOG_INFO("wifi init %d\n", wiced_result);

    SPRINKL_LOG_INFO("Scanning WiFi networks...");

    result = wiced_wifi_scan_networks(ble_wifi_scan_result2_handler, &ble_wifi_connection);

    SPRINKL_LOG_INFO("[BLE_ WIFI]: scan result: %lu\n", result);

    SPRINKL_LOG_INFO("[BLE WIFI] Waiting on semaphore\r\n");

    wiced_rtos_get_semaphore(&(ble_wifi_connection.semaphore), 10000);            // 10 second timeout.

0 Likes
Anonymous
Not applicable

So I have gone back to SDK 3.3.1 and re-verified my comment and I have to undo my previous statement. It appears that our firmware for the BCM43362 supports scanning while connected in the general case

This is also true of our other devices including the BCM4343W and the BCM43340

However there is a limitation placed by the single radio and that is that some of the PHY parameters for the AP you are actively associated with and servicing might not be accurately reported in the scan report. For example RSSI.

In addition due to the need to time manage the radio - some of the scan results might not be accurate - i.e. missing BSSIDs, but over the long term, or if you scan less often this should not be an issue.

Here is the snippet of code to verify this

void application_start( )

{

    wiced_ip_address_t ip_address;

    wiced_init( );

    wiced_network_up( WICED_STA_INTERFACE, WICED_USE_EXTERNAL_DHCP_SERVER, NULL );

    wiced_hostname_lookup("www.google.com", &ip_address, 10000);

    WPRINT_APP_INFO( ( "Server is at %u.%u.%u.%u\n",  (uint8_t)(GET_IPV4_ADDRESS(ip_address) >> 24),

                                                      (uint8_t)(GET_IPV4_ADDRESS(ip_address) >> 16),

                                                      (uint8_t)(GET_IPV4_ADDRESS(ip_address) >> 8),

                                                      (uint8_t)(GET_IPV4_ADDRESS(ip_address) >> 0) ) );

    while(1)

    {

        record_count = 0;

        /* Send an ICMP ping to the address */

        send_ping( &ip_address );

       /* Start scanning while associated */

        WPRINT_APP_INFO( ( "Waiting for scan results...\n" ) );

        WPRINT_APP_INFO( ("  # Type  BSSID            RSSI  Rate Chan  Security        SSID\n" ) );

        WPRINT_APP_INFO( ("----------------------------------------------------------------------------------------------\n" ) );

        wiced_time_get_time(&scan_start_time);

        wiced_wifi_scan_networks(scan_result_handler, NULL );

        wiced_rtos_delay_milliseconds(DELAY_BETWEEN_SCANS);

    }

}

/*

* Callback function to handle scan results

*/

wiced_result_t scan_result_handler( wiced_scan_handler_result_t* malloced_scan_result )

{

    if ( malloced_scan_result != NULL )

    {

        malloc_transfer_to_curr_thread( malloced_scan_result );

        if ( malloced_scan_result->status == WICED_SCAN_INCOMPLETE )

        {

            wiced_scan_result_t* record = &malloced_scan_result->ap_details;

            WPRINT_APP_INFO( ( "%3d ", record_count ) );

            print_scan_result(record);

            ++record_count;

        }

        else

        {

            wiced_time_t scan_end_time;

            wiced_time_get_time(&scan_end_time);

            WPRINT_APP_INFO( ("\nScan complete in %lu milliseconds\n", (unsigned long )(scan_end_time - scan_start_time) ) );

        }

        free( malloced_scan_result );

        malloced_scan_result = NULL;

    }

    return WICED_SUCCESS;

}

static wiced_result_t send_ping( wiced_ip_address_t *ping_target_ip )

{

    const uint32_t    ping_timeout = 1000;

    uint32_t          elapsed_ms;

    wiced_result_t    status;

    status = wiced_ping( WICED_STA_INTERFACE, ping_target_ip, ping_timeout, &elapsed_ms );

    if ( status == WICED_SUCCESS )

    {

        WPRINT_APP_INFO(( "Ping Reply %lums\n", elapsed_ms ));

    }

    else if ( status == WICED_TIMEOUT )

    {

        WPRINT_APP_INFO(( "Ping timeout\n" ));

    }

    else

    {

        WPRINT_APP_INFO(( "Ping error\n" ));

    }

    return WICED_SUCCESS;

}

Anonymous
Not applicable

Hi markmendelsohn , please refer below information for your issue;

" WIFI Scan time"  may be different at each Air environment , So it needs to be confirmed that "scaning complete" and "mutual exclusive blocking"

1.  Confirm "scaning complete"

2. How about using mutex to access global variable like "scan_start_time" , "global_scan_is_in_progress", etc

uint8_t global_scan_is_in_progress=0;

wiced_mutex_t mutex_a;

ex_result = wiced_rtos_init_mutex( &mutex_a);

    while(1)

    {

        record_count = 0;

        /* Send an ICMP ping to the address */

        send_ping( &ip_address );

       /* Start scanning while associated */

        WPRINT_APP_INFO( ( "Waiting for scan results...\n" ) );

        WPRINT_APP_INFO( ("  # Type  BSSID            RSSI  Rate Chan  Security        SSID\n" ) );

        WPRINT_APP_INFO( ("----------------------------------------------------------------------------------------------\n" ) );

        wiced_time_get_time(&scan_start_time);

#if 0

        wiced_wifi_scan_networks(scan_result_handler, NULL );     

        wiced_rtos_delay_milliseconds(DELAY_BETWEEN_SCANS);

#else

//*********************************************************************

//added code ----------------------------------

        global_scan_is_in_progress=1;

        wiced_wifi_scan_networks(scan_result_handler, NULL );     

        while(1)

       {

          wiced_rtos_delay_milliseconds(1000);         

          result = wiced_rtos_lock_mutex( & mutex_a);

          if( global_scan_is_in_progress==0)

          {

             wiced_rtos_unlock_mutex( &mutex_a);

             break;

         }

         wiced_rtos_unlock_mutex( &mutex_a);

       }

//*********************************************************************

#endif

    }

wiced_result_t scan_result_handler( wiced_scan_handler_result_t* malloced_scan_result )

{

result = wiced_rtos_lock_mutex( & mutex_a);     //added code ----------------------------------

    if ( malloced_scan_result != NULL )

    {

        malloc_transfer_to_curr_thread( malloced_scan_result );

        if ( malloced_scan_result->status == WICED_SCAN_INCOMPLETE )

        {

            wiced_scan_result_t* record = &malloced_scan_result->ap_details;

            WPRINT_APP_INFO( ( "%3d ", record_count ) );

            print_scan_result(record);

            ++record_count;

        }

        else

        {

            wiced_time_t scan_end_time;            wiced_time_get_time(&scan_end_time);

            WPRINT_APP_INFO( ("\nScan complete in %lu milliseconds\n", (unsigned long )(scan_end_time - scan_start_time) ) );

            global_scan_is_in_progress=0;               // added code ----------------------------------

        }

        free( malloced_scan_result );

        malloced_scan_result = NULL;

    }

    else 

    {

          WPRINT_APP_INFO( ( "scan_reault_handler:  has NULL\n\r") );  // added code ----------------------------------

    }

     wiced_rtos_unlock_mutex( &mutex_a);  // added code ----------------------------------

    return WICED_SUCCESS;

}

0 Likes

Hi,

Here is scanning the networks while listening and sending data on a TCP connection using Wiced-SDK-3.3.1.

This example is an updated snip.tcp_client application "snip.tcp_client-BCM943362WCD4 download run"

Update your dct file or the default dct file ".../include/default_wifi_config_dct.h" to connect your device to your network.

#define CLIENT_AP_SSID      "BroadcomSA_24"

#define CLIENT_AP_PASSPHRASE "123456789SA"

Update the "TCP_SERVER_IP_ADDRESS" with your host device TCP server IP address.

/* Change the server IP address to match the TCP echo server address */

#define TCP_SERVER_IP_ADDRESS MAKE_IPV4_ADDRESS(192,168,0,102)

Run the ".../apps/snip/tcp_client/tcp_echo_server.py" on the host to start TCP server.

Updated .../apps/snip/tcp_client/tcp_client.c is below. The patch file is also attached.

/*

* Copyright 2015, Broadcom Corporation

* All Rights Reserved.

*

* This is UNPUBLISHED PROPRIETARY SOURCE CODE of Broadcom Corporation;

* the contents of this file may not be disclosed to third parties, copied

* or duplicated in any form, in whole or in part, without the prior

* written permission of Broadcom Corporation.

*/

/** @file

*

* TCP Client Application

*

* This application snippet demonstrates how to connect to a Wi-Fi

* network and communicate with a TCP server

*

* Features demonstrated

*  - Wi-Fi client mode

*  - DHCP client

*  - TCP transmit and receive

*

* Application Instructions

*   1. Modify the CLIENT_AP_SSID/CLIENT_AP_PASSPHRASE Wi-Fi credentials

*      in the wifi_config_dct.h header file to match your Wi-Fi access point

*   2. Ensure your computer is connected to the same Wi-Fi access point.

*   3. Determine the computer's IP address for the Wi-Fi interface.

*   4. Change the #define TCP_SERVER_IP_ADDRESS in the code below to match

*      the computer's IP address

*   5. Connect a PC terminal to the serial port of the WICED Eval board,

*      then build and download the application as described in the WICED

*      Quick Start Guide

*   6. Ensure Python 2.7.x (*NOT* 3.x) is installed on your computer

*   7. Open a command shell

*   8. Run the python TCP echo server as follows from the tcp_client directory

*     c:\<WICED-SDK>\Apps\snip\tcp_client> c:\path\to\Python27\python.exe tcp_echo_server.py

*       - Ensure your firewall allows TCP for Python on port 50007

*

* Every TCP_CLIENT_INTERVAL seconds, the app establishes a connection

* with the remote TCP server, sends a message "Hello from WICED" and

* receives an echo of the message in response. The response is printed

* on the serial console.

*

* The network to be used can be changed by the #define WICED_NETWORK_INTERFACE in wifi_config_dct.h

* In the case of using AP or STA mode, change the AP_SSID and AP_PASSPHRASE accordingly.

*

*/

#include "wiced.h"

/******************************************************

*                      Macros

******************************************************/

#define TCP_PACKET_MAX_DATA_LENGTH        30

#define TCP_CLIENT_INTERVAL               2

#define TCP_SERVER_PORT                   50007

#define TCP_CLIENT_CONNECT_TIMEOUT        500

#define TCP_CLIENT_RECEIVE_TIMEOUT        300

#define TCP_CONNECTION_NUMBER_OF_RETRIES  3

/* Change the server IP address to match the TCP echo server address */

#define TCP_SERVER_IP_ADDRESS MAKE_IPV4_ADDRESS(192,168,0,102)

/******************************************************

*                    Constants

******************************************************/

/******************************************************

*                   Enumerations

******************************************************/

/******************************************************

*                 Type Definitions

******************************************************/

/******************************************************

*                    Structures

******************************************************/

/******************************************************

*               Static Function Declarations

******************************************************/

static wiced_result_t tcp_client();

/******************************************************

*               Variable Definitions

******************************************************/

static int record_count;

static wiced_time_t scan_start_time;

static const wiced_ip_setting_t device_init_ip_settings =

{

    INITIALISER_IPV4_ADDRESS( .ip_address, MAKE_IPV4_ADDRESS(192,168,  0,  1) ),

    INITIALISER_IPV4_ADDRESS( .netmask,    MAKE_IPV4_ADDRESS(255,255,255,  0) ),

    INITIALISER_IPV4_ADDRESS( .gateway,    MAKE_IPV4_ADDRESS(192,168,  0,  1) ),

};

static wiced_tcp_socket_t  tcp_client_socket;

static wiced_timed_event_t tcp_client_event;

/******************************************************

*               Function Definitions

******************************************************/

/*

* Callback function to handle scan results

*/

wiced_result_t scan_result_handler( wiced_scan_handler_result_t* malloced_scan_result )

{

    if ( malloced_scan_result != NULL )

    {

        malloc_transfer_to_curr_thread( malloced_scan_result );

        if ( malloced_scan_result->status == WICED_SCAN_INCOMPLETE )

        {

            wiced_scan_result_t* record = &malloced_scan_result->ap_details;

            WPRINT_APP_INFO( ( "%3d ", record_count ) );

            print_scan_result(record);

            ++record_count;

        }

        else

        {

            wiced_time_t scan_end_time;

            wiced_time_get_time(&scan_end_time);

            WPRINT_APP_INFO( ("\nScan complete in %lu milliseconds\n", scan_end_time - scan_start_time) );

        }

        free( malloced_scan_result );

    }

    return WICED_SUCCESS;

}

void scan( void )

{

    /* Start scanning while associated */

     WPRINT_APP_INFO( ( "Waiting for scan results...\n" ) );

     WPRINT_APP_INFO( ("  # Type  BSSID            RSSI  Rate Chan  Security        SSID\n" ) );

     WPRINT_APP_INFO( ("----------------------------------------------------------------------------------------------\n" ) );

     wiced_time_get_time(&scan_start_time);

     wiced_wifi_scan_networks(scan_result_handler, NULL );

}

void application_start(void)

{

    wiced_interface_t interface;

    wiced_result_t result;

    /* Initialise the device and WICED framework */

    wiced_init( );

    /* Bring up the network interface */

    result = wiced_network_up_default( &interface, &device_init_ip_settings );

    if ( result != WICED_SUCCESS )

    {

        WPRINT_APP_INFO( ("Bringing up network interface failed !\n") );

    }

    /* Create a TCP socket */

    if ( wiced_tcp_create_socket( &tcp_client_socket, interface ) != WICED_SUCCESS )

    {

        WPRINT_APP_INFO( ("TCP socket creation failed\n") );

    }

    /* Bind to the socket */

    wiced_tcp_bind( &tcp_client_socket, TCP_SERVER_PORT );

    /* Register a function to send TCP packets */

    wiced_rtos_register_timed_event( &tcp_client_event, WICED_NETWORKING_WORKER_THREAD, &tcp_client, TCP_CLIENT_INTERVAL * SECONDS, 0 );

    WPRINT_APP_INFO(("Connecting to the remote TCP server every %d seconds ...\n", TCP_CLIENT_INTERVAL));

}

wiced_result_t tcp_client( void* arg )

{

    wiced_result_t           result;

    wiced_packet_t*          packet;

    wiced_packet_t*          rx_packet;

    char*                    tx_data;

    char*                    rx_data;

    uint16_t                 rx_data_length;

    uint16_t                 available_data_length;

    const wiced_ip_address_t INITIALISER_IPV4_ADDRESS( server_ip_address, TCP_SERVER_IP_ADDRESS );

    int                      connection_retries;

    UNUSED_PARAMETER( arg );

    /* Connect to the remote TCP server, try several times */

    connection_retries = 0;

    do

    {

        result = wiced_tcp_connect( &tcp_client_socket, &server_ip_address, TCP_SERVER_PORT, TCP_CLIENT_CONNECT_TIMEOUT );

        connection_retries++;

    }

    while( ( result != WICED_SUCCESS ) && ( connection_retries < TCP_CONNECTION_NUMBER_OF_RETRIES ) );

    if( result != WICED_SUCCESS)

    {

        WPRINT_APP_INFO(("Unable to connect to the server! Halt.\n"));

    }

    /* Create the TCP packet. Memory for the tx_data is automatically allocated */

    if (wiced_packet_create_tcp(&tcp_client_socket, TCP_PACKET_MAX_DATA_LENGTH, &packet, (uint8_t**)&tx_data, &available_data_length) != WICED_SUCCESS)

    {

        WPRINT_APP_INFO(("TCP packet creation failed\n"));

        return WICED_ERROR;

    }

    /* Write the message into tx_data"  */

    sprintf(tx_data, "%s", "Hello from WICED\n");

    /* Set the end of the data portion */

    wiced_packet_set_data_end(packet, (uint8_t*)tx_data + strlen(tx_data));

    /* Send the TCP packet */

    if (wiced_tcp_send_packet(&tcp_client_socket, packet) != WICED_SUCCESS)

    {

        WPRINT_APP_INFO(("TCP packet send failed\n"));

        /* Delete packet, since the send failed */

        wiced_packet_delete(packet);

        /* Close the connection */

        wiced_tcp_disconnect(&tcp_client_socket);

        return WICED_ERROR;

    }

    /* Receive a response from the server and print it out to the serial console */

    result = wiced_tcp_receive(&tcp_client_socket, &rx_packet, TCP_CLIENT_RECEIVE_TIMEOUT);

    if( result != WICED_SUCCESS )

    {

        WPRINT_APP_INFO(("TCP packet reception failed\n"));

        /* Delete packet, since the receive failed */

        wiced_packet_delete(rx_packet);

        /* Close the connection */

        wiced_tcp_disconnect(&tcp_client_socket);

        return WICED_ERROR;

    }

    /* Get the contents of the received packet */

    wiced_packet_get_data(rx_packet, 0, (uint8_t**)&rx_data, &rx_data_length, &available_data_length);

    /* Null terminate the received string */

    rx_data[rx_data_length] = '\x0';

    WPRINT_APP_INFO(("%s", rx_data));

    // Scan networks

    scan();

    /* Delete the packet and terminate the connection */

    wiced_packet_delete(rx_packet);

    wiced_tcp_disconnect(&tcp_client_socket);

    return WICED_SUCCESS;

}

pastedImage_8.png

Thanks,
Seyhan

0 Likes

seyhan

This still isn't working for me.

Like your code, the Scan is called, then the

TCP connection is terminated. We wait 10 seconds

for the scan_reply_handler to be called but get nothing.

Also tried waiting for the TCP connection to go down

before waiting the 10 seconds, still the scan reply handler is not called.

Waiting for the TCP connection to go down

[BLE]: Got WiFi-SCAN WRITE... Attempting scan

[BLE]: Scanning WiFi networks...[BLE]: [BLE_ WIFI]: scan result: 0

[BLE]: mqtt still connected... wait.

[MQTT]: Lost WiFi connection; disconnected MQTT socket.

[MQTT]: Waiting for WiFi connect...

[BLE]: [BLE WIFI] Waiting on semaphore

[BLE]: done

[BLE]: Waiting for data.

[MQTT]: WiFi connected. Connecting to MQTT.

Not Waiting for the TCP connection to go down

[BLE]: Got WiFi-SCAN WRITE... Attempting scan

[BLE]: Scanning WiFi networks...[BLE]: [BLE_ WIFI]: scan result: 0

[BLE]: [BLE WIFI] Waiting on semaphore

[MQTT]: Lost WiFi connection; disconnected MQTT socket.

[MQTT]: Waiting for WiFi connect...

[BLE]: done

[BLE]: Waiting for data.

[MQTT]: WiFi connected. Connecting to MQTT.

0 Likes
Anonymous
Not applicable

Which SDK are you using?

Have you tried this on a Broadcom standard EVB ? Do you have one?

0 Likes

The platform is an EMW3162 which is a 43362 module using SDK 3.3.1.

We do not have an EVB.

0 Likes
Anonymous
Not applicable

At this point since we are unable to duplicate your issue on our standard EVBs with our standard SDK, we will have to look at some platform difference in the code that you are using for the EMW3162. Where do you get the platform files for that platform?

0 Likes

The Platform files are from the the Vendor's github repo

https://github.com/MXCHIP-EMW/WICED-for-EMW

0 Likes
Anonymous
Not applicable

Sorry - Have you tried exactly Seyhan's patch? Does that patch not work as well?

0 Likes

The existing app was modified to use the same sequence for scanning as used in the example.

It cannot do it exactly since we are using MQTT connections.

To run the example as is will take some work and at least some modifications

on our platform.

0 Likes

markmendelsohn wrote:

The existing app was modified to use the same sequence for scanning as used in the example.

It cannot do it exactly since we are using MQTT connections.

To run the example as is will take some work and at least some modifications

on our platform.

I think this problem it's self is nothing to do with MQTT.

It would be easier to identify the problem using snip code.

So I'd suggest you try to test Seyhan's patch.

0 Likes
Anonymous
Not applicable

Hi-- are there other chips that can do the scan while connected to the AP?  Is there a particular item in the datasheet to look for?-- eg, will the 43341 or 4343 do it?

Thanks!

0 Likes
MaMe_1509466
Level 4
Level 4
25 replies posted 10 replies posted 5 replies posted

nsankar

Shouldn't the API have returned an error instead of success if a connection

was up and it could not perform the Scan?

Also, now that we know this fact, we wiced_wifi_down() to kill any connections,

do a wiced_wifi_up() and then do the Scan, but it does not work reliably. What

else needs to be performed procedurally to take the network down, take the

wifi down, put wifi up, scan successfully, and then bring the network back up?

0 Likes

Note that MXCHIP is not an authorized Broadcom module partner.

nsankar

0 Likes

Hi,

You may remove all the "wiced_tcp_disconnect(&tcp_client_socket);" from the tcp_client snip app or the last wiced_tcp_disconnect() in tcp_client(...).

There are some synchronization locks are needed to protect the resources but here what I have after removing from the  "wiced_tcp_disconnect(&tcp_client_socket);." After removing wiced_tcp_disconnect(...) the wiced_tcp_connect(...) will fail but it could be ignored for this sample code. You have to check the connection and and connect if the tcp connection is not established.

pastedImage_0.png

Thanks,

Seyhan

The snip is running on the target platform now. It

looks like it is working. The tcp_disconnects are

still in. I will remove them next and see how it works.

Then need to figure out equivalent mods that

need to be made in the target application with MQTT.

Scan complete in 1693 milliseconds

Hello from WICED

Waiting for scan results...

  # Type  BSSID            RSSI  Rate Chan  Security        SSID

---------------------------------------------------------------------------------------

143 Infra 94:62:69:75:6B:20  -42 144.4    6  WPA2 Mixed PSK         ATTICnzmvS        

144 Infra 00:18:E7:E4:1A:7E  -44 130.0    4  WPA2 Mixed PSK         mendeltron dlink  

145 Infra F8:32:E4:A6:02:F0  -91 216.7    6  WPA2 AES   PSK         gomba             

146 Infra 00:1D:D5:55:D6:A0  -90 144.4    6  WPA2 Mixed PSK         Jennie413         

147 Infra 84:61:A0:C2:38:30  -57 144.4   11  WPA2 Mixed PSK         ATT4b9K7d3        

148 Infra 44:E1:37:26:D9:10  -73 144.4   11  WPA2 Mixed PSK         ATT3Z6k8B8        

149 Infra 00:22:75:4C:CB:13  -92 144.4    6  WPA2 Mixed PSK         ddblothome        

150 Infra 00:1D:D5:7F:D8:10  -92 144.4   11  WPA2 AES   PSK         Alexandra         

151 Infra C0:FF:D4:E3:B9:1B  -55 216.7    1  WPA2 AES   PSK         DonMichelotto     

152 Infra 10:0D:7F:DA:08:82  -88 216.7    1  WPA2 AES   PSK         ImpHome7          

153 Infra E8:33:81:77:50:30  -77 144.4    1  WPA2 Mixed PSK         ATT6m3R4K7        

0 Likes

markmendelsohn

Note that MXCHIP is officially a partner now.

My understanding is that they will be providing their own software package based on WICED.

nsankar

0 Likes