MSoM WiFi failed to load session

Hello friends,

MSoM is not connecting fully when it is only using WiFi (cell signal blocked). It enters on state with the cyan light blinking rapidly and so it remains.

When the cellular signal is available, it successfully connects (breathing cyan) and remains connected and sending data via WIFI when the cellular signal is blocked again.

Below is the log when trying to connect via WIFI without a cellular signal available - Device OS: 5.9.0

And a question: how to identify if the data is being sent by Cell Phone or Wifi, when both are ready

Thank you very much


0000030193 [system.nm] INFO: State changed: IFACE_DOWN -> IFACE_REQUEST_UP
0000030241 [net.ifapi] INFO: Netif wl4 state UP
0000030245 [system.nm] INFO: State changed: IFACE_REQUEST_UP -> IFACE_UP
0000030262 [hal] INFO: rltk_wlan_set_netif_info: 0, 94:94:4a:06:03:80
0000030274 [net.ifapi] INFO: Netif pp3 state UP
0000030394 [hal] INFO: WiFi on
0000030395 [ncp.rltk.client] INFO: rltkOff
0000030703 [hal] INFO: WiFi off
0000030704 [ncp.rltk.client] INFO: rltkOff done
0000030714 [hal] INFO: rltk_wlan_set_netif_info: 0, 94:94:4a:06:03:80
0000030846 [hal] INFO: WiFi on
0000030849 [ncp.rltk.client] INFO: Try to connect to ssid: Cello 2-2.4G
0000035537 [net.ifapi] INFO: Netif wl4 link UP, profile=Cello 2-2.4G
0000035546 [system.nm] INFO: State changed: IFACE_UP -> IFACE_LINK_UP
0000035757 [hal] INFO: DNS server list changed
0000035759 [system.nm] INFO: State changed: IFACE_LINK_UP -> IP_CONFIGURED
0000035799 [system] INFO: Cloud: connecting
0000035820 [system] INFO: Read Server Address = type:1,domain:$id.udp.particle.io
0000035860 [system] WARN: Failed to load session data from persistent storage
0000035894 [system] INFO: Discarding session data
0000036005 [system] INFO: Cloud socket=0, connecting to 52.5.139.123#5684 using if 5
0000036046 [system] INFO: Bound cloud socket to lwip if 5 ("wl4")
0000036078 [system] INFO: Cloud socket connected
0000036100 [system] INFO: Starting handshake: presense_announce=0
0000036131 [comm.protocol.handshake] INFO: Establish secure connection
0000036167 [comm.dtls] INFO: (CMPL,RENEG,NO_SESS,ERR) restoreStatus=2
0000038996 [comm.protocol.handshake] INFO: Sending HELLO message
0000039180 [comm.protocol.handshake] INFO: Handshake completed
0000039209 [comm.dtls] INFO: session cmd (CLS,DIS,MOV,LOD,SAV): 4
0000039238 [comm.dtls] INFO: session cmd (CLS,DIS,MOV,LOD,SAV): 3
0000044521 [ncp.client] ERROR: Failed to perform early initialization
0000074212 [net.pppncp] ERROR: Failed to initialize cellular NCP client: -210

Hey, I believe there are some WiFi fixes on DeviceOS 6.2.0

would you like to try that out jsut to check if the situation improves?

Thanks for the feedback.
But how do I get version 6.2?

Please use:

I updated to @6.2.0 and unfortunately it is behaving the same way.
First successful connection via Cell Phone only

Is the correct WiFi antenna connected to the correct place on the M-SoM?

Can you upload a picture?

See the photos, everything looks fine to me


Do you mean that if you use a hot stpot on your phone the device connects successfully?

I did this test. It has the same behavior.
Namely, Argon has already successfully connected to the same networks.
I can test this again

Yes, I tested it just now and Argon connects quickly to the same network.

maybe @Support can check this out. Thanks.

Looking at the log in the original post:

0000035860 [system] WARN: Failed to load session data from persistent storage

This is normal. It happens whenever you reboot the device.

0000036005 [system] INFO: Cloud socket=0, connecting to 52.5.139.123#5684 using if 5
0000036046 [system] INFO: Bound cloud socket to lwip if 5 ("wl4")
0000036078 [system] INFO: Cloud socket connected

This means DNS works.

0000038996 [comm.protocol.handshake] INFO: Sending HELLO message
0000039180 [comm.protocol.handshake] INFO: Handshake completed

This means it authenticated with the cloud successfully

0000044521 [ncp.client] ERROR: Failed to perform early initialization
0000074212 [net.pppncp] ERROR: Failed to initialize cellular NCP client: -210

