WIfi.begin() fails status=6, disconnected , on Nano iot, resolved

I have this sketch that creates an AP or connects to the access point depending on the config.
was built with 1.8.12

I am starting to add web server to this.. it complained on downlevel firmware, so I updated.
I also updated the IDE to 1.8.19 and the samd libs to 1.8.13..

build happens with 1.8.13..

Using board 'nano_33_iot' from platform in folder: /Users/sam/Library/Arduino15/packages/arduino/hardware/samd/1.8.13
Using core 'arduino' from platform in folder: /Users/sam/Library/Arduino15/packages/arduino/hardware/samd/1.8.13
Using library WiFiNINA at version 1.8.13 in folder: /Users/sam/Documents/Arduino/libraries/WiFiNINA 

the sketch says the firmware is latest

 Wifi firmware version=1.4.8
// was at 1.4.5

but now my Wifi.begin(ssid) returns rc=6 Disconnected..
// the test network doesn't have a passcode set)

the AP side works ok..

So, I decided to connect to my local wifi.. (that DOES have a passcode)
that also fails rc=6..

I wait 10 seconds and try again.. never to succeed in either case.

this depends on a static variable.  bool MakeAP=true; or false.

#include <WiFiNINA.h> // this is 1.8.13
setup(){
if(MakeAp == true) {
// the ap side , this  works ok, can connect from desktop and laptop
 status= WiFi.beginAP(ssid); // try to make AP  
      if (status != WL_AP_LISTENING) {
          some error message
      } 
}

the client system side

else {
  while (WiFi.status() != WL_CONNECTED) {
        Serial.print("status=");
        Serial.println(WiFi.status());
        // wait 10 seconds
        delay(10000);
        WiFi.begin(ssid); // connect to the ap created by other Nano iot, no passcode
        // for debug only) connect to home wifi 
        WiFi.begin(ssid1,passcode);  // test connect to home network , with passcode 
  }
}
}

I don't see any changes in the api in the Nina doc.
is there something else I can do for debug?

thanks

here is a sketch that demos the failure

change these lines (below) when type = Member to connect to a ;local access point
char ssid[]="network_ssid";
char passcode[]="network_passcode";

#include <SPI.h>
#include <WiFiNINA.h>
#define AccessPoint 1
#define Member 2
int type = Member;

void setup() {
     while (!Serial)
    Serial.begin(115200); 
  // put your setup code here, to run once:
  if(type == AccessPoint){
      char ssid[]="network1";
      Serial.print("Attempting to create Network named: ");        // print the network name (SSID)
      Serial.println(ssid);
      int status= WiFi.beginAP(ssid); // try to connect
      if (status != WL_AP_LISTENING) {
        Serial.println("Creating access point failed");
        // don't continue
        while (true);
      }

    } else {
      char ssid[]="network_ssid";
      char passcode[]="network_passcode";
      while (WiFi.status() != WL_CONNECTED) {
        Serial.print("status=");
        Serial.println(WiFi.status());
        // wait 30 seconds
        delay(10000);

        Serial.print("Attempting to connect to Network named: ");        // print the network name (SSID)
        Serial.println(ssid);      
        WiFi.begin(ssid,passcode);
        delay(2000);
      }

    }
Serial.println("setup completed");

}

void loop() {
  // put your main code here, to run repeatedly:

}

if you use some non-existant SSID , then u get status=4, WL_CONNECT_FAILED, as expected

now, this local network is both 2g and 5g

results.. if u have a true 2.4g wifi network then the connect is ok..

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.