This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC3235SF: sl_WlanSet Failure when trying to enable NoPsPollMode.

Part Number: CC3235SF


Hi, 

I have had issues with my device in the field regarding frequent disconnections with the clients routers. Through another thread (expired now) I had got the solution to this by enabling NoPsPollMode.

I have been able to work with this without any failure. After upgrading to the latest available SDK 4.30 I am not able to figure out how to implement this feature. The code is the same as in the previous SDK implementation but after migration I get an error (-2188) returned through the function sl_WlanSet(.....). The following is the snippet of the code for enabling the mentioned feature.

SlWlanNoPSPollMode_t NoPsPollMode;
NoPsPollMode.Enable = 1; // enable no PS-Poll mode (work without PS-Poll frames)
retVal = sl_WlanSet(SL_WLAN_CFG_GENERAL_PARAM_ID, SL_WLAN_GENERAL_PARAM_OPT_NO_PS_POLL_MODE,sizeof(SlWlanNoPSPollMode_t),(_u8 *)& NoPsPollMode);
if(retVal < 0)
{
   AS_LOG(AS_LOG_ERROR,"sl_WlanSet FAILED: %d", retVal);
}

The above code returns a negative value -2188 for which I could not find any reference to. Could you let me know how to get over this issue.

One of my clients is reporting frequent disconnection of his device from his router (TP-Link Deco X60 mesh). I am guessing this could be the issue. Could you confirm this?

Hope to hear from you soon.

Regards,

Darpan


 

  • Hi,

    The -2188 means that you are trying to apply the command when the device is connected to the network.

    The SL_WLAN_GENERAL_PARAM_OPT_NO_PS_POLL_MODE can be used only when the station is disconnected.

    Br,

    Kobi

  • Hi,

    As you mentioned the meaning of the Error code -2188. I was unable to find its definition in any of the documents or error list included in the system. Is there a reason to why this is not defines as I could find meanings for other error codes.

    In my device, the flow is such that whenever the device boots up. As soon as sl_start is called the device connects to the last provisioned AP, hence I get the error when I try to enable No PS Poll. Could you recommend a method in which I can implement the No PS Poll feature when the device auto connects when sl_start is called?

    Regards,

    Darpan.

  • Hi,

    The setting is persistent, you don't need to set it every time. When you decide to set it, you can disable the auto/fast-connect option so the NWP will not connect automatically, then set this one with other persistent settings you may require (including the re-enabling of the auto/fast-connect) and restart the NWP. You can mark this by writing to a file, or by first reading the parameter value - so you will not repeat the procedure every time (which has impact on flash endurance and on init time).

    This API and error code was added relatively late and it is not part of the current host driver errors definition. The definition was found in the NWP code and I opened an internal bug on this so it should be updated in one of the next SDK releases.

    Br,

    Kobi

     

  • Hi,

    As mentioned by you that the device needs to be disconnected when this Policy is set, this has solved the issue with getting an error when sl_WlanSet is called while enabling No PS Poll.

    But in order to limit the Enabling process only to when the policy is disabled I came across the api of sl_WlanGet which should return the value of No PS Poll as it exists in the device at that particular time. But when this is called I am always returned with the feature being disabled even when there was no error returned when setting it. The following is the implementation 

         SlWlanNoPSPollMode_t NoPsPollMode;
         uint16_t   config_opt = SL_WLAN_GENERAL_PARAM_OPT_NO_PS_POLL_MODE;
         uint16_t   Len = sizeof(SlWlanNoPSPollMode_t);
    
         NoPsPollMode.Enable = 0;
         retVal =  sl_WlanGet(SL_WLAN_CFG_GENERAL_PARAM_ID, &config_opt, &Len, (_u8* )&NoPsPollMode);
         if(retVal < 0)
         {
              printf(printf_WARN,"sl_WlanGet FAILED: %d", retVal);
         }
    
         if(NoPsPollMode.Enable == 0)
         {
            retVal = sl_WlanDisconnect();
            if(retVal < 0)
            {
                printf(printf_INFO,"[NWIF] sl_WlanDisconnect FAILED: %d", retVal);
            }
    
            NoPsPollMode.Enable = 1; // enable no PS-Poll mode (work without PS-Poll frames)
            retVal = sl_WlanSet(SL_WLAN_CFG_GENERAL_PARAM_ID, SL_WLAN_GENERAL_PARAM_OPT_NO_PS_POLL_MODE,sizeof(SlWlanNoPSPollMode_t),(_u8 *)& NoPsPollMode);
            if(retVal < 0)
            {
                 printf(printf_WARN,"sl_WlanSet FAILED: %d", retVal);
            }//else{
                retVal = sl_Stop(200);
                if(retVal < 0)
                {
                    printf(printf_ERROR,"[NWIF] sl_Stop FAILED: %d", retVal);
                    while(1);
                }
                CLR_STATUS_BIT(g_ulStatus, STATUS_BIT_NWP_INIT);
                /* Restart the NWP */
                retVal = sl_Start(0, 0,0);
                if(retVal != ROLE_STA)
                {
                    printf(printf_ERROR,"[NWIF] sl_Start FAILED: %d", retVal);
                    while(1);
                }
                SET_STATUS_BIT(g_ulStatus, STATUS_BIT_NWP_INIT);
            }
         }else{
              printf(printf_DEBUG,"No PS Poll Already Enabled");
         }

    Please correct me if I have been doing it wrong.

    I have also read about your recommendation about writing it in a file but I would prefer if I could read its state through system api's.

    Regards,

    Darpan.

  • You are right. It looks like the parameter (which was added as a service pack patch) is not supported by the sl_WlanGet. I'm not sure why you are not getting error in the return code.

    You will need to use another method to monitor the state of configuration.

    Br,

    Kobi

  • Hi Again,

    I checked the latest SP and it seems to support this.

    Please try to update the SP. 

    Br,

    Kobi 

  • Hi,

    I am using the service pack sp_4.8.0.8_3.7.0.1_3.1.0.26.bin in my code. And I think this is the latest available. Please could you let me know more details in the SDK through which I can get this to work.

    Regards,

    Darpan

  • Hi,

    I have gone through the following document (SWRU455E) which states that the sl_WlanSet API is System-persistent, whose persistency is controlled by setting SL_DEVICE_GENERAL_PERSISTENT option using the sl_DeviceSet API.

    I was not able to track down if setting No PS Poll using the sl_WlanSet API is a System-persistent feature or it is not.

    In our system, we have set the General Persistence to False before enabling the default policy that we require. 

    As you mentioned that we need to enable the No PS Poll feature just once since it affects the life of the flash. Can disabling the General Persistency permit us to enable No PS Poll every time we power on the device. Will this cause any harm to the device as a whole??

    Regards,

    Darpan

  • This is probably the cause.

    The NO PS POLL setting is persistent unless you disable the General Persistence.

    In such case you will need to set it every time you call ower up the network processor.

    Br,

    Kobi