These aren't relevant to Wi-Fi; they're cellular messages.

What's missing is the step after handshake completed, namely sending subscriptions and getting the time. Something like this is missing:

0000363187 [system] INFO: Send subscriptions
0000363398 [comm.dtls] INFO: session cmd (CLS,DIS,MOV,LOD,SAV): 4
0000363398 [comm.dtls] INFO: session cmd (CLS,DIS,MOV,LOD,SAV): 3
0000363399 [comm] INFO: Sending TIME request
0000363692 [comm.protocol] INFO: Sending 'M' describe message
0000363937 [comm.protocol] INFO: rcv'd message type=1
0000363937 [system] INFO: Cloud connected

Some possible reasons why the those steps aren't completed:

  • Insufficient power to the M-SoM module to transmit, but enough to prevent brownout reset.
  • Something in the firmware that's preventing cloud processing.
  • Unusual firewall issue, though the hotspot test probably disproves this.
2 Likes

Hi @mbv_arquiduke,
Do you have any cellular specific API calls in your firmware such as Particle.keepAlive()?

Can you try to reproduce the issue with a minimal code example and share it with us?

Thank you all for your support.

Yes, I saw that Particle.keepAlive() is also being used in the wifi connection instance. I don't use it in Argon, should I remove it?

What is the best way to know which connection the data is being sent through? Is there a way?

I will write a minimal code, copy it here and continue testing.
see you soon

Hello friends, successful connection to Wi-Fi.
It happened surprisingly.
When preparing a minimal code to test and share here, I found a method that I created in the first attempt to use Wi-Fi by interrupting the cellular network by setting it to EXTERNAL_SIM ( :roll_eyes:. oops) It was still being called inadvertently.

type or paste code here

Interestingly, the Wi-Fi negotiation apparently only ends fully with the SIM accessed. Does that make sense?

Below is the code & log

#include "ble_wifi_setup_manager.h"
#include "dct.h"

SYSTEM_MODE(MANUAL);
SYSTEM_THREAD(ENABLED);
SerialLogHandler logHandler(LOG_LEVEL_INFO);

bool settingWifi = false;
int W_PIN;

typedef enum
{
  STATE_IDLE = 0,
  STATE_PROVISIONED
} ProvisionStates_t;

ProvisionStates_t provision_state, next_provision_state;

void provisionCb()
{
  provision_state = STATE_PROVISIONED;
}

void setSIM(SimType qual)
{
  Cellular.setActiveSim(qual);
  const uint8_t val = 0x01;
  dct_write_app_data(&val, DCT_SETUP_DONE_OFFSET, 1);
}

void setup()
{
  delay(5000);
  Log.info("setup");
  W_PIN = D3; // WDT PIN
  // SWITCHES
  pinMode(W_PIN, OUTPUT);
  //DIP Switches pins
  pinMode(D6, INPUT_PULLDOWN);
  pinMode(D7, INPUT_PULLDOWN);
  pinMode(D5, INPUT_PULLDOWN);
  pinMode(D4, INPUT_PULLDOWN);
  pinMode(D23, INPUT_PULLDOWN);

//all switches on > config wifi password
  if (digitalRead(D6) && digitalRead(D7) && digitalRead(D5) && digitalRead(D4) && digitalRead(D23))
  {

    bool clearedWifi = WiFi.clearCredentials();
    WiFi.prefer(false);

    settingWifi = true;
    if (clearedWifi)
    {
      Log.info("ok clear wifi Credentials");
    }
    Log.info("config wifi");
    provision_state = STATE_IDLE;
    next_provision_state = STATE_IDLE;

    BLEWiFiSetupManager::instance().setup();
    BLEWiFiSetupManager::instance().setProvisionCallback(provisionCb);

    // misuse  found from first attempt to disable cell!!!
    //setSIM(EXTERNAL_SIM);

  }
}

void loop()
{
  if (settingWifi)
  {

    BLEWiFiSetupManager::instance().loop();
    // State machine to handle WiFi provisioning states
    switch (provision_state)
    {
    case STATE_IDLE:
    {
      next_provision_state = STATE_IDLE;
      break;
    }

    case STATE_PROVISIONED:
    {

      if (WiFi.ready() || WiFi.connecting())
      {
        WiFi.disconnect();
      }
      // WiFi.prefer();
      // STARTUP(WiFi.selectAntenna(ANT_EXTERNAL));
      Particle.connect();
      next_provision_state = STATE_IDLE;
      settingWifi = false;
      break;
    }
    }

    if (provision_state != next_provision_state)
    {
      Log.info("Provision State Transition: %u -> %u", provision_state, next_provision_state);
      provision_state = next_provision_state;
    }

    // iWdt();  hardwarw watchdog
  }
}

