Keep WiFi connection during code upload

Hello guys,

is it somehow possible to keep the WiFi connection after uploading the code? Seems like the WiFiNINA resets the ESP-Chip each time the class is initialized. It's fine for production but I'd like to keep the connection to speed up the development process. Otherwise I have to wait several seconds after each upload until the connection is established.

maybe just change how you initialize WiFi in setup(). the way WiFiNINA examples do it always waits 10 seconds after the connection is established.

I've tried to read out the current status at the beginning of the setup routine:

status = WiFi.status();

It is always WL_IDLE_STATUS, even if the connection was established before the flashing..

Now I've found it, the "SpiDrv" seems always to reset the slave, in it's begin() call.. Damn.

do you have this? or something better?

  while (status != WL_CONNECTED) {
    Serial.print("Attempting to connect to WPA SSID: ");
    Serial.println(ssid);
    // Connect to WPA/WPA2 network:
    status = WiFi.begin(ssid, pass);

    // wait 10 seconds for connection:
    delay(10000);
  }

I have this. But after the boot status (WiFi.status()) is always IDLE and the module is trying to connect to WiFi. So on each boot the code starts with WiFi.begin(...). But this is exactly what I want to avoid (to speed up the development time).

Is it reasonable to expect that after a reset, which is necessary because new code has been uploaded, that the WiFi should remain connected ?

If that were the case and you uploaded a different sketch that did not use WiFi would you expect it to remain connected ?

Sure, in normal operation mode, this is exactly what I'm expecting: Reset after boot. I just would like to skip the reset during development.

Because the main uC communicates over SPI using AT-Commands with the WiFi-Module, it should work without problems to reprogram the uC and keep the WiFi-Module connected. At least so the theory..

But surely the uC must be reset when new code is uploaded in order to get it in a known state

yes the uC, but not the ublox chip (on the Nano 33 IoT). Flashing the uC doesn't affect it.

You say that the uC communicates with the Ublox chip using SPI and during a chip reset the SPI interface will have been reset won't it ?

It seems to be a part of the begin() routine of the WiFi-SPI-Driver of WiFiNINA. The reset line to the ublox will be set to zero.

add

if (status == WL_CONNECTED)
  break;

before the delay

No, it's not working, "status" is a local variable, which is always Zero after boot. The correct state would be "WiFi.status()" but it is also Zero because of the reset.

after status= and before the delay

  while (status != WL_CONNECTED) {
    Serial.print("Attempting to connect to WPA SSID: ");
    Serial.println(ssid);
    // Connect to WPA/WPA2 network:
    status = WiFi.begin(ssid, pass);
    if (status == WL_CONNECTED)
      break;
    // wait 10 seconds for connection:
    delay(10000);
  }

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