Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_readSerial does not catch a reply #42

Open
ontheronix opened this issue Jan 30, 2022 · 1 comment
Open

_readSerial does not catch a reply #42

ontheronix opened this issue Jan 30, 2022 · 1 comment

Comments

@ontheronix
Copy link

ontheronix commented Jan 30, 2022

I'm running the SMS example on a sim800l from Amazon. Although it sends the SMS, something seems wrong with receiving the replies from the sent AT-commands.
(I modified the first 3 functions to return the _buffer instead, and it seems like the sim module is just echoing the commands?)

22:10:27.293 -> Set Phone Function... AT+CFUN=1
22:10:29.299 -> is Module Registered to Network?... AT+CREG?
22:10:31.306 -> Signal Quality... AT+CSQ
22:10:33.313 -> Operator Name... NOT CONNECTED
22:10:35.320 -> Init SMS... 0
22:10:37.321 -> List Unread SMS... NO_SMS
22:10:39.368 -> SMS to any number... 1
22:10:42.404 -> Begin to listen incoming messages...

I work with an Arduino Nano. It only has 1 serial connection so I tried different softwareserial, and outputting to a display. Always the same result. The slightly modified code (with softserial):

#include <AltSoftSerial.h>
#include <GSMSimSMS.h>

// You can use any Serial interface. I recommended HardwareSerial. Please use the library with highiest baudrate.
// In examples, i used HardwareSerial. You can change it anymore.

#define RESET_PIN 10 // you can use any pin.

static volatile int num = 0;

AltSoftSerial mySerial;
GSMSimSMS sms(mySerial, RESET_PIN); // GSMSimSMS inherit from GSMSim. You can use GSMSim methods with it.



void initSIM() {
  mySerial.begin(9600); // If you dont change module baudrate, it comes with auto baudrate.
  delay(1000);
/*
  while(!mySerial.available()) {
    ; // wait for module for connect.
  }
*/
  Serial.begin(9600); // Serial for debug...

  // Init module...
  sms.init(); // use for init module. Use it if you dont have any valid reason.

  Serial.print("Set Phone Function... ");
  Serial.println(sms.setPhoneFunc(1));
  delay(1000);

  Serial.print("is Module Registered to Network?... ");
  Serial.println(sms.isRegistered());
  delay(1000);

  Serial.print("Signal Quality... ");
  Serial.println(sms.signalQuality());
  delay(1000);

  Serial.print("Operator Name... ");
  Serial.println(sms.operatorNameFromSim());
  delay(1000);



  Serial.print("Init SMS... ");
  Serial.println(sms.initSMS()); // Its optional but highly recommended. Some function work with this function.
  delay(1000);

  Serial.print("List Unread SMS... ");
  Serial.println(sms.list(true)); // Its optional but highly recommended. Some function work with this function.
  delay(1000);

  
  Serial.print("SMS to any number... ");
  Serial.println(sms.send("0032123456789", "Selam kardesim, naber?")); // only use ascii chars please
  //delay(1000);

  // For other methods please look at readme.txt file.

  Serial.println("Begin to listen incoming messages...");

}
void loop() {
  char c;

  if (Serial.available()) {
    c = Serial.read();
    mySerial.print(c);
  }
  if (mySerial.available()) {
    c = mySerial.read();
    Serial.print(c);
  }
}
@ontheronix
Copy link
Author

ontheronix commented Feb 10, 2022

It does work with an Arduino that has a dedicated hardware serial port (Serial1). In my case an Arduino mkr gsm 1400.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant