I am trying to hook up to an A9G Pudding GSM board via an Arduino. I intend to use the onboard UART chip to facilitate TTL-UART conversion between PC and A9G.
I have initiated a software serial instance and using this to pass communication to/from the A9G and the Arduino.
Here's my code. However, all I'm getting is gibberish stuff. I've checked my connections, the link seems to exist but the encoding is mismatched. I'm communicating with the A9G at 115200 and my emulated serial is at 9600.
Could this be an issue?
#include <SoftwareSerial.h>
SoftwareSerial mySerial(10, 11); // RX, TX
void setup() {
Serial.begin(9600); // Monitor baud rate
mySerial.begin(57600); // Set to detected baud rate
Serial.println("A9G Module Communication Test");
// Send AT command with carriage return and line feed
mySerial.print("AT\r\n");
delay(1000); // Wait for response
}
void loop() {
// Check if data is available from the A9G module
if (mySerial.available()) {
// Read the data from the A9G module
while (mySerial.available()) {
char c = mySerial.read();
Serial.write(c); // Send it to the Serial Monitor
}
}
// Check if data is available from the Serial Monitor
if (Serial.available()) {
// Read the data from the Serial Monitor
while (Serial.available()) {
char c = Serial.read();
mySerial.write(c); // Send it to the A9G module
}
}
}
Here's the output on the serial monitor.