I have a SIM800L module connected to Arduino Mega's Serial3. SIM800L is powered by 4.2V power supply and I have put a voltage divider between Arduino's TX3 and SIM800L's RX so that the voltage in the line stays about 2V. The TX line of the module is directly connected to Arduino's RX3.
The problem is that when I try to communicate with the module it responds fine but after some AT commands the module starts panicking and start sending random garbage. The code I'm using is a simple Serial to Serial code :
#include<SoftwareSerial.h>
#define mySerial Serial3
//SoftwareSerial mySerial(10, 11);
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(115200);
mySerial.begin(38400);
}
void loop() { // run over and over
if (mySerial.available()) {
Serial.write(mySerial.read());
}
if (Serial.available()) {
mySerial.write(Serial.read());
}
}
Output :
[This is with serial monitor set to 115200 baud rate]
[The garbage values with serial monitor set to 9600 baud rate]
The solutions I have tried so far are :
Put a 220uF cap between SIM800L's VCC and GND. (a 470uF tantalum cap is already included on the module but still to be safe)
Tried various baud rates from 9600 to 115200 (the baud rate setting on the module is set to auto baud rate) but only 38400 works reliably.
Tried to pull the RX3 line up on Arduino with a 100k resistor so that it doesn't float.
Tried to put up to 5s delay between AT commands given to the module but it still goes into panic.
The thing I noticed is that if we enter some wrong command like ATD74xxxxxxxx (which calls a phone number) instead of with proper ending like ATD74xxxxxxxx; the module does the same thing which is spitting garbage values.
Can anybody help me with what is wrong with the module?