Pages: [1]   Go Down
Author Topic: Siemens TC35 sending AT commands  (Read 2699 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 22
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
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:
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
Logged

Switzerland
Offline Offline
Faraday Member
**
Karma: 96
Posts: 4702
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 22
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Switzerland
Offline Offline
Faraday Member
**
Karma: 96
Posts: 4702
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yep:

Code:
while (Serial1.available()) Serial1.read();
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 22
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

many thanks, works like a charm
Logged

Pages: [1]   Go Up
Jump to: