Sim900 only echos back the commands- No response -


i'm using atmega32 , sim900 project. keep sending "at" command , wait "ok" response, getting at\r\n. i've checked , rechecked wiring , baud rate, still getting no where. whatever send sim900 echoed of same transmitted string.

can me please? i'd appreciate it.

i'm posting code here:

int sim900_init(void) {        while(1)     {     sim_command("at");     _delay_ms(2000);     } return 0; }  void usart_init(void) { /************enable usart***************/     ubrrh=(uint8_t)(myubrr>>8);     ubrrl=(uint8_t)(myubrr);                         //set baud rate     ucsrb=(1<<txen)|(1<<rxen);             //enable receiver , transmitter     ucsrc=(1<<ucsz0)|(1<<ucsz1)|(1<<ursel);  // 8bit data format      ucsrb |= (1 << rxcie); // enable usart recieve complete interrupt (usart_rxc)  /***************flush privious activities********************/      flush_usart();  /*********appoint pointers arrays********************/      command=commandarray;       // assigning pointer array     response=responsearray;     //assigning pointer array  /*****************enable intrupt***************************/ sei();                          //enabling intrupts receving characters }   void flush_usart(void) {     response_full=false;        //we have not yet received   }  void transmit_char(unsigned char value) {     while (!( ucsra & (1<<udre)));            // wait while register free     udr = value;  }  void sim_command(char *cmd) {     int j=0;     strcpy(command,cmd);     while(*(cmd+j)!='\0')     {          transmit_char(*(cmd+j));           j++;     }      transmit_char(0x0d);   // \r                   // after @ commands should send \r\n so, send here after string      transmit_char(0x0a);   // \n  }  unsigned char recieve_char(void) {        char temp;     while(!(ucsra) & (1<<rxc));           // wait while data being received     temp=udr;     lcddata(lcdchar,temp);     return temp; }  void recive_sim900_response(void) {     static int i=0;     char temp;     temp=recieve_char();      if(temp!='\n' && temp!='\r')        // dont want \r \n send sim dont store them     *(response+i)=temp;          if(i==8)                    //when null char sent means string finished- have full response         {                               //we use them later in waitforresponse function. wait until full response received             i=0;                                                 response_full=true;         }         else             i++; } 

you 1 had same problem i.

somehow library gsmlib.org worked entering @ commands directly using arduino serial monitor using arduino bridge or ftdi didn't.

the reason apparently sim900 expects commands end '\r' character. found trying gtkterm worked.

if typing "at" , pressing enter in gtkterm sent "at" followed twice '\r' (0x0d) , 1 0x0a


Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -