Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Troubleshooting
  3. ESP8266 Unexpected Crash or Reset

ESP8266 Unexpected Crash or Reset

Scheduled Pinned Locked Moved Troubleshooting
5 Posts 3 Posters 3.8k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • AffordableTechA Offline
    AffordableTechA Offline
    AffordableTech
    wrote on last edited by
    #1

    I had problems with the ESP8266 Gateway crashing and resetting every few minutes with an "Exception(28)".

    After lots of searching, I found it was a problem in the 'core driver' in the MySensors library (1.51).

    The Fix:

    • Open the "MyMessage.cpp" file in your "...\Arduino\libraries\MySensors" folder.
    • Search for the "MyMessage& MyMessage::set(const char* value)" function (WARNING: there are several similar names).
    • Comment the existing code out and add replacement as illustrated below.
    /*  COMMENT OUT THE OLD FUNCTION
    MyMessage& MyMessage::set(const char* value) {
    	uint8_t length = min(strlen(value), MAX_PAYLOAD);
    	miSetLength(length);
    	miSetPayloadType(P_STRING);
    	strncpy(data, value, length);
    	return *this;
    }
    */
    
    /*   INSERT THE FOLLOWING IN ITS PLACE   */
    MyMessage& MyMessage::set(const char* value) {
    	uint8_t length = value == NULL ? 0 : min(strlen(value), MAX_PAYLOAD);
    	miSetLength(length);
    	miSetPayloadType(P_STRING);
    	if (length) {		
    		strncpy(data, value, length);
    	}
    	// null terminate string
    	data[length] = 0;
    	return *this;
    }
    

    If you compile any MySensors ESP8266 project, the library will be rebuilt and with a bit of luck the crashes will vanish.

    Paul

    YveauxY 1 Reply Last reply
    0
    • AffordableTechA AffordableTech

      I had problems with the ESP8266 Gateway crashing and resetting every few minutes with an "Exception(28)".

      After lots of searching, I found it was a problem in the 'core driver' in the MySensors library (1.51).

      The Fix:

      • Open the "MyMessage.cpp" file in your "...\Arduino\libraries\MySensors" folder.
      • Search for the "MyMessage& MyMessage::set(const char* value)" function (WARNING: there are several similar names).
      • Comment the existing code out and add replacement as illustrated below.
      /*  COMMENT OUT THE OLD FUNCTION
      MyMessage& MyMessage::set(const char* value) {
      	uint8_t length = min(strlen(value), MAX_PAYLOAD);
      	miSetLength(length);
      	miSetPayloadType(P_STRING);
      	strncpy(data, value, length);
      	return *this;
      }
      */
      
      /*   INSERT THE FOLLOWING IN ITS PLACE   */
      MyMessage& MyMessage::set(const char* value) {
      	uint8_t length = value == NULL ? 0 : min(strlen(value), MAX_PAYLOAD);
      	miSetLength(length);
      	miSetPayloadType(P_STRING);
      	if (length) {		
      		strncpy(data, value, length);
      	}
      	// null terminate string
      	data[length] = 0;
      	return *this;
      }
      

      If you compile any MySensors ESP8266 project, the library will be rebuilt and with a bit of luck the crashes will vanish.

      Paul

      YveauxY Offline
      YveauxY Offline
      Yveaux
      Mod
      wrote on last edited by
      #2

      @AffordableTech So, concluding, the set-method will crash when called with a null-pointer.
      Does your sketch call it with a null-pointer, or does the MySensors library pass it somewhere along the road?

      http://yveaux.blogspot.nl

      AffordableTechA 1 Reply Last reply
      0
      • YveauxY Yveaux

        @AffordableTech So, concluding, the set-method will crash when called with a null-pointer.
        Does your sketch call it with a null-pointer, or does the MySensors library pass it somewhere along the road?

        AffordableTechA Offline
        AffordableTechA Offline
        AffordableTech
        wrote on last edited by
        #3

        @Yveaux

        Yes, I believe it happens when a client connects with no message, it causes a memory fault (loss); after several such connections the stack is exhausted and the ESP8266 crashes (and reboots).

        This cured my crashes, but I'm sure there are many other possibilities for an Exception(28).

        1 Reply Last reply
        0
        • hekH Offline
          hekH Offline
          hek
          Admin
          wrote on last edited by
          #4

          This has been fixed in development branch. It was never backported.

          AffordableTechA 1 Reply Last reply
          0
          • hekH hek

            This has been fixed in development branch. It was never backported.

            AffordableTechA Offline
            AffordableTechA Offline
            AffordableTech
            wrote on last edited by
            #5

            @hek

            Yes, as I gathered, but I have too many sensors on 1.5.1 and don't want to upgrade them to 2.0 while its not an official release.

            I posted it because there are probably others on 1.5.1 with the problem, but can't find a fix.

            Cheers...

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            17

            Online

            11.7k

            Users

            11.2k

            Topics

            113.1k

            Posts


            Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • MySensors
            • OpenHardware.io
            • Categories
            • Recent
            • Tags
            • Popular