Electron code stops after sending and sms


I have been using Electron’s for the past three years sending text messages from remotes units with third party sims with great success, but after upgrading to OS 1.4.4 the code just stops after any sms is send. The serial output also stops so that it is impossible to try and follow the problem.

Help would be appreciated.

Found the problem - Also changed to a new carrier for a new client and its seems the carrier’s response is the problem. The current carrier simcards work fine, but the new carrier not. - Will investigate further…

1 Like

particle update
particle doctor
Workbench re-install
The following code just freezes the Electron after the CTRL Z is sended ?

#include "cellular_hal.h"
#include "math.h"
#include "application.h"

#define TIMEOUT 1000
#define CTRL_Z 0x1A
char szReturn[32] = "";
char szCmd[64];
int counter = 0;
SerialLogHandler logHandler(LOG_LEVEL_ALL); 
String command;


void setup() 
  Serial.println("Modem on");
  Serial.println("Wait 15 sek for registration 1237");
  int t = 15;
  while (t > 1)
    t = t - 1;
  Serial.println(" Step 1");


void loop() 
  Serial.println(" Step 2");
  if  (counter < 3)
    counter = counter + 1;
    Serial.print("Counter = ");
    //Send sms
    Cellular.command(callback, szReturn, TIMEOUT, "ATZ\r\n"); 
    Cellular.command(callback, szReturn, TIMEOUT, "AT+CMGF=1\r\n");
    command = "";
    command.concat("Test - 06:32\r\n");
    Serial.println("CMGS - number");
    Cellular.command(callback, szReturn, TIMEOUT,  "AT+CMGS="999999999999999"\r\n");
    Cellular.command(callback, szReturn, TIMEOUT, command);
    Cellular.command(callback, szReturn, TIMEOUT, "\x1a");
    //  Serial.println("ctrlz");
    //  sprintf(szCmd, "%c", CTRL_Z);
    //  Cellular.command(callback, szReturn, TIMEOUT, szCmd);
    //  delay(1000);
  Serial.println("Wait 1 second");

// //&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&

// // Read all the responses from modem after any AT command
// int callbackraw(int type, const char* buf, int len, char* param)
// {
//   Serial.write((const uint8_t*)buf, len);
//   //Serial.println();
//   delay(100);
//   return WAIT;
// }


// Read all the responses from modem after any AT command
int callback(int type, const char* buf, int len, char* param)
  return WAIT;


I have reformatted your code so that it displays correctly as code block and also replaced the typographic double-quotes with normal ones to make the code build again.

Also application.h should no be Particle.h.
It may also be helpful to catch the return value of the Cellular.command() calls and investigate the data that’s passed to the callback() function.
You also have SerialLogHandler logHandler(LOG_LEVEL_ALL) so having a look at its output may also help understanding the issue a bit better.

Also application.h should no be Particle.h . - Thanks a lot, this solved the Electron freezing.

The other issue was the serial output that stopped after a few seconds but was solved by this

  1. install the required build tooling as described here (but don’t try to run npm i )
  2. rm -rf ~/.particle/node_modules
  3. particle update-cli
1 Like

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