AI-Thinker A6 GSM: Receiving but not sending

Dear Forum!

I want to be using an ESP-12 and the AI-Thinker A6 GSM like stavros did (Stavros Korokithakis / A6-ESP8266-breakout · GitLab) and iam using his library (https://github.com/skorokithakis/A6lib) and or a simple serial redirector.
I have a problem that the RX is working fine and 115200 baud seems to be sending from the module, also i receive +CIEV: service, 1\n+CIEV: roam, 0\n+CREG: 1. But iam not able to send to the A6 from the serial, i immediately receive the same answer i have sent, but not OK. When using the library i cant get it to connect via AT as well.

I would really appreciate some help.

Here is the code i use:

#include <SoftwareSerial.h>
#define DEBUG
#include <A6lib.h>
#define SERIAL_A6_BAUD 115200
//#define SERIAL_A6_BAUD 9600
#define SERIAL_ESP_BAUD 115200
//#define SERIAL_ESP_BAUD 9600
#define GPIO_A6_RX 14
#define GPIO_A6_TX 13
#define GPIO_A6_POWER 4
//#define USE_LIB
//#define LOOP_AT
#ifndef USE_LIB
char buffer[1024];
char end_c[2];
SoftwareSerial A6board (GPIO_A6_RX, GPIO_A6_TX);
#endif
#ifdef USE_LIB
A6lib A6l(GPIO_A6_TX, GPIO_A6_RX);
#endif
void setup() {
Serial.begin(SERIAL_ESP_BAUD);
while (!Serial) { }
log(“Serial set to “);
log(SERIAL_ESP_BAUD);
logln(” baud”);

#ifdef USE_LIB
logln(“Starting power cycle”);
A6l.powerCycle(GPIO_A6_POWER);
logln(“Wait until ready”);
int ret = A6l.blockUntilReady(SERIAL_A6_BAUD);
log(“Seems ready:”);
logln(ret);
#else
logln(“Enabling A6 power switch”);
pinMode(GPIO_A6_POWER, OUTPUT);

logln(“Enabling A6 rx”);
pinMode(GPIO_A6_RX, INPUT);
logln(“Enabling A6 tx”);
pinMode(GPIO_A6_TX, OUTPUT);

log(“Starting A6 serial: “);
log(SERIAL_A6_BAUD);
logln(” baud”);
A6board.begin(SERIAL_A6_BAUD);

logln(“Switch A6 ON”);
digitalWrite(GPIO_A6_POWER, HIGH);

logln(“READY:”);

end_c[0] = 0x1a;
end_c[1] = ‘\0’;
#endif
}
#ifdef LOOP_AT
bool somethingReceived = false;
#endif
void loop() {
#ifdef USE_LIB
while (A6l.A6conn->available() > 0) {
logln(“RECEIVED:”);
Serial.write(A6l.A6conn->read());
}
while (Serial.available() > 0) {
logln(“SEND:”);
A6l.A6conn->write(Serial.read());
}
#else
#ifdef LOOP_AT
if(somethingReceived){
A6board.write(“AT\n”);
logln(“SEND: AT”);
delay(200);
}
#else
if (Serial.available()) {
String hh = Serial.readStringUntil(’\n’);
hh.toCharArray(buffer, hh.length() + 1);
if (hh.indexOf(“END”) == 0) {
A6board.write(end_c);
logln(“SEND: END”);
} else {
A6board.write(buffer);
A6board.write(’\n’);
log("SEND: ");
logln(buffer);
}
}
#endif
if (A6board.available()) {
log("RECEIVED: ");
logln(A6board.readStringUntil(’\n’));
#ifdef LOOP_AT
somethingReceived = true;
#endif
}
#endif
#ifdef LOOP_AT
delay(200);
#else
delay(10);
#endif
}

I dont know about the library yet but sending only a \n doesnt seem sufficient enough.

The problem was that my board always sent back the command i sent without any error code or other indication.

Sending 0x0D (Carriage Return) and 0x0A (Line feed or Newline) seemed to do the trick:
A6board.write(0x0D);
A6board.write(0x0A);

If this issue persist in the library i will probably also change it there and push a fix.

I have the same problem, could you solve it?