0000031526 [app.BLEWiFiSetupManager] INFO: WiFi credentials set
0000031542 [app] INFO: Provision State Transition: 1 -> 0
0000031555 [system.nm] INFO: State changed: IFACE_DOWN -> IFACE_REQUEST_UP
0000031600 [net.ifapi] INFO: Netif wl4 state UP
0000031622 [system.nm] INFO: State changed: IFACE_REQUEST_UP -> IFACE_UP
0000031628 [ncp.rltk.client] INFO: Try to connect to ssid: Cello 2-2.4G
0000031635 [net.ifapi] INFO: Netif pp3 state UP
0000036318 [net.ifapi] INFO: Netif wl4 link UP, profile=Cello 2-2.4G
0000036328 [system.nm] INFO: State changed: IFACE_UP -> IFACE_LINK_UP
0000036461 [hal] INFO: DNS server list changed
0000036467 [system.nm] INFO: State changed: IFACE_LINK_UP -> IP_CONFIGURED
0000036573 [system] INFO: Cloud: connecting
0000036596 [system] INFO: Read Server Address = type:1,domain:$id.udp.particle.io
0000036632 [system] WARN: Failed to load session data from persistent storage
0000036668 [system] INFO: Discarding session data
0000037104 [system] INFO: Cloud socket=0, connecting to 52.45.184.198#5684 using if 5
0000037140 [system] INFO: Bound cloud socket to lwip if 5 ("wl4")
0000037171 [system] INFO: Cloud socket connected
0000037193 [system] INFO: Starting handshake: presense_announce=0
0000037223 [comm.protocol.handshake] INFO: Establish secure connection
0000037256 [comm.dtls] INFO: (CMPL,RENEG,NO_SESS,ERR) restoreStatus=2
0000040171 [comm.protocol.handshake] INFO: Sending HELLO message
0000040354 [comm.protocol.handshake] INFO: Handshake completed
0000040384 [comm.dtls] INFO: session cmd (CLS,DIS,MOV,LOD,SAV): 4
0000040412 [comm.dtls] INFO: session cmd (CLS,DIS,MOV,LOD,SAV): 3
0000042845 [mux] INFO: Starting GSM07.10 muxer
0000042847 [mux] INFO: Opening mux channel 0
0000042847 [mux] INFO: GSM07.10 muxer thread started
0000042950 [mux] INFO: Opening mux channel 1
0000043046 [comm] INFO: Sending TIME request
0000043068 [system] INFO: Send spark/device/last_reset event
0000043105 [system] INFO: Sending application DESCRIBE
0000043134 [system] INFO: Sending subscriptions
0000043157 [comm.protocol] INFO: Sending subscriptions
0000043191 [comm.protocol] INFO: Received DESCRIBE request; flags: 0x04
0000043270 [comm.dtls] INFO: session cmd (CLS,DIS,MOV,LOD,SAV): 4
0000044286 [comm.dtls] INFO: session cmd (CLS,DIS,MOV,LOD,SAV): 3
0000044315 [comm.protocol] INFO: Received TIME response: 1731505751
0000044352 [comm.dtls] INFO: session cmd (CLS,DIS,MOV,LOD,SAV): 4
0000044383 [comm.dtls] INFO: session cmd (CLS,DIS,MOV,LOD,SAV): 3
0000044415 [comm.dtls] INFO: session cmd (CLS,DIS,MOV,LOD,SAV): 4
0000044443 [comm.dtls] INFO: session cmd (CLS,DIS,MOV,LOD,SAV): 3
0000044474 [system] INFO: All handshake messages have been processed
0000044509 [system] INFO: Cloud connected
0000044530 [comm] INFO: Forcing a cloud ping

I don't think that's the reason. The M-SoM doesn't have a SIM switch so setting it to external doesn't do anything. Also remove the code for setting setup done mode. That's not used in any version of Device OS that can be used on the M-SoM.

How are you powering the M-SoM?

My power supply is quite robust, I use a TPS63070 (3A) to regulate the 5V (from 6.4V lifepo4 battery) for the peripherals and the LM26420 (2A) that regulates all the power supply of the Particle devices at the appropriate voltages (3.3V and 3.875V)

**I forgot to say that I removed the Particle.keepAlive() command from the wifi connection procedures.

I don't yet know how to manage keepAlive() because I don't know how to identify which network is connected (cell or wifi). The goal is to have the cellular network as an alternative in case of wifi network outages.