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