Problems Connecting To The Cloud

Hi!, i have an electron which is acting strange. i am using a 3rd party sim and after i flashed the correct firmware it tries to connect but not always succeeds. it sometimes does connect to the cloud and i can use it just fine although i still get some problems, for example after a while it just stops communicating even tough the led shows that its connected and i have to manually reboot it to get it working again. if i get unlucky it just doesnt connect, it keeps flashing green and after quite a lot of time it breathes blue and immediately restarts. to fix this i have to re-flash the firmware which is a huge pain.

any help is greatly appreciated!

Are you setting Particle.keepAlive() correctly?

i have never used Particle.keepAlive(), what is it needed for?

thanks

https://docs.particle.io/reference/device-os/firmware/electron/#particle-keepalive-

Thanks,

i’ll try that out!

that solved the first problem! although i’m still having trouble. it just refuses to connect again after around 5 successful connections, i have good reception where i am so this shouldn’t be happening, it just repeats this pattern and i have to re-flash it to get it working again, here is a video

Reflashing probably isn't the actual resolution.
Although we don't know what your code does, it's highly unlikely that your code can do anything to corrupt the firmware on the device which would need to be repaired.

There are probably other factors that come along when reflashing that allow your device to reconnect.

We also don't know how your cell provider likes the behaviour of your device. It might well be that your code does something that causes your cell provider to temporarily blacklist your device and the time it takes to realise the issue and reflash the firmware might be enough for that blacklist to phase out.

i’m running the default wireless led example, although i’m pretty sure that it’s not getting blacklisted, this is due to the fact that it takes me around 2 minutes for me to flash it so i’m pretty sure that the blacklist didn’t phase out in those 2 minutes. to add to that i re-flashed around 3 times so it would be a huge coincidence if each time the blacklisting phased out in those 2 minutes.

something i forgot to say was that after i power it / reboot it the red led at the top flashes around 5 times quickly and then another 4 times slower, this didn’t happen when it was still working fine.

could unplugging the power without shutting it down through software corrupt it?

thanks!

Unplugging while you are reflashing the device would probably not be a good idea, but during normal process you won't corrupt the firmware by just unplugging it.

That red LED next to the LiPo connector at the top is the charging indicator or do you mean the RGB LED blinking red?
If it's infact the RGB LED blinking this way it sounds like a panic reset (SOS ... --- ...) which would account for 9 flashes followed by some more flashes that indicate the reason for the fault.
https://docs.particle.io/tutorials/device-os/led/electron/#red-flash-sos

no the rgb led doesn’t blink red, the charging indicator does so i guess it doesn’t really have anything to do with the problem.

You may want to flash the cloud debug code to your electron and post the output here

Sorry for the late response. I did that, here’s the output, i edited it a bit so i don’t show some of the sim info.

this only occurs after i unplug power, it doesn’t occur when i hit the reset button

starting tests...
turning cellular on...
attempting to connect to the cellular network...
0000021332 [system] INFO: Sim Ready
0000021332 [system] INFO: Sim Ready
0000021333 [system] INFO: ARM_WLAN_WD 1
0000021333 [system] INFO: ARM_WLAN_WD 1

[ Modem::register ] = = = = = = = = = = = = = =
    21.334 AT send      10 "AT+CREG?\r\n"
    21.344 AT read  +   14 "\r\n+CREG: 0,1\r\n"
    21.354 AT read OK    6 "\r\nOK\r\n"
    21.354 AT send      11 "AT+CGREG?\r\n"
    21.364 AT read  +   15 "\r\n+CGREG: 0,1\r\n"
    21.374 AT read OK    6 "\r\nOK\r\n"
    21.374 AT send      10 "AT+COPS?\r\n"
    21.394 AT read  +   32 "\r\n+COPS: 0,0,\"VodafoneMalta\",2\r\n"
    21.404 AT read OK    6 "\r\nOK\r\n"
    21.404 AT send       8 "AT+CSQ\r\n"
    21.414 AT read  +   14 "\r\n+CSQ: 11,1\r\n"
    21.424 AT read OK    6 "\r\nOK\r\n"

