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

[M590] LIbrary not working on ESP32 #91

Closed
thomasklingbeil opened this issue Oct 10, 2017 · 13 comments
Closed

[M590] LIbrary not working on ESP32 #91

thomasklingbeil opened this issue Oct 10, 2017 · 13 comments

Comments

@thomasklingbeil
Copy link

thomasklingbeil commented Oct 10, 2017

As already described in issue #81, using HardwareSerial on ESP32 does not work with the library.
If transferring the data "manually" in a simple sketch, everything works fine.

With the TinyGSM library, a lot of random characters show up during the communication, rendering all results unusable.

rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0010,len:4
load:0x3fff0014,len:588
load:0x40078000,len:0
load:0x40078000,len:9880
entry 0x400789d8
Initializing modem...ATE0

OK
AT&FZE0
 fail
************************
 Is your modem connected properly?
 Is your serial speed (baud rate) correct?
 Is your modem powered on?
 Do you use a good, stable power source?
 Try useing File -> Examples -> TinyGSM -> tools -> AT_Debug to find correct configuration
************************
Waiting for network...AT+CREG?
AT+CREG?
AT+CREG?
AT+CREG?
AT+CREG?
AT+CREG?
AT+CREG?
AT+CREG?
AT+CREG?
AT+CREG?
AT+CREG?
AT+CREG?
AT+CREG?
G: 0,1
�������"]��RAT+CREG?
AT+CREG?
AT+CREG?
AT+CREG?
AT+CREG?
AT+CREG?
AT+CREG?
AT+CREG?
AT+CREG?

m590

Code used:

HardwareSerial mySerial(2);

void setup() {
    // put your setup code here, to run once:
    Serial.begin(115200);
    mySerial.begin(115200, SERIAL_8N1, 32, 33);
    Serial.print("Let's go");
}

void loop() {
  while (mySerial.available() > 0) {
    Serial.write(mySerial.read());
  }
  if (Serial.available()) {
    mySerial.write(Serial.read());
  }
}
@thomasklingbeil
Copy link
Author

thomasklingbeil commented Oct 11, 2017

