Electron code stops after sending and sms


#1

Hi,

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.


#2

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…


#3

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

#include "cellular_hal.h"
#include "math.h"
#include "application.h"
SYSTEM_MODE(MANUAL);
STARTUP(System.enableFeature(FEATURE_RESET_INFO));

#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.begin(9600);
  delay(1000);
  //Serial.flush();
  //delay(2000);
  Serial.println("Modem on");
  Cellular.on();
  Serial.println("Wait 15 sek for registration 1237");
  int t = 15;
  while (t > 1)
  {
    t = t - 1;
    Serial.println(t);
    delay(1000);
  }
  Serial.println(" Step 1");
}

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

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

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

// // 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)
{
  //Serial.println("callbackraw");
  //delay(100);
  return WAIT;
}

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

#4

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.


#5

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