Cannot communicate with software serial on particular devices (SIM7600G-H)

Solution summary, the RX and TX were labeled to mirror the raspberry pi. So I now connect the wires TX to TX and RX to RX.


I have 3 devices:

UNO

SMS Device

AT Manual: https://mt-system.ru/sites/default/files/documents/a7600_series_at_command_manual_v1.01.pdf
User Manual: https://fcc.report/FCC-ID/2AJYU-8PYA007/4857209.pdf

UART USB 5v


I'm using the UNO to talk to the SMS device via UART at 9600 baud to send and receive SMS commands. I need the hardware port open to debug, and I am trying to use a software port to talk to the SMS device via it's TX RX pins.

But I cannot get the software port to talk to the SMS device at all.

This is the success I've had trying to talk to and from devices. The bold boxes are needed to be solved for this setup to work. :white_check_mark: = working coms, :x: = nothing on coms at all. Read left to right, HAT serial (SMS DEVICE) can communicate with UNO hardware serial.

Connection matrix

And I'm using this code to just relay inputs and outputs between the hardware and software ports for testing.

// Must be same on mock and serial
const int baud = 9600;

// Communication with mock hat
SoftwareSerial mockPort(2, 3);

void setup()
{
  Serial.begin(baud);

  while (!Serial)
  {
    ; // wait for serial port to connect. Needed for native USB port only
  }

  mockPort.begin(baud);
  Serial.println("Mock port has started @ " + String(baud));
}

void loop()
{

  while (mockPort.available() > 0)
  {
    char inByte = mockPort.read();
    // and send to the hardware serial port:
    Serial.write(inByte);
  }

  // while there is data coming in FROM SERIAL, read it and send it back to mock
  while (Serial.available() > 0)
  {
    char inByte = Serial.read();
    // and send to the mock serial port:
    mockPort.write(inByte);
  }
}

Why can't I communicate to the SMS device with the software ports? (or the USB UART as well?) When testing, I can see the UNO's RX light turn on, but I never receive any data back from the SMS device (the serial monitor is just black).


Notes:

  • I've tried the AltSoftSerial library as well

  • I've set the SMS hat's baud rate default to 9600

  • I've tried different communication pins

  • I've got the TX pins on RX pins and vice versa

How did you do this?

What baud rate was used when the UNO successfully talked to the SIM7600? How do you know it worked?

have you looked at SIM7600G-H-M2_4G_HAT
I cannot see any specification of the Logic level of the UART pins
if it is 3.3V logic the UNO which uses 5V logic may damage the device
I would assume 3.3V logic (the RPi is 3.3V) and connect it to an Arduino which uses 3.3V logic, e.g. Arduino Due or ESP32 - this would also give you hardware serial ports
If you do connect it a UNO I would recommend a potential divider on the UNO Tx to SIM Rx pin

the first task is to be able to enter AT commands and see the response, e.g. enter AT and it should respond OK

I used an AT command to permanently change the baud

The baud was at 9600 when it worked (it also worked at the factory default 115200 before changing)

I know it worked because I sent AT and received OK on my monitor

Yeah I tested the ports and they measure at 3.3 volts. I will get an LLC. Should I test my sketch on an ESP32?

Just confused how you used the serial monitor if you had the SIM7600 connected to the hardware serial port of the Uno ?

I had TX and RX on pins 0,1 (UNO) connected to RX and TX on the SMS hat, then just opened the serial monitor

OK... and does this setup still work? The SIM7600 is logic level 3.3v, but many work with 5v also.

If hardware works then software should...

Do you have a common GND between the UNO and the SIM7600 when using software serial?

Yes it works, and it shares a common ground. Would you like a video or diagram?

Just trying to understand what might be different between hardware and software as they should both work if one does.

To set the baud I presume you used AT+IPREX=9600 ?

Have you tried communicating directly from the serial monitor via the USB to TTL UART adapter? Does this have a 3.3v setting ?

I am genuinely interested as I have a SIM7600 that I have had trouble with...

good idea - the ESP32 runs at 3.3V and has hardware serial ports
I have used this to communicate with SIM800 and SIM990 modem using ESP32 Serial1 port

// ESP32  Serial1 test

// for loopback test connect pins 16 and 15

#define RXD1 16
#define TXD1 15

void setup() {
  // initialize both serial ports:
  Serial.begin(115200);
  Serial1.begin(9600, SERIAL_8N1, RXD1, TXD1);
  Serial.println();
  Serial.println("ESP32 serial1  test Rx pin 16 Tx pin 15");
}

void loop() {
  // read from port 1, send to port 0:
  if (Serial1.available()) {
    int inByte = Serial1.read();
    Serial.write(inByte);
  }

  // read from port 0, send to port 1:
  if (Serial.available()) {
    int inByte = Serial.read();
    //Serial.write(inByte);
    Serial1.write(inByte);
  }
}

when commected to a SIM900 the serial monitor displays

RDY
+CPIN: NOT INSERTED

+CFUN: 1
AT
OK
AT+CGMI
SIMCOM_Ltd
OK
AT+CGMM
SIMCOM_SIM900
OK
AT+CGMR
Revision:1137B06SIM900M64_ST_ENHANCE
OK

Yep, and AT+IPREX? returns 9600

Yes and it wont work. The USB is ~5v, but has a 3.3v pin for some reason?

I used AT+IPREX=115200 to set back to the default baud, then uploaded:

#include <HardwareSerial.h>

void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
  // set the data rate for the HardwareSerial port
  Serial2.begin(115200);
}

void loop() {
  if (Serial2.available()) {
    Serial.write(Serial2.read());
  }
  if (Serial.available()) {
    Serial2.write(Serial.read());
  }
}

In this configuration:

But i get no communication from the SIM module? To confirm I got the pins right, I shorted the serial wires to get gibberish on my monitor.

Just to summarise...

You have successfully sent/received AT commands using...

  • UNO hardware serial

But failed with the following...

  • UNO Software Serial
  • Direct via FDTI adapter to view within the serial monitor
  • Using serial port 2 on an ESP32

Is that correct? If so... pretty weird.

Correct

Perhaps I’m making an error somewhere when using these devices?
Would it be worth doing a video demonstration?

Sure. I'm keenest to see how you are getting the UNO hardware serial to work. I have a SIM7600 that was working when it left the factory (they sent screenshots of the AT commands/responses), but I can't get it to work at all. I've tried the first 2 methods that failed for you.

... and can you post the sketch you used for the UNO hardware serial... thanks.

what was the setup the factory used to test the device?
could you replicate it?

Don't know exactly what tool was used (screenshot below) - the IMEI matches that on the device so pretty sure it is legit. They just said 3.3v and 115200 baud.

That's why I'm quite interested in this post, as the OP also seems to be having difficultly communicating with theirs... strangely though they managed it with UNO serial hardware.

I have no idea

looking at the image it appears the device is set to detect autobaud
the first text transmitted is ATAT which is used by SIMCOM on their device to autobaaud
e.g. from the sim800l manual
When DCE powers on with autobauding enabled, it is recommended to send "AT" or "at" or "aT" or "At" to synchronize the baud rate, until DTE receives the "OK" response, which means DTE and DCE are correctly synchronized.
may be worth looking at a SIM7600 hardware manual