Hi, i'm using 2 chips : ESP-32S from NodeMCU and sim800l from SimCom .
Sim800l connected to LIPO battery with 3.7v, esp-32 via usb to computer.
#include <HardwareSerial.h>
HardwareSerial SerialPort2(1);
void setup() {
Serial.begin(9600);
SerialPort2.begin(9600, SERIAL_8N1, 16, 17);
Serial.println("Initializing...");
Serial.println("\nSIM800 EVB to ESP32 Serial port 2 test");
SerialPort2.write("AT\r\n");
}
void loop() {
readFromSim800l();
}
void readFromSim800l() {
delay(500);
while (SerialPort2.available() > 0) {
SerialPort2.read();
Serial.print("Bytes available ");
Serial.println(SerialPort2.available());
}
}
My problem is that serial buffer on sim800l almost never gets empty. I've tried a bunch of code snippets, that are covering sim800l and esp32 communication. In those tutorials serial buffer is being read in a while loop. And it provides nice output. For AT
command it gives nice OK
. In my case it looks like OKOKOKOKOKOKOK...
and it never stops.
If to execute at the code above executes the output looks something like this:
Bytes available 256
Bytes available 255
Bytes available 254
Bytes available 253
...
Bytes available 230
...
Bytes available 255
Bytes available 254
Bytes available 253
Other commands involving communication with sim800l seem to work. But i'm having a huge trouble executing them one after another, to debug and set everything correctly.
I would appreciate any clues, what am i doing wrong.
Also, either i'm malfunctioning or esp32 chips i've bought, but i can't use different Hardware Serial Port, and different pins. In both cases it leads to some broken output.
It's the only setup that worked more or less fine.