Unable to bring network down

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

cross mob
Anonymous
Not applicable

Hello, i was trying to join a different wifi network by using the wiced_network_down() method, but it fails. I searched around and found that it fails because the wiced_ip_down() method fails, however if i call wiced_leave_ap() it successfully disassociates the station(my device ) from the AP and i am able to join another AP. Am i doing somehing wrong? Or is it a bug?

0 Likes
5 Replies
GauravS_31
Moderator
Moderator
Moderator
10 questions asked 250 solutions authored 250 sign-ins

Please let us know the platform in which wiced_network_down() fails along with the error code. Also if possible, please share a reduced version of your project where you could reproduce the error.

Anonymous
Not applicable

I am using this version(taken from the version txt file of my ide) Wiced_006.001.000.0085 ,  the platform i use is EMW3165 by mxchip, i used the files they provide and followed the procedure they list on their website to add this platform in the wiced wifi studio.

!

wiced_dct_read_lock( (void**) &dct_wifi_config_new, WICED_TRUE, DCT_WIFI_CONFIG_SECTION, 0, sizeof( *dct_wifi_config_new ) );

        wiced_dct_read_unlock( (void*) dct_wifi_config_new, WICED_FALSE );

        strcpy(&dct_wifi_config_new->stored_ap_list[0].security_key,wifiKey);

        dct_wifi_config_new->stored_ap_list[0].security_key_length=strlen(wifiKey);

        deinit_app_services(WICED_STA_INTERFACE);

        result=wiced_leave_ap(WICED_STA_INTERFACE);

        if(result!=WICED_SUCCESS)

        {

            WPRINT_APP_INFO(("Cant bring interface down error %d\n",result));

        } ! !

The deinit_app_services_method de initializes a tcp server i have running and a Gedday instance

!

void deinit_app_services(wiced_interface_t interfaceToInit)

{

    wiced_result_t result;

    /*Deregister network connection callbacks*/

    wiced_network_deregister_link_callback(network_up,network_down,interfaceToInit);

    /* Drop tcp connections, deregister callbacks and delete socket*/

    wiced_tcp_unregister_callbacks(&tcp_server_handle.socket);

    wiced_tcp_disconnect(&tcp_server_handle.socket);

    wiced_tcp_delete_socket(&tcp_server_handle.socket);

    /*Deinit mDNS and deregister all services*/

    gedday_deinit();

}

0 Likes
GauravS_31
Moderator
Moderator
Moderator
10 questions asked 250 solutions authored 250 sign-ins

The mxchip module EMW3165 contains CYW43362. We do not have this module so we had tested wiced_network_down() on platform BCM943362WCD4 but this error could not be reproduced. Create a simple project with the following statements:

     wiced_result_t result;

     wiced_init();

     wiced_network_up(WICED_STA_INTERFACE, WICED_USE_EXTERNAL_DHCP_SERVER, NULL);

     result=wiced_network_down(WICED_STA_INTERFACE);

     printf("Result of wiced_network_down() is %d\n",result);

Check the result of wiced_network_down().

Anonymous
Not applicable

It returns 0 so that must mean it is successful. I will investigate some more, could it be that the change in wifi config dct hinders the ability of the network down function?

GauravS_31
Moderator
Moderator
Moderator
10 questions asked 250 solutions authored 250 sign-ins

The role of DCT in causing this issue is not clear to me right now. There is no DCT API call in wiced_ip_down(). You can configure the DCT and call the DCT API after wiced_network_down(). If the issue still persists, you can rule out DCT as a cause.