ESPSoftwareSerial problem

I am using the SoftwareSerial.h library with a Arduino Uno and a 800L modem module (simple Rx/Tx communication).
This works just fine, (running the program outputs modem result codes on the Serial Monitor), but after changing to a ESP32-Wrover the Rx/Tx communication no longer works.
I have updated the library to Peter Lerups ESPSoftwareSerial.h (version 6.30).
After the update the Uno still works fine with the modem, but not the ESP32-Wrover.

(Running the ESP32-wrover blink sketch, etc, works fine, so the ESP32 module is working)…

Here is the code that works with Uno (with the ESPSoftwareSerial.h library) :

#include <SoftwareSerial.h>

//Create software serial object to communicate with SIM800L
SoftwareSerial mySerial(3, 2); //SIM800L Tx & Rx is connected to Arduino #3 & #2

void setup()
{
  //Begin serial communication with Arduino and Arduino IDE (Serial Monitor)
  Serial.begin(9600);
  
  //Begin serial communication with Arduino and SIM800L
  mySerial.begin(9600);

  Serial.println("Initializing...");
  delay(1000);

  mySerial.println("AT"); //Once the handshake test is successful, it will back to OK
  updateSerial();
  mySerial.println("AT+CSQ"); //Signal quality test, value range is 0-31 , 31 is the best
  updateSerial();
  mySerial.println("AT+CCID"); //Read SIM information to confirm whether the SIM is plugged
  updateSerial();
  mySerial.println("AT+CREG?"); //Check whether it has registered in the network
  updateSerial();
}

void loop()
{
  updateSerial();
}

void updateSerial()
{
  delay(500);
  while (Serial.available()) 
  {
    mySerial.write(Serial.read());//Forward what Serial received to Software Serial Port
  }
  while(mySerial.available()) 
  {
    Serial.write(mySerial.read());//Forward what Software Serial received to Serial Port
  }
}

When changing to ESP32-wrover the only thing I have changed in the sketch code is the line :

SoftwareSerial mySerial(3, 2);

that is changed to :

SoftwareSerial mySerial(34, 26);

(I have a level shifter from the ESP32 output pin ( GPIO26), to the 800L modem module, so I have checked that the voltage levels are correct…)

I assume that I may have to make more program changes, but I cant figure out what to do…

How can I proceed ???

/Gurra

Not sure why'd you'd want to run software serial on an ESP32 when there are 2 hardware serial ports available for use.

Anyways, when you assign a pin, for the software serial, you might want to consider the pin use in relation to the ESP32 pin matrix and I/O port availability. All pins on an ESP32 above pin 32 are on I/O port B, which is designated as INPUT only.

All this and more is documented in the ESP32 documentation: https://docs.espressif.com/projects/esp-idf/en/latest/api-reference/index.html

Hi Idahowalker.

It would be nice if I didn't have to use any external libraries for the serial communication to/from the 800L modem.. (I have done a lot of work with the Wemos D1 mini, but I am new to the ESP32, so please advise me if there is an easier way to do this)....

My ESP32-wrover is from LOLIN and has an integrated TFT connector for their TFT display, (which I am using). This display uses GPIO 12, 14, 18, 19, 23, 33 and 35.

(The ESP32 documentation from RandomNerdTutorials says that UART 2 RX/TX is on GPIO 16&17, (unfortunately GPIO16&17 does not exist on the Lolin Wrover model)....

GPIO34 in my project is connected as input (tx data from the 800L), (and GPIO26 as output)..

If I can provide some more info regarding this problem, please let me know....

/Kind regards : gurra

I tend to use ESP32’s from Hiletgo, they stick to the Espressif specs.

How I set up hardware serial on an ESP32

#include <HardwareSerial.h>

HardwareSerial SerialTFMini( 1 );
HardwareSerial SerialBrain( 2 );
// serial(1) = pin27=RX green, pin26=TX white
// serial(2) = pin16=RXgreen , pin17=TX white
setup()
{
 SerialBrain.begin( SerialDataBits );
 SerialTFMini.begin(  SerialDataBits, SERIAL_8N1, 27, 26 );

}

The default pins for (2) are rx=16 and tx=17.

The default pins for (1) are GPIO 9/10 << which should NOT be used. But using the ESP32 pin matrix nearly all the pins can be reassigned. In the case of (1) the reassignment is done with initialization in setup()

.

Hello again.

I would be very grateful if you could make the necessary changes in my sketch so it works using HardwareSerial.h and RX=GPIO34 & TX=GPIO26.....

(Do I also have to make any changes in HardwareSerial.h ??)

Many thanks in advance....

/Regards Gurra

Gurra: (Do I also have to make any changes in HardwareSerial.h ??)

No.