[ Modem::join ] = = = = = = = = = = = = = = = =
    21.424 AT send      12 "AT+CGATT=1\r\n"
    21.435 AT read OK    6 "\r\nOK\r\n"
    21.435 AT send      14 "AT+UPSND=0,8\r\n"
    21.445 AT read  +   17 "\r\n+UPSND: 0,8,0\r\n"
    21.455 AT read OK    6 "\r\nOK\r\n"
    21.455 AT send      23 "AT+UPSD=0,7,\"0.0.0.0\"\r\n"
    21.465 AT read ERR  37 "\r\n+CME ERROR: operation not allowed\r\n"
0000051335 [system] WARN: Resetting WLAN due to WLAN_WD_TO()
0000051335 [system] WARN: Resetting WLAN due to WLAN_WD_TO()

[ Modem::powerOff ] = = = = = = = = = = = = = =
    51.335 AT send      12 "AT+CPWROFF\r\n"
    51.335 AT read  +   14 "\r\n+UUPSDA: 0\r\n"
    51.346 AT read  +   14 "\r\n+CIEV: 2,1\r\n"
    57.396 AT read OK    6 "\r\nOK\r\n"
[ ElectronSerialPipe::begin ] = = = = = = = =

[ Modem::powerOn ] = = = = = = = = = = = = = =
    58.706 AT send       4 "AT\r\n"
    60.026 AT send       4 "AT\r\n"
    60.556 AT read UNK   6 "ATT=1\r"
    60.566 AT read ERR   9 "\r\nERROR\r\n"
    60.876 AT send       4 "AT\r\n"
    60.886 AT read UNK   3 "AT\r"
    60.896 AT read OK    6 "\r\nOK\r\n"
    60.896 AT send       9 "AT+CGMM\r\n"
    60.906 AT read UNK   8 "AT+CGMM\r"
    60.916 AT read UNK  13 "\r\nSARA-U270\r\n"
    60.926 AT read OK    6 "\r\nOK\r\n"
    61.136 AT send       7 "AT E0\r\n"
    61.146 AT read UNK   6 "AT E0\r"
    61.156 AT read OK    6 "\r\nOK\r\n"
    61.156 AT send      11 "AT+CMEE=2\r\n"
    61.166 AT read OK    6 "\r\nOK\r\n"
    61.166 AT send      19 "AT+CMER=1,0,0,2,1\r\n"
    61.176 AT read OK    6 "\r\nOK\r\n"
    61.176 AT send      15 "AT+IPR=115200\r\n"
    61.186 AT read OK    6 "\r\nOK\r\n"
    61.286 AT send      10 "AT+CPIN?\r\n"
    61.296 AT read  +   16 "\r\n+CPIN: READY\r\n"
    61.306 AT read OK    6 "\r\nOK\r\n"

[ Modem::init ] = = = = = = = = = = = = = = =
    61.306 AT send       9 "AT+CGSN\r\n"
    61.327 AT read UNK  19 "\r\n(blanked out for privacy reasons)\r\n"
    61.337 AT read OK    6 "\r\nOK\r\n"
    61.337 AT send       9 "AT+CGMI\r\n"
    61.347 AT read UNK  10 "\r\nu-blox\r\n"
    61.357 AT read OK    6 "\r\nOK\r\n"
    61.357 AT send       9 "AT+CGMR\r\n"
    61.367 AT read UNK   9 "\r\n23.20\r\n"
    61.377 AT read OK    6 "\r\nOK\r\n"
    61.377 AT send       9 "AT+CCID\r\n"
    61.387 AT read  +   30 "\r\n+CCID: (blanked out for privacy reasons)\r\n"
    61.397 AT read OK    6 "\r\nOK\r\n"
    61.397 AT send      11 "AT+UPSV=1\r\n"
    61.407 AT read OK    6 "\r\nOK\r\n"
    61.407 AT send      11 "AT+CMGF=1\r\n"
    61.417 AT read OK    6 "\r\nOK\r\n"
    61.417 AT send      13 "AT+CNMI=2,1\r\n"
    61.427 AT read OK    6 "\r\nOK\r\n"
    61.427 AT send       9 "AT+CIMI\r\n"
    61.437 AT read UNK  19 "\r\n(blanked out for privacy reasons)\r\n"
    61.447 AT read OK    6 "\r\nOK\r\n"
