Cellular.connecting and deepsleep


Has anyone had issues with putting an e0 U260 into deep sleep while Cellular.connecting is true?

My code goes to sleep and wakes up as expected when my e0 successfully connects to the cloud.

However when I disconnect the antenna from the e0. It’ll go deep sleep but it never wakes up and hard faults.

Any thoughts to why disconnecting the antenna and going to deep sleep would cause it to hard fault?


@wesner0019, it’s never good practice to remove the antenna on a transmitter though in the case of the Electron, I have not had any problems doing so when the power is off. Are you taking the antenna off after the device has gone to sleep? Speaking to a couple of engineers here at Particle, they don’t see any reason for the hard fault under those conditions. I assume if you replace the antenna, everything works again?


This library may allow you to see what actually happening via the log output.


I am trying to simulate a situation where the electron can’t connect to a cellular network, so that I can test my code for when that happens. The only way I could find so that it didn’t connect was when I removed the antenna before powering it on.

I’ll look into that debug code.


you can try using

  if (const  char* newSerialMessage = checkForNewSerialMessage(Serial, '\n')) {
    if (strstr(newSerialMessage, "ON")) {
      Serial.println("********** Cellular now ON **********");
    } else if (strstr(newSerialMessage, "OFF")) {
      Serial.println("********** Cellular now OFF *********");


  const char* checkForNewSerialMessage(Stream& stream, const char endMarker) {
    static char incomingMessage[MAX_MESSAGE_LENGTH_BYTES] = "";
    static byte idx = 0;
    if(stream.available()) {
      incomingMessage[idx] = stream.read();
      if(incomingMessage[idx] == endMarker) {
        incomingMessage[idx] = '\0';
        idx = 0;
        return incomingMessage;
      } else {
        if(idx > MAX_MESSAGE_LENGTH_BYTES - 1) {
          //stream.print(F("{\"error\":\"message too long\"}\n"));  //you can send an error to sender here
          idx = 0;
          incomingMessage[idx] = '\0';
    return nullptr;

via Serial to test without cellular.