Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TinyGSM function (modem.gprsConnect(...)) reset Wemos D1 mini (ESP8266) - Soft WDT reset problem #783

Open
Engine1992 opened this issue Feb 25, 2024 · 0 comments

Comments

@Engine1992
Copy link

Engine1992 commented Feb 25, 2024

[x] Question or request for help

Modem: SIM800L
Main processor board: WEMOS D1 Mini (ESP8266)
TinyGSM version: 0.11.7
Code:

 #define TINY_GSM_MODEM_SIM800
 #include <TinyGsmClient.h>
 #include <Firebase_ESP_Client.h>
 #include <Ultrasonic.h>
 #include <SoftwareSerial.h>
 
 // Provide the token generation process info.
 #include "addons/TokenHelper.h"
 // Provide the RTDB payload printing info and other helper functions.
 #include "addons/RTDBHelper.h"
 
 // Pin configuratuin for Ultrasonic Sensor
 #define TRIG_PIN D2
 #define ECHO_PIN D1
 float distance = 0;
 Ultrasonic ultrasonic(TRIG_PIN, ECHO_PIN);

 // Var for voltage metter
 int voltageValue;
 float voltage;
 
 // Insert Firebase project API Key
 #define API_KEY ""
 
 // Insert RTDB URL
 #define DATABASE_URL ""
 
 // Define Firebase Data object
 FirebaseData fbdo;
 
 FirebaseAuth auth;
 FirebaseConfig config;
 
 // Pin configuration for SIM800L
 SoftwareSerial SIM800L_Serial(12, 13, false, 128);
 
 // Your SIM card PIN
 #define SIM_PIN ""
 
 // APN settings for your mobile network provider
 #define GPRS_APN "internet"
 #define GPRS_LOGIN ""
 #define GPRS_PASSWORD ""
 
 TinyGsm modem(SIM800L_Serial);
 //TinyGsmClient client(modem);
 
 unsigned long sendDataPrevMillis = 0;
 int count = 0;
 bool signupOK = false;
 
 void setup() {
   Serial.begin(115200);
   delay(10);
   Serial.println("Started Serial");
   SIM800L_Serial.begin(115200);
   delay(3000); // Give SIM800L some time to initialize
   Serial.println("Started SIM800L Serial");
   // Unlock SIM card with PIN
   modem.simUnlock(SIM_PIN);
 }
 
 void loop() {
 
   distance = ultrasonic.read();
   voltageValue = analogRead(A0);
   voltage = voltageValue * (7.2 / 1023.0)*2;
 
   Serial.print("Distance: ");
   Serial.print(distance);
   Serial.println(" cm");
 
   Serial.print("Voltage: ");
   Serial.print(voltage);
   Serial.println(" V");
 
   //Send data through GPRS (SIM800L)
   sendDataThroughGPRS();
 }

 void sendDataThroughGPRS() {
   Serial.println("Connecting to GPRS");
   if (modem.gprsConnect(GPRS_APN, GPRS_LOGIN, GPRS_PASSWORD)) {
   Serial.println("Connected to GPRS");
 }
}

Scenario, steps to reproduce

  • Arduino IDE - LOLIN(WEMOS) D1 R2 mini board
  • Serial speed 115200
  • SIM800L connection to Wemos D1 mini (SIM800L RX to D6 and TX to D7)
  • SIM800L powered by 2x 18650 3.7v batteries through a voltage regulator (5V)
  • Wemos D1 powered by USB
  • SIM800L is connected to network (status LED flashes every 3 seconds).
  • SIM PIN is disabled

Expected result

I want to make SIM800L works with ESP8266 and finally sent data to Firebase via GPRS.

Actual result

Sensor readings work and are displayed in SERIAL. When I try to call the "modem.gprsConnect(GPRS_APN, GPRS_LOGIN, GPRS_PASSWORD)" function, I get an error "Soft WDT reset":

  • 23:02:58.198 -> ������n��r��n|� l � l��b��� b�r��l�nB�n� l���r�l�l�� �Started standard Serial
  • 23:03:01.242 -> Started SIM800L Serial
  • 23:03:01.242 -> Distance: 25.00 cm
  • 23:03:01.242 -> Voltage: 6.97 V
  • 23:03:01.242 -> Connecting to GPRS
  • 23:03:03.111 ->
  • 23:03:03.111 -> --------------- CUT HERE FOR EXCEPTION DECODER ---------------
  • 23:03:03.143 ->
  • 23:03:03.143 -> Soft WDT reset
  • 23:03:03.143 ->
  • 23:03:03.143 -> Exception (4):
  • 23:03:03.143 -> epc1=0x402156ee epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000
  • 23:03:03.143 ->
  • 23:03:03.143 -> >>>stack>>>
  • 23:03:03.143 ->
  • 23:03:03.143 -> ctx: cont
  • 23:03:03.143 -> sp: 3fff0790 end: 3fff09d0 offset: 0160
  • 23:03:03.143 -> 3fff08f0: 00000000 00000c17 31eb851e 000dfad1
  • 23:03:03.143 -> 3fff0900: 3ffe8c01 00000000 00000c17 0000ea60
  • 23:03:03.143 -> 3fff0910: 3fffdad0 00000000 00000c17 00000000
  • 23:03:03.175 -> 3fff0920: 3ffe8c09 3ffe8c01 3ffeedf4 40209223
  • 23:03:03.175 -> 3fff0930: 00000000 00000000 3ffeee10 3fff0a2c
  • 23:03:03.175 -> 3fff0940: 3fff37bc 0000004f 80000000 402134a8
  • 23:03:03.175 -> 3fff0950: 402107e0 00000000 3ffeedf4 4020947c
  • 23:03:03.175 -> 3fff0960: 00000000 3ffef4f0 3ffef7fc 40213f24
  • 23:03:03.175 -> 3fff0970: 3ffe8c77 3ffe8c77 3ffe8bca 40213f24
  • 23:03:03.175 -> 3fff0980: 402107e0 3ffe8c75 3ffef7fc 3fff0a2c
  • 23:03:03.214 -> 3fff0990: 3fffdad0 00000012 3ffef7fc 3fff0a2c
  • 23:03:03.214 -> 3fff09a0: 3fffdad0 00000000 3ffef7fc 4020976a
  • 23:03:03.214 -> 3fff09b0: 3fffdad0 00000000 3fff0a00 40212cc8
  • 23:03:03.214 -> 3fff09c0: feefeffe feefeffe 3fffdab0 401002dd
  • 23:03:03.214 -> <<<stack<<<
  • 23:03:03.214 -> --------------- CUT HERE FOR EXCEPTION DECODER ---------------
  • 23:03:03.214 ->
  • 23:03:03.214 -> ets Jan 8 2013,rst cause:2, boot mode:(3,6)
  • 23:03:03.251 ->
  • 23:03:03.251 -> load 0x4010f000, len 3424, room 16
  • 23:03:03.251 -> tail 0
  • 23:03:03.251 -> chksum 0x2e
  • 23:03:03.251 -> load 0x3fff20b8, len 40, room 8
  • 23:03:03.251 -> tail 0
  • 23:03:03.251 -> chksum 0x2b
  • 23:03:03.251 -> csum 0x2b
  • 23:03:03.251 -> v0006f2d0
  • 23:03:03.251 -> ~ld

I tried to use yield(); and delay(0); but not success.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant