+ Post New Thread
Results 1 to 3 of 3
  1. #1
    Full Member level 2
    Points: 1,269, Level: 8
    arunbharathi.arasu's Avatar
    Join Date
    Feb 2013
    Location
    Chennai, Tamil Nadu, India
    Posts
    123
    Helped
    7 / 7
    Points
    1,269
    Level
    8

    GSM Message Read Problem

    Dear all,

    I facing problem while read message.

    when i read msg some letters are missing.

    +CMGR:"REC UNREAD","+918754449444","",""17/08/17,15:48:23"
    Hi, this is message
    The above is the message format and message what i get from GSM.
    shows in Terminal.

    but when i read this i got

    +CMGR:"REC UNREAD","+918754449444","",""17/08/17,154823"
    Hthi is mssg
    Like this. letters are missing form time..
    body of the message also missing.

    I have checked by sending the data what i received.
    Learn from Yesterday...............
    Live for Today.........
    Hope for tomorrow.............

    •   Alt3rd January 2017, 11:27

      advertising

        
       

  2. #2
    Member level 1
    Points: 764, Level: 6

    Join Date
    Jan 2014
    Location
    Bangalore, India
    Posts
    36
    Helped
    9 / 9
    Points
    764
    Level
    6

    Re: GSM Message Read Problem

    Hello Arun,

    I understand that the GSM module works as expected. But it is on the microcontroller side that you are missing some characters.
    1. Assuming you are using a microcontroller, what microcontroller are you using?
    2. How are you handling UART receive? via. interrupt or by polling?
    3. How do you handle the received characters? That is, can you explain how you receive the characters and buffer it to your array?

    Regards,
    Raj Gunaseelan James



    •   Alt4th January 2017, 09:04

      advertising

        
       

  3. #3
    Full Member level 2
    Points: 1,269, Level: 8
    arunbharathi.arasu's Avatar
    Join Date
    Feb 2013
    Location
    Chennai, Tamil Nadu, India
    Posts
    123
    Helped
    7 / 7
    Points
    1,269
    Level
    8

    Re: GSM Message Read Problem

    Dear Raj Gunaseelan ,

    problem solved. thanks.

    - - - Updated - - -

    hi,

    Now i can read first message properly.

    But i cannot read second message.

    - - - Updated - - -
    main program inside while

    Code:
      
    while(1)    {
        if(msgflag==1)
        {
         MSG_READ();
         count=0;
        delay(1000);
        msgflag=0;
        }
    }
    My interrupt code is
    Code:
    unsigned char *ok="OK",*error="ERROR",*newmsg="+CMTI: "SM",1";
    Code:
    void interrupt uart_ISR()
    {      
        if(RCIF==1)
        {
           Rx_data=RCREG;
           RCIF=0;
           if(Rx_data!= 0x0A)
           {
             Arraydata[count]= Rx_data; 
             count++;
           }
           else
           {
            Arraydata[count]=0;
            if(flag);
            else
            count=0;
           }
           
           arrayptr=Arraydata;
           if(flag)
               data=Arraydata;
           if(strstr(arrayptr,ok))
           {
               RC_BIT_Flag=1;
           }
           else if(strstr(arrayptr,error))
           {
               RC_BIT_Flag=0;   
           
           }
           else if(strstr(arrayptr,newmsg))
           {
              msgflag=1;
           }
        }
      
    }
    please let me if any error..

    I can read ok,error,and first message but if i am reading secound message i cannot.

    once i read message i will delete the message
    Code:
    void MSG_READ()
    {   
        flag=1;
        trans_string("AT+CMGR=1\r"); 
        delay(500);
        flag=0;
        trans_string("AT+CMGD=1\r");
        delay(100);
    }
    here i used flag. because after message i received "ok".
    so im using flag to stop "count=0" in interrupt.

    Thanks in advance..
    Learn from Yesterday...............
    Live for Today.........
    Hope for tomorrow.............



+ Post New Thread
Please login
--[[ ]]--