I am getting error on Serial monitor Soft WDT reset. I decoded the error code also and found the following stacktrace.

I am using SIM808 module and DFRobot_sim808 as the library.

0x4010030d: millis at AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.0\cores\esp8266/core_esp8266_wiring.c line 180

0x401003b9: __digitalWrite at AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.0\cores\esp8266/core_esp8266_wiring_digital.c line 82

0x40202863: sim808_wait_for_resp(char const*, DataType, unsigned int, unsigned int) at Documents\Arduino\libraries\DFRobot_SIM808-master/sim808.cpp line 172

0x402027a4: sim808_send_byte(unsigned char) at Documents\Arduino\libraries\DFRobot_SIM808-master/sim808.cpp line 118

0x402028ce: sim808_check_with_cmd(char const*, char const*, DataType, unsigned int, unsigned int) at Documents\Arduino\libraries\DFRobot_SIM808-master/sim808.cpp line 191

0x402025dc: DFRobot_SIM808::init() at Documents\Arduino\libraries\DFRobot_SIM808-master/DFRobot_sim808.cpp line 63

0x402024c1: setup at G:\Development\ESP8266\SIM Module\sim_module/sim_module.ino line 41 (discriminator 1)

0x40203248: loop_wrapper() at AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.0\cores\esp8266/core_esp8266_main.cpp line 122

0x40100e8d: cont_wrapper at AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.0\cores\esp8266/cont.S line 81

I tried to find solution for the same everywhere but none found it. But the same code I am trying on arduino it works but not for ESP8266. I dont have long waiting loop(). But still it gives me error.

Below is the code for the same

#include <DFRobot_sim808.h>
#include <SoftwareSerial.h>

#define PHONE_NUMBER "********"  

#define MESSAGE  "hello,world"

#define PIN_TX D1 
#define PIN_RX D0

SoftwareSerial mySerial(PIN_RX, PIN_TX);
DFRobot_SIM808 sim808(&mySerial);//Connect RX,TX,PWR,

void setup() {

  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB
  while(!sim808.init()) {
      Serial.print("Sim808 init error\r\n");
  Serial.println("Sim808 init success");
  Serial.println("Start to send message ...");


void loop() {


1 Answer 1


The culpret is the SIM808 library. It's not written to work well with the ESP8266.

The problem lies in this function:

boolean sim808_wait_for_resp(const char* resp, DataType type, unsigned int timeout, unsigned int chartimeout)
    int len = strlen(resp);
    int sum = 0;
    unsigned long timerStart, prevChar;    //prevChar is the time when the previous Char has been read.
    timerStart = millis();
    prevChar = 0;
    while(1) {
        if(sim808_check_readable()) {
            char c = serialSIM808->read();
            prevChar = millis();
            sum = (c==resp[sum]) ? sum+1 : 0;
            if(sum == len)break;
        if ((unsigned long) (millis() - timerStart) > timeout * 1000UL) {
            return false;
        //If interchar Timeout => return FALSE. So we can return sooner from this function.
        if (((unsigned long) (millis() - prevChar) > chartimeout) && (prevChar != 0)) {
            return false;

    //If is a CMD, we will finish to read buffer.
    if(type == CMD) sim808_flush_serial();
    return true;

It has a loop that can take some time to run, and it doesn't yield() at any point to allow the ESP8266's housekeeping routines to run and "kick the dog".

Adding a call to yield() inside the while(1) loop should cure the problem.

  • Thank you very much. It worked. Really appreciated. But I am facing I more issue after 10-12 "Sim808 init error" I receive success why is it so why it does not get initialised in first attempt. Sep 8, 2019 at 4:32
  • Probably waiting to connect to the network. That can take up to a minute sometimes.
    – Majenko
    Sep 8, 2019 at 8:41
  • Thanks for the reply. Nothing to bother. There was some contact issue between Gnd Pins of both modules. Sep 9, 2019 at 10:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.