Setting Country code fails with WWD_WLAN_BADARG for CYW4343

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

cross mob
Anonymous
Not applicable

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;

    }

0 Likes
1 Solution
Anonymous
Not applicable

Hi rroy,

I have found the root cause of the problem. There was some issue regarding the OOB Interrupt setting on my hardware. Once I fixed it I am able to set the country code.

Thank you for your time.

View solution in original post

6 Replies
RaktimR_11
Moderator
Moderator
Moderator
500 replies posted 250 replies posted 100 replies posted

Please check whether CLM download is happening or not? If the CLM blob download is successful, you should see the clm version in the debug terminal

Anonymous
Not applicable

Yes, I am able to read the CLM version if I add "wwd_wifi_get_clm_version()" after the CLM Blob Download is completed successfully.

I get following version.

API: 12.2 Data: 9.10.39 Compiler: 1.29.4 ClmImport: 1.36.3 Creation: 2018-04-11 22:31:21

After this process, APSTA mode is also activated, ampdu parameters are also set successfully but when I try to set the country code it returns WWD_TIMEOUT. Earlier when I didn't download the CLM_BLOB, it returned WWD_WLAN_BADARG.

0 Likes
RaktimR_11
Moderator
Moderator
Moderator
500 replies posted 250 replies posted 100 replies posted

Try adding the WICED_STARTUP_DELAY in your application make file and see if that helps. Mostly if you are stuck at this point, it can mean

  • Bus interrupt not triggering properly - the WLAN chip is unable to signal the host that there is data available.
  • Timing problems - if the timeouts on semaphores are not working correctly, then the system might think that the IOCTL has timed out much faster than it should do.

Just to understand the problem, you are facing issues in line #306 in wwd_management.c. Is that correct?

Anonymous
Not applicable

1) I have tried adding the startup delay but I get the same return value i.e. WW_TIMEOUT.

2) Yes, I am facing the issue in line #306 in wwd_management.c

If I bypass the "setting country code" procedure (assuming that the chip takes US as default country code), than the "Set Event Msg" and "Set G-mode" commands, which are in sequence after the country code setting, are successfully sent. And when I try to scan the networks in the application, again it fails to scan with same return type "WWD_TIMEOUT" in sending of the command.

So, is it possible that the chip may not respond to some commands and it may respond to others?

0 Likes
RaktimR_11
Moderator
Moderator
Moderator
500 replies posted 250 replies posted 100 replies posted

It's highly unlikely that the chip will respond to some IOCTL/IOVAR and not to the other ones. You can check the bus stats to check the packet statistics as mentioned in STM32F469 porting in WICED and find out the failure point.

Please check the ccode option in the nvram file used for your platform. If the country option is not set, scan or any other WLAN related operation will fail so you can't really bypass it. For more information on country codes, you can refer to How to set country code in WICED APP?

Anonymous
Not applicable

Hi rroy,

I have found the root cause of the problem. There was some issue regarding the OOB Interrupt setting on my hardware. Once I fixed it I am able to set the country code.

Thank you for your time.