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. = working coms, = nothing on coms at all. Read left to right, HAT serial (SMS DEVICE) can communicate with UNO hardware serial.
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).
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
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
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());
}
}
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.
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.
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