cancel
Showing results for 
Search instead for 
Did you mean: 

SIM800 with stm32f334

gautamtripathi2003
Associate
Posted on June 09, 2016 at 02:21

Hi all;

I am trying to send sms using sim800l module with stm32f334

&sharpinclude ''mbed.h''

&sharpinclude <string>

Serial pc(SERIAL_TX, SERIAL_RX); // pc comunication

Serial SIM900(PA_9, PA_10);   //tx, rx SIM 900

string result;

char x;

 

 

void clearString()

 {

  result.clear();

  }

 

void callback_rx() {

 

    while (SIM900.readable()) {

      x = SIM900.getc();

      result += x;

    pc.putc(x); // print the answer from SIM900

 

       }

}

 

void sendSMS()

{

 

//SIM900.putc('''');

  SIM900.printf(''AT+CMGF=1\r''); //at command for send sms

 // SIM900.putc('''');

wait_ms(1000);

//SIM900.putc('''');

SIM900.printf(''AT+CMGS=\''+074xxxxxx\''\r\n'');

//SIM900.putc('''');

wait_ms(1000);

SIM900.printf(''test1'');

wait_ms(1000);

SIM900.putc((char)26);

wait_ms(5000);

}

 

 

int main() {

 

pc.printf(''\r\n GSM 900 TEST\n'');

SIM900.attach(&callback_rx);

SIM900.baud(9600); //

wait_ms(100);

 

sendSMS();  // SEND SMS

pc.printf(''\r\n SMS Send\n'');

 wait_ms(100);

 

}

I dont know what is going wrong. Please help me 

#stm32
1 REPLY 1
Posted on June 09, 2016 at 04:45

Are you seeing any response from the modem? Can you send other AT commands and see responses? Have to made sure you can read the SIM, and that the modem has registered to the network?

The message format command should probably have a CR and LF

Does the sms message send respond with an ERROR, or a caret > expecting the message

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..