3 Replies Latest reply on Apr 4, 2019 7:54 PM by RaktimR_11

    Problem with wifi join semaphore


      I am using the following function to join an AP:


      wwd_result_t wwd_wifi_join_specific( const wiced_scan_result_t* ap,

                                         const uint8_t* security_key,

                                         uint8_t key_length,

                                         host_semaphore_type_t* semaphore,

                                         wwd_interface_t interface )


      I pass the following semaphore to the function:

      host_semaphore_type_t semph_wifi_join_cmpltd_hdle; // this semaphore resumes the wifi connection thread


      But the semaphore is never set!


      The function returns successfully and connects to the AP. But the semaphore is never set to indicate the end of the association process.

        • 1. Re: Problem with wifi join semaphore

          You can try checking the active_join_mutex status; instead of your own semaphore which should give you the indication of assoc completed. If you are setting up WICED platform as a softAP, then you can check for WLC_E_ASSOC_IND for the event and put debug prints/asserts if necessary.

          1 of 1 people found this helpful
          • 2. Re: Problem with wifi join semaphore

            This is part of the code I am using:


            static host_semaphore_type_t  WICED_DEEP_SLEEP_SAVED_VAR( active_join_mutex );



                wwd_result_t     result;

                result = wiced_rtos_init_semaphore(&active_join_mutex);

                if ( result != WWD_SUCCESS )


                    /* could not create semaphore */

                    WPRINT_APP_ERROR(("||||||||| ERROR: Could not create LwIP semph_wifi_join_cmpltd_hdle semaphore"));





                        if (wwd_wifi_join_specific( (const) &alternative_ap, (const) security_key, key_length,

                                &active_join_mutex, WICED_STA_INTERFACE ) != WWD_SUCCESS)


                            WPRINT_APP_INFO(( "\nAlternate join failed! \n"));




                            WPRINT_APP_INFO(( "\n***JOIN SPECIFIC***: Switching the AP...! \n"));



                    WPRINT_APP_INFO(( "\n******Waiting for a join process to complete...******\n"));



                    host_rtos_get_semaphore( &active_join_mutex, NEVER_TIMEOUT, WICED_FALSE );



                    WPRINT_APP_INFO(( "\n******Semaphore for join has been set******\n"));

            And the semaphore is never set!


            Could you please provide a sample code for checking the mutex?

            active_join_mutex is internal and cannot be accessed easily.


            • 3. Re: Problem with wifi join semaphore

              You can print the active_join_mutex status in a debug build by just putting a print statement

              If you want to use the release build, you can print done variable in wwd_wifi_join_wait_for_complete in the following way

              If the value of done is WICED_TRUE, the assoc process is not completed or if it is WICED_FALSE, the assoc process has gone through. I haven't tried using my own semaphore though but can try it if this does not help your use-case.