0000061448 [system] INFO: Sim Ready
0000061448 [system] INFO: Sim Ready
0000061449 [system] INFO: ARM_WLAN_WD 1
0000061449 [system] INFO: ARM_WLAN_WD 1

[ Modem::register ] = = = = = = = = = = = = = =
    61.448 AT send      10 "AT+CREG?\r\n"
    61.459 AT read  +   14 "\r\n+CREG: 0,0\r\n"
    61.469 AT read OK    6 "\r\nOK\r\n"
    61.469 AT send      11 "AT+CGREG?\r\n"
    61.479 AT read  +   15 "\r\n+CGREG: 0,0\r\n"
    61.489 AT read OK    6 "\r\nOK\r\n"
    61.489 AT send      10 "AT+URAT?\r\n"
    61.499 AT read  +   14 "\r\n+URAT: 1,2\r\n"
    61.509 AT read OK    6 "\r\nOK\r\n"
    61.509 AT send      12 "AT+CGREG=2\r\n"
    61.519 AT read OK    6 "\r\nOK\r\n"
    61.519 AT send      11 "AT+CREG=2\r\n"
    61.529 AT read OK    6 "\r\nOK\r\n"
    61.529 AT send      10 "AT+CREG?\r\n"
    61.539 AT read  +   14 "\r\n+CREG: 2,0\r\n"
    61.549 AT read OK    6 "\r\nOK\r\n"
    61.549 AT send      11 "AT+CGREG?\r\n"
    61.559 AT read  +   15 "\r\n+CGREG: 2,0\r\n"
    61.569 AT read OK    6 "\r\nOK\r\n"
    76.569 AT send      10 "AT+CREG?\r\n"
    76.569 AT read  +   14 "\r\n+CIEV: 5,1\r\n"
    76.579 AT read  +   14 "\r\n+CIEV: 2,1\r\n"
    76.589 AT read  +   30 "\r\n+CREG: 1,\"46B5\",\"6095AB\",2\r\n"
    76.599 AT read  +   36 "\r\n+CGREG: 1,\"46B5\",\"6095AB\",2,\"13\"\r\n"
    76.610 AT read  +   14 "\r\n+CIEV: 3,1\r\n"
    76.620 AT read  +   14 "\r\n+CIEV: 7,0\r\n"
    76.630 AT read  +   14 "\r\n+CIEV: 9,2\r\n"
CIEV matched: 9,2
    77.640 AT read  +   32 "\r\n+CREG: 2,1,\"46B5\",\"6095AB\",2\r\n"
    77.650 AT read OK    6 "\r\nOK\r\n"
    77.650 AT send      11 "AT+CGREG?\r\n"
    77.660 AT read  +   38 "\r\n+CGREG: 2,1,\"46B5\",\"6095AB\",2,\"13\"\r\n"
    77.671 AT read OK    6 "\r\nOK\r\n"
    77.671 AT send      10 "AT+COPS?\r\n"
    77.691 AT read  +   32 "\r\n+COPS: 0,0,\"VodafoneMalta\",2\r\n"
    77.701 AT read OK    6 "\r\nOK\r\n"
    77.701 AT send       8 "AT+CSQ\r\n"
    77.711 AT read  +   13 "\r\n+CSQ: 9,1\r\n"
    77.721 AT read OK    6 "\r\nOK\r\n"

