Skip to content

_readSerial does not catch a reply #42

@ontheronix

Description

@ontheronix

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);
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions