Forum Menu




 


Log in Problems?
New User? Sign Up!
AVR Freaks Forum Index

Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
nidhi.ns
PostPosted: Feb 24, 2012 - 05:29 AM
Wannabe


Joined: Aug 10, 2011
Posts: 62


Hello everyone,

I want to send messages to mobile using Atmega32 and TC35i_Seimens GSM Modem.

I read AT Commands. I also searched for the same on this forum. It helped me a lot.

But i am stuck. I am not able to send messages.

When i send AT to Modem, i am gettin response as OK.

Then i send AT+CMGF=1(for text mode) to Modem, i get response as OK.

Finally when i send AT+CMGS="my no", sometimes i get OK as response and sometimes i get ">" as response out of which i think(as far as i read ATCommands) ">" is the correct response.

But even though i get ">" response from modem, when i send my sms i get error.

I have also tried sending the same using Hyperterminal, on which everything works fine.

Can anyone suggest me what the problem could be.
 
 View user's profile Send private message  
Reply with quote Back to top
meslomp
PostPosted: Feb 24, 2012 - 06:33 AM
Raving lunatic


Joined: May 02, 2007
Posts: 3020
Location: Nieuwegein, Netherlands

what is your system clock source? xtal or internal rc? if it is the last then you have a clock that is not accurate and thus can cause a problem on the receiving end.

also as you write nothing on how you transmit stuff it might be that you stop sending data to the modem to early, or you 'think' you know what you send, but in reality you send something else by accident.

so a lot of loose ends potentially.

not mentioning that you actually might be sending the wrong commands in the end.

_________________
1)Datasheet and application notes checked?
2)tutorial forum
3)Newbie start here
 
 View user's profile Send private message  
Reply with quote Back to top
nidhi.ns
PostPosted: Feb 24, 2012 - 07:16 AM
Wannabe


Joined: Aug 10, 2011
Posts: 62


I am using external crystal of 16MHz.
In my code I have used UART Library which i found on this forum.
Here is my code

Code:


int main (void)
   {
      unsigned char s[80];
      int n;
          UART_init();   // in UART.c
      sei();          // Global interrupt enable
      
      
      
      ///////////////////////////////////////////////////////////////////////////////////////////
      //Make Echo OFF
   
      UART_puts_P(PSTR("ATE0\r"));
      
      // Getting Response from GSM Modem______Response should be OK
      n = UART_gets(s, sizeof(s)-2);
      s[strlen(s)-1] = 0;   // drop the ending \r

      
      ///////////////////////////////////////////////////////////////////////////////////////////
      //SENDING AT
      UART_puts_P(PSTR("AT\r"));
   
      // Getting Response from GSM Modem______Response should be OK
   
      n = UART_gets(s, sizeof(s)-2);
      s[strlen(s)-1] = 0;   // drop the ending \r
      
      
      ///////////////////////////////////////////////////////////////////////////////////////////
      //SENDING AT+CMGF
   
      UART_puts_P(PSTR("AT+CMGF=1\r"));
   
      // Getting Response from GSM Modem______Response should be OK
   
      n = UART_gets(s, sizeof(s)-2);
      s[strlen(s)-1] = 0;   // drop the ending \r

      
      ///////////////////////////////////////////////////////////////////////////////////////////
      //SENDING AT+CMGS
   
      UART_puts_P(PSTR("AT+CMGS=\""));
      UART_puts_P(PSTR("91my_no"));  //Country code
      UART_puts_P(PSTR("\"\r"));
      UART_puts_P(PSTR("Hi\r"));
      UART_puts_P(PSTR("0x1A"));   //Sending Ctrl+Z
   
   
      // Getting Response from GSM Modem______Response should be +CMGS= some ID and then OK
   
      n = UART_gets(s, sizeof(s)-2);
      s[strlen(s)-1] = 0;   // drop the ending \r
      _delay_ms(150);
     return 0;
   }

 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT + 1 Hour
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2006 The PNphpBB Group
Credits