[ Modem::join ] = = = = = = = = = = = = = = = =
    77.721 AT send      12 "AT+CGATT=1\r\n"
    77.732 AT read OK    6 "\r\nOK\r\n"
    77.732 AT send      14 "AT+UPSND=0,8\r\n"
    77.742 AT read  +   17 "\r\n+UPSND: 0,8,0\r\n"
    77.752 AT read OK    6 "\r\nOK\r\n"
    77.752 AT send      23 "AT+UPSD=0,7,\"0.0.0.0\"\r\n"
    77.762 AT read OK    6 "\r\nOK\r\n"
    77.762 AT send      36 "AT+UPSD=0,1,\"spark.telefonica.com\"\r\n"
    77.773 AT read OK    6 "\r\nOK\r\n"
    77.773 AT send      15 "AT+UPSD=0,6,0\r\n"
    77.783 AT read OK    6 "\r\nOK\r\n"
    77.783 AT send      14 "AT+UPSDA=0,3\r\n"
    79.823 AT read ERR  38 "\r\n+CME ERROR: Service not subscribed\r\n"
    79.823 AT send      15 "AT+UPSD=0,6,1\r\n"
    79.834 AT read OK    6 "\r\nOK\r\n"
    79.834 AT send      14 "AT+UPSDA=0,3\r\n"
   112.004 AT read ERR  38 "\r\n+CME ERROR: Service not subscribed\r\n"
   112.004 AT send      15 "AT+UPSD=0,6,2\r\n"
   112.005 AT read  +   14 "\r\n+CIEV: 2,2\r\n"
   112.016 AT read  +   14 "\r\n+CIEV: 2,1\r\n"
   112.026 AT read OK    6 "\r\nOK\r\n"
   112.026 AT send      14 "AT+UPSDA=0,3\r\n"
   144.236 AT read ERR  38 "\r\n+CME ERROR: Service not subscribed\r\n"
Your modem APN/password/username may be wrong

0000144238 [system] WARN: Resetting WLAN due to WLAN_WD_TO()
0000144238 [system] WARN: Resetting WLAN due to WLAN_WD_TO()

[ Modem::powerOff ] = = = = = = = = = = = = = =
   144.238 AT send      12 "AT+CPWROFF\r\n"
   144.238 AT read  +   30 "\r\n+CREG: 1,\"46B5\",\"608223\",2\r\n"
   144.249 AT read  +   36 "\r\n+CGREG: 1,\"46B5\",\"608223\",2,\"13\"\r\n"
   144.260 AT read  +   30 "\r\n+CREG: 1,\"46B5\",\"6095AB\",2\r\n"
   144.270 AT read  +   36 "\r\n+CGREG: 1,\"46B5\",\"6095AB\",2,\"13\"\r\n"
   144.281 AT read  +   14 "\r\n+CIEV: 2,2\r\n"
   144.291 AT read  +   14 "\r\n+CIEV: 2,1\r\n"
   144.301 AT read  +   14 "\r\n+CIEV: 2,2\r\n"
   145.411 AT read OK    6 "\r\nOK\r\n"

This seems to be the issue. Did you set the APN name and password in your application?

not sure, what application are you refering to exactly? i did set the correct apn name when downloading the firmware for my 3rd party sim.

@ascii, do you have a line similar to this in your firmware (with your APN, etc):

// Connects to a cellular network with a specified APN, USERNAME and PASSWORD
#include “cellular_hal.h”
STARTUP(cellular_credentials_set(APN, USERNAME, PASSWORD, NULL));

how do i open the firmware bin file and search for that line? i downloaded the firm from the official particle setup page.

@ascii, what application is your Electron running? The firmware bin file is the compiled version of the application so you can’t “open it”. You need to show the application you are compiling.

i don’t know what it’s name is, i downloaded it from here, i inserted the correct APN name which in my case is “internet” and hit download

@ascii, I see. The application is “Tinker” which that configuration created and downloaded for you. Unfortunately, it seems the APN, username or password you supplied are incorrect for your 3rd party SIM. It may have changed from the one Particle has on file. What provider are you using?

Vodafone