Open dmnc-net opened 5 years ago
MCVE:
#define USE_NEO
#define BAUD_RATE 38400
#ifdef USE_NEO
#include <NeoSWSerial.h>
NeoSWSerial modemSerial(7, 8); // RX, TX
#else
#include <SoftwareSerial.h>
SoftwareSerial modemSerial(7, 8);
#endif
void setup() {
Serial.begin(BAUD_RATE);
modemSerial.begin(BAUD_RATE);
Serial.println(F("Ready!"));
}
void loop() {
while (Serial.available()) modemSerial.write(Serial.read());
delay(100);
if (modemSerial.available()) {
Serial.print(F("bytes in buffer: "));
Serial.println(modemSerial.available());
}
while (modemSerial.available()) Serial.write(modemSerial.read());
}
I'd like to debug this issue, @SlashDevin please do you have some advice for me where to look?
Hi @SlashDevin, I'm doing some GPS tracker with SIMCom board and I'm using NeoSWSerial for AT commanding the modem. At this phase, I'm moving the project from Arduino Uno to the Pro Mini (5V 16bit) which uses the same Mega328P MCU. I've created my own methods for sending AT commands and receiving responses and my limitation is that I need to set
ATE0
for disabling echoes because of handling responses.However Uno is working fine, Pro Mini duplicates the outgoing AT command. For example:
Uno, command:
AT+CREG?
, response:Pro Mini, command:
AT+CREG?
, response:But this is not an echo problem, because if I turn echo on with
ATE1
, response will be:I can solve this by adding step #2 to the process
_serialDevice.write("AT...")
)while (_serialDevice.available()) _serialDevice.read()
)_serialDevice.flush()
)... but I've tried to change
NeoSWSerial
toSoftwareSerial
and the issue is gone. I'm not quite happy from flushing part of the response from modem when I'm going to read and store the response.I'm using the Arduino USB2Serial board for uploading and reading the Serial console, but SoftwareSerial test has excluded this possibility (of cause).