The problem seems to be related to the implementation of HardwareSerial for ESP32. With the most recent git state, things seems to be better (see also espressif/arduino-esp32#665)

EDIT: Even though, some more things seem to work (i.e. sending commands from my own code), the library still does not work - it seems as if it does not receive the answers from the module.
I have also tried the same thing with an A7 - same problem.

Both modules, connected to an ESP8266 with SoftwareSerial --> Working without any problems... So it seems to have something to do with the ESP32's Serial implementation...

@vshymanskyy
Copy link
Owner

I'll re-check this once I get some spare time. Thanks!

@papawattu
Copy link

papawattu commented Jan 6, 2018

Hi

I am getting a similar issue, I am seeing the following.

image

Jamie.

@papawattu
Copy link

papawattu commented Jan 8, 2018

Looks like my issue was unrelated to this maybe, I am using a Adafruit Huzzah 32. I switched to using UART1 (2nd one). I had to pass the pin numbers and "false" to the begin method call. This works fine now, hope this helps someone else.

HardwareSerial Serial1(1);

#define SerialAT Serial1

TinyGsm modem(SerialAT);
TinyGsmClient client(modem);

void setup() {
  SerialAT.begin(115200,SERIAL_8N1,16,17,false);
  delay(3000);
  modem.restart();
}

Jamie.

@ankgt
Copy link

ankgt commented Mar 10, 2018

@papawattu I'm facing a similar issue, and trying to understand your solution. If you switched to UART1, does that mean you can no longer use the USB port on your board to monitor the program? Thanks!

@abhaysbharadwaj
Copy link

abhaysbharadwaj commented Dec 1, 2018

@papawattu , @vshymanskyy , I can confirm that TinyGSM is working flawlessly on my ESP32.
As per comment, I have added the following before setup():
HardwareSerial gsmSerial(1); // (1) implies serial 1
TinyGsm modem(gsmSerial);
TinyGsmClient client(modem);
PubSubClient mqtt(client);

and in setup:
gsmSerial.begin(115200, SERIAL_8N1, 18, 19, false); // i am remapping serial1 pins to 18 and 19

image

Edit: I have uploaded my working code here:
https://github.com/abhaysbharadwaj/esp32-gsm-gps

@jrutke
Copy link

jrutke commented Dec 9, 2018

I have a problem with gprs connection in my ESP32. Don't find the modem. WIth AT command's its working. Can someone help me?

@abhaysbharadwaj, how did you use?

@vitzaoral
Copy link

vitzaoral commented Dec 9, 2018

I can't connect SIM800L EVB version to my Espressif ESP32-WROOM-32 developer kit. I'm using UART 2 connection (SIM800L TX -> ESP32 TX2, SIM800L RX -> ESP32 RX2, GND is same picture here). I think there is no problem with power supply, I can call to SIM800L, it blinks every 3sec so it's connected to network.

I'm using code as was described above:

HardwareSerial gsmSerial(2);
TinyGsm modem(gsmSerial);

void setup()
{
 // Set GSM module baud rate
  gsmSerial.begin(115200, SERIAL_8N1, 16, 17, false);
....

There is no response from SIM800L. Am I doing something wrong, or is EVB version somehow different from "classic" red SIM800l?
Thank you.

@remenyo
Copy link

remenyo commented Apr 20, 2019

@vitzaoral
You connected RX to RX and TX to TX, but you have to connect RX into TX, and TX into RX.
Wiring and Hardware of UART devices

@MahmoudMohamedAli
Copy link

MahmoudMohamedAli commented Oct 26, 2021

i have problem with gsm a6/ai it can't establish connection to mqtt serve
problem_5
problem2
problem_3
r

@sass00
Copy link

sass00 commented Jan 23, 2022

Hey guys,

Have a problem with my ESP32. Using DevKitC V4 with Wrower. Trying to hook up SIM800L. My unit is connected, i can type AT commands through USB-TTL. Light flashes as its connected to the network.

My device is defined as serial2 on pins 16, 17. When i start my ESP it cant initialize modem. Tried example sketeches of both TinyGSM and FONA library. Works normally directly through serial on arduino (i short RST to GND) so i know the SIM module is working.

#define SerialMon Serial
#define TINY_GSM_MODEM_SIM800
#include <TinyGsmClient.h> //
HardwareSerial SerialGSM(2);
TinyGsm modemGSM(SerialGSM);
const int BAUD_RATE = 9600;
long int millisRefCon, millisUserResp;
bool flagCon = false, flagUserResp = false;
const int relayPin1 = 14, relayPin2 = 12, relayPin3 = 13, relayPin4 = 27, RX_PIN = 16, TX_PIN = 17;
const char *APN = "internet";
const char *USER = "mobitel";

my void setupGSM;
Serial.println("Setup GSM...");
SerialGSM.begin(BAUD_RATE, SERIAL_8N1, 16, 17, false);
delay(2000);
Serial.println(modemGSM.getModemInfo());
Serial.println(modemGSM.getOperator());
Serial.println(modemGSM.testAT());
Serial.println(modemGSM.getModemName());
Serial.println(modemGSM.getSimStatus());
Serial.println(modemGSM.getIMEI());
Serial.println(modemGSM.isNetworkConnected());

My serial monitor output;
Setup GSM...

0
SIMCom SIM800
0

0
Restarting GSM
Modem failed

This is my code. Tried different baud rates, inverting RX/TX pins, different UART, ... nothing works. I'm just using the sim800 to trigger relays and send temp and humidity status.

I am powering my SIM800L from a outer power supply with 3A max. My wiring is GND->GND; TX->17; RX->16; GND->GND. Tried also rreversing RX/TX. I'm using V2 of the SIM800 (EVB version).

I'm a bit depressed allready :)

P.S also tried with;
#define SerialGSM Serial2

@CcKefa
Copy link

CcKefa commented Jan 9, 2024

Was this issue resolved? I'm having the same issue and using UART1 does not solve it.

@live-alchemy
Copy link

live-alchemy commented Feb 23, 2024

@CcKefa @sass00 took me some time to get this working, I'll paste the important parts for reference maybe it helps you as well. I had to instantiate my serial connection to the LTE module as a HardwareSerial and pass it (1) so it would use the Uart1 option. Then later, in the SerialAt.begin() call, I pass the RX & TX pins that map to Uart1 on my device, in this case 18 and 17. Notice in the diagram how these are labelled U1RXD and U1TXD. Maybe that's obvious but for me it was a missing link, the diagrams here helped me as well.

Also, my LTE module uses 115200 baud rate, so I have passed that in as well, but if you are unclear what baud rate your LTE module uses then use this AT_Debug sketch to try and find that first

#define SerialMon Serial
HardwareSerial SerialAT(1);

#define PIN_TX              17
#define PIN_RX              18

#include <TinyGsmClient.h>

TinyGsm        modem(SerialAT);
TinyGsmClient  client(modem);

void setup() {
    SerialMon.begin(115200);
    SerialAT.begin(115200, SERIAL_8N1, PIN_RX, PIN_TX, false);
}

Another detail is that I am supplying power to my LTE module via micro usb plugged in to the wall, so the only connection from my ESP32 to the LTE module is 1 GND connection and the TX/RX. I'm not sure about your ESP32 units, but mine does not output 5V power so I had to supply it elsewhere.

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

No branches or pull requests