I can confirm that the SMS hat can send and receive AT commands through serial correctly. As discussed here.
I would like to use both hardware serial ports on the ESP32 to debug and talk to the hat at the same time. Serial1 for USB debug, and Serial2 for the SMS hat.
OK... I did a bit of playing with an ESP32, and my SIM7600 (the one that works ok).
I used your code and got nothing returned. After a bit of digging I believe the issue is with the way you are declaring the 2nd serial port. Try this version...
#include <HardwareSerial.h>
HardwareSerial SerialPort2 (2); // This is the key line missing.
void setup()
{
Serial.begin(115200);
SerialPort2.begin(115200, SERIAL_8N1, 16, 17);
}
void loop()
{
while (Serial.available() > 0)
SerialPort2.write(Serial.read());
while (SerialPort2.available() > 0)
Serial.write(SerialPort2.read());
}
Interestingly, if I called it "Serial2" instead of "SerialPort2" it fails to compile.
I'm using an ESP32-WROOM-32U... closest board I could find is ESP32-WROOM-DA Module.
However, although Serial2 seems to be defined (and when I print SOC_UART_NUM = 3), the serial port does not work. It only works if I define with a different name ?
So the P-TX to RX-3.3v and P-RX to TX-3.3v works with Arduino (5v) but not ESP32 (3.3v) so the UART header is probably right what about the UART voltage selection is that set to 3.3v (default). Can you adjust the UART header and get a response sending AT commands over USB just to take any external module out of the equation.
Edit : the tx rx connections I refer to are the ones at the uart header.
I can't communicate over a 5 volt USB TTL adaptor (RX TX header) to the hat, But I can send AT commands through the Arduino UNO (RX TX header) to the hat, and the Shield's built-in USB port.
No Luck from this one. I can't send anything to the HAT, and the USB UART adaptor doesn't work with this either. for some reason
Which doesn't make much sense if I could receive from the last script. But when I boot my 3rd party serial monitor for the USB the TX light gets stuck on. If i disconnect and plug back it it turns off
Ok so can you just confirm what works and what doesn't...
Uno hardware with blank sketch (effectively sending to/from commands from the IDE serial monitor)?
Uno Software serial? Using pass-through sketch?
ESP32 using pass-though sketch ? (using port 0 monitor, and port 2 for SIM7600). You get boot messages but can't send commands?
USB/TTL adapter and your 3rd party monitor doesn't work?
PS. My ESP32 is now working fine using Serial2... don't need to rename as per post #3... but at the time it definitely wasn't so not sure what changed... I should have been more methodical when playing around.
I went back and re-did all of these tests to be sure
115200 baud
UNO can send and relieve data from SMS hat.
UNO can't receive data from TX2 on ESP32, but can send data to RX2
This is wired TX UNO -> TX2 ESP32 & RX UNO RX2 ESP32
9600 baud for software serial
UNO can talk to the SMS hat perfectly fine
UNO can send to the ESP32 Serial2 fine, but cannot receive from it
115200 baud
Correct, I get the boot and can't send messages
The use of HardwareSerial SerialPort2 (2); didn't make a difference. I had trouble getting it to work at all a min ago, so I deleted it and used the code below. Which gets the boot message at least.
Correct. I can't talk to the hat at all. As soon as I connect on the serial monitor, the TX light on the USB turns solid red even through I'm not sending anything. When resetting the SMS hat, the RX light flashes once for some reason.