APWebServer problems

After spending MANY hours, and a couple of minutes from getting the big hammer, I have found that you cannot change the SSID, from the original SSID used, after you have uploaded a sketch, when using the device as an AP Server.

If I change it back to the original SSID it works again.

Is that burnt into the chip? Does anyone know how to fix this?

Below is the code in the main file. The same thing happens with the Ap_SimpleWebserver example.

#include <WiFiNINA.h>
//#include <FlashStorage_SAMD.h>
#include <Iono.h>
#include <Arduino_MKRGPS.h>
//#include <ArduinoUniqueID.h>
#include "arduino_secrets.h"

float latitude;
float longitude;
float altitude;
float speed;
unsigned int satellites;
//unsigned int localPort = 2390;

///////please enter your sensitive data in the Secret tab/arduino_secrets.h

char ssid[] = SECRET_SSID;  // your network SSID (name)
char pass[] = SECRET_PASS;  // your network password (use for WPA, or use as key for WEP)

IPAddress ip(192, 168, 4, 1);  // for local connection
IPAddress subnet(255, 255, 0, 0);
IPAddress dns(192, 168, 4, 1);
IPAddress gateway(192, 168, 4, 1);
//********************************************************************************************


WiFiServer server(80);

void setup()
{
  Serial.begin(115200);
  //  while (!Serial)
  //   {
  //     ;  // wait for serial port to connect. Needed for native USB port only
  //   }

  if (!GPS.begin())
  {
    Serial.println("Failed to initialize GPS!");
    while (true)
      ;
  }

  WiFi.config(ip, dns, gateway, subnet);
  WiFi.setHostname("GpsModule");
  WiFi.beginAP(ssid, pass);  // for local ap connection ***************************************************

  delay(100);         // wait 10 seconds for connection:
  server.begin();     // start the web server on port 80
  printWiFiStatus();  // you're connected now, so print out the status
}

void loop()
{
  listenForEthernetClients();
  GetGpsData();
}

void printWiFiStatus()
{
  //print the SSID of the network you're attached to:
  Serial.print("SSID: ");
  Serial.println(WiFi.SSID());
  //print your WiFi shield's IP address:
  IPAddress ip = WiFi.localIP();
  Serial.print("IP Address: ");
  Serial.println(ip);
  IPAddress gateway = WiFi.gatewayIP();
  Serial.print("IP Gateway: ");
  Serial.println(gateway);

  //print where to go in a browser
  Serial.print("To see this page in action, open a browser to https://");
  Serial.println(ip);
}

Why would you want/need to change it? You use it to create the AP. Once connected, there is no use for it.

Yes I understand, I had salvages this code from another app, that I had. I was just experimenting and trying to get it up and running when I discovered the issue. I want to change the SSID ‘BoilerController’ which was the SSID I used before to ‘GpsServer’. Maybe I have to redo the WIFININA firmware.

NO, just change the line in the arduino_secrets.h file that has

#define SECRET_SSID = BoilerController to GpsServer

Right, but when I do change it to GPSServer, it will not take the new SSID. In the printWiFiStatus function it displays the SSID as blank, and there is no SSID in the wifi scan from my phone or laptop. If I change it back to BoilerController, then it shows in the PrintWiFiStatus and shows in the scan list.

In the AP_SimpleWifiServer example. It fails at creating access point name, it shows a blank and then fails. As soon as I change the SSID back to BoilerController then it works OK.

The mkr 1010 is retaining the first SSID name you use and you cannot change it after that. I have not redone the WiFINina firmware yet to see if that clears it out. I will try later this afternoon. Thanks.

I have been using these boards since they came out. I have never had any problems with them. I have made hundreds of Boiler Controls utilizing the IONOMkr PLC. I have never had a reason to change the SSID before, so this is new to me.

What you are saying is impossible. Show us the CHANGED android_secrets.h file.
Do NOT touch the firmware, it has nothing to do with this.

Do you have a MKR1010? If you do could just try it. Maybe you are not understanding how I am using the device. I am using it as a stand alone Access Point Server, where you connect directly to the MKR1010 WiFi signal, not connecting to an existing WiFi router.

I do not, but all you need to do is change the android_secrets.h
The SSID is not in the firmware, it's in your source code.
If you are somehow unable to follow directions, then nobody can help. Change the arduino_secrets.h file and show us, then compile and upload.

Thanks for trying, you are obviously not able to help. Hopefully someone else can.

It looks like someone has figured it out. I will try it.

Solved thanks: Wifi SSID Not Changing To New One After Upload - #3 .._gaMTg2NTM3ODkyNS4xNzU1NTIwMDQx*_ga_NEXN8H46L5*czE3NTU1MjAwNDEkbzEkZzAkdDE3NTU1MjAwNDEkajYwJGwwJGgxNjg1NTEzODI3

Here it is in the documentation. I should have read a little more.

Parameters

  • ssid: the SSID (Service Set Identifier) of the created Access Point. Must be 8 or more characters.

  • passphrase: optional, the WPA password of the created Access Point. Must be 8 or more characters.

  • channel: optional, channel of created Access Point (1 - 14). Defaults to channel 1;

I used a different board and had to fix the code, but the basics are the same, here is the output


Here is the file arduino_secrets.h originally,

Here is the new arduino_secrets.h

and the output

Your problem is caused because you set the SSID to be the same as the HOSTNAME. Here is my test. In my case because I am using a different WIFI stack the ssid printed out is different, BUT what matters is it is NOT what you specified in the arduino_secrets.h file


YOU are right, the bug I found is a different bug. Just make your password 8+ chars and the problem is fixed!

Thanks again for your help.

I think we both learned something so that's a bonus.