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.

WPS repeat connections



Hi,

I am having an issue with WPS connections.

I can establish a connection using the following code

    SlSecParams_t secParams;
    long lRetVal = -1;

    secParams.Key = NULL;
    secParams.KeyLen = 0;
    secParams.Type = SL_SEC_TYPE_WPS_PBC;

    lRetVal = sl_WlanConnect("1", 1, 0, &secParams,0);

This works well, I run this via a button press.

However, if I press run this a second time, e.g. to connect to a different router it connects instantly to the same router, without the router being in WPS mode.
If I press it for a third time then it disconnects and I will have to restart the device to get it to connect again.

Ideally I would like it to try WPS connection for a minute or so, if it doesn't connect then it should go back to the previous connection.


Can anyone help.

  • Ok, progressing on from this.

    If I add the following at the beginning it seems to work better

    	sl_WlanDisconnect();
    	sl_Stop(0);
    	CLR_STATUS_BIT(g_ulStatus, STATUS_BIT_CONNECTION);
    	CLR_STATUS_BIT(g_ulStatus, STATUS_BIT_IP_AQUIRED);
    	memset(g_ucConnectionSSID,0,sizeof(g_ucConnectionSSID));
    	memset(g_ucConnectionBSSID,0,sizeof(g_ucConnectionBSSID));
    	sl_Start(0,0,0);

    Is this a good way of doing this?

    Another question, is there a timeout on how long it will allow a wps connection?

    Or do I need to add my own timeout?

  • Hi Matthew,

    The timeout is 2 minutes. Also, see section 8.4 for more details on how to use WPS: www.ti.com/.../swru368a.pdf

    -Aaron
  • Hi Aaron,

    That is great, thanks for that.
    I have looked at the programmers guide a lot, very useful. However, I cannot find the following...

    Is there a way to find out if it is still running the WPS connection? Or do I have to maintain my own 2 minute timer?
    Is there a way to cancel it? Or would I just reset everything?