Go Down

Topic: Siemens TC35 sending AT commands (Read 3475 times) previous topic - next topic

spriggsy

hi all,
i have a Siemens TC35 modem dev board, its all hooked up to my mega and iv got it sending txts and calls. the prob is i need it to auto recieve txts and send the txt straight to the arduino.
if i connect the arduino up and load a blank project i can send the codes in my example below, when i send a txt to the modem it displays exactly as i need in the terminal.

prob is if i upload the following code it doesnt work for some reason. even though the AT codes are exactly the same, and in the same order.



Code: [Select]

boolean firstrun = false;

void setup()
{
 Serial.begin(115200);
 Serial1.begin(9600);
}

void loop(){

 if (firstrun == false){

   Serial1.println("AT+CMGF=1"); // set SMS mode to text
   delay(2000);

   Serial1.println("AT^SSDA =1");// set the gsm module to think it has a screen(needed to auto send sms to terminal)
   delay(2000);

   Serial1.println("AT+CSMS=1"); // set the gsm module to Phase 2+ version. needed to allow all modes in CNMI
   delay(2000);

   Serial1.println("AT+CNMI=2,2,0,0,1"); // set module to send SMS data to serial out upon receipt
   delay(2000);

   Serial.println("firstrun finished");
   firstrun = true;
 }


 //If a character comes in from the cellular module...

 if(Serial1.available() >0)

 {
   char  inchar=Serial1.read();
   Serial.print(inchar);

 }
}



heres what the terminal replies


Code: [Select]
firstrun finished
AT+CMGF=1

OK
AT^SSDA =1

OK
AT+CSMS=1

+CSMS: 1,1,1

OK



fir some reason its note printing the last command  "AT+CNMI=2,2,0,0,1"

can anyone shed any light on this???

many thanks

Spriggsy

pylon

Serial reception buffers on the Arduino are very small. Get the modems responses after every command you send to it and the answers to the last command will probably show up.

spriggsy

thanks for the response, ill give that a go when i get in, thinking about it, it kinda makes sense now. is there any way to flush the buffer if i dont intend to use it?

pylon

Yep:

Code: [Select]
while (Serial1.available()) Serial1.read();

spriggsy


Go Up