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 4.2k 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

    Y 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

      Y Offline
      Y 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
      • Y 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
        • H Offline
          H 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
          • H 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

            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

            With your input, this post could be even better 💗

            Register Login
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            28

            Online

            12.0k

            Users

            11.2k

            Topics

            113.4k

            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