Pages: [1]   Go Down
Author Topic: Can't save whole SMS text  (Read 1409 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi I am using this code:
Code:
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
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Portugal
Offline Offline
Edison Member
*
Karma: 37
Posts: 1573
Pretending you know everything then you will learn nothing.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Debian,Mint,Ubuntu
Arduino Mega 2560
Arduino Nano
Arduino Duemilanove
MAC OS Montain Lion
Raspberry PI Model B


Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Logged

Pages: [1]   Go Up
Jump to: