Objective: Submit AT Commands to the Quectel M95 (GSM2 Click http://www.mikroe.com/click/gsm2/) via SoftwareSerial/Arduino and parse responses; no Arduino GSM library.
Current condition: Able to fully communicate with the M95 via terminal at a variety of baud rates (9600 - 115200). AT Commands can be submitted and the desired result codes are present. I have tried with a different modem (DroneCell) with same results. All wiring has been checked 10 times and verified correct. If I submit AT commands via SoftwareSerial I know the modem is receiving the data as I can send an SMS, enact GPRS, etc; just can't get valid responses.
Issue: Arduino is unable to read GSM Module responses using the below code. Result is garbled text/chars - variable and unpredictable. The expected response when submitting AT Command "AT" is "OK."
Images:
Success via terminal:
Arduino response:
#include <SoftwareSerial.h>
#define rxPin 10
#define txPin 11
SoftwareSerial mySerial(rxPin,txPin); // RX, TX
void setup(){
pinMode(rxPin, INPUT);
pinMode(txPin, OUTPUT);
Serial.begin(9600);
Serial.println("Arduino serial initialized!");
delay(10);
mySerial.begin(9600);
Serial.println("Software serial initialized!");
delay(10);
}
void loop(){
issueCommand("AT");
readSerial();
delay(500);
while(true){
readSerial();
}
}
void issueCommand(char* msg){
mySerial.println(msg);
Serial.print(msg);
delay(10);
}
void readSerial(){
while (mySerial.available()){
Serial.write(mySerial.read());
delay(10);
}
}