WINC1500 Provision Mode

Go To Last Post
7 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi guys one more time.

 

I have a question and I hope you can help me.

 

I configured the WINC1500 module to work as Provision Mode. So far so good the phone detects the module, I connect my phone to the module and it asks me to sign in. It opens the provision webpage and I put the data of the router which I want to sign in.

 

Now what I want is a condition in my program so my program only executes if the module winc1500 is connected to a router. I want something like this.

 

while (winc1500 is not connect to router)

{

    printf("Waiting connection");

}

if (winc1500 connected)

{

   //execute the program

}

 

My problem is I don't know which variable(s) is/are changed after I connect to a router.

 

 

Hope you can help me.

Thanks for your attention

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm not quite clear on the condition you're trying to detect.

 

IIRC, the only time the WINC1500 acts as "host" (ie, a phone can connect to it) is in Commissioning mode; in all other cases, it is the WINC1500 which connects to a "host" (ie, router or hotspot)?

 

If that's right, then your question becomes, "how do I tell when I am in commissioning mode, or not?" - doesn't it?

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

awneil wrote:

I'm not quite clear on the condition you're trying to detect.

 

IIRC, the only time the WINC1500 acts as "host" (ie, a phone can connect to it) is in Commissioning mode; in all other cases, it is the WINC1500 which connects to a "host" (ie, router or hotspot)?

 

If that's right, then your question becomes, "how do I tell when I am in commissioning mode, or not?" - doesn't it?

 

 

Let me try explain again what I want.

 

So far, the module is working in Provision Mode. I pick up my cellphone and it detects the module. I connect my phone to the module and the cellphone says to sign in. It opens the page and then I put the router settings which I want to connect and then my cellphone disconnects from the module because it's no more detectable.

What I want is my program only runs after the procedure I mention before. Until this is not accomplished the program doesn't run to other instructions. That's why I need to know how to do the condition I said before.

For example, I want to create a TCP Client to connect to a Server TCP. It makes no sense the program runs without internet configuration. So before I create the client socket my program is in a loop until the module winc1500 is connected to a router.

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

miguelfcp93 wrote:
So far, the module is working in Provision Mode. I pick up my cellphone and it detects the module. I connect my phone to the module and the cellphone says to sign in. It opens the page and then I put the router settings which I want to connect

That is what I called the "Commissioning mode"; aka Provisioning mode.

 

That's why I need to know how to do the condition I said before.

So, as I said, the condition you're looking for is when Commisioning (aka Provisioning) is complete.

 

This must be in the examples, because this is exactly what the examples do!

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

awneil wrote:

miguelfcp93 wrote:

So far, the module is working in Provision Mode. I pick up my cellphone and it detects the module. I connect my phone to the module and the cellphone says to sign in. It opens the page and then I put the router settings which I want to connect

 

That is what I called the "Commissioning mode"; aka Provisioning mode.

 

That's why I need to know how to do the condition I said before.

So, as I said, the condition you're looking for is when Commisioning (aka Provisioning) is complete.

 

This must be in the examples, because this is exactly what the examples do!

 

 

I already read (a lot) of times the examples and didn't find what I was searching... Or it isn't there or it is me that I'm already blind xD

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I already tried so many things that I'm out of ideas. I read so many times the examples and nothing worked. What I really want is a condition that tells me that winc1500 is connected to a router. My code is this (main function only):

int main(void)
{
    tstrWifiInitParam param;
    tstrM2MAPConfig apConfig;
    init_board();
    init_network();
    param.pfAppWifiCb = wifi_event_cb;
    if(!m2m_wifi_init(&param))
    {
        uint8 bEnableRedirect = 1;
        strcpy(apConfig.au8SSID, "WINC1500");
        apConfig.u8ListenChannel = 1;
        apConfig.u8SecType = M2M_WIFI_SEC_OPEN;
        apConfig.u8SsidHide = 0;
        // IP Address
        apConfig.au8DHCPServerIP[0] = 192;
        apConfig.au8DHCPServerIP[1] = 168;
        apConfig.au8DHCPServerIP[2] = 1;
        apConfig.au8DHCPServerIP[3] = 1;
        m2m_wifi_start_provision_mode(&apConfig, "atmelconfig.com", bEnableRedirect);
    }
    printf ("Provision Mode started.\n");
    
    while(1)
    {
        if() //Condition that says the winc1500 is connected to a router
        {    
            printf ("Connection established with sucess.\n");
            //Insert here TCP Client Socket code
            
        }
    }
}

Last Edited: Mon. Feb 13, 2017 - 10:50 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Reading through the "weather client example" I noticed the following conditional (in bold):

 

/* Start web provisioning mode. */
    m2m_wifi_start_provision_mode((tstrM2MAPConfig *)&gstrM2MAPConfig, (char *)gacHttpProvDomainName, 1);
    printf("\r\nProvision Mode started.\r\nConnect to [%s] via AP[%s] and fill up the page.\r\n\r\n",
            MAIN_HTTP_PROV_SERVER_DOMAIN_NAME, gstrM2MAPConfig.au8SSID);

 

    while (1) {
        m2m_wifi_handle_events(NULL);

        if (gbConnectedWifi && !gbTcpConnection) {
            if (gbHostIpByName) {
                /* Open TCP client socket. */