Can't SoftAP to new WiFi network after upgrade to system 0.7

Hello,

We are troubleshooting an issue where we are unable to connect to a new WiFi network using SoftAP with our P1’s that have been updated to system firmware 0.7.

This only happens when our application binary is loaded. If we are running tinker, it takes the new wifi credentials normally (using softap or the CLI tool). Our application binary appears to run normally otherwise.

There are two cases, but I think it’s really the same root cause of the new credentials not being saved:

Case 1: No credentials previously saved

  1. P1 boots into listening mode, LED starts flashing dark blue
  2. Connect using SoftAP, send in the desired credentials
  3. P1 restarts, goes immediately into listening mode again with dark blue flashing LED

Case 2: Credentials previously saved (for a network that is not visible)

  1. P1 boots into flashing green mode, trying to connect to the old WiFi network
  2. Put the P1 into listening mode, LED starts flashing dark blue
  3. Connect using SoftAP, send in desired credentials
  4. P1 restarts, goes into flashing green again, still trying to connect to old WiFi network

listening to the device over USB serial connection, when we save the credentials we do get a system message saying it saved the new credentials before it resets.

Any clues as to what could be going wrong? This seems somewhat related to the issue discussed here: Update to 0.7.0 goes wrong however it does appear that the upgrade to 0.7 went well. If we set the wifi credentials while the P1 is running tinker, it can connect to the wifi and cloud no problem. The only issue as far as I can tell is the failure to save new credentials.

Here’s what I get when I do a particle serial inspect:

particle serial inspect 
Platform: 8 - P1
Modules
  Bootloader module #0 - version 101, main location, 16384 bytes max size
    Integrity: PASS
    Address Range: PASS
    Platform: PASS
    Dependencies: PASS
  System module #1 - version 207, main location, 262144 bytes max size
    Integrity: PASS
    Address Range: PASS
    Platform: PASS
    Dependencies: PASS
  System module #2 - version 207, main location, 262144 bytes max size
    Integrity: PASS
    Address Range: PASS
    Platform: PASS
    Dependencies: PASS
      System module #1 - version 207
      Bootloader module #0 - version 7
  User module #1 - version 2, main location, 131072 bytes max size
    UUID: 14D591F52CC90D5896B955DFF02FB415EE5D3BB86A0B35D13483814F2E6FD26A
    Integrity: PASS
    Address Range: PASS
    Platform: PASS
    Dependencies: PASS
      System module #2 - version 3
  User module #1 - version 3, factory location, 131072 bytes max size
    UUID: FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
    Integrity: PASS
    Address Range: PASS
    Platform: PASS
    Dependencies: PASS
      System module #2 - version 11

If the system update is the only thing that changed I’d suspect an issue with too little free RAM.
SoftAP requires 21+ KBfree space before engaging.

Thanks for the reply @ScruffR . In our normal application, we typically have around 32K of free memory prior to engaging listening mode. After listening mode is engaged, it looks like free memory drops to around 15k. Then when the soft AP client connects it drops further.

When you say SoftAP requires 21K free memory, are you referring to before the WiFi listening mode is enaged, or after it’s already engaged and before the softap client connects?

I made a branch of our code and went through and turned off / commented out as much as I could and was able to get it to take the new credentials. In this case, I started out with 37488 free memory prior to listening mode, it dropped to 17120 after the client connected, and then dropped to 12936 when the credentials were passed in. It then connected to the new network immediately without restarting.

The problem of course is that I’ve removed all the guts of my application! About all that’s left is the Soft AP controller and some output log messages. I had issues with memory usage in 0.6.x, but I was able to run my entire app including some large statically allocated struct buffers. Does 0.7 just require a lot more memory for the system code?

If that’s the case we will probably have to downgrade to 0.6.2.

It should be before, but depending on your (customised) SoftAP page you may need more.

You could give 0.8.0-rc.11 a try. It should have some lighter footprint on memory than 0.7.0

BTW, for Photon 0.6.3 should be the better than 0.6.2

Thanks. We aren’t using any custom softap pages, we just put the P1 into listening mode and use the softap-setup-js library to connect via our mobile app. So it’s all using the HTTP API and our custom UI.

I tried downgrading to 0.6.3 and things are working great again. With the same user application, I have about 40k free memory prior to listening mode, 23k available after entering listening mode, and the credentials save correctly.

We’ll just stick with 0.6.3!

Just a note according that

Due to the residual effects of SoftAP (which should be addressed by Particle IMO) it might be best to finish the process with a System.reset() call to properly free up the memory occupied by SoftAP.
I've read another thread where a subsequent SoftAP attempt crashes - probably due to SoftAP not reusing the allocated memory but rather acquiring new space.

@andrewa @scruffR I can confirm that repeated use of SoftAP with 0.8.0-RC.10 will drop the free memory to a level that causes a photon to hang when trying to save the credentials - my watchdog logged the freememory as around 17300 bytes at this point. Typically when running the free memory is around 43000.