Go Down

Topic: Can't save whole SMS text (Read 1 time) previous topic - next topic

aybyd

Hi I am using this code:
Code: [Select]
void checkSMS(void)
{

  Serial.println("called checkSMS");
  if(started){
    int position = sms.IsSMSPresent(SMS_UNREAD);
    if (position > 0) {
      sms.GetSMS(position, n, smsbuffer, 160);
      while(smsbuffer[s+1] != '\0')
      {
        Serial.print(smsbuffer[s]);
        s++;
      }
      s = 0;
      sms_MSG[t] = strdup(smsbuffer);
      t++;
      store();
      delay(1000);
    }
    else
    {
      Serial.print("No SMS");
    }

  }

};


Supposedly sms contains:
Quote
This a test sms that consume 160 characters of a single page sms data to send in gsm shield for arduino uno microprocessor for final report in ECE course...#


But when I print the saved sms on my serial monitor,
It contains only of this part:
Quote
This a test sms that consume 160 characters of a single page sms data to send in gsm shield for arduino uno microprocessor for final repo

aybyd

Is this a memory problem?
If I send 20 letters only, it saved.
but it more than 100 letters to consume at least 158 letters, it crashes.

Riccardo_Ric

I had similar problem with long SMS, roughly greater than 64 char, with Arduino UNO R3 and I saw few ram bytes available.
I switched to an Arduino Mega and I resolved.
I also investigate the GSM library to see where memory buffer for SMS are allocated , but for me is not easy to change library.

HugoPT

Sounds like a serialBuffer problem
What are you using to comunicate with the modem?(softserial , native UART,newsoftserial???)
Quote

The native serial support happens via a piece of hardware (built into the chip) called a UART. This hardware allows the Atmega chip to receive serial communication even while working on other tasks, as long as there room in the 64 byte serial buffer.

The problem could be you are not reading the incoming data fast anought and then the serialBuffer overflow
Post all the code
Debian,Mint,Ubuntu
Arduino Mega 2560
Arduino Nano
Arduino Duemilanove
MAC OS Montain Lion
Raspberry PI Model B

aybyd

I am using a GSM Library from gsmlib.org
And I think it is using SoftwareSerial coz I am connecting my gsm modem trough Pin2 and Pin3 of Arduino Uno.


Go Up