Strange GSM modem behaviour

Hi,

I am using one Wavecom 2403A GSM modem interfaced to AVR AT90CAN128 microcontroller. Here, in the code i am sending AT command for sending SMS to an arbitrary cellphone. I am using USART0 of the controller to send the characters to my GSM modem. The AT command and the SMS text, both are hardcoded into the source. After compiling and flashing my controller, i wait for sometime staring at my cellphone but nothing comes. However, during the course of debugging the code for which i am using JTAG, if i step through the line in the while loops of functions cmdSendGSM() and SMS_SendGSM() then after coming out of the SMS_SendGSM(), i am pleased to find that SMS is received on my cellphone. The same doesn't work when i flash my controller and Reset it. I have tried putting delays at various position between successive sending of characters but it doesn't work.

The AT command reference manual says the format for the same is:

AT+CMGS="xxxxx" Please call me soon.

I have also tried putting a delay of 1-5 seconds in the beginning for the GSM modem to setup, this didn't workout too :( Any help is appreciated.

/**************************GSM.C*******************************/ //Code For USART and Wavecomm Modem Communication

#include #include #include

#define F_CPU 16000000L /* 16 MHz */ #define TIMER1_ PRESCALER 256

/* Command buffer for storing the AT command for SMS send */ /* AT+CMGS="9986366564" and 0x0D */ uint8_t USART_CMD_Buf[] = {'A','T','+','C','M','G','S','=','"','9','8','8','6','6','7','2','8','8','3','"',

0x0D};

/* SMS buffer for storing the text to be sent */ /* "Hello" and 0x0D */ uint8_t USART_SMS_Buf[] = {'H','e','l','l','o',0x0D};

/* variables used inside the ISR's */ volatile uint8_t timer1Flag = 0; volatile uint8_t u8genericUsartTxData = 0;

/* Interrupt Service Routine for Timer1 OutputComapreA */ ISR(TIMER1_COMPA_vect) { timer1Flag = 1; }

/* Interrupt Service Routine for USART0 data buffer empty */ ISR(USART0_UDRE_vect) { UDR0 = u8genericUsartTxData; UCSR0B &= ~(1

Reply to
Rav
Loading thread data ...

Have you made sure all your hardware handshake lines (RT, CTS, etc.) are at the apropriate levels?

--
Stef    (remove caps, dashes and .invalid from e-mail address to reply by mail)
Reply to
Stef

','3=AD','"',

ch

ch

cter

Some times modem takes too long time to get initilize, mine was taking around 15 seconds to get connected with network so increase the delay and wait for little long.

Reply to
kushal

Hi Rav,

Modems are a bitch to work with, generally.

First, you should make sure that your micro is actually sending the correct thing. Hook it to a PC and look at its output. Use a hex terminal (eg "Sickterm", an old DOS program) to make sure there's no excessive 0x00 byte at the end etc (wouldn't show up in Hyperterm).

Second, some modems won't see the AT when it's not preceeded by a CR.

Third, you should wait for "modem ready" by sending AT and CR in a loop (with 1-2 sec pause) until the modem answers OK CRLF.

Fourth, you seem to rely on factory defaults from the modem manual. But your modem may have a different configuration, until you force it to load those factory defaults (typically with AT&F).

Regards, Marc

Reply to
jetmarc

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.