6 Replies Latest reply on Oct 11, 2018 10:50 PM by keval.soni_3633561

    Setting Country code fails with WWD_WLAN_BADARG for CYW4343

    keval.soni_3633561

      Hi,

       

      I am working on porting the WiFi driver for CYW4343 on a custom board using the reference from WICED SDK.

       

      We are following the sequence of commands found in the API wwd_management_wifi_on() of wwd_management.c and I have successfully downloaded the chip firmware.

       

      I get retval = WWD_WLAN_BADARG while calling "wwd_sdpcm_send_iovar( SDPCM_SET, buffer, 0, WWD_STA_INTERFACE )", where the country code is set as WICED_COUNTRY_UNITED_STATES. I have attached the code snippet below for reference.

       

      We tried to verify the firmware loading by using  wwd_wifi_get_wifi_version API and I am able to read the FW version as shown below:

      wl0: Apr 30 2018 04:14:19 version 7.45.98.50 (r688715 CY) FWID 01-283fcdb9

       

      But, set country code still fails. Can anyone please help me if I am missing anything. Thanks in advance for your help.

       country_struct = (wl_country_t*) wwd_sdpcm_get_iovar_buffer( &buffer, (uint16_t) sizeof(wl_country_t), IOVAR_STR_COUNTRY );
          if ( country_struct == NULL )
          {
              wiced_assert( "Could not get buffer for IOCTL", 0 != 0 );
              return WWD_BUFFER_ALLOC_FAIL;
          }
          memset(country_struct, 0, sizeof(wl_country_t));
      
          ptr  = (uint32_t*)country_struct->ccode;
          *ptr = (uint32_t) wwd_wlan_status.country_code & 0x0000ffff;
          ptr  = (uint32_t*)country_struct->country_abbrev;
          *ptr = (uint32_t) wwd_wlan_status.country_code & 0x0000ffff;
          country_struct->rev = (int32_t) ( ( wwd_wlan_status.country_code & 0xffff0000 ) >> 16 );
      
          /* if regrev is 0 then set regrev to -1 so the FW will use any NVRAM/OTP configured aggregate
           * to choose the regrev.  If there is no aggregate configured then the FW will try to use regrev 0.
           */
          if ( country_struct->rev == 0 )
          {
              country_struct->rev = -1;
          }
          retval = wwd_sdpcm_send_iovar( SDPCM_SET, buffer, 0, WWD_STA_INTERFACE );
          if ( retval != WWD_SUCCESS )
          {
              /* Could not set wifi country */
              WPRINT_WWD_ERROR(("Could not set Country code\n"));
              return retval;
          }