6 Replies Latest reply on Jan 30, 2018 2:37 AM by huseyinkozan

    Clear Wifi DCT

    huseyinkozan

      Hi,

       

      I have a Redbear Duo and want to clear and be sure device will not try to connect unconfigured networks.

       

      Here the question that I asked at Redbear forums : Clear Wifi DCT - WICED (Broadcom/Cypress) - Discussion Forums

       

      Current message that show unconfigured connect trial:

       

      Joining : �����������������������������������������������������������������������������������������������������������������������������������������������������������������

      Failed to join : ����������������������������������������������������������������������������������������������������������������������������������������������������������

       

       

      I am using WICED SDK 5.0.1.

        • 1. Re: Clear Wifi DCT
          huseyinkozan

          How about this ?

           

          static wiced_result_t config_at_worker_thread( void * arg )
          {
              platform_dct_wifi_config_t  dct_wifi_config;
              if (wiced_dct_read_with_copy( &dct_wifi_config, DCT_WIFI_CONFIG_SECTION, 0, sizeof(platform_dct_wifi_config_t) ) == WICED_SUCCESS) {
                  // dct_wifi_config.device_configured = WICED_FALSE;
                  memset(&dct_wifi_config, 0, sizeof(dct_wifi_config));
                  if (wiced_dct_write( &dct_wifi_config, DCT_WIFI_CONFIG_SECTION, 0, sizeof(platform_dct_wifi_config_t)) == WICED_SUCCESS) {
                      const configuration_entry_t app_config[] = { {0,0,0,0} };
                      r_ = wiced_configure_device( app_config );
                      if (r_) GW_PRINTF("wiced_configure_device() failed! r_=%d\n", r_);
                      r_ = wiced_rtos_set_event_flags(&app.events, GW_EVENT_CONFIG_FINISHED);
                      if (r_) GW_PRINTF("wiced_rtos_set_event_flags(GW_EVENT_CONFIG_FINISHED) failed! r_=%d\n", r_);
                  }
                  else GW_PRINTF("wiced_dct_write(dct_wifi_config.device_configured=false) failed! r_=%d\n", r_);
              }
              else GW_PRINTF("wiced_dct_read(dct_wifi_config) failed! r_=%d\n", r_);
              return WICED_SUCCESS;
          }
          
          

           

          Simply with words:

          • Get DCT
          • Clear DCT
          • Write DCT to back
          • Run `wiced_configure_device()`
          • 2. Re: Clear Wifi DCT
            huseyinkozan

            Clearing all data was a wrong choice. Only clearing the stored AP list solves my problem. But, don't know this is a right answer.

             

            static wiced_result_t config_at_worker_thread( void * arg )
            {
                platform_dct_wifi_config_t  dct_wifi_config;
                uint32_t i = 0;
                if (wiced_dct_read_with_copy( &dct_wifi_config, DCT_WIFI_CONFIG_SECTION, 0, sizeof(platform_dct_wifi_config_t) ) == WICED_SUCCESS) {
                    dct_wifi_config.device_configured = WICED_FALSE;
                    for(i = 0; i < CONFIG_AP_LIST_SIZE; ++i) memset(&dct_wifi_config.stored_ap_list[i], 0, sizeof(wiced_config_ap_entry_t));
                    // memcpy(&dct_wifi_config.mac_address, &mac_address, sizeof(wiced_mac_t));
                    // dct_wifi_config.country_code = WICED_COUNTRY_TURKEY;
                    if (wiced_dct_write( &dct_wifi_config, DCT_WIFI_CONFIG_SECTION, 0, sizeof(platform_dct_wifi_config_t)) == WICED_SUCCESS) {
                        const configuration_entry_t app_config[] = { {0,0,0,0} };
                        r_ = wiced_configure_device( app_config );
                        if (r_) GW_PRINTF("wiced_configure_device() failed! r_=%d\n", r_);
                        r_ = wiced_rtos_set_event_flags(&app.events, GW_EVENT_CONFIG_FINISHED);
                        if (r_) GW_PRINTF("wiced_rtos_set_event_flags(GW_EVENT_CONFIG_FINISHED) failed! r_=%d\n", r_);
                    }
                    else GW_PRINTF("wiced_dct_write(dct_wifi_config.device_configured=false) failed! r_=%d\n", r_);
                }
                else GW_PRINTF("wiced_dct_read(dct_wifi_config) failed! r_=%d\n", r_);
                return WICED_SUCCESS;
            }
            
            
            • 3. Re: Clear Wifi DCT
              mifo

              Adding the Level 1 applications team.

               

              grsr lsri rash mady gsns ankh,wwfe

               

              Note that it would be helpful if you could reproduce this issue using one of our eval boards since the Apps team will not have access to a Redbear Duo.

              • 4. Re: Clear Wifi DCT
                huseyinkozan

                Thanks for the answer. I  don't have any eval board.

                • 5. Re: Clear Wifi DCT
                  riya

                  I have modified the dct_read_write snip in WICED to clear the soft AP list of wifi_config_dct. The approach you followed appears correct.

                  I would suggest you lock the DCT before modifying it.

                  I have tried the application in CYW943907AEVAL1F EVK in WICED SDK 6.0.1

                  • 6. Re: Clear Wifi DCT
                    huseyinkozan

                    Thanks